varnish-4.1.1/0000755000201500234410000000000012652366756010206 500000000000000varnish-4.1.1/lib/0000755000201500234410000000000012652366756010754 500000000000000varnish-4.1.1/lib/libvmod_std/0000755000201500234410000000000012652366756013262 500000000000000varnish-4.1.1/lib/libvmod_std/vmod.vcc0000644000201500234410000001745512652366721014650 00000000000000#- # Copyright (c) 2010-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. $Module std 3 Varnish Standard Module DESCRIPTION =========== `vmod_std` contains basic functions which are part and parcel of Varnish, but which for reasons of architecture fit better in a VMOD. One particular class of functions in vmod_std is the conversions functions which all have the form:: TYPE type(STRING, TYPE) These functions attempt to convert STRING to the TYPE, and if that fails, they return the second argument, which must have the given TYPE. $Function STRING toupper(STRING_LIST s) Description Converts the string *s* to uppercase. Example set beresp.http.scream = std.toupper("yes!"); $Function STRING tolower(STRING_LIST s) Description Converts the string *s* to lowercase. Example set beresp.http.nice = std.tolower("VerY"); $Function VOID set_ip_tos(INT tos) Description Sets the IP type-of-service (TOS) field for the current session to *tos*. Please note that the TOS field is not removed by the end of the request so probably want to set it on every request should you utilize it. Example | if (req.url ~ "^/slow/") { | std.set_ip_tos(0); | } $Function REAL random(REAL lo, REAL hi) Description Returns a random real number between *lo* and *hi*. Example set beresp.http.random-number = std.random(1, 100); $Function VOID log(STRING_LIST s) Description Logs the string *s* to the shared memory log, using VSL tag *SLT_VCL_Log*. Example std.log("Something fishy is going on with the vhost " + req.http.host); $Function VOID syslog(INT priority, STRING_LIST s) Description Logs the string *s* to syslog tagged with *priority*. *priority* is formed by ORing the facility and level values. See your system's syslog.h file for possible values. Example std.syslog(9, "Something is wrong"); This will send a message to syslog using LOG_USER | LOG_ALERT. $Function STRING fileread(PRIV_CALL, STRING) Description Reads a file and returns a string with the content. Please note that it is not recommended to send variables to this function the caching in the function doesn't take this into account. Also, files are not re-read. Example set beresp.http.served-by = std.fileread("/etc/hostname"); $Function VOID collect(HEADER hdr) Description Collapses multiple *hdr* headers into one long header. Care should be taken when collapsing headers. In particular collapsing Set-Cookie will lead to unexpected results on the browser side. Example std.collect(req.http.cookie); $Function DURATION duration(STRING s, DURATION fallback) Description Converts the string *s* to seconds. *s* must be quantified with ms (milliseconds), s (seconds), m (minutes), h (hours), d (days), w (weeks) or y (years) units. If conversion fails, *fallback* will be returned. Example set beresp.ttl = std.duration("1w", 3600s); $Function INT integer(STRING s, INT fallback) Description Converts the string *s* to an integer. If conversion fails, *fallback* will be returned. Example | if (std.integer(req.http.foo, 0) > 5) { | ... | } $Function IP ip(STRING s, IP fallback) Description Converts the string *s* to the first IP number returned by the system library function getaddrinfo(3). If conversion fails, *fallback* will be returned. Example | if (std.ip(req.http.X-forwarded-for, "0.0.0.0") ~ my_acl) { | ... | } $Function REAL real(STRING s, REAL fallback) Description Converts the string *s* to a real. If conversion fails, *fallback* will be returned. Example | if (std.real(req.http.foo, 0.0) > 5.5) { | ... | } $Function INT real2integer(REAL r, INT fallback) Description Converts the real *r* to an integer. If conversion fails, *fallback* will be returned. Example set req.http.integer = std.real2integer(1140618699.00, 0); $Function TIME real2time(REAL r, TIME fallback) Description Converts the real *r* to a time. If conversion fails, *fallback* will be returned. Example set req.http.time = std.real2time(1140618699.00, now); $Function INT time2integer(TIME t, INT fallback) Description Converts the time *t* to a integer. If conversion fails, *fallback* will be returned. Example set req.http.int = std.time2integer(now, 0); $Function REAL time2real(TIME t, REAL fallback) Description Converts the time *t* to a real. If conversion fails, *fallback* will be returned. Example set req.http.real = std.time2real(now, 1.0); $Function BOOL healthy(BACKEND be) Description Returns `true` if the backend *be* is healthy. $Function INT port(IP ip) Description Returns the port number of the IP address *ip*. $Function VOID rollback(HTTP h) Description Restores the *h* HTTP headers to their original state. Example std.rollback(bereq); $Function VOID timestamp(STRING s) Description Introduces a timestamp in the log with the current time, using the string *s* as the label. This is useful to time the execution of lengthy VCL procedures, and makes the timestamps inserted automatically by Varnish more accurate. Example std.timestamp("curl-request"); $Function STRING querysort(STRING) Description Sorts the query string for cache normalization purposes. Example set req.url = std.querysort(req.url); $Function VOID cache_req_body(BYTES size) Description Cache the req.body if it is smaller than *size*. Caching the req.body makes it possible to retry pass operations (POST, PUT). Example std.cache_req_body(1KB); This will cache the req.body if its size is smaller than 1KB. $Function STRING strstr(STRING s1, STRING s2) Description Returns a string beginning at the first occurrence of the string *s2* in the string *s1*, or an empty string if *s2* is not found. Note that the comparison is case sensitive. Example | if (std.strstr(req.url, req.http.restrict)) { | ... | } This will check if the content of req.http.restrict occurs anywhere in req.url. $Function TIME time(STRING s, TIME fallback) Description Converts the string *s* to a time. If conversion fails, *fallback* will be returned. Supported formats: | "Sun, 06 Nov 1994 08:49:37 GMT" | "Sunday, 06-Nov-94 08:49:37 GMT" | "Sun Nov 6 08:49:37 1994" | "1994-11-06T08:49:37" | "784111777.00" | "784111777" Example | if (std.time(resp.http.last-modified, now) < now - 1w) { | ... | } SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`vsl(7)` HISTORY ======= The Varnish standard module was released along with Varnish Cache 3.0. This manual page was written by Per Buer with help from Martin Blix Grydeland. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2010-2015 Varnish Software AS varnish-4.1.1/lib/libvmod_std/vmod_std_querysort.c0000644000201500234410000000636612652366721017325 00000000000000/*- * Copyright (c) 2010-2014 Varnish Software AS * All rights reserved. * * Author: Naren Venkataraman of Vimeo Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include "vrt.h" #include "cache/cache.h" #include "vcc_if.h" static int compa(const void *a, const void *b) { const char * const *pa = a; const char * const *pb = b; const char *a1, *b1; for(a1 = pa[0], b1 = pb[0]; a1 < pa[1] && b1 < pb[1]; a1++, b1++) if (*a1 != *b1) return (*a1 - *b1); return (0); } VCL_STRING __match_proto__(td_std_querysort) vmod_querysort(VRT_CTX, VCL_STRING url) { const char *cq, *cu; char *p, *r; const char **pp; const char **pe; int np; int i; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (url == NULL) return (NULL); /* Split :query from :url */ cu = strchr(url, '?'); if (cu == NULL) return (url); /* Spot single-param queries */ cq = strchr(cu, '&'); if (cq == NULL) return (url); r = WS_Copy(ctx->ws, url, -1); if (r == NULL) return (url); (void)WS_Reserve(ctx->ws, 0); /* We trust cache_ws.c to align sensibly */ pp = (const char**)(void*)(ctx->ws->f); pe = (const char**)(void*)(ctx->ws->e); if (pp + 4 > pe) { WS_Release(ctx->ws, 0); WS_MarkOverflow(ctx->ws); return (url); } /* Collect params as pointer pairs */ np = 0; pp[np++] = 1 + cu; for (cq = 1 + cu; *cq != '\0'; cq++) { if (*cq == '&') { if (pp + 3 > pe) { WS_Release(ctx->ws, 0); WS_MarkOverflow(ctx->ws); return (url); } pp[np++] = cq; /* Skip trivially empty params */ while(cq[1] == '&') cq++; pp[np++] = cq + 1; } } pp[np++] = cq; assert(!(np & 1)); qsort(pp, np / 2, sizeof(*pp) * 2, compa); /* Emit sorted params */ p = 1 + r + (cu - url); cq = ""; for (i = 0; i < np; i += 2) { /* Ignore any edge-case zero length params */ if (pp[i + 1] == pp[i]) continue; assert(pp[i + 1] > pp[i]); if (*cq) *p++ = *cq; memcpy(p, pp[i], pp[i + 1] - pp[i]); p += pp[i + 1] - pp[i]; cq = "&"; } *p = '\0'; WS_Release(ctx->ws, 0); return (r); } varnish-4.1.1/lib/libvmod_std/Makefile.am0000644000201500234410000000173312652366721015232 00000000000000# AM_LDFLAGS = $(AM_LT_LDFLAGS) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/bin/varnishd \ -I$(top_builddir)/include vmoddir = $(pkglibdir)/vmods vmod_srcdir = $(top_srcdir)/lib/libvmod_std vmodtool = $(top_srcdir)/lib/libvcc/vmodtool.py vmodtoolargs = --strict vmod_LTLIBRARIES = libvmod_std.la libvmod_std_la_LDFLAGS = $(AM_LDFLAGS) -module -export-dynamic -avoid-version -shared libvmod_std_la_SOURCES = \ vmod_std.c \ vmod_std_conversions.c \ vmod_std_fileread.c \ vmod_std_querysort.c nodist_libvmod_std_la_SOURCES = \ vcc_if.c \ vcc_if.h # BUILT_SOURCES is only a hack and dependency tracking does not help for the first build $(libvmod_std_la_OBJECTS): vcc_if.h vcc_if.c vcc_if.h vmod_std.rst vmod_std.man.rst: $(vmodtool) $(vmod_srcdir)/vmod.vcc @PYTHON@ $(vmodtool) $(vmodtoolargs) $(vmod_srcdir)/vmod.vcc EXTRA_DIST = vmod.vcc CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \ $(builddir)/vmod_std.rst \ $(builddir)/vmod_std.man.rst varnish-4.1.1/lib/libvmod_std/vmod_std_conversions.c0000644000201500234410000001171112652366721017606 00000000000000/*- * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "config.h" #include #include #include #include #include #include #include "cache/cache.h" #include "vnum.h" #include "vrt.h" #include "vsa.h" #include "vtim.h" #include "vcc_if.h" VCL_DURATION __match_proto__(td_std_duration) vmod_duration(VRT_CTX, VCL_STRING p, VCL_DURATION d) { const char *e; double r; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (p == NULL) return (d); while(isspace(*p)) p++; if (*p != '+' && *p != '-' && !isdigit(*p)) return (d); e = NULL; r = VNUMpfx(p, &e); if (isnan(r) || e == NULL) return (d); while(isspace(*e)) e++; /* NB: Keep this list synchronized with VCC */ switch (*e++) { case 's': break; case 'm': if (*e == 's') { r *= 1e-3; e++; } else r *= 60.; break; case 'h': r *= 60.*60.; break; case 'd': r *= 60.*60.*24.; break; case 'w': r *= 60.*60.*24.*7.; break; case 'y': r *= 60.*60.*24.*365.; break; default: return (d); } while(isspace(*e)) e++; if (*e != '\0') return (d); return (r); } VCL_INT __match_proto__(td_std_integer) vmod_integer(VRT_CTX, VCL_STRING p, VCL_INT i) { char *e; long r; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (p == NULL) return (i); while(isspace(*p)) p++; if (*p != '+' && *p != '-' && !isdigit(*p)) return (i); e = NULL; r = strtol(p, &e, 0); if (e == NULL || *e != '\0') return (i); return (r); } VCL_IP vmod_ip(VRT_CTX, VCL_STRING s, VCL_IP d) { struct addrinfo hints, *res0 = NULL; const struct addrinfo *res; int error; void *p; struct suckaddr *r; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(d); assert(VSA_Sane(d)); p = WS_Alloc(ctx->ws, vsa_suckaddr_len); if (p == NULL) { VSLb(ctx->vsl, SLT_VCL_Error, "vmod std.ip(): insufficient workspace"); return d; } r = NULL; if (s != NULL) { memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; error = getaddrinfo(s, "80", &hints, &res0); if (!error) { for (res = res0; res != NULL; res = res->ai_next) { r = VSA_Build(p, res->ai_addr, res->ai_addrlen); if (r != NULL) break; } } } if (r == NULL) { r = p; memcpy(r, d, vsa_suckaddr_len); } if (res0 != NULL) freeaddrinfo(res0); return (r); } VCL_REAL __match_proto__(td_std_real) vmod_real(VRT_CTX, VCL_STRING p, VCL_REAL d) { double r; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (p == NULL) return (d); r = VNUM(p); if (isnan(r)) return (d); return (r); } VCL_INT __match_proto__(td_std_real2integer) vmod_real2integer(VRT_CTX, VCL_REAL r, VCL_INT i) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (!isfinite(r)) return (i); r = round(r); if (r > LONG_MAX || r < LONG_MIN) return(i); return ((long)r); } VCL_TIME __match_proto__(td_std_real2time) vmod_real2time(VRT_CTX, VCL_REAL r, VCL_TIME t) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (!isfinite(r)) return (t); return (r); } VCL_INT __match_proto__(td_std_time2integer) vmod_time2integer(VRT_CTX, VCL_TIME t, VCL_INT i) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (!isfinite(t)) return (i); t = round(t); if (t > LONG_MAX || t < LONG_MIN) return(i); return ((long)t); } VCL_REAL __match_proto__(td_std_time2real) vmod_time2real(VRT_CTX, VCL_TIME t, VCL_REAL r) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (!isfinite(t)) return (r); return (t); } VCL_TIME __match_proto__(td_std_time) vmod_time(VRT_CTX, VCL_STRING p, VCL_TIME d) { double r; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (p == NULL) return (d); r = VTIM_parse(p); if (r) return (r); return (vmod_real(ctx, p, d)); } varnish-4.1.1/lib/libvmod_std/vmod_std.c0000644000201500234410000001330512652366721015157 00000000000000/*- * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include #include #include #include #include "vrt.h" #include "vtcp.h" #include "vsa.h" #include "vtim.h" #include "cache/cache.h" #include "cache/cache_director.h" #include "vcc_if.h" VCL_VOID __match_proto__(td_std_set_ip_tos) vmod_set_ip_tos(VRT_CTX, VCL_INT tos) { int itos = tos; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); VTCP_Assert(setsockopt(ctx->req->sp->fd, IPPROTO_IP, IP_TOS, &itos, sizeof(itos))); } static const char * vmod_updown(VRT_CTX, int up, const char *s, va_list ap) { unsigned u; char *b, *e; const char *p; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); u = WS_Reserve(ctx->ws, 0); e = b = ctx->ws->f; e += u; p = s; while (p != vrt_magic_string_end && b < e) { if (p != NULL) { for (; b < e && *p != '\0'; p++) if (up) *b++ = (char)toupper(*p); else *b++ = (char)tolower(*p); } p = va_arg(ap, const char *); } if (b < e) *b = '\0'; b++; if (b > e) { WS_Release(ctx->ws, 0); return (NULL); } else { e = b; b = ctx->ws->f; WS_Release(ctx->ws, e - b); return (b); } } VCL_STRING __match_proto__(td_std_toupper) vmod_toupper(VRT_CTX, const char *s, ...) { const char *p; va_list ap; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); va_start(ap, s); p = vmod_updown(ctx, 1, s, ap); va_end(ap); return (p); } VCL_STRING __match_proto__(td_std_tolower) vmod_tolower(VRT_CTX, const char *s, ...) { const char *p; va_list ap; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); va_start(ap, s); p = vmod_updown(ctx, 0, s, ap); va_end(ap); return (p); } VCL_REAL __match_proto__(td_std_random) vmod_random(VRT_CTX, VCL_REAL lo, VCL_REAL hi) { double a; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); a = drand48(); a *= hi - lo; a += lo; return (a); } VCL_VOID __match_proto__(td_std_log) vmod_log(VRT_CTX, const char *fmt, ...) { unsigned u; va_list ap; txt t; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); u = WS_Reserve(ctx->ws, 0); t.b = ctx->ws->f; va_start(ap, fmt); t.e = VRT_StringList(ctx->ws->f, u, fmt, ap); va_end(ap); if (t.e != NULL) { assert(t.e > t.b); t.e--; VSLbt(ctx->vsl, SLT_VCL_Log, t); } WS_Release(ctx->ws, 0); } VCL_VOID __match_proto__(td_std_syslog) vmod_syslog(VRT_CTX, VCL_INT fac, const char *fmt, ...) { unsigned u; va_list ap; txt t; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); u = WS_Reserve(ctx->ws, 0); t.b = ctx->ws->f; va_start(ap, fmt); t.e = VRT_StringList(ctx->ws->f, u, fmt, ap); va_end(ap); if (t.e != NULL) syslog((int)fac, "%s", t.b); WS_Release(ctx->ws, 0); } VCL_VOID __match_proto__(td_std_collect) vmod_collect(VRT_CTX, VCL_HEADER hdr) { struct http *hp; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); hp = VRT_selecthttp(ctx, hdr->where); http_CollectHdr(hp, hdr->what); } VCL_BOOL __match_proto__(td_std_healthy) vmod_healthy(VRT_CTX, VCL_BACKEND be) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (be == NULL) return (0); CHECK_OBJ_NOTNULL(be, DIRECTOR_MAGIC); return (VDI_Healthy(be, ctx->bo)); } VCL_INT __match_proto__(td_std_port) vmod_port(VRT_CTX, VCL_IP ip) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (ip == NULL) return (0); return (VSA_Port(ip)); } VCL_VOID __match_proto__(td_std_rollback) vmod_rollback(VRT_CTX, VCL_HTTP hp) { VRT_Rollback(ctx, hp); } VCL_VOID __match_proto__(td_std_timestamp) vmod_timestamp(VRT_CTX, VCL_STRING label) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (label == NULL) return; if (*label == '\0') return; if (ctx->bo != NULL && ctx->req == NULL) { /* Called from backend vcl methods */ CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); VSLb_ts_busyobj(ctx->bo, label, VTIM_real()); } else if (ctx->req != NULL) { /* Called from request vcl methods */ CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); VSLb_ts_req(ctx->req, label, VTIM_real()); } } VCL_VOID __match_proto__(td_std_cache_req_body) vmod_cache_req_body(VRT_CTX, VCL_BYTES size) { int result; ssize_t ss; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (size < 0) size = 0; ss = (ssize_t)size; result = VRT_CacheReqBody(ctx, ss); VSLb(ctx->vsl, SLT_Debug, "VRT_CacheReqBody(%zd): %d", ss, result); } VCL_STRING __match_proto__(td_std_strstr) vmod_strstr(VRT_CTX, VCL_STRING s1, VCL_STRING s2) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (s1 == NULL || s2 == NULL) return (NULL); return (strstr(s1, s2)); } varnish-4.1.1/lib/libvmod_std/Makefile.in0000644000201500234410000004767512652366727015270 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = lib/libvmod_std DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(vmoddir)" LTLIBRARIES = $(vmod_LTLIBRARIES) libvmod_std_la_LIBADD = am_libvmod_std_la_OBJECTS = vmod_std.lo vmod_std_conversions.lo \ vmod_std_fileread.lo vmod_std_querysort.lo nodist_libvmod_std_la_OBJECTS = vcc_if.lo libvmod_std_la_OBJECTS = $(am_libvmod_std_la_OBJECTS) \ $(nodist_libvmod_std_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent libvmod_std_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libvmod_std_la_LDFLAGS) $(LDFLAGS) -o \ $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libvmod_std_la_SOURCES) $(nodist_libvmod_std_la_SOURCES) DIST_SOURCES = $(libvmod_std_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ AM_LDFLAGS = $(AM_LT_LDFLAGS) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/bin/varnishd \ -I$(top_builddir)/include vmoddir = $(pkglibdir)/vmods vmod_srcdir = $(top_srcdir)/lib/libvmod_std vmodtool = $(top_srcdir)/lib/libvcc/vmodtool.py vmodtoolargs = --strict vmod_LTLIBRARIES = libvmod_std.la libvmod_std_la_LDFLAGS = $(AM_LDFLAGS) -module -export-dynamic -avoid-version -shared libvmod_std_la_SOURCES = \ vmod_std.c \ vmod_std_conversions.c \ vmod_std_fileread.c \ vmod_std_querysort.c nodist_libvmod_std_la_SOURCES = \ vcc_if.c \ vcc_if.h EXTRA_DIST = vmod.vcc CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \ $(builddir)/vmod_std.rst \ $(builddir)/vmod_std.man.rst all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/libvmod_std/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/libvmod_std/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-vmodLTLIBRARIES: $(vmod_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(vmoddir)" || $(MKDIR_P) "$(DESTDIR)$(vmoddir)" @list='$(vmod_LTLIBRARIES)'; test -n "$(vmoddir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(vmoddir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(vmoddir)"; \ } uninstall-vmodLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(vmod_LTLIBRARIES)'; test -n "$(vmoddir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(vmoddir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(vmoddir)/$$f"; \ done clean-vmodLTLIBRARIES: -test -z "$(vmod_LTLIBRARIES)" || rm -f $(vmod_LTLIBRARIES) @list='$(vmod_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libvmod_std.la: $(libvmod_std_la_OBJECTS) $(libvmod_std_la_DEPENDENCIES) $(EXTRA_libvmod_std_la_DEPENDENCIES) $(AM_V_CCLD)$(libvmod_std_la_LINK) -rpath $(vmoddir) $(libvmod_std_la_OBJECTS) $(libvmod_std_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_if.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vmod_std.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vmod_std_conversions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vmod_std_fileread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vmod_std_querysort.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(vmoddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-vmodLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-vmodLTLIBRARIES install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-vmodLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-vmodLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip install-vmodLTLIBRARIES installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-vmodLTLIBRARIES # BUILT_SOURCES is only a hack and dependency tracking does not help for the first build $(libvmod_std_la_OBJECTS): vcc_if.h vcc_if.c vcc_if.h vmod_std.rst vmod_std.man.rst: $(vmodtool) $(vmod_srcdir)/vmod.vcc @PYTHON@ $(vmodtool) $(vmodtoolargs) $(vmod_srcdir)/vmod.vcc # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/lib/libvmod_std/vmod_std_fileread.c0000644000201500234410000000733412652366721017017 00000000000000/*- * Copyright (c) 2010-2011 Varnish Software AS * All rights reserved. * * Author: Sanjoy Das * * 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. * * XXX: It might make sense to use just a single global list of all files * XXX: and use the call-private pointer to point to the file instance on * XXX: that list. * XXX: Duplicates in the global list can be avoided by examining the * XXX: dev+inode fields of the stat structure. * XXX: Individual files would need to be refcounted, so they can be * XXX: deleted when no VCL's reference them. * * XXX: We should periodically stat(2) the filename and check if the * XXX: underlying file has been updated. */ #include "config.h" #include #include #include "cache/cache.h" #include "vrt.h" #include "vfil.h" #include "vcc_if.h" struct frfile { unsigned magic; #define CACHED_FILE_MAGIC 0xa8e9d87a char *file_name; char *contents; int refcount; VTAILQ_ENTRY(frfile) list; }; static VTAILQ_HEAD(, frfile) frlist = VTAILQ_HEAD_INITIALIZER(frlist); static pthread_mutex_t frmtx = PTHREAD_MUTEX_INITIALIZER; static void free_frfile(void *ptr) { struct frfile *frf; CAST_OBJ_NOTNULL(frf, ptr, CACHED_FILE_MAGIC); AZ(pthread_mutex_lock(&frmtx)); if (--frf->refcount > 0) frf = NULL; else VTAILQ_REMOVE(&frlist, frf, list); AZ(pthread_mutex_unlock(&frmtx)); if (frf != NULL) { free(frf->contents); free(frf->file_name); FREE_OBJ(frf); } } VCL_STRING __match_proto__(td_std_fileread) vmod_fileread(VRT_CTX, struct vmod_priv *priv, VCL_STRING file_name) { struct frfile *frf = NULL; char *s; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(priv); if (priv->priv != NULL) { CAST_OBJ_NOTNULL(frf, priv->priv, CACHED_FILE_MAGIC); if (!strcmp(file_name, frf->file_name)) return (frf->contents); } AZ(pthread_mutex_lock(&frmtx)); if (frf != NULL) frf->refcount--; VTAILQ_FOREACH(frf, &frlist, list) { if (!strcmp(file_name, frf->file_name)) { frf->refcount++; break; } } AZ(pthread_mutex_unlock(&frmtx)); if (frf != NULL) { priv->free = free_frfile; priv->priv = frf; return (frf->contents); } s = VFIL_readfile(NULL, file_name, NULL); if (s != NULL) { ALLOC_OBJ(frf, CACHED_FILE_MAGIC); AN(frf); frf->file_name = strdup(file_name); AN(frf->file_name); frf->refcount = 1; frf->contents = s; priv->free = free_frfile; priv->priv = frf; AZ(pthread_mutex_lock(&frmtx)); VTAILQ_INSERT_HEAD(&frlist, frf, list); AZ(pthread_mutex_unlock(&frmtx)); } return (s); } varnish-4.1.1/lib/libvarnishapi/0000755000201500234410000000000012652366756013607 500000000000000varnish-4.1.1/lib/libvarnishapi/vsl_cursor.c0000644000201500234410000002626012652366721016072 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * 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. * */ #include #include #include #include #include #include #include #include #include #include "vdef.h" #include "vas.h" #include "miniobj.h" #include "vmb.h" #include "vqueue.h" #include "vre.h" #include "vsl_priv.h" #include "vapi/vsl.h" #include "vapi/vsm.h" #include "vsl_api.h" #include "vsm_api.h" struct vslc_vsm { unsigned magic; #define VSLC_VSM_MAGIC 0x4D3903A6 struct VSL_cursor cursor; unsigned options; struct VSM_data *vsm; struct VSM_fantom vf; const struct VSL_head *head; const uint32_t *end; struct VSLC_ptr next; }; static void vslc_vsm_delete(const struct VSL_cursor *cursor) { struct vslc_vsm *c; CAST_OBJ_NOTNULL(c, cursor->priv_data, VSLC_VSM_MAGIC); assert(&c->cursor == cursor); FREE_OBJ(c); } /* * We tolerate the fact that segment_n wraps around eventually: for the default * vsl_space of 80MB and 8 segments, each segment is 10MB long, so we wrap * roughly after 40 pebibytes (32bit) or 160 yobibytes (64bit) worth of vsl * written. * * The vsm_check would fail if a vslc paused while this amount of data was * written */ static int vslc_vsm_check(const struct VSL_cursor *cursor, const struct VSLC_ptr *ptr) { const struct vslc_vsm *c; unsigned dist; CAST_OBJ_NOTNULL(c, cursor->priv_data, VSLC_VSM_MAGIC); assert(&c->cursor == cursor); if (ptr->ptr == NULL) return (0); dist = c->head->segment_n - ptr->priv; if (dist >= VSL_SEGMENTS - 2) /* Too close to continue */ return (0); if (dist >= VSL_SEGMENTS - 4) /* Warning level */ return (1); /* Safe */ return (2); } static int vslc_vsm_next(const struct VSL_cursor *cursor) { struct vslc_vsm *c; int i; uint32_t t; CAST_OBJ_NOTNULL(c, cursor->priv_data, VSLC_VSM_MAGIC); assert(&c->cursor == cursor); CHECK_OBJ_NOTNULL(c->vsm, VSM_MAGIC); while (1) { t = *(volatile const uint32_t *)c->next.ptr; AN(t); if (t == VSL_WRAPMARKER) { /* Wrap around not possible at front */ assert(c->next.ptr != c->head->log); c->next.ptr = c->head->log; while (c->next.priv % VSL_SEGMENTS) c->next.priv++; continue; } if (t == VSL_ENDMARKER) { if (VSM_invalid == VSM_StillValid(c->vsm, &c->vf) || VSM_Abandoned(c->vsm)) return (-2); /* VSL abandoned */ if (c->options & VSL_COPT_TAILSTOP) return (-1); /* EOF */ return (0); /* No new records available */ } i = vslc_vsm_check(&c->cursor, &c->next); if (i <= 0) return (-3); /* Overrun */ c->cursor.rec = c->next; c->next.ptr = VSL_NEXT(c->next.ptr); if (VSL_TAG(c->cursor.rec.ptr) == SLT__Batch) { if (!(c->options & VSL_COPT_BATCH)) /* Skip the batch record */ continue; /* Next call will point to the first record past the batch */ c->next.ptr += VSL_WORDS(VSL_BATCHLEN(c->cursor.rec.ptr)); } while ((c->next.ptr - c->head->log) / c->head->segsize > c->next.priv % VSL_SEGMENTS) c->next.priv++; assert(c->next.ptr >= c->head->log); assert(c->next.ptr < c->end); return (1); } } static int vslc_vsm_reset(const struct VSL_cursor *cursor) { struct vslc_vsm *c; unsigned u, segment_n; int i; CAST_OBJ_NOTNULL(c, cursor->priv_data, VSLC_VSM_MAGIC); assert(&c->cursor == cursor); c->cursor.rec.ptr = NULL; segment_n = c->head->segment_n; VRMB(); /* Make sure offset table is not stale compared to segment_n */ if (c->options & VSL_COPT_TAIL) { /* Start in the same segment varnishd currently is in and run forward until we see the end */ u = c->next.priv = segment_n; assert(c->head->offset[c->next.priv % VSL_SEGMENTS] >= 0); c->next.ptr = c->head->log + c->head->offset[c->next.priv % VSL_SEGMENTS]; do { if (c->head->segment_n - u > 1) { /* Give up if varnishd is moving faster than us */ return (-3); /* overrun */ } i = vslc_vsm_next(&c->cursor); } while (i == 1); if (i) return (i); } else { /* Starting (VSL_SEGMENTS - 3) behind varnishd. This way * even if varnishd advances segment_n immediately, we'll * still have a full segment worth of log before the * general constraint of at least 2 segments apart will be * broken. */ c->next.priv = segment_n - (VSL_SEGMENTS - 3); while (c->head->offset[c->next.priv % VSL_SEGMENTS] < 0) { /* seg 0 must be initialized */ assert(c->next.priv % VSL_SEGMENTS != 0); c->next.priv++; } assert(c->head->offset[c->next.priv % VSL_SEGMENTS] >= 0); c->next.ptr = c->head->log + c->head->offset[c->next.priv % VSL_SEGMENTS]; } assert(c->next.ptr >= c->head->log); assert(c->next.ptr < c->end); return (0); } static const struct vslc_tbl vslc_vsm_tbl = { .magic = VSLC_TBL_MAGIC, .delete = vslc_vsm_delete, .next = vslc_vsm_next, .reset = vslc_vsm_reset, .check = vslc_vsm_check, }; struct VSL_cursor * VSL_CursorVSM(struct VSL_data *vsl, struct VSM_data *vsm, unsigned options) { struct vslc_vsm *c; struct VSM_fantom vf; struct VSL_head *head; int i; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); CHECK_OBJ_NOTNULL(vsm, VSM_MAGIC); if (!VSM_Get(vsm, &vf, VSL_CLASS, "", "")) { (void)vsl_diag(vsl, "No VSL chunk found (child not started ?)\n"); return (NULL); } head = vf.b; if (memcmp(head->marker, VSL_HEAD_MARKER, sizeof head->marker)) { (void)vsl_diag(vsl, "Not a VSL chunk\n"); return (NULL); } ALLOC_OBJ(c, VSLC_VSM_MAGIC); if (c == NULL) { (void)vsl_diag(vsl, "Out of memory\n"); return (NULL); } c->cursor.priv_tbl = &vslc_vsm_tbl; c->cursor.priv_data = c; c->options = options; c->vsm = vsm; c->vf = vf; c->head = head; c->end = c->head->log + c->head->segsize * VSL_SEGMENTS; assert(c->end <= (const uint32_t *)vf.e); i = vslc_vsm_reset(&c->cursor); if (i) { (void)vsl_diag(vsl, "Cursor initialization failure (%d)\n", i); FREE_OBJ(c); return (NULL); } return (&c->cursor); } struct vslc_file { unsigned magic; #define VSLC_FILE_MAGIC 0x1D65FFEF int error; int fd; int close_fd; ssize_t buflen; uint32_t *buf; struct VSL_cursor cursor; }; static void vslc_file_delete(const struct VSL_cursor *cursor) { struct vslc_file *c; CAST_OBJ_NOTNULL(c, cursor->priv_data, VSLC_FILE_MAGIC); assert(&c->cursor == cursor); if (c->close_fd) (void)close(c->fd); if (c->buf != NULL) free(c->buf); FREE_OBJ(c); } /* Read n bytes from fd into buf */ static ssize_t vslc_file_readn(int fd, void *buf, size_t n) { size_t t = 0; ssize_t l; while (t < n) { l = read(fd, (char *)buf + t, n - t); if (l <= 0) return (l); t += l; } return (t); } static int vslc_file_next(const struct VSL_cursor *cursor) { struct vslc_file *c; ssize_t i; size_t l; CAST_OBJ_NOTNULL(c, cursor->priv_data, VSLC_FILE_MAGIC); assert(&c->cursor == cursor); if (c->error) return (c->error); do { c->cursor.rec.ptr = NULL; assert(c->buflen >= 2); i = vslc_file_readn(c->fd, c->buf, VSL_BYTES(2)); if (i < 0) return (-4); /* I/O error */ if (i == 0) return (-1); /* EOF */ assert(i == VSL_BYTES(2)); l = 2 + VSL_WORDS(VSL_LEN(c->buf)); if (c->buflen < l) { while (c->buflen < l) c->buflen = 2 * l; c->buf = realloc(c->buf, VSL_BYTES(c->buflen)); AN(c->buf); } if (l > 2) { i = vslc_file_readn(c->fd, c->buf + 2, VSL_BYTES(l - 2)); if (i < 0) return (-4); /* I/O error */ if (i == 0) return (-1); /* EOF */ assert(i == VSL_BYTES(l - 2)); } c->cursor.rec.ptr = c->buf; } while (VSL_TAG(c->cursor.rec.ptr) == SLT__Batch); return (1); } static int vslc_file_reset(const struct VSL_cursor *cursor) { (void)cursor; /* XXX: Implement me */ return (-1); } static const struct vslc_tbl vslc_file_tbl = { .magic = VSLC_TBL_MAGIC, .delete = vslc_file_delete, .next = vslc_file_next, .reset = vslc_file_reset, .check = NULL, }; struct VSL_cursor * VSL_CursorFile(struct VSL_data *vsl, const char *name, unsigned options) { struct vslc_file *c; int fd; int close_fd = 0; char buf[] = VSL_FILE_ID; ssize_t i; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); AN(name); (void)options; if (!strcmp(name, "-")) fd = STDIN_FILENO; else { fd = open(name, O_RDONLY); if (fd < 0) { vsl_diag(vsl, "Could not open %s: %s\n", name, strerror(errno)); return (NULL); } close_fd = 1; } i = vslc_file_readn(fd, buf, sizeof buf); if (i <= 0) { if (close_fd) (void)close(fd); vsl_diag(vsl, "VSL file read error: %s\n", i < 0 ? strerror(errno) : "EOF"); return (NULL); } assert(i == sizeof buf); if (memcmp(buf, VSL_FILE_ID, sizeof buf)) { if (close_fd) (void)close(fd); vsl_diag(vsl, "Not a VSL file: %s\n", name); return (NULL); } ALLOC_OBJ(c, VSLC_FILE_MAGIC); if (c == NULL) { if (close_fd) (void)close(fd); vsl_diag(vsl, "Out of memory\n"); return (NULL); } c->cursor.priv_tbl = &vslc_file_tbl; c->cursor.priv_data = c; c->fd = fd; c->close_fd = close_fd; c->buflen = VSL_WORDS(BUFSIZ); c->buf = malloc(VSL_BYTES(c->buflen)); AN(c->buf); return (&c->cursor); } void VSL_DeleteCursor(const struct VSL_cursor *cursor) { const struct vslc_tbl *tbl; CAST_OBJ_NOTNULL(tbl, cursor->priv_tbl, VSLC_TBL_MAGIC); if (tbl->delete == NULL) return; (tbl->delete)(cursor); } int VSL_ResetCursor(const struct VSL_cursor *cursor) { const struct vslc_tbl *tbl; CAST_OBJ_NOTNULL(tbl, cursor->priv_tbl, VSLC_TBL_MAGIC); if (tbl->reset == NULL) return (-1); return ((tbl->reset)(cursor)); } int VSL_Next(const struct VSL_cursor *cursor) { const struct vslc_tbl *tbl; CAST_OBJ_NOTNULL(tbl, cursor->priv_tbl, VSLC_TBL_MAGIC); AN(tbl->next); return ((tbl->next)(cursor)); } int VSL_Check(const struct VSL_cursor *cursor, const struct VSLC_ptr *ptr) { const struct vslc_tbl *tbl; CAST_OBJ_NOTNULL(tbl, cursor->priv_tbl, VSLC_TBL_MAGIC); if (tbl->check == NULL) return (-1); return ((tbl->check)(cursor, ptr)); } varnish-4.1.1/lib/libvarnishapi/vxp.c0000644000201500234410000001130212652366721014475 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 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. * */ #include "config.h" #include #include #include #include #include "vdef.h" #include "vas.h" #include "miniobj.h" #include "vqueue.h" #include "vre.h" #include "vsb.h" #include "vxp.h" static void vxp_ErrToken(const struct vxp *vxp, const struct token *t) { if (t->tok == EOI) VSB_printf(vxp->sb, "end of input"); else VSB_printf(vxp->sb, "'%.*s'", PF(t)); } static void vxp_Pos(const struct vxp *vxp, struct vsb *vsb, const struct token *t, int tokoff) { unsigned pos; AN(vxp); AN(vsb); AN(t); assert(t->b >= vxp->b); pos = (unsigned)(t->b - vxp->b); if (tokoff > 0) pos += tokoff; VSB_printf(vsb, "(Pos %u)", pos + 1); } static void vxp_quote(const struct vxp *vxp, const char *b, const char *e, int tokoff) { const char *p; char c; assert(b <= e); assert(b >= vxp->b); assert(e <= vxp->e); for (p = vxp->b; p < vxp->e; p++) { if (isspace(*p)) VSB_putc(vxp->sb, ' '); else VSB_putc(vxp->sb, *p); } VSB_putc(vxp->sb, '\n'); for (p = vxp->b; p < vxp->e; p++) { if (p >= b && p < e) { if (p - b == tokoff) c = '^'; else c = '#'; } else c = '-'; VSB_putc(vxp->sb, c); } VSB_putc(vxp->sb, '\n'); } void vxp_ErrWhere(struct vxp *vxp, const struct token *t, int tokoff) { AN(vxp); AN(t); vxp_Pos(vxp, vxp->sb, t, tokoff); VSB_putc(vxp->sb, '\n'); vxp_quote(vxp, t->b, t->e, tokoff); VSB_putc(vxp->sb, '\n'); vxp->err = 1; } void vxp_NextToken(struct vxp *vxp) { AN(vxp->t); vxp->t = VTAILQ_NEXT(vxp->t, list); if (vxp->t == NULL) { VSB_printf(vxp->sb, "Ran out of input, something is missing or" " maybe unbalanced parenthesis\n"); vxp->err = 1; } } void vxp__Expect(struct vxp *vxp, unsigned tok) { if (vxp->t->tok == tok) return; VSB_printf(vxp->sb, "Expected %s got ", vxp_tnames[tok]); vxp_ErrToken(vxp, vxp->t); VSB_putc(vxp->sb, ' '); vxp_ErrWhere(vxp, vxp->t, -1); } static void vxp_DoFree(struct vxp *vxp, void *p) { struct membit *mb; mb = calloc(sizeof *mb, 1); AN(mb); mb->ptr = p; VTAILQ_INSERT_TAIL(&vxp->membits, mb, list); } void * vxp_Alloc(struct vxp *vxp, unsigned len) { void *p; p = calloc(len, 1); AN(p); vxp_DoFree(vxp, p); return (p); } static struct vxp * vxp_New(struct vsb *sb) { struct vxp *vxp; AN(sb); ALLOC_OBJ(vxp, VXP_MAGIC); AN(vxp); VTAILQ_INIT(&vxp->membits); VTAILQ_INIT(&vxp->tokens); vxp->sb = sb; return (vxp); } static void vxp_Delete(struct vxp **pvxp) { struct vxp *vxp; struct membit *mb; AN(pvxp); vxp = *pvxp; *pvxp = NULL; CHECK_OBJ_NOTNULL(vxp, VXP_MAGIC); while (!VTAILQ_EMPTY(&vxp->membits)) { mb = VTAILQ_FIRST(&vxp->membits); VTAILQ_REMOVE(&vxp->membits, mb, list); free(mb->ptr); free(mb); } FREE_OBJ(vxp); } struct vex * vex_New(const char *query, struct vsb *sb, unsigned options) { struct vxp *vxp; struct vex *vex; AN(query); AN(sb); vxp = vxp_New(sb); vxp->b = query; vxp->e = query + strlen(query); vxp->vex_options = options; if (options & VEX_OPT_CASELESS) vxp->vre_options |= VRE_CASELESS; vxp_Lexer(vxp); #ifdef VXP_DEBUG vxp_PrintTokens(vxp); #endif if (vxp->err) { vxp_Delete(&vxp); AZ(vxp); return (NULL); } vex = vxp_Parse(vxp); #ifdef VXP_DEBUG if (vex != NULL) vex_PrintTree(vex); #endif vxp_Delete(&vxp); AZ(vxp); return (vex); } varnish-4.1.1/lib/libvarnishapi/vsc.c0000644000201500234410000003107412652366721014463 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * 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. */ #include "config.h" #include #include #include #include #include #include #include "vdef.h" #include "vas.h" #include "miniobj.h" #include "vqueue.h" #include "vapi/vsc.h" #include "vapi/vsm.h" #include "vsm_api.h" enum { #define VSC_TYPE_F(n,t,l,e,d) \ VSC_type_order_##n, #include "tbl/vsc_types.h" #undef VSC_TYPE_F }; struct vsc_vf { unsigned magic; #define VSC_VF_MAGIC 0x516519f8 VTAILQ_ENTRY(vsc_vf) list; struct VSM_fantom fantom; struct VSC_section section; int order; }; struct vsc_pt { unsigned magic; #define VSC_PT_MAGIC 0xa4ff159a VTAILQ_ENTRY(vsc_pt) list; struct VSC_point point; }; struct vsc_sf { unsigned magic; #define VSC_SF_MAGIC 0x558478dd VTAILQ_ENTRY(vsc_sf) list; int flags; #define VSC_SF_EXCL (1 << 0) #define VSC_SF_TY_WC (1 << 1) #define VSC_SF_ID_WC (1 << 2) #define VSC_SF_NM_WC (1 << 3) char *type; char *ident; char *name; }; struct vsc { unsigned magic; #define VSC_MAGIC 0x3373554a VTAILQ_HEAD(, vsc_vf) vf_list; VTAILQ_HEAD(, vsc_pt) pt_list; VTAILQ_HEAD(, vsc_sf) sf_list; struct VSM_fantom iter_fantom; }; /*--------------------------------------------------------------------*/ static struct vsc * vsc_setup(struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (vd->vsc == NULL) { ALLOC_OBJ(vd->vsc, VSC_MAGIC); AN(vd->vsc); VTAILQ_INIT(&vd->vsc->vf_list); VTAILQ_INIT(&vd->vsc->pt_list); VTAILQ_INIT(&vd->vsc->sf_list); } CHECK_OBJ_NOTNULL(vd->vsc, VSC_MAGIC); return (vd->vsc); } /*--------------------------------------------------------------------*/ static void vsc_delete_vf_list(struct vsc *vsc) { struct vsc_vf *vf; while (!VTAILQ_EMPTY(&vsc->vf_list)) { vf = VTAILQ_FIRST(&vsc->vf_list); CHECK_OBJ_NOTNULL(vf, VSC_VF_MAGIC); VTAILQ_REMOVE(&vsc->vf_list, vf, list); FREE_OBJ(vf); } } static void vsc_delete_pt_list(struct vsc *vsc) { struct vsc_pt *pt; while (!VTAILQ_EMPTY(&vsc->pt_list)) { pt = VTAILQ_FIRST(&vsc->pt_list); CHECK_OBJ_NOTNULL(pt, VSC_PT_MAGIC); VTAILQ_REMOVE(&vsc->pt_list, pt, list); FREE_OBJ(pt); } } static void vsc_delete_sf_list(struct vsc *vsc) { struct vsc_sf *sf; while (!VTAILQ_EMPTY(&vsc->sf_list)) { sf = VTAILQ_FIRST(&vsc->sf_list); CHECK_OBJ_NOTNULL(sf, VSC_SF_MAGIC); VTAILQ_REMOVE(&vsc->sf_list, sf, list); free(sf->type); free(sf->ident); free(sf->name); FREE_OBJ(sf); } } void VSC_Delete(struct VSM_data *vd) { struct vsc *vsc; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); vsc = vd->vsc; vd->vsc = NULL; CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC); vsc_delete_sf_list(vsc); vsc_delete_pt_list(vsc); vsc_delete_vf_list(vsc); FREE_OBJ(vsc); } /*--------------------------------------------------------------------*/ static int vsc_f_arg(struct VSM_data *vd, const char *opt) { struct vsc *vsc = vsc_setup(vd); struct vsc_sf *sf; const char *error = NULL; const char *p, *q; char *r; int i; int flags = 0; char *parts[3]; AN(vd); AN(opt); if (opt[0] == '^') { flags |= VSC_SF_EXCL; opt++; } /* Split on '.' */ memset(parts, 0, sizeof parts); for (i = 0, p = opt; *p != '\0'; i++) { for (q = p; *q != '\0' && *q != '.'; q++) if (*q == '\\') q++; if (i < 3) { parts[i] = malloc(1 + q - p); AN(parts[i]); memcpy(parts[i], p, q - p); parts[i][q - p] = '\0'; p = r = parts[i]; /* Unescape */ while (1) { if (*p == '\\') p++; if (*p == '\0') break; *r++ = *p++; } *r = '\0'; } p = q; if (*p == '.') p++; } if (i < 1 || i > 3) { (void)vsm_diag(vd, "-f: Wrong number of elements"); for (i = 0; i < 3; i++) free(parts[i]); return (-1); } /* Set fields */ ALLOC_OBJ(sf, VSC_SF_MAGIC); AN(sf); sf->flags = flags; AN(parts[0]); sf->type = parts[0]; if (i == 2) { AN(parts[1]); sf->name = parts[1]; } else if (i == 3) { AN(parts[1]); sf->ident = parts[1]; AN(parts[2]); sf->name = parts[2]; } /* Check for wildcards */ if (sf->type != NULL) { r = strchr(sf->type, '*'); if (r != NULL && r[1] == '\0') { *r = '\0'; sf->flags |= VSC_SF_TY_WC; } else if (r != NULL) error = "-f: Wildcard not last"; } if (sf->ident != NULL) { r = strchr(sf->ident, '*'); if (r != NULL && r[1] == '\0') { *r = '\0'; sf->flags |= VSC_SF_ID_WC; } else if (r != NULL) error = "-f: Wildcard not last"; } if (sf->name != NULL) { r = strchr(sf->name, '*'); if (r != NULL && r[1] == '\0') { *r = '\0'; sf->flags |= VSC_SF_NM_WC; } else if (r != NULL) error = "-f: Wildcard not last"; } if (error != NULL) { (void)vsm_diag(vd, "%s", error); free(sf->type); free(sf->ident); free(sf->name); FREE_OBJ(sf); return (-1); } VTAILQ_INSERT_TAIL(&vsc->sf_list, sf, list); return (1); } /*--------------------------------------------------------------------*/ int VSC_Arg(struct VSM_data *vd, int arg, const char *opt) { switch (arg) { case 'f': return (vsc_f_arg(vd, opt)); case 'n': return (VSM_n_Arg(vd, opt)); case 'N': return (VSM_N_Arg(vd, opt)); default: return (0); } } /*--------------------------------------------------------------------*/ struct VSC_C_mgt * VSC_Mgt(const struct VSM_data *vd, struct VSM_fantom *fantom) { return (VSC_Get(vd, fantom, VSC_type_mgt, "")); } /*--------------------------------------------------------------------*/ struct VSC_C_main * VSC_Main(const struct VSM_data *vd, struct VSM_fantom *fantom) { return (VSC_Get(vd, fantom, VSC_type_main, "")); } /*-------------------------------------------------------------------- */ void * VSC_Get(const struct VSM_data *vd, struct VSM_fantom *fantom, const char *type, const char *ident) { struct VSM_fantom f2 = VSM_FANTOM_NULL; if (fantom == NULL) fantom = &f2; if (VSM_invalid == VSM_StillValid(vd, fantom) && !VSM_Get(vd, fantom, VSC_CLASS, type, ident)) return (NULL); return ((void*)fantom->b); } /*--------------------------------------------------------------------*/ static void vsc_add_vf(struct vsc *vsc, const struct VSM_fantom *fantom, const struct VSC_type_desc *desc, int order) { struct vsc_vf *vf, *vf2; ALLOC_OBJ(vf, VSC_VF_MAGIC); AN(vf); vf->fantom = *fantom; vf->section.type = vf->fantom.type; vf->section.ident = vf->fantom.ident; vf->section.desc = desc; vf->section.fantom = &vf->fantom; vf->order = order; VTAILQ_FOREACH(vf2, &vsc->vf_list, list) { if (vf->order < vf2->order) break; } if (vf2 != NULL) VTAILQ_INSERT_BEFORE(vf2, vf, list); else VTAILQ_INSERT_TAIL(&vsc->vf_list, vf, list); } /*lint -esym(528, vsc_add_pt) */ static void vsc_add_pt(struct vsc *vsc, const volatile void *ptr, const struct VSC_desc *desc, const struct vsc_vf *vf) { struct vsc_pt *pt; ALLOC_OBJ(pt, VSC_PT_MAGIC); AN(pt); pt->point.desc = desc; pt->point.ptr = ptr; pt->point.section = &vf->section; VTAILQ_INSERT_TAIL(&vsc->pt_list, pt, list); } #define VSC_DO(U,l,t) \ static void \ iter_##l(struct vsc *vsc, const struct VSC_desc *descs, \ struct vsc_vf *vf) \ { \ struct VSC_C_##l *st; \ \ CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC); \ st = vf->fantom.b; #define VSC_F(nn,tt,ll,ss,ff,vv,dd,ee) \ vsc_add_pt(vsc, &st->nn, descs++, vf); #define VSC_DONE(U,l,t) \ } #include "tbl/vsc_all.h" #undef VSC_DO #undef VSC_F #undef VSC_DONE /*-------------------------------------------------------------------- */ #include static void vsc_build_vf_list(struct VSM_data *vd) { struct vsc *vsc = vsc_setup(vd); vsc_delete_pt_list(vsc); vsc_delete_vf_list(vsc); VSM_FOREACH(&vsc->iter_fantom, vd) { if (strcmp(vsc->iter_fantom.class, VSC_CLASS)) continue; #define VSC_TYPE_F(n,t,l,e,d) \ if (!strcmp(vsc->iter_fantom.type, t)) \ vsc_add_vf(vsc, &vsc->iter_fantom, \ &VSC_type_desc_##n, VSC_type_order_##n); #include "tbl/vsc_types.h" #undef VSC_TYPE_F } } static void vsc_build_pt_list(struct VSM_data *vd) { struct vsc *vsc = vsc_setup(vd); struct vsc_vf *vf; vsc_delete_pt_list(vsc); VTAILQ_FOREACH(vf, &vsc->vf_list, list) { #define VSC_DO(U,l,t) \ CHECK_OBJ_NOTNULL(vf, VSC_VF_MAGIC); \ if (!strcmp(vf->fantom.type, t)) \ iter_##l(vsc, VSC_desc_##l, vf); #define VSC_F(n,t,l,s,f,v,d,e) #define VSC_DONE(a,b,c) #include "tbl/vsc_all.h" #undef VSC_DO #undef VSC_F #undef VSC_DONE } } /*-------------------------------------------------------------------- */ static inline int iter_test(const char *s1, const char *s2, int wc) { if (s1 == NULL) return (0); if (!wc) return (strcmp(s1, s2)); for (; *s1 != '\0' && *s1 == *s2; s1++, s2++) continue; return (*s1 != '\0'); } static void vsc_filter_pt_list(struct VSM_data *vd) { struct vsc *vsc = vsc_setup(vd); struct vsc_sf *sf; struct vsc_pt *pt, *pt2; VTAILQ_HEAD(, vsc_pt) pt_list; if (VTAILQ_EMPTY(&vsc->sf_list)) return; VTAILQ_INIT(&pt_list); VTAILQ_FOREACH(sf, &vsc->sf_list, list) { CHECK_OBJ_NOTNULL(sf, VSC_SF_MAGIC); VTAILQ_FOREACH_SAFE(pt, &vsc->pt_list, list, pt2) { CHECK_OBJ_NOTNULL(pt, VSC_PT_MAGIC); if (iter_test(sf->type, pt->point.section->type, sf->flags & VSC_SF_TY_WC)) continue; if (iter_test(sf->ident, pt->point.section->ident, sf->flags & VSC_SF_ID_WC)) continue; if (iter_test(sf->name, pt->point.desc->name, sf->flags & VSC_SF_NM_WC)) continue; VTAILQ_REMOVE(&vsc->pt_list, pt, list); if (sf->flags & VSC_SF_EXCL) { FREE_OBJ(pt); } else { VTAILQ_INSERT_TAIL(&pt_list, pt, list); } } } vsc_delete_pt_list(vsc); VTAILQ_CONCAT(&vsc->pt_list, &pt_list, list); } /*-------------------------------------------------------------------- */ int VSC_Iter(struct VSM_data *vd, struct VSM_fantom *fantom, VSC_iter_f *func, void *priv) { struct vsc *vsc = vsc_setup(vd); struct vsc_pt *pt; int i; if (VSM_valid != VSM_StillValid(vd, &vsc->iter_fantom)) { /* Tell app that list will be nuked */ (void)func(priv, NULL); vsc_build_vf_list(vd); vsc_build_pt_list(vd); vsc_filter_pt_list(vd); } if (fantom != NULL) *fantom = vsc->iter_fantom; VTAILQ_FOREACH(pt, &vsc->pt_list, list) { i = func(priv, &pt->point); if (i) return (i); } return (0); } /*-------------------------------------------------------------------- */ const struct VSC_level_desc * VSC_LevelDesc(unsigned level) { switch (level) { #define VSC_LEVEL_F(v,l,e,d) \ case VSC_level_##v: \ return (&VSC_level_desc_##v); #include "tbl/vsc_levels.h" #undef VSC_LEVEL_F default: return (NULL); } } /*-------------------------------------------------------------------- * Build the static level, type and point descriptions */ #define VSC_LEVEL_F(v,l,e,d) \ const struct VSC_level_desc VSC_level_desc_##v = \ {VSC_level_##v, l, e, d}; #include "tbl/vsc_levels.h" #undef VSC_LEVEL_F #define VSC_TYPE_F(n,t,l,e,d) const char *VSC_type_##n = t; #include "tbl/vsc_types.h" #undef VSC_TYPE_F #define VSC_TYPE_F(n,t,l,e,d) \ const struct VSC_type_desc VSC_type_desc_##n = {l,e,d}; #include "tbl/vsc_types.h" #undef VSC_TYPE_F #define VSC_DO(U,l,t) const struct VSC_desc VSC_desc_##l[] = { #define VSC_F(n,t,l,s,f,v,d,e) {#n,#t,s,f,&VSC_level_desc_##v,d,e}, #define VSC_DONE(U,l,t) }; #include "tbl/vsc_all.h" #undef VSC_DO #undef VSC_F #undef VSC_DONE varnish-4.1.1/lib/libvarnishapi/vxp_parse.c0000644000201500234410000003061112652366721015673 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 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. * */ #include "config.h" #include #include #include #include #include #include #include "vdef.h" #include "vas.h" #include "miniobj.h" #include "vbm.h" #include "vnum.h" #include "vqueue.h" #include "vre.h" #include "vsb.h" #include "vapi/vsl.h" #include "vsl_api.h" #include "vxp.h" static void vxp_expr_or(struct vxp *vxp, struct vex **pvex); static struct vex * vex_alloc(const struct vxp *vxp) { struct vex *vex; ALLOC_OBJ(vex, VEX_MAGIC); AN(vex); vex->options = vxp->vex_options; return (vex); } static void vxp_expr_lhs(struct vxp *vxp, struct vex_lhs **plhs) { char *p; int i; AN(plhs); AZ(*plhs); ALLOC_OBJ(*plhs, VEX_LHS_MAGIC); AN(*plhs); (*plhs)->tags = vbit_init(SLT__MAX); (*plhs)->level = -1; if (vxp->t->tok == '{') { /* Transaction level limits */ vxp_NextToken(vxp); if (vxp->t->tok != VAL) { VSB_printf(vxp->sb, "Expected integer got '%.*s' ", PF(vxp->t)); vxp_ErrWhere(vxp, vxp->t, -1); return; } (*plhs)->level = (int)strtol(vxp->t->dec, &p, 0); if ((*plhs)->level < 0) { VSB_printf(vxp->sb, "Expected positive integer "); vxp_ErrWhere(vxp, vxp->t, -1); return; } if (*p == '-') { (*plhs)->level_pm = -1; p++; } else if (*p == '+') { (*plhs)->level_pm = 1; p++; } if (*p) { VSB_printf(vxp->sb, "Syntax error in level limit "); vxp_ErrWhere(vxp, vxp->t, -1); return; } vxp_NextToken(vxp); ExpectErr(vxp, '}'); vxp_NextToken(vxp); } while (1) { /* The tags this expression applies to */ if (vxp->t->tok != VAL) { VSB_printf(vxp->sb, "Expected VSL tag name got '%.*s' ", PF(vxp->t)); vxp_ErrWhere(vxp, vxp->t, -1); return; } i = VSL_Glob2Tags(vxp->t->dec, -1, vsl_vbm_bitset, (*plhs)->tags); if (i == -1) { VSB_printf(vxp->sb, "Tag name matches zero tags "); vxp_ErrWhere(vxp, vxp->t, -1); return; } if (i == -2) { VSB_printf(vxp->sb, "Tag name is ambiguous "); vxp_ErrWhere(vxp, vxp->t, -1); return; } if (i == -3) { VSB_printf(vxp->sb, "Syntax error in tag name "); vxp_ErrWhere(vxp, vxp->t, -1); return; } assert(i > 0); vxp_NextToken(vxp); if (vxp->t->tok != ',') break; vxp_NextToken(vxp); } if (vxp->t->tok == ':') { /* Record prefix */ vxp_NextToken(vxp); if (vxp->t->tok != VAL) { VSB_printf(vxp->sb, "Expected string got '%.*s' ", PF(vxp->t)); vxp_ErrWhere(vxp, vxp->t, -1); return; } AN(vxp->t->dec); (*plhs)->prefix = strdup(vxp->t->dec); AN((*plhs)->prefix); (*plhs)->prefixlen = strlen((*plhs)->prefix); vxp_NextToken(vxp); } if (vxp->t->tok == '[') { /* LHS field [] */ vxp_NextToken(vxp); if (vxp->t->tok != VAL) { VSB_printf(vxp->sb, "Expected integer got '%.*s' ", PF(vxp->t)); vxp_ErrWhere(vxp, vxp->t, -1); return; } (*plhs)->field = (int)strtol(vxp->t->dec, &p, 0); if (*p || (*plhs)->field <= 0) { VSB_printf(vxp->sb, "Expected positive integer "); vxp_ErrWhere(vxp, vxp->t, -1); return; } vxp_NextToken(vxp); ExpectErr(vxp, ']'); vxp_NextToken(vxp); } } static void vxp_expr_num(struct vxp *vxp, struct vex_rhs **prhs) { char *endptr; AN(prhs); AZ(*prhs); if (vxp->t->tok != VAL) { VSB_printf(vxp->sb, "Expected number got '%.*s' ", PF(vxp->t)); vxp_ErrWhere(vxp, vxp->t, -1); return; } AN(vxp->t->dec); ALLOC_OBJ(*prhs, VEX_RHS_MAGIC); AN(*prhs); if (strchr(vxp->t->dec, '.')) { (*prhs)->type = VEX_FLOAT; (*prhs)->val_float = VNUM(vxp->t->dec); if (isnan((*prhs)->val_float)) { VSB_printf(vxp->sb, "Floating point parse error "); vxp_ErrWhere(vxp, vxp->t, -1); return; } } else { (*prhs)->type = VEX_INT; (*prhs)->val_int = strtoll(vxp->t->dec, &endptr, 0); while (isspace(*endptr)) endptr++; if (*endptr != '\0') { VSB_printf(vxp->sb, "Integer parse error "); vxp_ErrWhere(vxp, vxp->t, -1); return; } } vxp_NextToken(vxp); } static void vxp_expr_str(struct vxp *vxp, struct vex_rhs **prhs) { AN(prhs); AZ(*prhs); if (vxp->t->tok != VAL) { VSB_printf(vxp->sb, "Expected string got '%.*s' ", PF(vxp->t)); vxp_ErrWhere(vxp, vxp->t, -1); return; } AN(vxp->t->dec); ALLOC_OBJ(*prhs, VEX_RHS_MAGIC); AN(*prhs); (*prhs)->type = VEX_STRING; (*prhs)->val_string = strdup(vxp->t->dec); AN((*prhs)->val_string); (*prhs)->val_stringlen = strlen((*prhs)->val_string); vxp_NextToken(vxp); } static void vxp_expr_regex(struct vxp *vxp, struct vex_rhs **prhs) { const char *errptr; int erroff; /* XXX: Caseless option */ AN(prhs); AZ(*prhs); if (vxp->t->tok != VAL) { VSB_printf(vxp->sb, "Expected regular expression got '%.*s' ", PF(vxp->t)); vxp_ErrWhere(vxp, vxp->t, -1); return; } AN(vxp->t->dec); ALLOC_OBJ(*prhs, VEX_RHS_MAGIC); AN(*prhs); (*prhs)->type = VEX_REGEX; (*prhs)->val_string = strdup(vxp->t->dec); (*prhs)->val_regex = VRE_compile(vxp->t->dec, vxp->vre_options, &errptr, &erroff); if ((*prhs)->val_regex == NULL) { AN(errptr); VSB_printf(vxp->sb, "Regular expression error: %s ", errptr); vxp_ErrWhere(vxp, vxp->t, erroff); return; } vxp_NextToken(vxp); } /* * SYNTAX: * expr_cmp: * lhs * lhs num|str|regex */ static void vxp_expr_cmp(struct vxp *vxp, struct vex **pvex) { AN(pvex); AZ(*pvex); *pvex = vex_alloc(vxp); AN(*pvex); vxp_expr_lhs(vxp, &(*pvex)->lhs); ERRCHK(vxp); /* Test operator */ switch (vxp->t->tok) { /* Single lhs expressions don't take any more tokens */ case EOI: case T_AND: case T_OR: case ')': (*pvex)->tok = T_TRUE; return; /* Valid operators */ case T_EQ: /* == */ case '<': /* < */ case '>': /* > */ case T_GEQ: /* >= */ case T_LEQ: /* <= */ case T_NEQ: /* != */ case T_SEQ: /* eq */ case T_SNEQ: /* ne */ case '~': /* ~ */ case T_NOMATCH: /* !~ */ (*pvex)->tok = vxp->t->tok; break; /* Error */ default: VSB_printf(vxp->sb, "Expected operator got '%.*s' ", PF(vxp->t)); vxp_ErrWhere(vxp, vxp->t, -1); return; } vxp_NextToken(vxp); ERRCHK(vxp); /* Value */ switch((*pvex)->tok) { case '\0': WRONG("Missing token"); break; case T_EQ: /* == */ case '<': /* < */ case '>': /* > */ case T_GEQ: /* >= */ case T_LEQ: /* <= */ case T_NEQ: /* != */ vxp_expr_num(vxp, &(*pvex)->rhs); break; case T_SEQ: /* eq */ case T_SNEQ: /* ne */ vxp_expr_str(vxp, &(*pvex)->rhs); break; case '~': /* ~ */ case T_NOMATCH: /* !~ */ vxp_expr_regex(vxp, &(*pvex)->rhs); break; default: INCOMPL(); } } /* * SYNTAX: * expr_group: * '(' expr_or ')' * expr_not */ static void vxp_expr_group(struct vxp *vxp, struct vex **pvex) { AN(pvex); AZ(*pvex); if (vxp->t->tok == '(') { SkipToken(vxp, '('); vxp_expr_or(vxp, pvex); ERRCHK(vxp); SkipToken(vxp, ')'); return; } vxp_expr_cmp(vxp, pvex); } /* * SYNTAX: * expr_not: * 'not' expr_group * expr_group */ static void vxp_expr_not(struct vxp *vxp, struct vex **pvex) { AN(pvex); AZ(*pvex); if (vxp->t->tok == T_NOT) { *pvex = vex_alloc(vxp); AN(*pvex); (*pvex)->tok = vxp->t->tok; vxp_NextToken(vxp); vxp_expr_group(vxp, &(*pvex)->a); return; } vxp_expr_group(vxp, pvex); } /* * SYNTAX: * expr_and: * expr_not { 'and' expr_not }* */ static void vxp_expr_and(struct vxp *vxp, struct vex **pvex) { struct vex *a; AN(pvex); AZ(*pvex); vxp_expr_not(vxp, pvex); ERRCHK(vxp); while (vxp->t->tok == T_AND) { a = *pvex; *pvex = vex_alloc(vxp); AN(*pvex); (*pvex)->tok = vxp->t->tok; (*pvex)->a = a; vxp_NextToken(vxp); ERRCHK(vxp); vxp_expr_not(vxp, &(*pvex)->b); ERRCHK(vxp); } } /* * SYNTAX: * expr_or: * expr_and { 'or' expr_and }* */ static void vxp_expr_or(struct vxp *vxp, struct vex **pvex) { struct vex *a; AN(pvex); AZ(*pvex); vxp_expr_and(vxp, pvex); ERRCHK(vxp); while (vxp->t->tok == T_OR) { a = *pvex; *pvex = vex_alloc(vxp); AN(*pvex); (*pvex)->tok = vxp->t->tok; (*pvex)->a = a; vxp_NextToken(vxp); ERRCHK(vxp); vxp_expr_and(vxp, &(*pvex)->b); ERRCHK(vxp); } } /* * SYNTAX: * expr: * expr_or EOI */ static void vxp_expr(struct vxp *vxp, struct vex **pvex) { vxp_expr_or(vxp, pvex); ERRCHK(vxp); ExpectErr(vxp, EOI); } /* * Build a struct vex tree from the token list in vxp */ struct vex * vxp_Parse(struct vxp *vxp) { struct vex *vex = NULL; vxp->t = VTAILQ_FIRST(&vxp->tokens); if (vxp->t == NULL) return (NULL); vxp_expr(vxp, &vex); if (vxp->err) { if (vex) vex_Free(&vex); AZ(vex); return (NULL); } return (vex); } /* * Free a struct vex tree */ void vex_Free(struct vex **pvex) { if ((*pvex)->lhs != NULL) { if ((*pvex)->lhs->tags != NULL) vbit_destroy((*pvex)->lhs->tags); if ((*pvex)->lhs->prefix != NULL) free((*pvex)->lhs->prefix); FREE_OBJ((*pvex)->lhs); } if ((*pvex)->rhs != NULL) { if ((*pvex)->rhs->val_string) free((*pvex)->rhs->val_string); if ((*pvex)->rhs->val_regex) VRE_free(&(*pvex)->rhs->val_regex); FREE_OBJ((*pvex)->rhs); } if ((*pvex)->a != NULL) { vex_Free(&(*pvex)->a); AZ((*pvex)->a); } if ((*pvex)->b != NULL) { vex_Free(&(*pvex)->b); AZ((*pvex)->b); } FREE_OBJ(*pvex); *pvex = NULL; } #ifdef VXP_DEBUG static void vex_print_rhs(const struct vex_rhs *rhs) { CHECK_OBJ_NOTNULL(rhs, VEX_RHS_MAGIC); fprintf(stderr, "rhs="); switch (rhs->type) { case VEX_INT: fprintf(stderr, "INT(%jd)", (intmax_t)rhs->val_int); break; case VEX_FLOAT: fprintf(stderr, "FLOAT(%f)", rhs->val_float); break; case VEX_STRING: AN(rhs->val_string); fprintf(stderr, "STRING(%s)", rhs->val_string); break; case VEX_REGEX: AN(rhs->val_string); AN(rhs->val_regex); fprintf(stderr, "REGEX(%s)", rhs->val_string); break; default: WRONG("rhs type"); break; } } static void vex_print_tags(const struct vbitmap *vbm) { int i; int first = 1; for (i = 0; i < SLT__MAX; i++) { if (VSL_tags[i] == NULL) continue; if (!vbit_test(vbm, i)) continue; if (first) first = 0; else fprintf(stderr, ","); fprintf(stderr, "%s", VSL_tags[i]); } } static void vex_print(const struct vex *vex, int indent) { CHECK_OBJ_NOTNULL(vex, VEX_MAGIC); fprintf(stderr, "%*s%s", indent, "", vxp_tnames[vex->tok]); if (vex->lhs != NULL) { CHECK_OBJ_NOTNULL(vex->lhs, VEX_LHS_MAGIC); AN(vex->lhs->tags); fprintf(stderr, " lhs="); if (vex->lhs->level >= 0) fprintf(stderr, "{%d%s}", vex->lhs->level, vex->lhs->level_pm < 0 ? "-" : vex->lhs->level_pm > 0 ? "+" : ""); fprintf(stderr, "("); vex_print_tags(vex->lhs->tags); fprintf(stderr, ")"); if (vex->lhs->prefix) { assert(vex->lhs->prefixlen == strlen(vex->lhs->prefix)); fprintf(stderr, ":%s", vex->lhs->prefix); } if (vex->lhs->field > 0) fprintf(stderr, "[%d]", vex->lhs->field); } if (vex->rhs != NULL) { fprintf(stderr, " "); vex_print_rhs(vex->rhs); } fprintf(stderr, "\n"); if (vex->a != NULL) vex_print(vex->a, indent + 2); if (vex->b != NULL) vex_print(vex->b, indent + 2); } void vex_PrintTree(const struct vex *vex) { CHECK_OBJ_NOTNULL(vex, VEX_MAGIC); fprintf(stderr, "VEX tree:\n"); vex_print(vex, 2); } #endif /* VXP_DEBUG */ varnish-4.1.1/lib/libvarnishapi/vxp_tokens.h0000644000201500234410000000051512652366744016076 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ #define EOI 128 #define T_AND 129 #define T_EQ 130 #define T_GEQ 131 #define T_LEQ 132 #define T_NEQ 133 #define T_NOMATCH 134 #define T_NOT 135 #define T_OR 136 #define T_SEQ 137 #define T_SNEQ 138 #define T_TRUE 139 #define VAL 140 varnish-4.1.1/lib/libvarnishapi/Makefile.am0000644000201500234410000000377312652366721015565 00000000000000# AM_LDFLAGS = $(AM_LT_LDFLAGS) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ @PCRE_CFLAGS@ lib_LTLIBRARIES = libvarnishapi.la libvarnishapi_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:4:0 libvarnishapi_la_SOURCES = \ vsm_api.h \ vsl_api.h \ vxp.h \ vxp_tokens.h \ \ ../libvarnish/vas.c \ ../libvarnish/vav.c \ ../../include/vcs_version.h \ ../libvarnish/version.c \ ../libvarnish/cli_common.c \ ../libvarnish/cli_auth.c \ ../libvarnish/vin.c \ ../libvarnish/vmb.c \ ../libvarnish/vre.c \ ../libvarnish/vsb.c \ ../libvarnish/vtim.c \ ../libvarnish/vnum.c \ ../libvarnish/vsha256.c \ vsm.c \ vsl_arg.c \ vsl_cursor.c \ vsl_dispatch.c \ vsl_query.c \ vsl.c \ vsc.c \ vxp.c \ vxp_parse.c \ vxp_lexer.c \ vxp_fixed_token.c \ libvarnishapi.map libvarnishapi_la_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' libvarnishapi_la_LIBADD = @PCRE_LIBS@ @RT_LIBS@ if HAVE_LD_VERSION_SCRIPT libvarnishapi_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libvarnishapi.map else libvarnishapi_la_LDFLAGS += -export-symbols-regex '^V' endif EXTRA_DIST = \ generate.py \ vsl-tags.rst BUILT_SOURCES = \ vxp_fixed_token.c \ vxp_tokens.h \ vsl-tags.rst CLEANFILES = \ $(builddir)/vxp_fixed_token.c \ $(builddir)/vxp_tokens.h MAINTAINERCLEANFILES = \ vsl-tags.rst noinst_PROGRAMS = vsl2rst vsl2rst_SOURCES = \ vsl2rst.c \ $(top_srcdir)/include/tbl/vsl_tags.h \ $(top_srcdir)/include/tbl/vsl_tags_http.h vsl-tags.rst: vsl2rst ./vsl2rst > $@ vxp_fixed_token.c vxp_tokens.h: \ $(srcdir)/generate.py @PYTHON@ $(srcdir)/generate.py $(srcdir) $(top_builddir) EXTRA_PROGRAMS = vxp_test vsl_glob_test vxp_test_LDADD = @PCRE_LIBS@ \ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS} vxp_test_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' \ -DVXP_DEBUG vxp_test_SOURCES = \ $(libvarnishapi_la_SOURCES) \ vxp_test.c vsl_glob_test_SOURCES = \ vsl_glob_test.c vsl_glob_test_LDADD = @PCRE_LIBS@ ${RT_LIBS} ${LIBM} libvarnishapi.la vsl_glob_test_CFLAGS = -I$(top_srcdir)/include varnish-4.1.1/lib/libvarnishapi/vsl_dispatch.c0000644000201500234410000010003312652366721016343 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 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. * */ #include #include #include #include #include #include #include "vdef.h" #include "vas.h" #include "miniobj.h" #include "vqueue.h" #include "vre.h" #include "vtim.h" #include "vtree.h" #include "vapi/vsl.h" #include "vsl_api.h" #define VTX_CACHE 10 #define VTX_BUFSIZE_MIN 64 #define VTX_SHMCHUNKS 3 static const char * const vsl_t_names[VSL_t__MAX] = { [VSL_t_unknown] = "unknown", [VSL_t_sess] = "sess", [VSL_t_req] = "req", [VSL_t_bereq] = "bereq", [VSL_t_raw] = "raw", }; 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", [VSL_r_pipe] = "pipe", }; struct vtx; struct vslc_raw { unsigned magic; #define VSLC_RAW_MAGIC 0x247EBD44 struct VSL_cursor cursor; const uint32_t *ptr; }; struct synth { unsigned magic; #define SYNTH_MAGIC 0xC654479F VTAILQ_ENTRY(synth) list; size_t offset; uint32_t data[2 + 64 / sizeof (uint32_t)]; }; VTAILQ_HEAD(synthhead, synth); enum chunk_t { chunk_t__unassigned, chunk_t_shm, chunk_t_buf, }; struct chunk { unsigned magic; #define CHUNK_MAGIC 0x48DC0194 enum chunk_t type; union { struct { struct VSLC_ptr start; VTAILQ_ENTRY(chunk) shmref; } shm; struct { uint32_t *data; size_t space; } buf; }; size_t len; struct vtx *vtx; VTAILQ_ENTRY(chunk) list; }; VTAILQ_HEAD(chunkhead, chunk); struct vslc_vtx { unsigned magic; #define VSLC_VTX_MAGIC 0x74C6523F struct VSL_cursor cursor; struct vtx *vtx; struct synth *synth; struct chunk *chunk; size_t chunkstart; size_t offset; }; struct vtx_key { unsigned vxid; VRB_ENTRY(vtx_key) entry; }; VRB_HEAD(vtx_tree, vtx_key); struct vtx { struct vtx_key key; unsigned magic; #define VTX_MAGIC 0xACC21D09 VTAILQ_ENTRY(vtx) list_child; VTAILQ_ENTRY(vtx) list_vtx; double t_start; unsigned flags; #define VTX_F_BEGIN 0x1 /* Begin record processed */ #define VTX_F_END 0x2 /* End record processed */ #define VTX_F_COMPLETE 0x4 /* Marked complete. No new children should be appended */ #define VTX_F_READY 0x8 /* This vtx and all it's children are complete */ enum VSL_transaction_e type; enum VSL_reason_e reason; struct vtx *parent; VTAILQ_HEAD(,vtx) child; unsigned n_child; unsigned n_childready; unsigned n_descend; VTAILQ_HEAD(,synth) synth; struct chunk shmchunks[VTX_SHMCHUNKS]; struct chunkhead shmchunks_free; struct chunkhead chunks; size_t len; struct vslc_vtx c; }; struct VSLQ { unsigned magic; #define VSLQ_MAGIC 0x23A8BE97 struct VSL_data *vsl; struct VSL_cursor *c; struct vslq_query *query; enum VSL_grouping_e grouping; /* Structured mode */ struct vtx_tree tree; VTAILQ_HEAD(,vtx) ready; VTAILQ_HEAD(,vtx) incomplete; unsigned n_outstanding; struct chunkhead shmrefs; VTAILQ_HEAD(,vtx) cache; unsigned n_cache; /* Raw mode */ struct { struct vslc_raw c; struct VSL_transaction trans; struct VSL_transaction *ptrans[2]; struct VSLC_ptr start; ssize_t len; size_t offset; } raw; }; static void vtx_synth_rec(struct vtx *vtx, unsigned tag, const char *fmt, ...); /*lint -esym(534, vtx_diag) */ static int vtx_diag(struct vtx *vtx, const char *msg); /*lint -esym(534, vtx_diag_tag) */ static int vtx_diag_tag(struct vtx *vtx, const uint32_t *ptr, const char *reason); static inline int vtx_keycmp(const struct vtx_key *a, const struct vtx_key *b) { if (a->vxid < b->vxid) return (-1); if (a->vxid > b->vxid) return (1); return (0); } VRB_PROTOTYPE_STATIC(vtx_tree, vtx_key, entry, vtx_keycmp) VRB_GENERATE_STATIC(vtx_tree, vtx_key, entry, vtx_keycmp) static int vslc_raw_next(const struct VSL_cursor *cursor) { struct vslc_raw *c; CAST_OBJ_NOTNULL(c, cursor->priv_data, VSLC_RAW_MAGIC); assert(&c->cursor == cursor); AN(c->ptr); if (c->cursor.rec.ptr == NULL) { c->cursor.rec.ptr = c->ptr; return (1); } else { c->cursor.rec.ptr = NULL; return (0); } } static int vslc_raw_reset(const struct VSL_cursor *cursor) { struct vslc_raw *c; CAST_OBJ_NOTNULL(c, cursor->priv_data, VSLC_RAW_MAGIC); assert(&c->cursor == cursor); AN(c->ptr); c->cursor.rec.ptr = NULL; return (0); } static const struct vslc_tbl vslc_raw_tbl = { .magic = VSLC_TBL_MAGIC, .delete = NULL, .next = vslc_raw_next, .reset = vslc_raw_reset, .check = NULL, }; static int vslc_vtx_next(const struct VSL_cursor *cursor) { struct vslc_vtx *c; const uint32_t *ptr; CAST_OBJ_NOTNULL(c, cursor->priv_data, VSLC_VTX_MAGIC); assert(&c->cursor == cursor); CHECK_OBJ_NOTNULL(c->vtx, VTX_MAGIC); do { CHECK_OBJ_ORNULL(c->synth, SYNTH_MAGIC); if (c->synth != NULL && c->synth->offset == c->offset) { /* We're at the offset of the next synth record, point to it and advance the pointer */ c->cursor.rec.ptr = c->synth->data; c->synth = VTAILQ_NEXT(c->synth, list); } else { assert(c->offset <= c->vtx->len); if (c->offset == c->vtx->len) /* End of cursor */ return (0); /* Advance chunk pointer */ if (c->chunk == NULL) { c->chunk = VTAILQ_FIRST(&c->vtx->chunks); c->chunkstart = 0; } CHECK_OBJ_NOTNULL(c->chunk, CHUNK_MAGIC); while (c->offset >= c->chunkstart + c->chunk->len) { c->chunkstart += c->chunk->len; c->chunk = VTAILQ_NEXT(c->chunk, list); CHECK_OBJ_NOTNULL(c->chunk, CHUNK_MAGIC); } /* Point to the next stored record */ if (c->chunk->type == chunk_t_shm) ptr = c->chunk->shm.start.ptr; else { assert(c->chunk->type == chunk_t_buf); ptr = c->chunk->buf.data; } c->cursor.rec.ptr = ptr + c->offset - c->chunkstart; c->offset += VSL_NEXT(c->cursor.rec.ptr) - c->cursor.rec.ptr; } } while (VSL_TAG(c->cursor.rec.ptr) == SLT__Batch); return (1); } static int vslc_vtx_reset(const struct VSL_cursor *cursor) { struct vslc_vtx *c; CAST_OBJ_NOTNULL(c, cursor->priv_data, VSLC_VTX_MAGIC); assert(&c->cursor == cursor); CHECK_OBJ_NOTNULL(c->vtx, VTX_MAGIC); c->synth = VTAILQ_FIRST(&c->vtx->synth); c->chunk = NULL; c->chunkstart = 0; c->offset = 0; c->cursor.rec.ptr = NULL; return (0); } static const struct vslc_tbl vslc_vtx_tbl = { .magic = VSLC_TBL_MAGIC, .delete = NULL, .next = vslc_vtx_next, .reset = vslc_vtx_reset, .check = NULL, }; /* Create a buf chunk */ static struct chunk * chunk_newbuf(struct vtx *vtx, const uint32_t *ptr, size_t len) { struct chunk *chunk; ALLOC_OBJ(chunk, CHUNK_MAGIC); XXXAN(chunk); chunk->type = chunk_t_buf; chunk->vtx = vtx; chunk->buf.space = VTX_BUFSIZE_MIN; while (chunk->buf.space < len) chunk->buf.space *= 2; chunk->buf.data = malloc(sizeof (uint32_t) * chunk->buf.space); AN(chunk->buf.data); memcpy(chunk->buf.data, ptr, sizeof (uint32_t) * len); chunk->len = len; return (chunk); } /* Free a buf chunk */ static void chunk_freebuf(struct chunk **pchunk) { CHECK_OBJ_NOTNULL(*pchunk, CHUNK_MAGIC); assert((*pchunk)->type == chunk_t_buf); free((*pchunk)->buf.data); FREE_OBJ(*pchunk); *pchunk = NULL; } /* Append a set of records to a chunk */ static void chunk_appendbuf(struct chunk *chunk, const uint32_t *ptr, size_t len) { CHECK_OBJ_NOTNULL(chunk, CHUNK_MAGIC); assert(chunk->type == chunk_t_buf); if (chunk->buf.space < chunk->len + len) { while (chunk->buf.space < chunk->len + len) chunk->buf.space *= 2; chunk->buf.data = realloc(chunk->buf.data, sizeof (uint32_t) * chunk->buf.space); } memcpy(chunk->buf.data + chunk->len, ptr, sizeof (uint32_t) * len); chunk->len += len; } /* Transform a shm chunk to a buf chunk */ static void chunk_shm_to_buf(struct VSLQ *vslq, struct chunk *chunk) { struct vtx *vtx; struct chunk *buf; CHECK_OBJ_NOTNULL(chunk, CHUNK_MAGIC); assert(chunk->type == chunk_t_shm); vtx = chunk->vtx; CHECK_OBJ_NOTNULL(vtx, VTX_MAGIC); buf = VTAILQ_PREV(chunk, chunkhead, list); if (buf != NULL && buf->type == chunk_t_buf) /* Previous is a buf chunk, append to it */ chunk_appendbuf(buf, chunk->shm.start.ptr, chunk->len); else { /* Create a new buf chunk and insert it before this */ buf = chunk_newbuf(vtx, chunk->shm.start.ptr, chunk->len); AN(buf); VTAILQ_INSERT_BEFORE(chunk, buf, list); } /* Reset cursor chunk pointer, vslc_vtx_next will set it correctly */ vtx->c.chunk = NULL; /* Remove from the shmref list and vtx, and put chunk back on the free list */ VTAILQ_REMOVE(&vslq->shmrefs, chunk, shm.shmref); VTAILQ_REMOVE(&vtx->chunks, chunk, list); VTAILQ_INSERT_HEAD(&vtx->shmchunks_free, chunk, list); } /* Append a set of records to a vtx structure */ static void vtx_append(struct VSLQ *vslq, struct vtx *vtx, const struct VSLC_ptr *start, size_t len) { struct chunk *chunk; AN(vtx); if (len == 0) return; AN(start); if (VSL_Check(vslq->c, start) == 2 && !VTAILQ_EMPTY(&vtx->shmchunks_free)) { /* Shmref it */ chunk = VTAILQ_FIRST(&vtx->shmchunks_free); CHECK_OBJ_NOTNULL(chunk, CHUNK_MAGIC); assert(chunk->type == chunk_t_shm); assert(chunk->vtx == vtx); VTAILQ_REMOVE(&vtx->shmchunks_free, chunk, list); chunk->shm.start = *start; chunk->len = len; VTAILQ_INSERT_TAIL(&vtx->chunks, chunk, list); /* Append to shmref list */ VTAILQ_INSERT_TAIL(&vslq->shmrefs, chunk, shm.shmref); } else { /* Buffer it */ chunk = VTAILQ_LAST(&vtx->chunks, chunkhead); CHECK_OBJ_ORNULL(chunk, CHUNK_MAGIC); if (chunk != NULL && chunk->type == chunk_t_buf) { /* Tail is a buf chunk, append to that */ chunk_appendbuf(chunk, start->ptr, len); } else { /* Append new buf chunk */ chunk = chunk_newbuf(vtx, start->ptr, len); AN(chunk); VTAILQ_INSERT_TAIL(&vtx->chunks, chunk, list); } } vtx->len += len; } /* Allocate a new vtx structure */ static struct vtx * vtx_new(struct VSLQ *vslq) { struct vtx *vtx; int i; AN(vslq); if (vslq->n_cache) { AZ(VTAILQ_EMPTY(&vslq->cache)); vtx = VTAILQ_FIRST(&vslq->cache); VTAILQ_REMOVE(&vslq->cache, vtx, list_child); vslq->n_cache--; } else { ALLOC_OBJ(vtx, VTX_MAGIC); AN(vtx); VTAILQ_INIT(&vtx->child); VTAILQ_INIT(&vtx->shmchunks_free); for (i = 0; i < VTX_SHMCHUNKS; i++) { vtx->shmchunks[i].magic = CHUNK_MAGIC; vtx->shmchunks[i].type = chunk_t_shm; vtx->shmchunks[i].vtx = vtx; VTAILQ_INSERT_TAIL(&vtx->shmchunks_free, &vtx->shmchunks[i], list); } VTAILQ_INIT(&vtx->chunks); VTAILQ_INIT(&vtx->synth); vtx->c.magic = VSLC_VTX_MAGIC; vtx->c.vtx = vtx; vtx->c.cursor.priv_tbl = &vslc_vtx_tbl; vtx->c.cursor.priv_data = &vtx->c; } CHECK_OBJ_NOTNULL(vtx, VTX_MAGIC); vtx->key.vxid = 0; 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; vtx->n_descend = 0; vtx->len = 0; (void)vslc_vtx_reset(&vtx->c.cursor); return (vtx); } /* Disuse a vtx and all it's children, freeing any resources held. Free or cache the vtx for later use */ static void vtx_retire(struct VSLQ *vslq, struct vtx **pvtx) { struct vtx *vtx; struct vtx *child; struct synth *synth; struct chunk *chunk; AN(vslq); AN(pvtx); vtx = *pvtx; *pvtx = NULL; CHECK_OBJ_NOTNULL(vtx, VTX_MAGIC); AN(vtx->flags & VTX_F_COMPLETE); AN(vtx->flags & VTX_F_READY); AZ(vtx->parent); while (!VTAILQ_EMPTY(&vtx->child)) { child = VTAILQ_FIRST(&vtx->child); assert(child->parent == vtx); AN(vtx->n_child); assert(vtx->n_descend >= child->n_descend + 1); VTAILQ_REMOVE(&vtx->child, child, list_child); child->parent = NULL; vtx->n_child--; vtx->n_descend -= child->n_descend + 1; vtx_retire(vslq, &child); AZ(child); } AZ(vtx->n_child); AZ(vtx->n_descend); vtx->n_childready = 0; AN(VRB_REMOVE(vtx_tree, &vslq->tree, &vtx->key)); vtx->key.vxid = 0; vtx->flags = 0; while (!VTAILQ_EMPTY(&vtx->synth)) { synth = VTAILQ_FIRST(&vtx->synth); CHECK_OBJ_NOTNULL(synth, SYNTH_MAGIC); VTAILQ_REMOVE(&vtx->synth, synth, list); FREE_OBJ(synth); } while (!VTAILQ_EMPTY(&vtx->chunks)) { chunk = VTAILQ_FIRST(&vtx->chunks); CHECK_OBJ_NOTNULL(chunk, CHUNK_MAGIC); VTAILQ_REMOVE(&vtx->chunks, chunk, list); if (chunk->type == chunk_t_shm) { VTAILQ_REMOVE(&vslq->shmrefs, chunk, shm.shmref); VTAILQ_INSERT_HEAD(&vtx->shmchunks_free, chunk, list); } else { assert(chunk->type == chunk_t_buf); chunk_freebuf(&chunk); AZ(chunk); } } vtx->len = 0; AN(vslq->n_outstanding); vslq->n_outstanding--; if (vslq->n_cache < VTX_CACHE) { VTAILQ_INSERT_HEAD(&vslq->cache, vtx, list_child); vslq->n_cache++; } else { FREE_OBJ(vtx); vtx = NULL; } } /* Lookup a vtx by vxid from the managed list */ static struct vtx * vtx_lookup(const struct VSLQ *vslq, unsigned vxid) { struct vtx_key lkey, *key; struct vtx *vtx; AN(vslq); lkey.vxid = vxid; key = VRB_FIND(vtx_tree, &vslq->tree, &lkey); if (key == NULL) return (NULL); CAST_OBJ_NOTNULL(vtx, (void *)key, VTX_MAGIC); return (vtx); } /* Insert a new vtx into the managed list */ static struct vtx * vtx_add(struct VSLQ *vslq, unsigned vxid) { struct vtx *vtx; AN(vslq); vtx = vtx_new(vslq); AN(vtx); vtx->key.vxid = vxid; AZ(VRB_INSERT(vtx_tree, &vslq->tree, &vtx->key)); VTAILQ_INSERT_TAIL(&vslq->incomplete, vtx, list_vtx); vslq->n_outstanding++; return (vtx); } /* Mark a vtx complete, update child counters and if possible push it or it's top parent to the ready state */ static void vtx_mark_complete(struct VSLQ *vslq, struct vtx *vtx) { AN(vslq); AN(vtx->flags & VTX_F_END); AZ(vtx->flags & VTX_F_COMPLETE); if (vtx->type == VSL_t_unknown) vtx_diag(vtx, "vtx of unknown type marked complete"); vtx->flags |= VTX_F_COMPLETE; VTAILQ_REMOVE(&vslq->incomplete, vtx, list_vtx); while (1) { AZ(vtx->flags & VTX_F_READY); if (vtx->flags & VTX_F_COMPLETE && vtx->n_child == vtx->n_childready) vtx->flags |= VTX_F_READY; else return; if (vtx->parent == NULL) { /* Top level vtx ready */ VTAILQ_INSERT_TAIL(&vslq->ready, vtx, list_vtx); return; } vtx = vtx->parent; vtx->n_childready++; assert(vtx->n_child >= vtx->n_childready); } } /* Add a child to a parent, and update child counters */ static void vtx_set_parent(struct vtx *parent, struct vtx *child) { CHECK_OBJ_NOTNULL(parent, VTX_MAGIC); CHECK_OBJ_NOTNULL(child, VTX_MAGIC); assert(parent != child); AZ(parent->flags & VTX_F_COMPLETE); AZ(child->flags & VTX_F_COMPLETE); AZ(child->parent); child->parent = parent; VTAILQ_INSERT_TAIL(&parent->child, child, list_child); parent->n_child++; do parent->n_descend += 1 + child->n_descend; while ((parent = parent->parent) != NULL); } /* Parse a begin or link record. Returns the number of elements that was successfully parsed. */ static int vtx_parse_link(const char *str, enum VSL_transaction_e *ptype, unsigned *pvxid, enum VSL_reason_e *preason) { char type[16], reason[16]; unsigned vxid; int i; enum VSL_transaction_e et; enum VSL_reason_e er; AN(str); AN(ptype); AN(pvxid); AN(preason); i = sscanf(str, "%15s %u %15s", type, &vxid, reason); if (i < 1) return (0); /* transaction type */ for (et = 0; et < VSL_t__MAX; et++) if (!strcmp(type, vsl_t_names[et])) break; if (et >= VSL_t__MAX) et = VSL_t_unknown; *ptype = et; if (i == 1) return (1); /* vxid */ assert((vxid & ~VSL_IDENTMASK) == 0); *pvxid = vxid; if (i == 2) return (2); /* transaction reason */ for (er = 0; er < VSL_r__MAX; er++) if (!strcmp(reason, vsl_r_names[er])) break; if (er >= VSL_r__MAX) er = VSL_r_unknown; *preason = er; return (3); } /* Parse and process a begin record */ static int 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; assert(VSL_TAG(ptr) == SLT_Begin); AZ(vtx->flags & VTX_F_READY); 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 */ if (vtx->type != VSL_t_unknown && vtx->type != type) /* Type not matching the one previously set by a link record */ (void)vtx_diag_tag(vtx, ptr, "type mismatch"); vtx->type = type; vtx->reason = reason; if (p_vxid == 0) /* Zero means no parent */ return (0); if (p_vxid == vtx->key.vxid) return (vtx_diag_tag(vtx, ptr, "link to self")); if (vslq->grouping == VSL_g_vxid) return (0); /* No links */ if (vslq->grouping == VSL_g_request && vtx->type == VSL_t_req && vtx->reason == VSL_r_rxreq) return (0); /* No links */ if (vtx->parent != NULL) { if (vtx->parent->key.vxid != p_vxid) { /* This vtx already belongs to a different parent */ return (vtx_diag_tag(vtx, ptr, "link mismatch")); } else /* Link already exists */ return (0); } p_vtx = vtx_lookup(vslq, p_vxid); if (p_vtx == NULL) { /* Not seen parent yet. Create it. */ p_vtx = vtx_add(vslq, p_vxid); AN(p_vtx); } else { 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); return (0); } /* Parse and process a link record */ static int 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; assert(VSL_TAG(ptr) == SLT_Link); AZ(vtx->flags & VTX_F_READY); i = vtx_parse_link(VSL_CDATA(ptr), &c_type, &c_vxid, &c_reason); if (i != 3) return (vtx_diag_tag(vtx, ptr, "parse error")); 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 */ if (vslq->grouping == VSL_g_request && vtx->type == VSL_t_sess) return (0); /* No links */ if (c_vxid == 0) return (vtx_diag_tag(vtx, ptr, "illegal link vxid")); if (c_vxid == vtx->key.vxid) return (vtx_diag_tag(vtx, ptr, "link to self")); /* Lookup and check child vtx */ c_vtx = vtx_lookup(vslq, c_vxid); if (c_vtx == NULL) { /* 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); } CHECK_OBJ_NOTNULL(c_vtx, VTX_MAGIC); if (c_vtx->parent == vtx) /* Link already exists */ return (0); if (c_vtx->parent != vtx) return (vtx_diag_tag(vtx, ptr, "duplicate link")); 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) (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); } /* Scan the records of a vtx, performing processing actions on specific records */ static void vtx_scan(struct VSLQ *vslq, struct vtx *vtx) { const uint32_t *ptr; enum VSL_tag_e tag; while (!(vtx->flags & VTX_F_COMPLETE) && vslc_vtx_next(&vtx->c.cursor) == 1) { ptr = vtx->c.cursor.rec.ptr; if (VSL_ID(ptr) != vtx->key.vxid) { (void)vtx_diag_tag(vtx, ptr, "vxid mismatch"); continue; } tag = VSL_TAG(ptr); assert(tag != SLT__Batch); switch (tag) { case SLT_Begin: if (vtx->flags & VTX_F_BEGIN) (void)vtx_diag_tag(vtx, ptr, "duplicate begin"); else { (void)vtx_scan_begin(vslq, vtx, ptr); vtx->flags |= VTX_F_BEGIN; } break; case SLT_Link: (void)vtx_scan_link(vslq, vtx, ptr); break; case SLT_End: AZ(vtx->flags & VTX_F_END); vtx->flags |= VTX_F_END; vtx_mark_complete(vslq, vtx); break; default: break; } } } /* Force a vtx into complete status by synthing the necessary outstanding records */ static void vtx_force(struct VSLQ *vslq, struct vtx *vtx, const char *reason) { AZ(vtx->flags & VTX_F_COMPLETE); AZ(vtx->flags & VTX_F_READY); vtx_scan(vslq, vtx); if (!(vtx->flags & VTX_F_BEGIN)) vtx_synth_rec(vtx, SLT_Begin, "%s %u synth", vsl_t_names[vtx->type], 0); vtx_diag(vtx, reason); if (!(vtx->flags & VTX_F_END)) vtx_synth_rec(vtx, SLT_End, "synth"); vtx_scan(vslq, vtx); AN(vtx->flags & VTX_F_COMPLETE); } /* Build transaction array, do the query and callback. Returns 0 or the return value from func */ static int vslq_callback(const struct VSLQ *vslq, struct vtx *vtx, VSLQ_dispatch_f *func, void *priv) { unsigned n = vtx->n_descend + 1; struct vtx *vtxs[n]; struct VSL_transaction trans[n]; struct VSL_transaction *ptrans[n + 1]; unsigned i, j; AN(vslq); CHECK_OBJ_NOTNULL(vtx, VTX_MAGIC); AN(vtx->flags & VTX_F_READY); AN(func); if (vslq->grouping == VSL_g_session && vtx->type != VSL_t_sess) return (0); if (vslq->grouping == VSL_g_request && vtx->type != VSL_t_req) return (0); /* Build transaction array */ (void)vslc_vtx_reset(&vtx->c.cursor); vtxs[0] = vtx; trans[0].level = 1; 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; while (j < i) { VTAILQ_FOREACH(vtx, &vtxs[j]->child, list_child) { assert(i < n); (void)vslc_vtx_reset(&vtx->c.cursor); vtxs[i] = vtx; 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; trans[i].reason = vtx->reason; trans[i].c = &vtx->c.cursor; i++; } j++; } assert(i == n); /* Build pointer array */ for (i = 0; i < n; i++) ptrans[i] = &trans[i]; ptrans[i] = NULL; /* Query test goes here */ if (vslq->query != NULL && !vslq_runquery(vslq->query, ptrans)) return (0); /* Callback */ return ((func)(vslq->vsl, ptrans, priv)); } /* Create a synthetic log record. The record will be inserted at the current cursor offset */ static void vtx_synth_rec(struct vtx *vtx, unsigned tag, const char *fmt, ...) { struct synth *synth, *it; va_list ap; char *buf; int l, buflen; ALLOC_OBJ(synth, SYNTH_MAGIC); AN(synth); buf = (char *)&synth->data[2]; buflen = sizeof (synth->data) - 2 * sizeof (uint32_t); va_start(ap, fmt); l = vsnprintf(buf, buflen, fmt, ap); assert(l >= 0); va_end(ap); if (l > buflen - 1) l = buflen - 1; buf[l++] = '\0'; /* NUL-terminated */ synth->data[1] = vtx->key.vxid; switch (vtx->type) { case VSL_t_req: synth->data[1] |= VSL_CLIENTMARKER; break; case VSL_t_bereq: synth->data[1] |= VSL_BACKENDMARKER; break; default: break; } synth->data[0] = (((tag & 0xff) << 24) | l); synth->offset = vtx->c.offset; VTAILQ_FOREACH_REVERSE(it, &vtx->synth, synthhead, list) { /* Make sure the synth list is sorted on offset */ CHECK_OBJ_NOTNULL(it, SYNTH_MAGIC); if (synth->offset >= it->offset) break; } if (it != NULL) VTAILQ_INSERT_AFTER(&vtx->synth, it, synth, list); else VTAILQ_INSERT_HEAD(&vtx->synth, synth, list); /* Update cursor */ CHECK_OBJ_ORNULL(vtx->c.synth, SYNTH_MAGIC); if (vtx->c.synth == NULL || vtx->c.synth->offset > synth->offset) vtx->c.synth = synth; } /* Add a diagnostic SLT_VSL synth record to the vtx. */ static int vtx_diag(struct vtx *vtx, const char *msg) { vtx_synth_rec(vtx, SLT_VSL, msg); return (-1); } /* Add a SLT_VSL diag synth record to the vtx. Takes an offending record that will be included in the log record */ static int vtx_diag_tag(struct vtx *vtx, const uint32_t *ptr, const char *reason) { vtx_synth_rec(vtx, SLT_VSL, "%s (%u:%s \"%.*s\")", reason, VSL_ID(ptr), VSL_tags[VSL_TAG(ptr)], (int)VSL_LEN(ptr), VSL_CDATA(ptr)); return (-1); } struct VSLQ * VSLQ_New(struct VSL_data *vsl, struct VSL_cursor **cp, enum VSL_grouping_e grouping, const char *querystring) { struct vslq_query *query; struct VSLQ *vslq; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); if (grouping > VSL_g_session) { (void)vsl_diag(vsl, "Illegal query grouping"); return (NULL); } if (querystring != NULL) { query = vslq_newquery(vsl, grouping, querystring); if (query == NULL) return (NULL); } else query = NULL; ALLOC_OBJ(vslq, VSLQ_MAGIC); AN(vslq); vslq->vsl = vsl; if (cp != NULL) { vslq->c = *cp; *cp = NULL; } vslq->grouping = grouping; vslq->query = query; /* Setup normal mode */ VRB_INIT(&vslq->tree); VTAILQ_INIT(&vslq->ready); VTAILQ_INIT(&vslq->incomplete); VTAILQ_INIT(&vslq->shmrefs); VTAILQ_INIT(&vslq->cache); /* Setup raw mode */ vslq->raw.c.magic = VSLC_RAW_MAGIC; vslq->raw.c.cursor.priv_tbl = &vslc_raw_tbl; 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; return (vslq); } void VSLQ_Delete(struct VSLQ **pvslq) { struct VSLQ *vslq; struct vtx *vtx; AN(pvslq); vslq = *pvslq; *pvslq = NULL; CHECK_OBJ_NOTNULL(vslq, VSLQ_MAGIC); (void)VSLQ_Flush(vslq, NULL, NULL); AZ(vslq->n_outstanding); if (vslq->c != NULL) { VSL_DeleteCursor(vslq->c); vslq->c = NULL; } if (vslq->query != NULL) vslq_deletequery(&vslq->query); AZ(vslq->query); while (!VTAILQ_EMPTY(&vslq->cache)) { AN(vslq->n_cache); vtx = VTAILQ_FIRST(&vslq->cache); VTAILQ_REMOVE(&vslq->cache, vtx, list_child); vslq->n_cache--; FREE_OBJ(vtx); } FREE_OBJ(vslq); } void VSLQ_SetCursor(struct VSLQ *vslq, struct VSL_cursor **cp) { CHECK_OBJ_NOTNULL(vslq, VSLQ_MAGIC); if (vslq->c != NULL) { (void)VSLQ_Flush(vslq, NULL, NULL); AZ(vslq->n_outstanding); VSL_DeleteCursor(vslq->c); vslq->c = NULL; } if (cp != NULL) { AN(*cp); vslq->c = *cp; *cp = NULL; } } /* Regard each log line as a single transaction, feed it through the query and do the callback */ static int vslq_raw(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv) { int i = 1; int r; assert(vslq->grouping == VSL_g_raw); assert(vslq->raw.offset <= vslq->raw.len); do { if (vslq->raw.offset == vslq->raw.len) { i = VSL_Next(vslq->c); if (i <= 0) return (i); AN(vslq->c->rec.ptr); vslq->raw.start = vslq->c->rec; if (VSL_TAG(vslq->c->rec.ptr) == SLT__Batch) vslq->raw.len = VSL_END(vslq->c->rec.ptr, VSL_BATCHLEN(vslq->c->rec.ptr)) - vslq->c->rec.ptr; else vslq->raw.len = VSL_NEXT(vslq->raw.start.ptr) - vslq->raw.start.ptr; assert(vslq->raw.len > 0); vslq->raw.offset = 0; } vslq->raw.c.ptr = vslq->raw.start.ptr + vslq->raw.offset; vslq->raw.c.cursor.rec.ptr = NULL; vslq->raw.trans.vxid = VSL_ID(vslq->raw.c.ptr); vslq->raw.offset += VSL_NEXT(vslq->raw.c.ptr) - vslq->raw.c.ptr; } while (VSL_TAG(vslq->raw.c.ptr) == SLT__Batch); if (func == NULL) return (i); if (vslq->query != NULL && !vslq_runquery(vslq->query, vslq->raw.ptrans)) return (i); r = (func)(vslq->vsl, vslq->raw.ptrans, priv); if (r) return (r); return (i); } /* Check the beginning of the shmref list, and buffer refs that are at * warning level. * * Returns: * 0: OK * -3: Failure */ static int vslq_shmref_check(struct VSLQ *vslq) { struct chunk *chunk; int i; while ((chunk = VTAILQ_FIRST(&vslq->shmrefs)) != NULL) { CHECK_OBJ_NOTNULL(chunk, CHUNK_MAGIC); assert(chunk->type == chunk_t_shm); i = VSL_Check(vslq->c, &chunk->shm.start); if (i == 2) /* First on list is OK, refs behind it must also be OK */ return (0); else if (i == 1) /* Warning level. Buffer this chunk */ chunk_shm_to_buf(vslq, chunk); else /* Too late to buffer */ return (-3); } return (0); } /* Process next input record */ static int vslq_next(struct VSLQ *vslq) { struct VSL_cursor *c; int i; enum VSL_tag_e tag; ssize_t len; unsigned vxid; struct vtx *vtx; c = vslq->c; i = VSL_Next(c); if (i != 1) return (i); tag = VSL_TAG(c->rec.ptr); if (tag == SLT__Batch) { vxid = VSL_BATCHID(c->rec.ptr); len = VSL_END(c->rec.ptr, VSL_BATCHLEN(c->rec.ptr)) - c->rec.ptr; if (len == 0) return (i); tag = VSL_TAG(VSL_NEXT(c->rec.ptr)); } else { vxid = VSL_ID(c->rec.ptr); len = VSL_NEXT(c->rec.ptr) - c->rec.ptr; } assert(len > 0); if (vxid == 0) /* Skip non-transactional records */ return (i); vtx = vtx_lookup(vslq, vxid); if (vtx == NULL && tag == SLT_Begin) { vtx = vtx_add(vslq, vxid); AN(vtx); } if (vtx != NULL) { vtx_append(vslq, vtx, &c->rec, len); vtx_scan(vslq, vtx); } return (i); } /* Test query and report any ready transactions */ static int vslq_process_ready(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv) { struct vtx *vtx; int i = 0; AN(vslq); while (!VTAILQ_EMPTY(&vslq->ready)) { vtx = VTAILQ_FIRST(&vslq->ready); CHECK_OBJ_NOTNULL(vtx, VTX_MAGIC); VTAILQ_REMOVE(&vslq->ready, vtx, list_vtx); AN(vtx->flags & VTX_F_READY); if (func != NULL) i = vslq_callback(vslq, vtx, func, priv); vtx_retire(vslq, &vtx); AZ(vtx); if (i) return (i); } return (0); } /* Process the input cursor, calling the callback function on matching transaction sets */ int VSLQ_Dispatch(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv) { int i, r; double now; struct vtx *vtx; CHECK_OBJ_NOTNULL(vslq, VSLQ_MAGIC); /* Check that we have a cursor */ if (vslq->c == NULL) return (-2); if (vslq->grouping == VSL_g_raw) return (vslq_raw(vslq, func, priv)); /* Process next cursor input */ i = vslq_next(vslq); if (i <= 0) /* At end of log or cursor reports error condition */ return (i); /* Check shmref list and buffer if necessary */ r = vslq_shmref_check(vslq); if (r) /* Buffering of shm ref failed */ return (r); /* Check vtx timeout */ now = VTIM_mono(); while (!VTAILQ_EMPTY(&vslq->incomplete)) { vtx = VTAILQ_FIRST(&vslq->incomplete); CHECK_OBJ_NOTNULL(vtx, VTX_MAGIC); if (now - vtx->t_start < vslq->vsl->T_opt) break; vtx_force(vslq, vtx, "timeout"); AN(vtx->flags & VTX_F_COMPLETE); } /* Check store limit */ while (vslq->n_outstanding > vslq->vsl->L_opt && !(VTAILQ_EMPTY(&vslq->incomplete))) { vtx = VTAILQ_FIRST(&vslq->incomplete); CHECK_OBJ_NOTNULL(vtx, VTX_MAGIC); vtx_force(vslq, vtx, "store overflow"); AN(vtx->flags & VTX_F_COMPLETE); r = vslq_process_ready(vslq, func, priv); if (r) /* User return code */ return (r); } /* Check ready list */ if (!VTAILQ_EMPTY(&vslq->ready)) { r = vslq_process_ready(vslq, func, priv); if (r) /* User return code */ return (r); } /* Return cursor return value */ return (i); } /* Flush any incomplete vtx held on to. Do callbacks if func != NULL */ int VSLQ_Flush(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv) { struct vtx *vtx; CHECK_OBJ_NOTNULL(vslq, VSLQ_MAGIC); while (!VTAILQ_EMPTY(&vslq->incomplete)) { vtx = VTAILQ_FIRST(&vslq->incomplete); CHECK_OBJ_NOTNULL(vtx, VTX_MAGIC); AZ(vtx->flags & VTX_F_COMPLETE); vtx_force(vslq, vtx, "flush"); } return (vslq_process_ready(vslq, func, priv)); } varnish-4.1.1/lib/libvarnishapi/libvarnishapi.map0000644000201500234410000000535612652366721017062 00000000000000/*- * Copyright (c) 2011-2015 Varnish Software AS * All rights reserved. * * Author: Tollef Fog Heen * * 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. */ LIBVARNISHAPI_1.0 { global: # Functions VSM_New; VSM_Diag; VSM_n_Arg; VSM_Name; VSM_Delete; VSM_Open; VSM_ReOpen; VSM_Seq; VSM_Head; VSM_Find_Chunk; VSM_Close; VSM_iter0; VSM_intern; VSC_Setup; VSC_Arg; VSC_Open; VSC_Main; VSC_Iter; VSL_Setup; VSL_Open; VSL_Arg; VSL_H_Print; VSL_Select; VSL_NonBlocking; VSL_Dispatch; VSL_NextLog; VSL_Matched; VCLI_WriteResult; VCLI_ReadResult; VCLI_AuthResponse; # Variables VSL_tags; local: *; }; LIBVARNISHAPI_1.1 { global: # Functions: VSL_Name2Tag; # Variables: } LIBVARNISHAPI_1.0; LIBVARNISHAPI_1.2 { global: # Functions: VSL_NextSLT; VSM_Error; VSM_Get; # Variables: } LIBVARNISHAPI_1.0; LIBVARNISHAPI_1.3 { global: # Functions: VSM_Abandoned; VSM_ResetError; VSM_StillValid; VSC_Mgt; VSC_LevelDesc; VSL_New; VSL_Delete; VSL_Error; VSL_ResetError; VSL_CursorVSM; VSL_CursorFile; VSL_DeleteCursor; VSL_Next; VSL_Match; VSL_Print; VSL_PrintTerse; VSL_PrintAll; VSL_PrintTransactions; VSL_WriteOpen; VSL_Write; VSL_WriteAll; VSL_WriteTransactions; VSLQ_New; VSLQ_Delete; VSLQ_Dispatch; VSLQ_Flush; VSLQ_Name2Grouping; VSL_Glob2Tags; VSL_List2Tags; VSM_N_Arg; VSL_Check; VSL_ResetCursor; # Variables: VSLQ_grouping; VSL_tagflags; } LIBVARNISHAPI_1.0; LIBVARNISHAPI_1.4 { global: VNUM; VSLQ_SetCursor; VSM_IsOpen; } LIBVARNISHAPI_1.0; varnish-4.1.1/lib/libvarnishapi/generate.py0000755000201500234410000001152712652366721015674 00000000000000#!/usr/bin/env python #- # Copyright (c) 2006 Verdens Gang AS # Copyright (c) 2006-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp # 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. # # Generate various .c and .h files for the VSL query expression parser # and the interfaces for it. import sys import copy srcroot = "../.." buildroot = "../.." if len(sys.argv) == 3: srcroot = sys.argv[1] buildroot = sys.argv[2] ####################################################################### # These are our tokens tokens = { # Numerical comparisons "T_EQ": "==", "T_NEQ": "!=", "T_LEQ": "<=", "T_GEQ": ">=", # String comparisons "T_SEQ": "eq", "T_SNEQ": "ne", # Regular expression matching "T_NOMATCH": "!~", # Boolean operators "T_AND": "and", "T_OR": "or", "T_NOT": "not", # Miscellaneous None: "<>~[]{}():,", # These have handwritten recognizers "VAL": None, "EOI": None, # Special "T_TRUE": None, } ####################################################################### # Emit a function to recognize tokens in a string def emit_vxp_fixed_token(fo, tokens): recog = list() emit = dict() for i in tokens: j = tokens[i] if (j != None): recog.append(j) emit[j] = i recog.sort() rrecog = copy.copy(recog) rrecog.sort(key = lambda x: -len(x)) fo.write(""" unsigned vxp_fixed_token(const char *p, const char **q) { \tswitch (p[0]) { """) last_initial = None for i in recog: if (i[0] == last_initial): continue last_initial = i[0] fo.write("\tcase '%s':\n" % last_initial) for j in rrecog: if (j[0] != last_initial): continue fo.write("\t\tif (") k = 1 l = len(j) while (k < l): fo.write("p[%d] == '%s'" % (k, j[k])) fo.write(" &&\n\t\t ") k += 1 fo.write("(isword(p[%d]) ? !isword(p[%d]) : 1)) {\n" % (l - 1, l)) fo.write("\t\t\t*q = p + %d;\n" % l) fo.write("\t\t\treturn (%s);\n" % emit[j]) fo.write("\t\t}\n"); fo.write("\t\treturn (0);\n") fo.write("\tdefault:\n\t\treturn (0);\n\t}\n}\n") ####################################################################### # Emit the vxp_tnames (token->string) conversion array def emit_vxp_tnames(fo, tokens): fo.write("\nconst char * const vxp_tnames[256] = {\n") l = list(tokens.keys()) l.sort() for i in l: j = tokens[i] if j == None: j = i if i[0] == "'": j = i fo.write("\t[%s] = \"%s\",\n" % (i, j)) fo.write("};\n") ####################################################################### def polish_tokens(tokens): # Expand single char tokens st = tokens[None] del tokens[None] for i in st: tokens["'" + i + "'"] = i ####################################################################### def file_header(fo): fo.write("""/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ """) ####################################################################### polish_tokens(tokens) fo = open(buildroot + "/lib/libvarnishapi/vxp_tokens.h", "w") file_header(fo) j = 128 l = list(tokens.keys()) l.sort() for i in l: if i[0] == "'": continue fo.write("#define\t%s %d\n" % (i, j)) j += 1 assert j < 256 fo.close() ####################################################################### fo = open(buildroot + "/lib/libvarnishapi/vxp_fixed_token.c", "w") file_header(fo) fo.write(""" #include "config.h" #include #include #include "vqueue.h" #include "vre.h" #include "vxp.h" """) emit_vxp_fixed_token(fo, tokens) emit_vxp_tnames(fo, tokens) fo.close() varnish-4.1.1/lib/libvarnishapi/vsl_query.c0000644000201500234410000001765712652366721015734 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 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. * */ #include #include #include #include #include #include #include #include "vdef.h" #include "vas.h" #include "miniobj.h" #include "vbm.h" #include "vnum.h" #include "vqueue.h" #include "vre.h" #include "vsb.h" #include "vapi/vsl.h" #include "vsl_api.h" #include "vxp.h" struct vslq_query { unsigned magic; #define VSLQ_QUERY_MAGIC 0x122322A5 struct vex *vex; }; #define VSLQ_TEST_NUMOP(TYPE, PRE_LHS, OP, PRE_RHS) \ switch (TYPE) { \ case VEX_INT: \ if (PRE_LHS##_int OP PRE_RHS##_int) \ return (1); \ return (0); \ case VEX_FLOAT: \ if (PRE_LHS##_float OP PRE_RHS##_float) \ return (1); \ return (0); \ default: \ WRONG("Wrong RHS type"); \ } static int vslq_test_rec(const struct vex *vex, const struct VSLC_ptr *rec) { const struct vex_rhs *rhs; long long lhs_int = 0; double lhs_float = 0.; const char *b, *e, *q; char *p; int i; AN(vex); AN(rec); b = VSL_CDATA(rec->ptr); e = b + VSL_LEN(rec->ptr) - 1; /* Prefix */ if (vex->lhs->prefix != NULL) { if (strncasecmp(b, vex->lhs->prefix, vex->lhs->prefixlen)) return (0); if (b[vex->lhs->prefixlen] != ':') return (0); b += vex->lhs->prefixlen + 1; /* Skip ws */ while (*b && isspace(*b)) b++; } /* Field */ if (vex->lhs->field > 0) { for (e = b, i = 0; *e && i < vex->lhs->field; i++) { b = e; /* Skip ws */ while (*b && isspace(*b)) b++; e = b; /* Skip non-ws */ while (*e && !isspace(*e)) e++; } assert(b <= e); if (*b == '\0' || i < vex->lhs->field) /* Missing field - no match */ return (0); } if (vex->tok == T_TRUE) /* Always true */ return (1); rhs = vex->rhs; CHECK_OBJ_NOTNULL(rhs, VEX_RHS_MAGIC); /* Prepare */ switch (vex->tok) { case T_EQ: /* == */ case T_NEQ: /* != */ case '<': case '>': case T_LEQ: /* <= */ case T_GEQ: /* >= */ /* Numerical comparison */ if (*b == '\0') /* Empty string doesn't match */ return (0); switch (rhs->type) { case VEX_INT: lhs_int = strtoll(b, &p, 0); if (*p == '\0' || isspace(*p)) break; /* Can't parse - no match */ return (0); case VEX_FLOAT: lhs_float = VNUMpfx(b, &q); if (isnan(lhs_float)) return (0); if (q != NULL && q > b && !isspace(q[-1])) return (0); break; default: WRONG("Wrong RHS type"); } break; default: break; } /* Compare */ switch (vex->tok) { case T_EQ: /* == */ VSLQ_TEST_NUMOP(rhs->type, lhs, ==, rhs->val); case T_NEQ: /* != */ VSLQ_TEST_NUMOP(rhs->type, lhs, !=, rhs->val); case '<': /* < */ VSLQ_TEST_NUMOP(rhs->type, lhs, <, rhs->val); case '>': VSLQ_TEST_NUMOP(rhs->type, lhs, >, rhs->val); case T_LEQ: /* <= */ VSLQ_TEST_NUMOP(rhs->type, lhs, <=, rhs->val); case T_GEQ: /* >= */ VSLQ_TEST_NUMOP(rhs->type, lhs, >=, rhs->val); case T_SEQ: /* eq */ assert(rhs->type == VEX_STRING); if (e - b != rhs->val_stringlen) return (0); if (vex->options & VEX_OPT_CASELESS) { if (strncasecmp(b, rhs->val_string, e - b)) return (0); } else { if (strncmp(b, rhs->val_string, e - b)) return (0); } return (1); case T_SNEQ: /* ne */ assert(rhs->type == VEX_STRING); if (e - b != rhs->val_stringlen) return (1); if (vex->options & VEX_OPT_CASELESS) { if (strncasecmp(b, rhs->val_string, e - b)) return (1); } else { if (strncmp(b, rhs->val_string, e - b)) return (1); } return (0); case '~': /* ~ */ assert(rhs->type == VEX_REGEX && rhs->val_regex != NULL); i = VRE_exec(rhs->val_regex, b, e - b, 0, 0, NULL, 0, NULL); if (i != VRE_ERROR_NOMATCH) return (1); return (0); case T_NOMATCH: /* !~ */ assert(rhs->type == VEX_REGEX && rhs->val_regex != NULL); i = VRE_exec(rhs->val_regex, b, e - b, 0, 0, NULL, 0, NULL); if (i == VRE_ERROR_NOMATCH) return (1); return (0); default: WRONG("Bad expression token"); } return (0); } static int vslq_test(const struct vex *vex, struct VSL_transaction * const ptrans[]) { struct VSL_transaction *t; int i; CHECK_OBJ_NOTNULL(vex, VEX_MAGIC); CHECK_OBJ_NOTNULL(vex->lhs, VEX_LHS_MAGIC); AN(vex->lhs->tags); for (t = ptrans[0]; t != NULL; t = *++ptrans) { if (vex->lhs->level >= 0) { if (vex->lhs->level_pm < 0) { /* OK if less than or equal */ if (t->level > vex->lhs->level) continue; } else if (vex->lhs->level_pm > 0) { /* OK if greater than or equal */ if (t->level < vex->lhs->level) continue; } else { /* OK if equal */ if (t->level != vex->lhs->level) continue; } } AZ(VSL_ResetCursor(t->c)); while (1) { i = VSL_Next(t->c); if (i < 0) return (i); if (i == 0) break; assert(i == 1); AN(t->c->rec.ptr); if (!vbit_test(vex->lhs->tags, VSL_TAG(t->c->rec.ptr))) continue; i = vslq_test_rec(vex, &t->c->rec); if (i) return (i); } } return (0); } static int vslq_exec(const struct vex *vex, struct VSL_transaction * const ptrans[]) { int r; CHECK_OBJ_NOTNULL(vex, VEX_MAGIC); switch (vex->tok) { case T_OR: AN(vex->a); AN(vex->b); r = vslq_exec(vex->a, ptrans); if (r != 0) return (r); return (vslq_exec(vex->b, ptrans)); case T_AND: AN(vex->a); AN(vex->b); r = vslq_exec(vex->a, ptrans); if (r <= 0) return (r); return (vslq_exec(vex->b, ptrans)); case T_NOT: AN(vex->a); AZ(vex->b); r = vslq_exec(vex->a, ptrans); if (r < 0) return (r); return (!r); default: return (vslq_test(vex, ptrans)); } NEEDLESS_RETURN(0); } struct vslq_query * vslq_newquery(struct VSL_data *vsl, enum VSL_grouping_e grouping, const char *querystring) { struct vsb *vsb; struct vex *vex; struct vslq_query *query = NULL; (void)grouping; AN(querystring); vsb = VSB_new_auto(); AN(vsb); vex = vex_New(querystring, vsb, vsl->C_opt ? VEX_OPT_CASELESS : 0); AZ(VSB_finish(vsb)); if (vex == NULL) vsl_diag(vsl, "%s", VSB_data(vsb)); else { ALLOC_OBJ(query, VSLQ_QUERY_MAGIC); XXXAN(query); query->vex = vex; } VSB_delete(vsb); return (query); } void vslq_deletequery(struct vslq_query **pquery) { struct vslq_query *query; AN(pquery); query = *pquery; *pquery = NULL; CHECK_OBJ_NOTNULL(query, VSLQ_QUERY_MAGIC); AN(query->vex); vex_Free(&query->vex); AZ(query->vex); FREE_OBJ(query); } int vslq_runquery(const struct vslq_query *query, struct VSL_transaction * const ptrans[]) { struct VSL_transaction *t; int r; CHECK_OBJ_NOTNULL(query, VSLQ_QUERY_MAGIC); r = vslq_exec(query->vex, ptrans); for (t = ptrans[0]; t != NULL; t = *++ptrans) AZ(VSL_ResetCursor(t->c)); return (r); } varnish-4.1.1/lib/libvarnishapi/vxp.h0000644000201500234410000000775612652366721014524 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 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. * */ #include "vxp_tokens.h" #define isword(c) (isalpha(c) || isdigit(c) || (c) == '_' || (c) == '-' || \ (c) == '+' || (c) == '.' || (c) == '*') #define PF(t) (int)((t)->e - (t)->b), (t)->b /* From vex_fixed_token.c */ unsigned vxp_fixed_token(const char *p, const char **q); extern const char * const vxp_tnames[256]; struct membit { VTAILQ_ENTRY(membit) list; void *ptr; }; struct token { unsigned tok; const char *b; const char *e; VTAILQ_ENTRY(token) list; unsigned cnt; char *dec; }; struct vxp { unsigned magic; #define VXP_MAGIC 0x59C7F6AC const char *src; const char *b; const char *e; VTAILQ_HEAD(, token) tokens; VTAILQ_HEAD(, membit) membits; struct token *t; unsigned vex_options; int vre_options; struct vsb *sb; int err; }; struct vex; struct vex_lhs { /* Left-hand-side of a vex expression. Stores the information about which records and what parts of those records the expression should be applied to */ unsigned magic; #define VEX_LHS_MAGIC 0x1AD3D78D struct vbitmap *tags; char *prefix; int prefixlen; int field; int level; int level_pm; }; enum vex_rhs_e { VEX__UNSET, VEX_INT, VEX_FLOAT, VEX_STRING, VEX_REGEX, }; struct vex_rhs { /* Right-hand-side of a vex expression. Stores the value that the records from LHS should be matched against */ unsigned magic; #define VEX_RHS_MAGIC 0x3F109965 enum vex_rhs_e type; long long val_int; double val_float; char *val_string; size_t val_stringlen; vre_t *val_regex; }; struct vex { unsigned magic; #define VEX_MAGIC 0xC7DB792D unsigned tok; unsigned options; struct vex *a, *b; struct vex_lhs *lhs; struct vex_rhs *rhs; }; /* VXP internals */ #define ERRCHK(tl) do { if ((tl)->err) return; } while (0) #define Expect(a, b) vxp__Expect(a, b) #define ExpectErr(a, b) \ do { vxp__Expect(a, b); ERRCHK(a); } while (0) #define SkipToken(a, b) \ do { vxp__Expect(a, b); ERRCHK(a); vxp_NextToken(a); } while (0) void vxp__Expect(struct vxp *vxp, unsigned tok); void vxp_ErrWhere(struct vxp *vxp, const struct token *t, int tokoff); void vxp_NextToken(struct vxp *vxp); void * vxp_Alloc(struct vxp *vxp, unsigned len); void vxp_Lexer(struct vxp *vxp); struct vex * vxp_Parse(struct vxp *vxp); /* API internal interface */ #define VEX_OPT_CASELESS (1 << 0) struct vex * vex_New(const char *query, struct vsb *sb, unsigned options); void vex_Free(struct vex **pvex); /* Debug routines */ #ifdef VXP_DEBUG void vxp_PrintTokens(const struct vxp *vxp); void vex_PrintTree(const struct vex *vex); #endif /* VXP_DEBUG */ varnish-4.1.1/lib/libvarnishapi/vsl2rst.c0000644000201500234410000000603412652366721015305 00000000000000/*- * Copyright (c) 2011-2015 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. * */ #include "config.h" #include #include #include #include #include "vapi/vsl.h" struct SLT { unsigned tag; unsigned flags; const char *name; const char *sdesc; const char *ldesc; }; static struct SLT tags[SLT__MAX] = { #define SLTM(name, flags, sdesc, ldesc) \ [SLT_##name] = { SLT_##name, flags, #name, sdesc, ldesc }, #include "tbl/vsl_tags.h" #undef SLTM }; static int ptag_cmp(const void *va, const void *vb) { const struct SLT *a, *b; a = *(const struct SLT * const *)va; b = *(const struct SLT * const *)vb; if (a->name == NULL && b->name != NULL) return (1); else if (a->name != NULL && b->name == NULL) return (-1); else if (a->name == NULL && b->name == NULL) return (0); return (strcmp(a->name, b->name)); } static void print_tabbed(const char *string, int tabs) { int i; const char *c; for (c = string; *c; c++) { if (c == string || *(c - 1) == '\n') for (i = 0; i < tabs; i++) printf("\t"); printf("%c", *c); } } int main(int argc, char *argv[]) { int i; struct SLT *ptags[SLT__MAX]; (void)argc; (void)argv; for (i = 0; i < SLT__MAX; i++) ptags[i] = &tags[i]; qsort(ptags, SLT__MAX, sizeof *ptags, ptag_cmp); for (i = 0; i < SLT__MAX; i++) { if (ptags[i]->name == NULL || !strcmp(ptags[i]->name, "")) continue; if (ptags[i]->flags & SLT_F_UNUSED) continue; printf("%s", ptags[i]->name); if (ptags[i]->sdesc != NULL && strcmp(ptags[i]->sdesc, "")) printf(" - %s", ptags[i]->sdesc); printf("\n"); if (ptags[i]->ldesc != NULL && strcmp(ptags[i]->ldesc, "")) { print_tabbed(ptags[i]->ldesc, 1); } printf("\n\n"); } return (0); } varnish-4.1.1/lib/libvarnishapi/Makefile.in0000644000201500234410000030570412652366727015603 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @HAVE_LD_VERSION_SCRIPT_TRUE@am__append_1 = -Wl,--version-script=$(srcdir)/libvarnishapi.map @HAVE_LD_VERSION_SCRIPT_FALSE@am__append_2 = -export-symbols-regex '^V' noinst_PROGRAMS = vsl2rst$(EXEEXT) EXTRA_PROGRAMS = vxp_test$(EXEEXT) vsl_glob_test$(EXEEXT) subdir = lib/libvarnishapi DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libvarnishapi_la_DEPENDENCIES = am_libvarnishapi_la_OBJECTS = libvarnishapi_la-vas.lo \ libvarnishapi_la-vav.lo libvarnishapi_la-version.lo \ libvarnishapi_la-cli_common.lo libvarnishapi_la-cli_auth.lo \ libvarnishapi_la-vin.lo libvarnishapi_la-vmb.lo \ libvarnishapi_la-vre.lo libvarnishapi_la-vsb.lo \ libvarnishapi_la-vtim.lo libvarnishapi_la-vnum.lo \ libvarnishapi_la-vsha256.lo libvarnishapi_la-vsm.lo \ libvarnishapi_la-vsl_arg.lo libvarnishapi_la-vsl_cursor.lo \ libvarnishapi_la-vsl_dispatch.lo libvarnishapi_la-vsl_query.lo \ libvarnishapi_la-vsl.lo libvarnishapi_la-vsc.lo \ libvarnishapi_la-vxp.lo libvarnishapi_la-vxp_parse.lo \ libvarnishapi_la-vxp_lexer.lo \ libvarnishapi_la-vxp_fixed_token.lo libvarnishapi_la_OBJECTS = $(am_libvarnishapi_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent libvarnishapi_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libvarnishapi_la_CFLAGS) $(CFLAGS) \ $(libvarnishapi_la_LDFLAGS) $(LDFLAGS) -o $@ PROGRAMS = $(noinst_PROGRAMS) am_vsl2rst_OBJECTS = vsl2rst.$(OBJEXT) vsl2rst_OBJECTS = $(am_vsl2rst_OBJECTS) vsl2rst_LDADD = $(LDADD) am_vsl_glob_test_OBJECTS = vsl_glob_test-vsl_glob_test.$(OBJEXT) vsl_glob_test_OBJECTS = $(am_vsl_glob_test_OBJECTS) am__DEPENDENCIES_1 = vsl_glob_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) libvarnishapi.la vsl_glob_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(vsl_glob_test_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am__objects_1 = vxp_test-vas.$(OBJEXT) vxp_test-vav.$(OBJEXT) \ vxp_test-version.$(OBJEXT) vxp_test-cli_common.$(OBJEXT) \ vxp_test-cli_auth.$(OBJEXT) vxp_test-vin.$(OBJEXT) \ vxp_test-vmb.$(OBJEXT) vxp_test-vre.$(OBJEXT) \ vxp_test-vsb.$(OBJEXT) vxp_test-vtim.$(OBJEXT) \ vxp_test-vnum.$(OBJEXT) vxp_test-vsha256.$(OBJEXT) \ vxp_test-vsm.$(OBJEXT) vxp_test-vsl_arg.$(OBJEXT) \ vxp_test-vsl_cursor.$(OBJEXT) vxp_test-vsl_dispatch.$(OBJEXT) \ vxp_test-vsl_query.$(OBJEXT) vxp_test-vsl.$(OBJEXT) \ vxp_test-vsc.$(OBJEXT) vxp_test-vxp.$(OBJEXT) \ vxp_test-vxp_parse.$(OBJEXT) vxp_test-vxp_lexer.$(OBJEXT) \ vxp_test-vxp_fixed_token.$(OBJEXT) am_vxp_test_OBJECTS = $(am__objects_1) vxp_test-vxp_test.$(OBJEXT) vxp_test_OBJECTS = $(am_vxp_test_OBJECTS) vxp_test_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) vxp_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(vxp_test_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libvarnishapi_la_SOURCES) $(vsl2rst_SOURCES) \ $(vsl_glob_test_SOURCES) $(vxp_test_SOURCES) DIST_SOURCES = $(libvarnishapi_la_SOURCES) $(vsl2rst_SOURCES) \ $(vsl_glob_test_SOURCES) $(vxp_test_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ AM_LDFLAGS = $(AM_LT_LDFLAGS) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ @PCRE_CFLAGS@ lib_LTLIBRARIES = libvarnishapi.la libvarnishapi_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:4:0 \ $(am__append_1) $(am__append_2) libvarnishapi_la_SOURCES = \ vsm_api.h \ vsl_api.h \ vxp.h \ vxp_tokens.h \ \ ../libvarnish/vas.c \ ../libvarnish/vav.c \ ../../include/vcs_version.h \ ../libvarnish/version.c \ ../libvarnish/cli_common.c \ ../libvarnish/cli_auth.c \ ../libvarnish/vin.c \ ../libvarnish/vmb.c \ ../libvarnish/vre.c \ ../libvarnish/vsb.c \ ../libvarnish/vtim.c \ ../libvarnish/vnum.c \ ../libvarnish/vsha256.c \ vsm.c \ vsl_arg.c \ vsl_cursor.c \ vsl_dispatch.c \ vsl_query.c \ vsl.c \ vsc.c \ vxp.c \ vxp_parse.c \ vxp_lexer.c \ vxp_fixed_token.c \ libvarnishapi.map libvarnishapi_la_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' libvarnishapi_la_LIBADD = @PCRE_LIBS@ @RT_LIBS@ EXTRA_DIST = \ generate.py \ vsl-tags.rst BUILT_SOURCES = \ vxp_fixed_token.c \ vxp_tokens.h \ vsl-tags.rst CLEANFILES = \ $(builddir)/vxp_fixed_token.c \ $(builddir)/vxp_tokens.h MAINTAINERCLEANFILES = \ vsl-tags.rst vsl2rst_SOURCES = \ vsl2rst.c \ $(top_srcdir)/include/tbl/vsl_tags.h \ $(top_srcdir)/include/tbl/vsl_tags_http.h vxp_test_LDADD = @PCRE_LIBS@ \ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS} vxp_test_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' \ -DVXP_DEBUG vxp_test_SOURCES = \ $(libvarnishapi_la_SOURCES) \ vxp_test.c vsl_glob_test_SOURCES = \ vsl_glob_test.c vsl_glob_test_LDADD = @PCRE_LIBS@ ${RT_LIBS} ${LIBM} libvarnishapi.la vsl_glob_test_CFLAGS = -I$(top_srcdir)/include all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/libvarnishapi/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/libvarnishapi/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libvarnishapi.la: $(libvarnishapi_la_OBJECTS) $(libvarnishapi_la_DEPENDENCIES) $(EXTRA_libvarnishapi_la_DEPENDENCIES) $(AM_V_CCLD)$(libvarnishapi_la_LINK) -rpath $(libdir) $(libvarnishapi_la_OBJECTS) $(libvarnishapi_la_LIBADD) $(LIBS) clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list vsl2rst$(EXEEXT): $(vsl2rst_OBJECTS) $(vsl2rst_DEPENDENCIES) $(EXTRA_vsl2rst_DEPENDENCIES) @rm -f vsl2rst$(EXEEXT) $(AM_V_CCLD)$(LINK) $(vsl2rst_OBJECTS) $(vsl2rst_LDADD) $(LIBS) vsl_glob_test$(EXEEXT): $(vsl_glob_test_OBJECTS) $(vsl_glob_test_DEPENDENCIES) $(EXTRA_vsl_glob_test_DEPENDENCIES) @rm -f vsl_glob_test$(EXEEXT) $(AM_V_CCLD)$(vsl_glob_test_LINK) $(vsl_glob_test_OBJECTS) $(vsl_glob_test_LDADD) $(LIBS) vxp_test$(EXEEXT): $(vxp_test_OBJECTS) $(vxp_test_DEPENDENCIES) $(EXTRA_vxp_test_DEPENDENCIES) @rm -f vxp_test$(EXEEXT) $(AM_V_CCLD)$(vxp_test_LINK) $(vxp_test_OBJECTS) $(vxp_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-cli_auth.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-cli_common.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vas.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vav.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-version.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vmb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vnum.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vre.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vsb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vsc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vsha256.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vsl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vsl_arg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vsl_cursor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vsl_dispatch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vsl_query.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vsm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vtim.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vxp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vxp_fixed_token.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vxp_lexer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-vxp_parse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsl2rst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsl_glob_test-vsl_glob_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-cli_auth.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-cli_common.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vas.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vav.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vmb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vnum.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vre.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vsb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vsc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vsha256.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vsl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vsl_arg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vsl_cursor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vsl_dispatch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vsl_query.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vsm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vtim.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vxp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vxp_fixed_token.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vxp_lexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vxp_parse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vxp_test-vxp_test.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< libvarnishapi_la-vas.lo: ../libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vas.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vas.Tpo -c -o libvarnishapi_la-vas.lo `test -f '../libvarnish/vas.c' || echo '$(srcdir)/'`../libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vas.Tpo $(DEPDIR)/libvarnishapi_la-vas.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vas.c' object='libvarnishapi_la-vas.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vas.lo `test -f '../libvarnish/vas.c' || echo '$(srcdir)/'`../libvarnish/vas.c libvarnishapi_la-vav.lo: ../libvarnish/vav.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vav.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vav.Tpo -c -o libvarnishapi_la-vav.lo `test -f '../libvarnish/vav.c' || echo '$(srcdir)/'`../libvarnish/vav.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vav.Tpo $(DEPDIR)/libvarnishapi_la-vav.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vav.c' object='libvarnishapi_la-vav.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vav.lo `test -f '../libvarnish/vav.c' || echo '$(srcdir)/'`../libvarnish/vav.c libvarnishapi_la-version.lo: ../libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-version.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-version.Tpo -c -o libvarnishapi_la-version.lo `test -f '../libvarnish/version.c' || echo '$(srcdir)/'`../libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-version.Tpo $(DEPDIR)/libvarnishapi_la-version.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/version.c' object='libvarnishapi_la-version.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-version.lo `test -f '../libvarnish/version.c' || echo '$(srcdir)/'`../libvarnish/version.c libvarnishapi_la-cli_common.lo: ../libvarnish/cli_common.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-cli_common.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-cli_common.Tpo -c -o libvarnishapi_la-cli_common.lo `test -f '../libvarnish/cli_common.c' || echo '$(srcdir)/'`../libvarnish/cli_common.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-cli_common.Tpo $(DEPDIR)/libvarnishapi_la-cli_common.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/cli_common.c' object='libvarnishapi_la-cli_common.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-cli_common.lo `test -f '../libvarnish/cli_common.c' || echo '$(srcdir)/'`../libvarnish/cli_common.c libvarnishapi_la-cli_auth.lo: ../libvarnish/cli_auth.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-cli_auth.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-cli_auth.Tpo -c -o libvarnishapi_la-cli_auth.lo `test -f '../libvarnish/cli_auth.c' || echo '$(srcdir)/'`../libvarnish/cli_auth.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-cli_auth.Tpo $(DEPDIR)/libvarnishapi_la-cli_auth.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/cli_auth.c' object='libvarnishapi_la-cli_auth.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-cli_auth.lo `test -f '../libvarnish/cli_auth.c' || echo '$(srcdir)/'`../libvarnish/cli_auth.c libvarnishapi_la-vin.lo: ../libvarnish/vin.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vin.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vin.Tpo -c -o libvarnishapi_la-vin.lo `test -f '../libvarnish/vin.c' || echo '$(srcdir)/'`../libvarnish/vin.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vin.Tpo $(DEPDIR)/libvarnishapi_la-vin.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vin.c' object='libvarnishapi_la-vin.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vin.lo `test -f '../libvarnish/vin.c' || echo '$(srcdir)/'`../libvarnish/vin.c libvarnishapi_la-vmb.lo: ../libvarnish/vmb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vmb.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vmb.Tpo -c -o libvarnishapi_la-vmb.lo `test -f '../libvarnish/vmb.c' || echo '$(srcdir)/'`../libvarnish/vmb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vmb.Tpo $(DEPDIR)/libvarnishapi_la-vmb.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vmb.c' object='libvarnishapi_la-vmb.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vmb.lo `test -f '../libvarnish/vmb.c' || echo '$(srcdir)/'`../libvarnish/vmb.c libvarnishapi_la-vre.lo: ../libvarnish/vre.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vre.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vre.Tpo -c -o libvarnishapi_la-vre.lo `test -f '../libvarnish/vre.c' || echo '$(srcdir)/'`../libvarnish/vre.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vre.Tpo $(DEPDIR)/libvarnishapi_la-vre.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vre.c' object='libvarnishapi_la-vre.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vre.lo `test -f '../libvarnish/vre.c' || echo '$(srcdir)/'`../libvarnish/vre.c libvarnishapi_la-vsb.lo: ../libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vsb.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vsb.Tpo -c -o libvarnishapi_la-vsb.lo `test -f '../libvarnish/vsb.c' || echo '$(srcdir)/'`../libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vsb.Tpo $(DEPDIR)/libvarnishapi_la-vsb.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vsb.c' object='libvarnishapi_la-vsb.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vsb.lo `test -f '../libvarnish/vsb.c' || echo '$(srcdir)/'`../libvarnish/vsb.c libvarnishapi_la-vtim.lo: ../libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vtim.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vtim.Tpo -c -o libvarnishapi_la-vtim.lo `test -f '../libvarnish/vtim.c' || echo '$(srcdir)/'`../libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vtim.Tpo $(DEPDIR)/libvarnishapi_la-vtim.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vtim.c' object='libvarnishapi_la-vtim.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vtim.lo `test -f '../libvarnish/vtim.c' || echo '$(srcdir)/'`../libvarnish/vtim.c libvarnishapi_la-vnum.lo: ../libvarnish/vnum.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vnum.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vnum.Tpo -c -o libvarnishapi_la-vnum.lo `test -f '../libvarnish/vnum.c' || echo '$(srcdir)/'`../libvarnish/vnum.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vnum.Tpo $(DEPDIR)/libvarnishapi_la-vnum.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vnum.c' object='libvarnishapi_la-vnum.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vnum.lo `test -f '../libvarnish/vnum.c' || echo '$(srcdir)/'`../libvarnish/vnum.c libvarnishapi_la-vsha256.lo: ../libvarnish/vsha256.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vsha256.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vsha256.Tpo -c -o libvarnishapi_la-vsha256.lo `test -f '../libvarnish/vsha256.c' || echo '$(srcdir)/'`../libvarnish/vsha256.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vsha256.Tpo $(DEPDIR)/libvarnishapi_la-vsha256.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vsha256.c' object='libvarnishapi_la-vsha256.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vsha256.lo `test -f '../libvarnish/vsha256.c' || echo '$(srcdir)/'`../libvarnish/vsha256.c libvarnishapi_la-vsm.lo: vsm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vsm.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vsm.Tpo -c -o libvarnishapi_la-vsm.lo `test -f 'vsm.c' || echo '$(srcdir)/'`vsm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vsm.Tpo $(DEPDIR)/libvarnishapi_la-vsm.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsm.c' object='libvarnishapi_la-vsm.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vsm.lo `test -f 'vsm.c' || echo '$(srcdir)/'`vsm.c libvarnishapi_la-vsl_arg.lo: vsl_arg.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vsl_arg.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vsl_arg.Tpo -c -o libvarnishapi_la-vsl_arg.lo `test -f 'vsl_arg.c' || echo '$(srcdir)/'`vsl_arg.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vsl_arg.Tpo $(DEPDIR)/libvarnishapi_la-vsl_arg.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_arg.c' object='libvarnishapi_la-vsl_arg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vsl_arg.lo `test -f 'vsl_arg.c' || echo '$(srcdir)/'`vsl_arg.c libvarnishapi_la-vsl_cursor.lo: vsl_cursor.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vsl_cursor.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vsl_cursor.Tpo -c -o libvarnishapi_la-vsl_cursor.lo `test -f 'vsl_cursor.c' || echo '$(srcdir)/'`vsl_cursor.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vsl_cursor.Tpo $(DEPDIR)/libvarnishapi_la-vsl_cursor.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_cursor.c' object='libvarnishapi_la-vsl_cursor.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vsl_cursor.lo `test -f 'vsl_cursor.c' || echo '$(srcdir)/'`vsl_cursor.c libvarnishapi_la-vsl_dispatch.lo: vsl_dispatch.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vsl_dispatch.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vsl_dispatch.Tpo -c -o libvarnishapi_la-vsl_dispatch.lo `test -f 'vsl_dispatch.c' || echo '$(srcdir)/'`vsl_dispatch.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vsl_dispatch.Tpo $(DEPDIR)/libvarnishapi_la-vsl_dispatch.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_dispatch.c' object='libvarnishapi_la-vsl_dispatch.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vsl_dispatch.lo `test -f 'vsl_dispatch.c' || echo '$(srcdir)/'`vsl_dispatch.c libvarnishapi_la-vsl_query.lo: vsl_query.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vsl_query.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vsl_query.Tpo -c -o libvarnishapi_la-vsl_query.lo `test -f 'vsl_query.c' || echo '$(srcdir)/'`vsl_query.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vsl_query.Tpo $(DEPDIR)/libvarnishapi_la-vsl_query.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_query.c' object='libvarnishapi_la-vsl_query.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vsl_query.lo `test -f 'vsl_query.c' || echo '$(srcdir)/'`vsl_query.c libvarnishapi_la-vsl.lo: vsl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vsl.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vsl.Tpo -c -o libvarnishapi_la-vsl.lo `test -f 'vsl.c' || echo '$(srcdir)/'`vsl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vsl.Tpo $(DEPDIR)/libvarnishapi_la-vsl.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl.c' object='libvarnishapi_la-vsl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vsl.lo `test -f 'vsl.c' || echo '$(srcdir)/'`vsl.c libvarnishapi_la-vsc.lo: vsc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vsc.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vsc.Tpo -c -o libvarnishapi_la-vsc.lo `test -f 'vsc.c' || echo '$(srcdir)/'`vsc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vsc.Tpo $(DEPDIR)/libvarnishapi_la-vsc.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsc.c' object='libvarnishapi_la-vsc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vsc.lo `test -f 'vsc.c' || echo '$(srcdir)/'`vsc.c libvarnishapi_la-vxp.lo: vxp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vxp.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vxp.Tpo -c -o libvarnishapi_la-vxp.lo `test -f 'vxp.c' || echo '$(srcdir)/'`vxp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vxp.Tpo $(DEPDIR)/libvarnishapi_la-vxp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp.c' object='libvarnishapi_la-vxp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vxp.lo `test -f 'vxp.c' || echo '$(srcdir)/'`vxp.c libvarnishapi_la-vxp_parse.lo: vxp_parse.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vxp_parse.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vxp_parse.Tpo -c -o libvarnishapi_la-vxp_parse.lo `test -f 'vxp_parse.c' || echo '$(srcdir)/'`vxp_parse.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vxp_parse.Tpo $(DEPDIR)/libvarnishapi_la-vxp_parse.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp_parse.c' object='libvarnishapi_la-vxp_parse.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vxp_parse.lo `test -f 'vxp_parse.c' || echo '$(srcdir)/'`vxp_parse.c libvarnishapi_la-vxp_lexer.lo: vxp_lexer.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vxp_lexer.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vxp_lexer.Tpo -c -o libvarnishapi_la-vxp_lexer.lo `test -f 'vxp_lexer.c' || echo '$(srcdir)/'`vxp_lexer.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vxp_lexer.Tpo $(DEPDIR)/libvarnishapi_la-vxp_lexer.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp_lexer.c' object='libvarnishapi_la-vxp_lexer.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vxp_lexer.lo `test -f 'vxp_lexer.c' || echo '$(srcdir)/'`vxp_lexer.c libvarnishapi_la-vxp_fixed_token.lo: vxp_fixed_token.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -MT libvarnishapi_la-vxp_fixed_token.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-vxp_fixed_token.Tpo -c -o libvarnishapi_la-vxp_fixed_token.lo `test -f 'vxp_fixed_token.c' || echo '$(srcdir)/'`vxp_fixed_token.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-vxp_fixed_token.Tpo $(DEPDIR)/libvarnishapi_la-vxp_fixed_token.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp_fixed_token.c' object='libvarnishapi_la-vxp_fixed_token.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnishapi_la_CFLAGS) $(CFLAGS) -c -o libvarnishapi_la-vxp_fixed_token.lo `test -f 'vxp_fixed_token.c' || echo '$(srcdir)/'`vxp_fixed_token.c vsl_glob_test-vsl_glob_test.o: vsl_glob_test.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vsl_glob_test_CFLAGS) $(CFLAGS) -MT vsl_glob_test-vsl_glob_test.o -MD -MP -MF $(DEPDIR)/vsl_glob_test-vsl_glob_test.Tpo -c -o vsl_glob_test-vsl_glob_test.o `test -f 'vsl_glob_test.c' || echo '$(srcdir)/'`vsl_glob_test.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vsl_glob_test-vsl_glob_test.Tpo $(DEPDIR)/vsl_glob_test-vsl_glob_test.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_glob_test.c' object='vsl_glob_test-vsl_glob_test.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vsl_glob_test_CFLAGS) $(CFLAGS) -c -o vsl_glob_test-vsl_glob_test.o `test -f 'vsl_glob_test.c' || echo '$(srcdir)/'`vsl_glob_test.c vsl_glob_test-vsl_glob_test.obj: vsl_glob_test.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vsl_glob_test_CFLAGS) $(CFLAGS) -MT vsl_glob_test-vsl_glob_test.obj -MD -MP -MF $(DEPDIR)/vsl_glob_test-vsl_glob_test.Tpo -c -o vsl_glob_test-vsl_glob_test.obj `if test -f 'vsl_glob_test.c'; then $(CYGPATH_W) 'vsl_glob_test.c'; else $(CYGPATH_W) '$(srcdir)/vsl_glob_test.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vsl_glob_test-vsl_glob_test.Tpo $(DEPDIR)/vsl_glob_test-vsl_glob_test.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_glob_test.c' object='vsl_glob_test-vsl_glob_test.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vsl_glob_test_CFLAGS) $(CFLAGS) -c -o vsl_glob_test-vsl_glob_test.obj `if test -f 'vsl_glob_test.c'; then $(CYGPATH_W) 'vsl_glob_test.c'; else $(CYGPATH_W) '$(srcdir)/vsl_glob_test.c'; fi` vxp_test-vas.o: ../libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vas.o -MD -MP -MF $(DEPDIR)/vxp_test-vas.Tpo -c -o vxp_test-vas.o `test -f '../libvarnish/vas.c' || echo '$(srcdir)/'`../libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vas.Tpo $(DEPDIR)/vxp_test-vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vas.c' object='vxp_test-vas.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vas.o `test -f '../libvarnish/vas.c' || echo '$(srcdir)/'`../libvarnish/vas.c vxp_test-vas.obj: ../libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vas.obj -MD -MP -MF $(DEPDIR)/vxp_test-vas.Tpo -c -o vxp_test-vas.obj `if test -f '../libvarnish/vas.c'; then $(CYGPATH_W) '../libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vas.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vas.Tpo $(DEPDIR)/vxp_test-vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vas.c' object='vxp_test-vas.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vas.obj `if test -f '../libvarnish/vas.c'; then $(CYGPATH_W) '../libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vas.c'; fi` vxp_test-vav.o: ../libvarnish/vav.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vav.o -MD -MP -MF $(DEPDIR)/vxp_test-vav.Tpo -c -o vxp_test-vav.o `test -f '../libvarnish/vav.c' || echo '$(srcdir)/'`../libvarnish/vav.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vav.Tpo $(DEPDIR)/vxp_test-vav.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vav.c' object='vxp_test-vav.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vav.o `test -f '../libvarnish/vav.c' || echo '$(srcdir)/'`../libvarnish/vav.c vxp_test-vav.obj: ../libvarnish/vav.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vav.obj -MD -MP -MF $(DEPDIR)/vxp_test-vav.Tpo -c -o vxp_test-vav.obj `if test -f '../libvarnish/vav.c'; then $(CYGPATH_W) '../libvarnish/vav.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vav.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vav.Tpo $(DEPDIR)/vxp_test-vav.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vav.c' object='vxp_test-vav.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vav.obj `if test -f '../libvarnish/vav.c'; then $(CYGPATH_W) '../libvarnish/vav.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vav.c'; fi` vxp_test-version.o: ../libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-version.o -MD -MP -MF $(DEPDIR)/vxp_test-version.Tpo -c -o vxp_test-version.o `test -f '../libvarnish/version.c' || echo '$(srcdir)/'`../libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-version.Tpo $(DEPDIR)/vxp_test-version.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/version.c' object='vxp_test-version.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-version.o `test -f '../libvarnish/version.c' || echo '$(srcdir)/'`../libvarnish/version.c vxp_test-version.obj: ../libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-version.obj -MD -MP -MF $(DEPDIR)/vxp_test-version.Tpo -c -o vxp_test-version.obj `if test -f '../libvarnish/version.c'; then $(CYGPATH_W) '../libvarnish/version.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/version.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-version.Tpo $(DEPDIR)/vxp_test-version.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/version.c' object='vxp_test-version.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-version.obj `if test -f '../libvarnish/version.c'; then $(CYGPATH_W) '../libvarnish/version.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/version.c'; fi` vxp_test-cli_common.o: ../libvarnish/cli_common.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-cli_common.o -MD -MP -MF $(DEPDIR)/vxp_test-cli_common.Tpo -c -o vxp_test-cli_common.o `test -f '../libvarnish/cli_common.c' || echo '$(srcdir)/'`../libvarnish/cli_common.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-cli_common.Tpo $(DEPDIR)/vxp_test-cli_common.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/cli_common.c' object='vxp_test-cli_common.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-cli_common.o `test -f '../libvarnish/cli_common.c' || echo '$(srcdir)/'`../libvarnish/cli_common.c vxp_test-cli_common.obj: ../libvarnish/cli_common.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-cli_common.obj -MD -MP -MF $(DEPDIR)/vxp_test-cli_common.Tpo -c -o vxp_test-cli_common.obj `if test -f '../libvarnish/cli_common.c'; then $(CYGPATH_W) '../libvarnish/cli_common.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/cli_common.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-cli_common.Tpo $(DEPDIR)/vxp_test-cli_common.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/cli_common.c' object='vxp_test-cli_common.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-cli_common.obj `if test -f '../libvarnish/cli_common.c'; then $(CYGPATH_W) '../libvarnish/cli_common.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/cli_common.c'; fi` vxp_test-cli_auth.o: ../libvarnish/cli_auth.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-cli_auth.o -MD -MP -MF $(DEPDIR)/vxp_test-cli_auth.Tpo -c -o vxp_test-cli_auth.o `test -f '../libvarnish/cli_auth.c' || echo '$(srcdir)/'`../libvarnish/cli_auth.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-cli_auth.Tpo $(DEPDIR)/vxp_test-cli_auth.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/cli_auth.c' object='vxp_test-cli_auth.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-cli_auth.o `test -f '../libvarnish/cli_auth.c' || echo '$(srcdir)/'`../libvarnish/cli_auth.c vxp_test-cli_auth.obj: ../libvarnish/cli_auth.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-cli_auth.obj -MD -MP -MF $(DEPDIR)/vxp_test-cli_auth.Tpo -c -o vxp_test-cli_auth.obj `if test -f '../libvarnish/cli_auth.c'; then $(CYGPATH_W) '../libvarnish/cli_auth.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/cli_auth.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-cli_auth.Tpo $(DEPDIR)/vxp_test-cli_auth.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/cli_auth.c' object='vxp_test-cli_auth.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-cli_auth.obj `if test -f '../libvarnish/cli_auth.c'; then $(CYGPATH_W) '../libvarnish/cli_auth.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/cli_auth.c'; fi` vxp_test-vin.o: ../libvarnish/vin.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vin.o -MD -MP -MF $(DEPDIR)/vxp_test-vin.Tpo -c -o vxp_test-vin.o `test -f '../libvarnish/vin.c' || echo '$(srcdir)/'`../libvarnish/vin.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vin.Tpo $(DEPDIR)/vxp_test-vin.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vin.c' object='vxp_test-vin.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vin.o `test -f '../libvarnish/vin.c' || echo '$(srcdir)/'`../libvarnish/vin.c vxp_test-vin.obj: ../libvarnish/vin.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vin.obj -MD -MP -MF $(DEPDIR)/vxp_test-vin.Tpo -c -o vxp_test-vin.obj `if test -f '../libvarnish/vin.c'; then $(CYGPATH_W) '../libvarnish/vin.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vin.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vin.Tpo $(DEPDIR)/vxp_test-vin.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vin.c' object='vxp_test-vin.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vin.obj `if test -f '../libvarnish/vin.c'; then $(CYGPATH_W) '../libvarnish/vin.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vin.c'; fi` vxp_test-vmb.o: ../libvarnish/vmb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vmb.o -MD -MP -MF $(DEPDIR)/vxp_test-vmb.Tpo -c -o vxp_test-vmb.o `test -f '../libvarnish/vmb.c' || echo '$(srcdir)/'`../libvarnish/vmb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vmb.Tpo $(DEPDIR)/vxp_test-vmb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vmb.c' object='vxp_test-vmb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vmb.o `test -f '../libvarnish/vmb.c' || echo '$(srcdir)/'`../libvarnish/vmb.c vxp_test-vmb.obj: ../libvarnish/vmb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vmb.obj -MD -MP -MF $(DEPDIR)/vxp_test-vmb.Tpo -c -o vxp_test-vmb.obj `if test -f '../libvarnish/vmb.c'; then $(CYGPATH_W) '../libvarnish/vmb.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vmb.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vmb.Tpo $(DEPDIR)/vxp_test-vmb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vmb.c' object='vxp_test-vmb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vmb.obj `if test -f '../libvarnish/vmb.c'; then $(CYGPATH_W) '../libvarnish/vmb.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vmb.c'; fi` vxp_test-vre.o: ../libvarnish/vre.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vre.o -MD -MP -MF $(DEPDIR)/vxp_test-vre.Tpo -c -o vxp_test-vre.o `test -f '../libvarnish/vre.c' || echo '$(srcdir)/'`../libvarnish/vre.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vre.Tpo $(DEPDIR)/vxp_test-vre.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vre.c' object='vxp_test-vre.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vre.o `test -f '../libvarnish/vre.c' || echo '$(srcdir)/'`../libvarnish/vre.c vxp_test-vre.obj: ../libvarnish/vre.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vre.obj -MD -MP -MF $(DEPDIR)/vxp_test-vre.Tpo -c -o vxp_test-vre.obj `if test -f '../libvarnish/vre.c'; then $(CYGPATH_W) '../libvarnish/vre.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vre.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vre.Tpo $(DEPDIR)/vxp_test-vre.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vre.c' object='vxp_test-vre.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vre.obj `if test -f '../libvarnish/vre.c'; then $(CYGPATH_W) '../libvarnish/vre.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vre.c'; fi` vxp_test-vsb.o: ../libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsb.o -MD -MP -MF $(DEPDIR)/vxp_test-vsb.Tpo -c -o vxp_test-vsb.o `test -f '../libvarnish/vsb.c' || echo '$(srcdir)/'`../libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsb.Tpo $(DEPDIR)/vxp_test-vsb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vsb.c' object='vxp_test-vsb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsb.o `test -f '../libvarnish/vsb.c' || echo '$(srcdir)/'`../libvarnish/vsb.c vxp_test-vsb.obj: ../libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsb.obj -MD -MP -MF $(DEPDIR)/vxp_test-vsb.Tpo -c -o vxp_test-vsb.obj `if test -f '../libvarnish/vsb.c'; then $(CYGPATH_W) '../libvarnish/vsb.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vsb.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsb.Tpo $(DEPDIR)/vxp_test-vsb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vsb.c' object='vxp_test-vsb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsb.obj `if test -f '../libvarnish/vsb.c'; then $(CYGPATH_W) '../libvarnish/vsb.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vsb.c'; fi` vxp_test-vtim.o: ../libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vtim.o -MD -MP -MF $(DEPDIR)/vxp_test-vtim.Tpo -c -o vxp_test-vtim.o `test -f '../libvarnish/vtim.c' || echo '$(srcdir)/'`../libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vtim.Tpo $(DEPDIR)/vxp_test-vtim.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vtim.c' object='vxp_test-vtim.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vtim.o `test -f '../libvarnish/vtim.c' || echo '$(srcdir)/'`../libvarnish/vtim.c vxp_test-vtim.obj: ../libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vtim.obj -MD -MP -MF $(DEPDIR)/vxp_test-vtim.Tpo -c -o vxp_test-vtim.obj `if test -f '../libvarnish/vtim.c'; then $(CYGPATH_W) '../libvarnish/vtim.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vtim.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vtim.Tpo $(DEPDIR)/vxp_test-vtim.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vtim.c' object='vxp_test-vtim.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vtim.obj `if test -f '../libvarnish/vtim.c'; then $(CYGPATH_W) '../libvarnish/vtim.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vtim.c'; fi` vxp_test-vnum.o: ../libvarnish/vnum.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vnum.o -MD -MP -MF $(DEPDIR)/vxp_test-vnum.Tpo -c -o vxp_test-vnum.o `test -f '../libvarnish/vnum.c' || echo '$(srcdir)/'`../libvarnish/vnum.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vnum.Tpo $(DEPDIR)/vxp_test-vnum.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vnum.c' object='vxp_test-vnum.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vnum.o `test -f '../libvarnish/vnum.c' || echo '$(srcdir)/'`../libvarnish/vnum.c vxp_test-vnum.obj: ../libvarnish/vnum.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vnum.obj -MD -MP -MF $(DEPDIR)/vxp_test-vnum.Tpo -c -o vxp_test-vnum.obj `if test -f '../libvarnish/vnum.c'; then $(CYGPATH_W) '../libvarnish/vnum.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vnum.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vnum.Tpo $(DEPDIR)/vxp_test-vnum.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vnum.c' object='vxp_test-vnum.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vnum.obj `if test -f '../libvarnish/vnum.c'; then $(CYGPATH_W) '../libvarnish/vnum.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vnum.c'; fi` vxp_test-vsha256.o: ../libvarnish/vsha256.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsha256.o -MD -MP -MF $(DEPDIR)/vxp_test-vsha256.Tpo -c -o vxp_test-vsha256.o `test -f '../libvarnish/vsha256.c' || echo '$(srcdir)/'`../libvarnish/vsha256.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsha256.Tpo $(DEPDIR)/vxp_test-vsha256.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vsha256.c' object='vxp_test-vsha256.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsha256.o `test -f '../libvarnish/vsha256.c' || echo '$(srcdir)/'`../libvarnish/vsha256.c vxp_test-vsha256.obj: ../libvarnish/vsha256.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsha256.obj -MD -MP -MF $(DEPDIR)/vxp_test-vsha256.Tpo -c -o vxp_test-vsha256.obj `if test -f '../libvarnish/vsha256.c'; then $(CYGPATH_W) '../libvarnish/vsha256.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vsha256.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsha256.Tpo $(DEPDIR)/vxp_test-vsha256.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/vsha256.c' object='vxp_test-vsha256.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsha256.obj `if test -f '../libvarnish/vsha256.c'; then $(CYGPATH_W) '../libvarnish/vsha256.c'; else $(CYGPATH_W) '$(srcdir)/../libvarnish/vsha256.c'; fi` vxp_test-vsm.o: vsm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsm.o -MD -MP -MF $(DEPDIR)/vxp_test-vsm.Tpo -c -o vxp_test-vsm.o `test -f 'vsm.c' || echo '$(srcdir)/'`vsm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsm.Tpo $(DEPDIR)/vxp_test-vsm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsm.c' object='vxp_test-vsm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsm.o `test -f 'vsm.c' || echo '$(srcdir)/'`vsm.c vxp_test-vsm.obj: vsm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsm.obj -MD -MP -MF $(DEPDIR)/vxp_test-vsm.Tpo -c -o vxp_test-vsm.obj `if test -f 'vsm.c'; then $(CYGPATH_W) 'vsm.c'; else $(CYGPATH_W) '$(srcdir)/vsm.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsm.Tpo $(DEPDIR)/vxp_test-vsm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsm.c' object='vxp_test-vsm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsm.obj `if test -f 'vsm.c'; then $(CYGPATH_W) 'vsm.c'; else $(CYGPATH_W) '$(srcdir)/vsm.c'; fi` vxp_test-vsl_arg.o: vsl_arg.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsl_arg.o -MD -MP -MF $(DEPDIR)/vxp_test-vsl_arg.Tpo -c -o vxp_test-vsl_arg.o `test -f 'vsl_arg.c' || echo '$(srcdir)/'`vsl_arg.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsl_arg.Tpo $(DEPDIR)/vxp_test-vsl_arg.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_arg.c' object='vxp_test-vsl_arg.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsl_arg.o `test -f 'vsl_arg.c' || echo '$(srcdir)/'`vsl_arg.c vxp_test-vsl_arg.obj: vsl_arg.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsl_arg.obj -MD -MP -MF $(DEPDIR)/vxp_test-vsl_arg.Tpo -c -o vxp_test-vsl_arg.obj `if test -f 'vsl_arg.c'; then $(CYGPATH_W) 'vsl_arg.c'; else $(CYGPATH_W) '$(srcdir)/vsl_arg.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsl_arg.Tpo $(DEPDIR)/vxp_test-vsl_arg.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_arg.c' object='vxp_test-vsl_arg.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsl_arg.obj `if test -f 'vsl_arg.c'; then $(CYGPATH_W) 'vsl_arg.c'; else $(CYGPATH_W) '$(srcdir)/vsl_arg.c'; fi` vxp_test-vsl_cursor.o: vsl_cursor.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsl_cursor.o -MD -MP -MF $(DEPDIR)/vxp_test-vsl_cursor.Tpo -c -o vxp_test-vsl_cursor.o `test -f 'vsl_cursor.c' || echo '$(srcdir)/'`vsl_cursor.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsl_cursor.Tpo $(DEPDIR)/vxp_test-vsl_cursor.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_cursor.c' object='vxp_test-vsl_cursor.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsl_cursor.o `test -f 'vsl_cursor.c' || echo '$(srcdir)/'`vsl_cursor.c vxp_test-vsl_cursor.obj: vsl_cursor.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsl_cursor.obj -MD -MP -MF $(DEPDIR)/vxp_test-vsl_cursor.Tpo -c -o vxp_test-vsl_cursor.obj `if test -f 'vsl_cursor.c'; then $(CYGPATH_W) 'vsl_cursor.c'; else $(CYGPATH_W) '$(srcdir)/vsl_cursor.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsl_cursor.Tpo $(DEPDIR)/vxp_test-vsl_cursor.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_cursor.c' object='vxp_test-vsl_cursor.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsl_cursor.obj `if test -f 'vsl_cursor.c'; then $(CYGPATH_W) 'vsl_cursor.c'; else $(CYGPATH_W) '$(srcdir)/vsl_cursor.c'; fi` vxp_test-vsl_dispatch.o: vsl_dispatch.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsl_dispatch.o -MD -MP -MF $(DEPDIR)/vxp_test-vsl_dispatch.Tpo -c -o vxp_test-vsl_dispatch.o `test -f 'vsl_dispatch.c' || echo '$(srcdir)/'`vsl_dispatch.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsl_dispatch.Tpo $(DEPDIR)/vxp_test-vsl_dispatch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_dispatch.c' object='vxp_test-vsl_dispatch.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsl_dispatch.o `test -f 'vsl_dispatch.c' || echo '$(srcdir)/'`vsl_dispatch.c vxp_test-vsl_dispatch.obj: vsl_dispatch.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsl_dispatch.obj -MD -MP -MF $(DEPDIR)/vxp_test-vsl_dispatch.Tpo -c -o vxp_test-vsl_dispatch.obj `if test -f 'vsl_dispatch.c'; then $(CYGPATH_W) 'vsl_dispatch.c'; else $(CYGPATH_W) '$(srcdir)/vsl_dispatch.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsl_dispatch.Tpo $(DEPDIR)/vxp_test-vsl_dispatch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_dispatch.c' object='vxp_test-vsl_dispatch.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsl_dispatch.obj `if test -f 'vsl_dispatch.c'; then $(CYGPATH_W) 'vsl_dispatch.c'; else $(CYGPATH_W) '$(srcdir)/vsl_dispatch.c'; fi` vxp_test-vsl_query.o: vsl_query.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsl_query.o -MD -MP -MF $(DEPDIR)/vxp_test-vsl_query.Tpo -c -o vxp_test-vsl_query.o `test -f 'vsl_query.c' || echo '$(srcdir)/'`vsl_query.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsl_query.Tpo $(DEPDIR)/vxp_test-vsl_query.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_query.c' object='vxp_test-vsl_query.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsl_query.o `test -f 'vsl_query.c' || echo '$(srcdir)/'`vsl_query.c vxp_test-vsl_query.obj: vsl_query.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsl_query.obj -MD -MP -MF $(DEPDIR)/vxp_test-vsl_query.Tpo -c -o vxp_test-vsl_query.obj `if test -f 'vsl_query.c'; then $(CYGPATH_W) 'vsl_query.c'; else $(CYGPATH_W) '$(srcdir)/vsl_query.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsl_query.Tpo $(DEPDIR)/vxp_test-vsl_query.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl_query.c' object='vxp_test-vsl_query.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsl_query.obj `if test -f 'vsl_query.c'; then $(CYGPATH_W) 'vsl_query.c'; else $(CYGPATH_W) '$(srcdir)/vsl_query.c'; fi` vxp_test-vsl.o: vsl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsl.o -MD -MP -MF $(DEPDIR)/vxp_test-vsl.Tpo -c -o vxp_test-vsl.o `test -f 'vsl.c' || echo '$(srcdir)/'`vsl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsl.Tpo $(DEPDIR)/vxp_test-vsl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl.c' object='vxp_test-vsl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsl.o `test -f 'vsl.c' || echo '$(srcdir)/'`vsl.c vxp_test-vsl.obj: vsl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsl.obj -MD -MP -MF $(DEPDIR)/vxp_test-vsl.Tpo -c -o vxp_test-vsl.obj `if test -f 'vsl.c'; then $(CYGPATH_W) 'vsl.c'; else $(CYGPATH_W) '$(srcdir)/vsl.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsl.Tpo $(DEPDIR)/vxp_test-vsl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsl.c' object='vxp_test-vsl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsl.obj `if test -f 'vsl.c'; then $(CYGPATH_W) 'vsl.c'; else $(CYGPATH_W) '$(srcdir)/vsl.c'; fi` vxp_test-vsc.o: vsc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsc.o -MD -MP -MF $(DEPDIR)/vxp_test-vsc.Tpo -c -o vxp_test-vsc.o `test -f 'vsc.c' || echo '$(srcdir)/'`vsc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsc.Tpo $(DEPDIR)/vxp_test-vsc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsc.c' object='vxp_test-vsc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsc.o `test -f 'vsc.c' || echo '$(srcdir)/'`vsc.c vxp_test-vsc.obj: vsc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vsc.obj -MD -MP -MF $(DEPDIR)/vxp_test-vsc.Tpo -c -o vxp_test-vsc.obj `if test -f 'vsc.c'; then $(CYGPATH_W) 'vsc.c'; else $(CYGPATH_W) '$(srcdir)/vsc.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vsc.Tpo $(DEPDIR)/vxp_test-vsc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsc.c' object='vxp_test-vsc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vsc.obj `if test -f 'vsc.c'; then $(CYGPATH_W) 'vsc.c'; else $(CYGPATH_W) '$(srcdir)/vsc.c'; fi` vxp_test-vxp.o: vxp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vxp.o -MD -MP -MF $(DEPDIR)/vxp_test-vxp.Tpo -c -o vxp_test-vxp.o `test -f 'vxp.c' || echo '$(srcdir)/'`vxp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vxp.Tpo $(DEPDIR)/vxp_test-vxp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp.c' object='vxp_test-vxp.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vxp.o `test -f 'vxp.c' || echo '$(srcdir)/'`vxp.c vxp_test-vxp.obj: vxp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vxp.obj -MD -MP -MF $(DEPDIR)/vxp_test-vxp.Tpo -c -o vxp_test-vxp.obj `if test -f 'vxp.c'; then $(CYGPATH_W) 'vxp.c'; else $(CYGPATH_W) '$(srcdir)/vxp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vxp.Tpo $(DEPDIR)/vxp_test-vxp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp.c' object='vxp_test-vxp.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vxp.obj `if test -f 'vxp.c'; then $(CYGPATH_W) 'vxp.c'; else $(CYGPATH_W) '$(srcdir)/vxp.c'; fi` vxp_test-vxp_parse.o: vxp_parse.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vxp_parse.o -MD -MP -MF $(DEPDIR)/vxp_test-vxp_parse.Tpo -c -o vxp_test-vxp_parse.o `test -f 'vxp_parse.c' || echo '$(srcdir)/'`vxp_parse.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vxp_parse.Tpo $(DEPDIR)/vxp_test-vxp_parse.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp_parse.c' object='vxp_test-vxp_parse.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vxp_parse.o `test -f 'vxp_parse.c' || echo '$(srcdir)/'`vxp_parse.c vxp_test-vxp_parse.obj: vxp_parse.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vxp_parse.obj -MD -MP -MF $(DEPDIR)/vxp_test-vxp_parse.Tpo -c -o vxp_test-vxp_parse.obj `if test -f 'vxp_parse.c'; then $(CYGPATH_W) 'vxp_parse.c'; else $(CYGPATH_W) '$(srcdir)/vxp_parse.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vxp_parse.Tpo $(DEPDIR)/vxp_test-vxp_parse.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp_parse.c' object='vxp_test-vxp_parse.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vxp_parse.obj `if test -f 'vxp_parse.c'; then $(CYGPATH_W) 'vxp_parse.c'; else $(CYGPATH_W) '$(srcdir)/vxp_parse.c'; fi` vxp_test-vxp_lexer.o: vxp_lexer.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vxp_lexer.o -MD -MP -MF $(DEPDIR)/vxp_test-vxp_lexer.Tpo -c -o vxp_test-vxp_lexer.o `test -f 'vxp_lexer.c' || echo '$(srcdir)/'`vxp_lexer.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vxp_lexer.Tpo $(DEPDIR)/vxp_test-vxp_lexer.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp_lexer.c' object='vxp_test-vxp_lexer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vxp_lexer.o `test -f 'vxp_lexer.c' || echo '$(srcdir)/'`vxp_lexer.c vxp_test-vxp_lexer.obj: vxp_lexer.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vxp_lexer.obj -MD -MP -MF $(DEPDIR)/vxp_test-vxp_lexer.Tpo -c -o vxp_test-vxp_lexer.obj `if test -f 'vxp_lexer.c'; then $(CYGPATH_W) 'vxp_lexer.c'; else $(CYGPATH_W) '$(srcdir)/vxp_lexer.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vxp_lexer.Tpo $(DEPDIR)/vxp_test-vxp_lexer.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp_lexer.c' object='vxp_test-vxp_lexer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vxp_lexer.obj `if test -f 'vxp_lexer.c'; then $(CYGPATH_W) 'vxp_lexer.c'; else $(CYGPATH_W) '$(srcdir)/vxp_lexer.c'; fi` vxp_test-vxp_fixed_token.o: vxp_fixed_token.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vxp_fixed_token.o -MD -MP -MF $(DEPDIR)/vxp_test-vxp_fixed_token.Tpo -c -o vxp_test-vxp_fixed_token.o `test -f 'vxp_fixed_token.c' || echo '$(srcdir)/'`vxp_fixed_token.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vxp_fixed_token.Tpo $(DEPDIR)/vxp_test-vxp_fixed_token.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp_fixed_token.c' object='vxp_test-vxp_fixed_token.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vxp_fixed_token.o `test -f 'vxp_fixed_token.c' || echo '$(srcdir)/'`vxp_fixed_token.c vxp_test-vxp_fixed_token.obj: vxp_fixed_token.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vxp_fixed_token.obj -MD -MP -MF $(DEPDIR)/vxp_test-vxp_fixed_token.Tpo -c -o vxp_test-vxp_fixed_token.obj `if test -f 'vxp_fixed_token.c'; then $(CYGPATH_W) 'vxp_fixed_token.c'; else $(CYGPATH_W) '$(srcdir)/vxp_fixed_token.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vxp_fixed_token.Tpo $(DEPDIR)/vxp_test-vxp_fixed_token.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp_fixed_token.c' object='vxp_test-vxp_fixed_token.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vxp_fixed_token.obj `if test -f 'vxp_fixed_token.c'; then $(CYGPATH_W) 'vxp_fixed_token.c'; else $(CYGPATH_W) '$(srcdir)/vxp_fixed_token.c'; fi` vxp_test-vxp_test.o: vxp_test.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vxp_test.o -MD -MP -MF $(DEPDIR)/vxp_test-vxp_test.Tpo -c -o vxp_test-vxp_test.o `test -f 'vxp_test.c' || echo '$(srcdir)/'`vxp_test.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vxp_test.Tpo $(DEPDIR)/vxp_test-vxp_test.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp_test.c' object='vxp_test-vxp_test.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vxp_test.o `test -f 'vxp_test.c' || echo '$(srcdir)/'`vxp_test.c vxp_test-vxp_test.obj: vxp_test.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -MT vxp_test-vxp_test.obj -MD -MP -MF $(DEPDIR)/vxp_test-vxp_test.Tpo -c -o vxp_test-vxp_test.obj `if test -f 'vxp_test.c'; then $(CYGPATH_W) 'vxp_test.c'; else $(CYGPATH_W) '$(srcdir)/vxp_test.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vxp_test-vxp_test.Tpo $(DEPDIR)/vxp_test-vxp_test.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vxp_test.c' object='vxp_test-vxp_test.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vxp_test_CFLAGS) $(CFLAGS) -c -o vxp_test-vxp_test.obj `if test -f 'vxp_test.c'; then $(CYGPATH_W) 'vxp_test.c'; else $(CYGPATH_W) '$(srcdir)/vxp_test.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-libLTLIBRARIES vsl-tags.rst: vsl2rst ./vsl2rst > $@ vxp_fixed_token.c vxp_tokens.h: \ $(srcdir)/generate.py @PYTHON@ $(srcdir)/generate.py $(srcdir) $(top_builddir) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/lib/libvarnishapi/vsl-tags.rst0000644000201500234410000003157412652366744016030 00000000000000Backend - Backend selected Logged when a connection is selected for handling a backend request. The format is:: %d %s %s | | | | | +- Backend display name | +---- VCL name +------- Connection file descriptor BackendClose - Backend connection closed Logged when a backend connection is closed. The format is:: %d %s [ %s ] | | | | | +- Optional reason | +------ Backend display name +--------- Connection file descriptor BackendOpen - Backend connection opened Logged when a new backend connection is opened. The format is:: %d %s %s %s %s %s | | | | | | | | | | | +- Local port | | | | +---- Local address | | | +------- Remote port | | +---------- Remote address | +------------- Backend display name +---------------- Connection file descriptor BackendReuse - Backend connection put up for reuse Logged when a backend connection is put up for reuse by a later connection. The format is:: %d %s | | | +- Backend display name +---- Connection file descriptor Backend_health - Backend health check The result of a backend health probe. The format is:: %s %s %s %u %u %u %f %f %s | | | | | | | | | | | | | | | | | +- Probe HTTP response | | | | | | | +---- Average response time | | | | | | +------- Response time | | | | | +---------- Probe window size | | | | +------------- Probe threshold level | | | +---------------- Number of good probes in window | | +------------------- Probe window bits | +---------------------- Status message +------------------------- Backend name Begin - Marks the start of a VXID The first record of a VXID transaction. The format is:: %s %d %s | | | | | +- Reason | +---- Parent vxid +------- Type ("sess", "req" or "bereq") BereqAcct - Backend request accounting Contains byte counters from backend request processing. The format is:: %d %d %d %d %d %d | | | | | | | | | | | +- Total bytes received | | | | +---- Body bytes received | | | +------- Header bytes received | | +---------- Total bytes transmitted | +------------- Body bytes transmitted +---------------- Header bytes transmitted BereqHeader - Backend request header HTTP header contents. The format is:: %s: %s | | | +- Header value +----- Header name BereqMethod - Backend request method The HTTP request method used. BereqProtocol - Backend request protocol The HTTP protocol version information. BereqURL - Backend request URL The HTTP request URL. BerespHeader - Backend response header HTTP header contents. The format is:: %s: %s | | | +- Header value +----- Header name BerespProtocol - Backend response protocol The HTTP protocol version information. BerespReason - Backend response response The HTTP response string received. BerespStatus - Backend response status The HTTP status code received. BogoHeader - Bogus HTTP received Contains the first 20 characters of received HTTP headers we could not make sense of. Applies to both req.http and beresp.http. CLI - CLI communication CLI communication between varnishd master and child process. Debug - Debug messages Debug messages can normally be ignored, but are sometimes helpful during trouble-shooting. Most debug messages must be explicitly enabled with parameters. ESI_xmlerror - ESI parser error or warning message An error or warning was generated during parsing of an ESI object. The log record describes the problem encountered. End - Marks the end of a VXID The last record of a VXID transaction. Error - Error messages Error messages are stuff you probably want to know. ExpBan - Object evicted due to ban Logs the VXID when an object is banned. ExpKill - Object expiry event Logs events related to object expiry. The events are: EXP_Rearm Logged when the expiry time of an object changes. EXP_Inbox Logged when the expiry thread picks an object from the inbox for processing. EXP_Kill Logged when the expiry thread kills an object from the inbox. EXP_When Logged when the expiry thread moves an object on the binheap. EXP_Expired Logged when the expiry thread expires an object. LRU_Cand Logged when an object is evaluated for LRU force expiry. LRU Logged when an object is force expired due to LRU. LRU_Fail Logged when no suitable candidate object is found for LRU force expiry. The format is:: EXP_Rearm p=%p E=%f e=%f f=0x%x EXP_Inbox p=%p e=%f f=0x%x EXP_Kill p=%p e=%f f=0x%x EXP_When p=%p e=%f f=0x%x EXP_Expired x=%u t=%f LRU_Cand p=%p f=0x%x r=%d LRU x=%u LRU_Fail Legend: p=%p Objcore pointer t=%f Remaining TTL (s) e=%f Expiry time (unix epoch) E=%f Old expiry time (unix epoch) f=0x%x Objcore flags r=%d Objcore refcount x=%u Object VXID FetchError - Error while fetching object Logs the error message of a failed fetch operation. Fetch_Body - Body fetched from backend Ready to fetch body from backend. The format is:: %d (%s) %s | | | | | +---- 'stream' or '-' | +--------- Text description of body fetch mode +------------- Body fetch mode Gzip - G(un)zip performed on object A Gzip record is emitted for each instance of gzip or gunzip work performed. Worst case, an ESI transaction stored in gzip'ed objects but delivered gunziped, will run into many of these. The format is:: %c %c %c %d %d %d %d %d | | | | | | | | | | | | | | | +- Bit length of compressed data | | | | | | +---- Bit location of 'last' bit | | | | | +------- Bit location of first deflate block | | | | +---------- Bytes output | | | +------------- Bytes input | | +---------------- 'E': ESI, '-': Plain object | +------------------- 'F': Fetch, 'D': Deliver +---------------------- 'G': Gzip, 'U': Gunzip, 'u': Gunzip-test Examples:: U F E 182 159 80 80 1392 G F E 159 173 80 1304 1314 Hash - Value added to hash This value was added to the object lookup hash. NB: This log record is masked by default. Hit - Hit object in cache Object looked up in cache. Shows the VXID of the object. HitPass - Hit for pass object in cache. Hit-for-pass object looked up in cache. Shows the VXID of the hit-for-pass object. HttpGarbage - Unparseable HTTP request Logs the content of unparseable HTTP requests. Length - Size of object body Logs the size of a fetch object body. Link - Links to a child VXID Links this VXID to any child VXID it initiates. The format is:: %s %d %s | | | | | +- Reason | +---- Child vxid +------- Child type ("req" or "bereq") LostHeader - Failed attempt to set HTTP header Logs the header name of a failed HTTP header operation due to resource exhaustion or configured limits. ObjHeader - Object header HTTP header contents. The format is:: %s: %s | | | +- Header value +----- Header name ObjProtocol - Object protocol The HTTP protocol version information. ObjReason - Object response The HTTP response string received. ObjStatus - Object status The HTTP status code received. PipeAcct - Pipe byte counts Contains byte counters for pipe sessions. The format is:: %d %d %d %d | | | | | | | +------- Piped bytes to client | | +---------- Piped bytes from client | +------------- Backend request headers +---------------- Client request headers Proxy - PROXY protocol information PROXY protocol information. The format is:: %d %s %d %s %d [key value]... | | | | | | | | | | | +- optional information | | | | +- server port | | | +- server ip | | +- client port | +- client ip +---- PROXY protocol version ProxyGarbage - Unparseable PROXY request A PROXY protocol header was unparseable. ReqAcct - Request handling byte counts Contains byte counts for the request handling. ESI sub-request counts are also added to their parent request. The body bytes count does not include transmission (ie: chunked encoding) overhead. The format is:: %d %d %d %d %d %d | | | | | | | | | | | +- Total bytes transmitted | | | | +---- Body bytes transmitted | | | +------- Header bytes transmitted | | +---------- Total bytes received | +------------- Body bytes received +---------------- Header bytes received ReqHeader - Client request header HTTP header contents. The format is:: %s: %s | | | +- Header value +----- Header name ReqMethod - Client request method The HTTP request method used. ReqProtocol - Client request protocol The HTTP protocol version information. ReqStart - Client request start Start of request processing. Logs the client IP address and port number. The format is:: %s %s | | | +- Client Port number +---- Client IP4/6 address ReqURL - Client request URL The HTTP request URL. RespHeader - Client response header HTTP header contents. The format is:: %s: %s | | | +- Header value +----- Header name RespProtocol - Client response protocol The HTTP protocol version information. RespReason - Client response response The HTTP response string received. RespStatus - Client response status The HTTP status code received. SessClose - Client connection closed SessionClose is the last record for any client connection. The format is:: %s %f | | | +- How long the session was open +---- Why the connection closed SessOpen - Client connection opened The first record for a client connection, with the socket-endpoints of the connection. The format is:: %s %d %s %s %s %d | | | | | | | | | | | +- File descriptor number | | | | +---- Local TCP port ('-' if !$log_local_addr) | | | +------- Local IPv4/6 address ('-' if !$log_local_addr) | | +---------- Listen socket (-a argument) | +------------- Remote TCP port +---------------- Remote IPv4/6 address Storage - Where object is stored Type and name of the storage backend the object is stored in. The format is:: %s %s | | | +- Name of storage backend +---- Type ("malloc", "file", "persistent" etc.) TTL - TTL set on object A TTL record is emitted whenever the ttl, grace or keep values for an object is set. The format is:: %s %d %d %d %d [ %d %d %u %u ] | | | | | | | | | | | | | | | | | +- Max-Age from Cache-Control header | | | | | | | +---- Expires header | | | | | | +------- Date header | | | | | +---------- Age (incl Age: header value) | | | | +--------------- Reference time for TTL | | | +------------------ Keep | | +--------------------- Grace | +------------------------ TTL +--------------------------- "RFC" or "VCL" The last four fields are only present in "RFC" headers. Examples:: RFC 60 10 -1 1312966109 1312966109 1312966109 0 60 VCL 120 10 0 1312966111 Timestamp - Timing information Contains timing information for the Varnish worker threads. Time stamps are issued by Varnish on certain events, and show the absolute time of the event, the time spent since the start of the work unit, and the time spent since the last timestamp was logged. See vsl(7) for information about the individual timestamps. The format is:: %s: %f %f %f | | | | | | | +- Time since last timestamp | | +---- Time since start of work unit | +------- Absolute time of event +----------- Event label VCL_Error - VCL execution error message Logs error messages generated during VCL execution. VCL_Log - Log statement from VCL User generated log messages insert from VCL through std.log() VCL_acl - VCL ACL check results Logs VCL ACL evaluation results. VCL_call - VCL method called Logs the VCL method name when a VCL method is called. VCL_return - VCL method return value Logs the VCL method terminating statement. VCL_trace - VCL trace data Logs VCL execution trace data. The format is:: %u %u.%u | | | | | +- VCL program line position | +---- VCL program line number +------- VCL trace point index NB: This log record is masked by default. VSL - VSL API warnings and error message Warnings and error messages genererated by the VSL API while reading the shared memory log. VfpAcct - Fetch filter accounting Contains name of VFP and statistics. The format is:: %s %d %d | | | | | +- Total bytes produced | +---- Number of calls made +------- Name of filter NB: This log record is masked by default. Witness - Lock order witness records Diagnostic recording of locking order. WorkThread - Logs thread start/stop events Logs worker thread creation and termination events. The format is:: %p %s | | | +- [start|end] +---- Worker struct pointer NB: This log record is masked by default. varnish-4.1.1/lib/libvarnishapi/vsl_glob_test.c0000644000201500234410000000422312652366721016532 00000000000000/*- * Copyright (c) 2013 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. * * Test what VSL_Name2Tag and VSL_Glob2Tags produces */ #include #include #include #include #include "vapi/vsl.h" static void cb(int tag, void *priv) { (void)priv; printf("\t%d (%s)\n", tag, VSL_tags[tag]); } int main(int argc, char * const *argv) { int i; if (argc != 2) { fprintf(stderr, "vsl_glob_test \n"); exit(1); } i = VSL_Name2Tag(argv[1], -1); printf("VSL_Name2Tag returns %d", i); if (i >= 0) printf(" (%s)", VSL_tags[i]); printf("\n"); printf("VSL_Glob2Tags:\n"); i = VSL_Glob2Tags(argv[1], -1, cb, NULL); printf("VSL_Glob2Tags returns %d\n", i); printf("VSL_List2Tags:\n"); i = VSL_List2Tags(argv[1], -1, cb, NULL); printf("VSL_List2Tags returns %d\n", i); return (0); } varnish-4.1.1/lib/libvarnishapi/vsm_api.h0000644000201500234410000000353212652366721015331 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ struct vsc; struct vsb; struct VSM_data { unsigned magic; #define VSM_MAGIC 0x6e3bd69b struct vsb *diag; char *name; char *fname; int N_opt; struct stat fstat; int vsm_fd; struct VSM_head *head; char *b; char *e; uint64_t age_ok; double t_ok; struct vsc *vsc; }; int vsm_diag(struct VSM_data *vd, const char *fmt, ...) __v_printflike(2, 3); void VSC_Delete(struct VSM_data *vd); varnish-4.1.1/lib/libvarnishapi/vxp_test.c0000644000201500234410000000432712652366721015545 00000000000000/*- * Copyright (c) 2014-2015 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. */ #include #include #include #include #include "miniobj.h" #include "vas.h" #include "vsb.h" #include "vxp.h" static void usage(void) { fprintf(stderr, "Usage: vxp_test -q \n"); exit(1); } int main(int argc, char * const *argv) { struct vsb *vsb; struct vex *vex; char *q_arg = NULL; char opt; while ((opt = getopt(argc, argv, "q:")) != -1) { switch (opt) { case 'q': REPLACE(q_arg, optarg); break; default: usage(); } } if (q_arg == NULL || optind != argc) usage(); vsb = VSB_new_auto(); AN(vsb); vex = vex_New(q_arg, vsb); if (vex == NULL) { VSB_finish(vsb); fprintf(stderr, "Error:\n%s", VSB_data(vsb)); VSB_delete(vsb); free(q_arg); exit(1); } VSB_delete(vsb); vex_Free(&vex); AZ(vex); free(q_arg); return (0); } varnish-4.1.1/lib/libvarnishapi/vsl_arg.c0000644000201500234410000001720112652366721015321 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * 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. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include "vdef.h" #include "vas.h" #include "miniobj.h" #include "vbm.h" #include "vnum.h" #include "vqueue.h" #include "vre.h" #include "vapi/vsl.h" #include "vapi/vsm.h" #include "vsl_api.h" #include "vsm_api.h" /*-------------------------------------------------------------------- * Look up a tag * 0..255 tag number * -1 no tag matches * -2 multiple tags match */ int VSL_Name2Tag(const char *name, int l) { int i, n; if (l == -1) l = strlen(name); n = -1; for (i = 0; i < SLT__MAX; i++) { if (VSL_tags[i] != NULL && !strncasecmp(name, VSL_tags[i], l)) { if (strlen(VSL_tags[i]) == l) { /* Exact match */ return (i); } if (n == -1) n = i; else n = -2; } } return (n); } int VSL_Glob2Tags(const char *glob, int l, VSL_tagfind_f *func, void *priv) { int i, r, l2; int pre = 0; int post = 0; char buf[64]; AN(glob); if (l < 0) l = strlen(glob); if (l == 0 || l > sizeof buf - 1) return (-1); if (strchr(glob, '*') != NULL) { if (glob[0] == '*') { /* Prefix wildcard */ pre = 1; glob++; l--; } if (l > 0 && glob[l - 1] == '*') { /* Postfix wildcard */ post = 1; l--; } } if (pre && post) /* Support only post or prefix wildcards */ return (-3); memcpy(buf, glob, l); buf[l] = '\0'; if (strchr(buf, '*') != NULL) /* No multiple wildcards */ return (-3); if (pre == 0 && post == 0) { /* No wildcards, use VSL_Name2Tag */ i = VSL_Name2Tag(buf, l); if (i < 0) return (i); if (func != NULL) (func)(i, priv); return (1); } r = 0; for (i = 0; i < SLT__MAX; i++) { if (VSL_tags[i] == NULL) continue; l2 = strlen(VSL_tags[i]); if (l2 < l) continue; if (pre) { /* Prefix wildcard match */ if (strcasecmp(buf, VSL_tags[i] + l2 - l)) continue; } else { /* Postfix wildcard match */ if (strncasecmp(buf, VSL_tags[i], l)) continue; } if (func != NULL) (func)(i, priv); r++; } if (r == 0) return (-1); return (r); } int VSL_List2Tags(const char *list, int l, VSL_tagfind_f *func, void *priv) { const char *p, *q, *e; int r, t; if (l < 0) l = strlen(list); p = list; e = p + l; t = 0; while (p < e) { while (p < e && *p == ',') p++; if (p == e) break; q = p; while (q < e && *q != ',') q++; r = VSL_Glob2Tags(p, q - p, func, priv); if (r < 0) return (r); t += r; p = q; } if (t == 0) return (-1); return (t); } const char *VSLQ_grouping[VSL_g__MAX] = { [VSL_g_raw] = "raw", [VSL_g_vxid] = "vxid", [VSL_g_request] = "request", [VSL_g_session] = "session", }; int VSLQ_Name2Grouping(const char *name, int l) { int i, n; if (l == -1) l = strlen(name); n = -1; for (i = 0; i < VSL_g__MAX; i++) { if (!strncasecmp(name, VSLQ_grouping[i], l)) { if (strlen(VSLQ_grouping[i]) == l) { /* Exact match */ return (i); } if (n == -1) n = i; else n = -2; } } return (n); } void __match_proto__(VSL_tagfind_f) vsl_vbm_bitset(int bit, void *priv) { vbit_set((struct vbitmap *)priv, bit); } void __match_proto__(VSL_tagfind_f) vsl_vbm_bitclr(int bit, void *priv) { vbit_clr((struct vbitmap *)priv, bit); } static int vsl_ix_arg(struct VSL_data *vsl, int opt, const char *arg) { int i; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); vsl->flags |= F_SEEN_ixIX; i = VSL_List2Tags(arg, -1, opt == 'x' ? vsl_vbm_bitset : vsl_vbm_bitclr, vsl->vbm_supress); if (i == -1) return (vsl_diag(vsl, "-%c: \"%s\" matches zero tags", (char)opt, arg)); else if (i == -2) return (vsl_diag(vsl, "-%c: \"%s\" is ambiguous", (char)opt, arg)); else if (i == -3) return (vsl_diag(vsl, "-%c: Syntax error in \"%s\"", (char)opt, arg)); return (1); } static int vsl_IX_arg(struct VSL_data *vsl, int opt, const char *arg) { int i, l, off; const char *b, *e, *err; vre_t *vre; struct vslf *vslf; struct vbitmap *tags = NULL; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); vsl->flags |= F_SEEN_ixIX; b = arg; e = strchr(b, ':'); if (e) { tags = vbit_init(SLT__MAX); AN(tags); l = e - b; i = VSL_List2Tags(b, l, vsl_vbm_bitset, tags); if (i < 0) vbit_destroy(tags); if (i == -1) return (vsl_diag(vsl, "-%c: \"%*.*s\" matches zero tags", (char)opt, l, l, b)); else if (i == -2) return (vsl_diag(vsl, "-%c: \"%*.*s\" is ambiguous", (char)opt, l, l, b)); else if (i <= -3) return (vsl_diag(vsl, "-%c: Syntax error in \"%*.*s\"", (char)opt, l, l, b)); b = e + 1; } vre = VRE_compile(b, vsl->C_opt ? VRE_CASELESS : 0, &err, &off); if (vre == NULL) { if (tags) vbit_destroy(tags); return (vsl_diag(vsl, "-%c: Regex error at position %d (%s)\n", (char)opt, off, err)); } ALLOC_OBJ(vslf, VSLF_MAGIC); AN(vslf); vslf->tags = tags; vslf->vre = vre; if (opt == 'I') VTAILQ_INSERT_TAIL(&vsl->vslf_select, vslf, list); else { assert(opt == 'X'); VTAILQ_INSERT_TAIL(&vsl->vslf_suppress, vslf, list); } return (1); } int VSL_Arg(struct VSL_data *vsl, int opt, const char *arg) { int i; char *p; double d; long l; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); /* If first option is 'i', set all bits for supression */ if ((opt == 'i' || opt == 'I') && !(vsl->flags & F_SEEN_ixIX)) for (i = 0; i < SLT__MAX; i++) vbit_set(vsl->vbm_supress, i); switch (opt) { case 'b': vsl->b_opt = 1; return (1); case 'c': vsl->c_opt = 1; return (1); case 'C': /* Caseless regular expressions */ vsl->C_opt = 1; return (1); case 'i': case 'x': return (vsl_ix_arg(vsl, opt, arg)); case 'I': case 'X': return (vsl_IX_arg(vsl, opt, arg)); case 'L': l = strtol(arg, &p, 0); while (isspace(*p)) p++; if (*p != '\0') return (vsl_diag(vsl, "-L: Syntax error")); if (l <= 0 || l > INT_MAX) return (vsl_diag(vsl, "-L: Range error")); vsl->L_opt = (int)l; return (1); case 'T': d = VNUM(arg); if (isnan(d)) return (vsl_diag(vsl, "-T: Syntax error")); if (d < 0.) return (vsl_diag(vsl, "-T: Range error")); vsl->T_opt = d; return (1); case 'v': vsl->v_opt = 1; return (1); default: return (0); } } varnish-4.1.1/lib/libvarnishapi/vxp_lexer.c0000644000201500234410000001030312652366721015674 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 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. * */ #include "config.h" #include #include #include #include #include "vdef.h" #include "vas.h" #include "vqueue.h" #include "vre.h" #include "vsb.h" #include "vxp.h" static void vxp_add_token(struct vxp *vxp, unsigned tok, const char *b, const char *e) { struct token *t; t = vxp_Alloc(vxp, sizeof *t); AN(t); t->tok = tok; t->b = b; t->e = e; if (vxp->t != NULL) VTAILQ_INSERT_AFTER(&vxp->tokens, vxp->t, t, list); else VTAILQ_INSERT_TAIL(&vxp->tokens, t, list); vxp->t = t; } static int vxp_decstr(struct vxp *vxp, int quoted) { const char *b, *e, *p; char *s; unsigned l; int esc = 0; assert(vxp->t->tok == VAL); b = vxp->t->b; e = vxp->t->e; if (quoted) { assert(e - b >= 2); b++; e--; } l = e - b; s = vxp->t->dec = vxp_Alloc(vxp, l + 1); AN(vxp->t->dec); for (p = b; p < e; p++) { if (!esc && *p == '\\') { esc = 1; continue; } esc = 0; *s++ = *p; } *s = '\0'; if (esc || p != e) { VSB_printf(vxp->sb, "Syntax error "); vxp_ErrWhere(vxp, vxp->t, -1); return (1); } return (0); } /* * Build a token list */ void vxp_Lexer(struct vxp *vxp) { const char *p, *q; unsigned u; char quote; for (p = vxp->b; p < vxp->e; ) { /* Skip any whitespace */ if (isspace(*p)) { p++; continue; } /* Match for the fixed tokens */ u = vxp_fixed_token(p, &q); if (u != 0) { AN(q); vxp_add_token(vxp, u, p, q); p = q; continue; } /* Match quoted strings */ if (*p == '"' || *p == '\'') { quote = *p; for (q = p + 1; q < vxp->e; q++) { if (q[-1] == '\\') continue; if (*q == quote) { q++; quote = '\0'; break; } } vxp_add_token(vxp, VAL, p, q); if (quote != '\0') { VSB_printf(vxp->sb, "Unterminated string "); vxp_ErrWhere(vxp, vxp->t, q - p - 1); return; } if (vxp_decstr(vxp, 1)) return; p = q; continue; } /* Match bareword */ if (isword(*p)) { for (q = p; q < vxp->e; q++) if (!isword(*q)) break; vxp_add_token(vxp, VAL, p, q); if (vxp_decstr(vxp, 0)) return; p = q; continue; } /* Error */ vxp_add_token(vxp, EOI, p, p + 1); VSB_printf(vxp->sb, "Syntax error "); vxp_ErrWhere(vxp, vxp->t, q - p); return; } /* Finished */ vxp_add_token(vxp, EOI, vxp->e, vxp->e); } #ifdef VXP_DEBUG void vxp_PrintTokens(const struct vxp *vxp) { struct token *t; fprintf(stderr, "Token list:\n"); fprintf(stderr, " %-5s %-20s %s\n", "TOK", "SUBSTR", "DECODED"); VTAILQ_FOREACH(t, &vxp->tokens, list) { fprintf(stderr, " "); fprintf(stderr, "%-5s", vxp_tnames[t->tok]); fprintf(stderr, " %-20.*s", (unsigned)(t->e - t->b), t->b); if (t->dec) fprintf(stderr, " '%s'", t->dec); fprintf(stderr, "\n"); } fprintf(stderr, "\n"); } #endif /* VXP_DEBUG */ varnish-4.1.1/lib/libvarnishapi/vsl_api.h0000644000201500234410000000575612652366721015342 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * 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. * */ #define VSL_FILE_ID "VSL" /*lint -esym(534, vsl_diag) */ int vsl_diag(struct VSL_data *vsl, const char *fmt, ...) __v_printflike(2, 3); void vsl_vbm_bitset(int bit, void *priv); void vsl_vbm_bitclr(int bit, void *priv); typedef void vslc_delete_f(const struct VSL_cursor *); typedef int vslc_next_f(const struct VSL_cursor *); typedef int vslc_reset_f(const struct VSL_cursor *); typedef int vslc_check_f(const struct VSL_cursor *, const struct VSLC_ptr *); struct vslc_tbl { unsigned magic; #define VSLC_TBL_MAGIC 0x5007C0DE vslc_delete_f *delete; vslc_next_f *next; vslc_reset_f *reset; vslc_check_f *check; }; struct vslf { unsigned magic; #define VSLF_MAGIC 0x08650B39 VTAILQ_ENTRY(vslf) list; struct vbitmap *tags; vre_t *vre; }; typedef VTAILQ_HEAD(,vslf) vslf_list; struct VSL_data { unsigned magic; #define VSL_MAGIC 0x8E6C92AA struct vsb *diag; unsigned flags; #define F_SEEN_ixIX (1 << 0) /* Bitmaps of -ix selected tags */ struct vbitmap *vbm_select; struct vbitmap *vbm_supress; /* Lists of -IX filters */ vslf_list vslf_select; vslf_list vslf_suppress; int b_opt; int c_opt; int C_opt; int L_opt; double T_opt; int v_opt; }; /* vsl_query.c */ struct vslq_query; struct vslq_query *vslq_newquery(struct VSL_data *vsl, enum VSL_grouping_e grouping, const char *query); void vslq_deletequery(struct vslq_query **pquery); int vslq_runquery(const struct vslq_query *query, struct VSL_transaction * const ptrans[]); varnish-4.1.1/lib/libvarnishapi/vsm.c0000644000201500234410000002435312652366721014477 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * 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. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include "vdef.h" #include "vas.h" #include "miniobj.h" #include "vin.h" #include "vsb.h" #include "vsm_priv.h" #include "vtim.h" #include "vapi/vsm.h" #include "vsm_api.h" #ifndef MAP_HASSEMAPHORE #define MAP_HASSEMAPHORE 0 /* XXX Linux */ #endif /*--------------------------------------------------------------------*/ struct VSM_data * VSM_New(void) { struct VSM_data *vd; ALLOC_OBJ(vd, VSM_MAGIC); if (vd == NULL) return (vd); REPLACE(vd->name, ""); vd->vsm_fd = -1; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); return (vd); } /*--------------------------------------------------------------------*/ int vsm_diag(struct VSM_data *vd, const char *fmt, ...) { va_list ap; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AN(fmt); if (vd->diag == NULL) vd->diag = VSB_new_auto(); AN(vd->diag); VSB_clear(vd->diag); va_start(ap, fmt); VSB_vprintf(vd->diag, fmt, ap); va_end(ap); AZ(VSB_finish(vd->diag)); return (-1); } /*--------------------------------------------------------------------*/ const char * VSM_Error(const struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (vd->diag == NULL) return (NULL); else return (VSB_data(vd->diag)); } /*--------------------------------------------------------------------*/ void VSM_ResetError(struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (vd->diag == NULL) return; VSB_delete(vd->diag); vd->diag = NULL; } /*--------------------------------------------------------------------*/ int VSM_n_Arg(struct VSM_data *vd, const char *arg) { char *name = NULL; char *fname = NULL; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); 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 = fname; vd->N_opt = 0; return (1); } /*--------------------------------------------------------------------*/ int VSM_N_Arg(struct VSM_data *vd, const char *arg) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AN(arg); 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); } /*--------------------------------------------------------------------*/ const char * VSM_Name(const struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); return (vd->name); } /*--------------------------------------------------------------------*/ void VSM_Delete(struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); VSM_Close(vd); if (vd->vsc != NULL) VSC_Delete(vd); VSM_ResetError(vd); free(vd->name); free(vd->fname); FREE_OBJ(vd); } /*-------------------------------------------------------------------- * The VSM open function * * Return: * 0 = success * <0 = failure * */ /*--------------------------------------------------------------------*/ int VSM_Open(struct VSM_data *vd) { int i; struct VSM_head slh; void *v; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (vd->head != NULL) /* Already open */ return (0); 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) return (vsm_diag(vd, "Cannot open %s: %s\n", vd->fname, strerror(errno))); AZ(fstat(vd->vsm_fd, &vd->fstat)); if (!S_ISREG(vd->fstat.st_mode)) { AZ(close(vd->vsm_fd)); vd->vsm_fd = -1; return (vsm_diag(vd, "%s is not a regular file\n", vd->fname)); } i = read(vd->vsm_fd, &slh, sizeof slh); if (i != sizeof slh) { AZ(close(vd->vsm_fd)); vd->vsm_fd = -1; return(vsm_diag(vd, "Cannot read %s: %s\n", vd->fname, strerror(errno))); } if (memcmp(slh.marker, VSM_HEAD_MARKER, sizeof slh.marker)) { AZ(close(vd->vsm_fd)); vd->vsm_fd = -1; return (vsm_diag(vd, "Not a VSM file %s\n", vd->fname)); } if (!vd->N_opt && slh.alloc_seq == 0) { AZ(close(vd->vsm_fd)); vd->vsm_fd = -1; return (vsm_diag(vd, "Abandoned VSM file (Varnish not running?) %s\n", vd->fname)); } v = mmap(NULL, slh.shm_size, PROT_READ, MAP_SHARED|MAP_HASSEMAPHORE, vd->vsm_fd, 0); if (v == MAP_FAILED) { AZ(close(vd->vsm_fd)); vd->vsm_fd = -1; return (vsm_diag(vd, "Cannot mmap %s: %s\n", vd->fname, strerror(errno))); } vd->head = v; vd->b = v; vd->e = vd->b + slh.shm_size; vd->age_ok = vd->head->age; vd->t_ok = VTIM_mono(); return (0); } /*--------------------------------------------------------------------*/ int VSM_IsOpen(const struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); return (vd->head != NULL); } /*--------------------------------------------------------------------*/ void VSM_Close(struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (vd->head == NULL) return; assert(vd->vsm_fd >= 0); AZ(munmap((void*)vd->b, vd->e - vd->b)); vd->b = NULL; vd->e = NULL; vd->head = NULL; AZ(close(vd->vsm_fd)); vd->vsm_fd = -1; } /*--------------------------------------------------------------------*/ int VSM_Abandoned(struct VSM_data *vd) { struct stat st; double now; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (vd->head == NULL) /* Not open */ return (1); if (vd->N_opt) /* No abandonment check should be done */ return (0); if (!vd->head->alloc_seq) /* Flag of abandonment set by mgt */ return (1); if (vd->head->age < vd->age_ok) /* Age going backwards */ return (1); now = VTIM_mono(); if (vd->head->age == vd->age_ok && now - vd->t_ok > 2.) { /* No age change for 2 seconds, stat the file */ if (stat(vd->fname, &st)) return (1); if (st.st_dev != vd->fstat.st_dev) return (1); if (st.st_ino != vd->fstat.st_ino) return (1); vd->t_ok = now; } else if (vd->head->age > vd->age_ok) { /* It is aging, update timestamps */ vd->t_ok = now; vd->age_ok = vd->head->age; } return (0); } /*--------------------------------------------------------------------*/ void VSM__iter0(const struct VSM_data *vd, struct VSM_fantom *vf) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AN(vf); memset(vf, 0, sizeof *vf); } int VSM__itern(const struct VSM_data *vd, struct VSM_fantom *vf) { struct VSM_chunk *c = NULL; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AN(vf); if (!vd->head) return (0); /* Not open */ if (!vd->N_opt && vd->head->alloc_seq == 0) return (0); /* abandoned VSM */ else if (vf->chunk != NULL) { /* get next chunk */ if (!vd->N_opt && vf->priv != vd->head->alloc_seq) return (0); /* changes during iteration */ if (vf->chunk->len == 0) return (0); /* free'd during iteration */ if (vf->chunk->next == 0) return (0); /* last */ c = (struct VSM_chunk *)(void*)(vd->b + vf->chunk->next); assert(c != vf->chunk); } else if (vd->head->first == 0) { return (0); /* empty vsm */ } else { /* get first chunk */ AZ(vf->chunk); c = (struct VSM_chunk *)(void*)(vd->b + vd->head->first); } AN(c); if (memcmp(c->marker, VSM_CHUNK_MARKER, sizeof c->marker)) return (0); /* XXX - assert? */ vf->chunk = c; vf->priv = vd->head->alloc_seq; vf->b = (void*)(vf->chunk + 1); vf->e = (char*)vf->b + vf->chunk->len; strncpy(vf->class, vf->chunk->class, sizeof vf->class); vf->class[sizeof vf->class - 1] = '\0'; strncpy(vf->type, vf->chunk->type, sizeof vf->type); vf->type[sizeof vf->type - 1] = '\0'; strncpy(vf->ident, vf->chunk->ident, sizeof vf->ident); vf->ident[sizeof vf->ident - 1] = '\0'; return (1); } /*--------------------------------------------------------------------*/ enum VSM_valid_e VSM_StillValid(const struct VSM_data *vd, struct VSM_fantom *vf) { struct VSM_fantom f2; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AN(vf); if (!vd->head) return (VSM_invalid); if (!vd->N_opt && !vd->head->alloc_seq) return (VSM_invalid); if (vf->chunk == NULL) return (VSM_invalid); if (vf->priv == vd->head->alloc_seq) return (VSM_valid); VSM_FOREACH(&f2, vd) { if (f2.chunk != vf->chunk || f2.b != vf->b || f2.e != vf->e) continue; if (strcmp(f2.class, vf->class)) continue; if (strcmp(f2.type, vf->type)) continue; if (strcmp(f2.ident, vf->ident)) continue; vf->priv = vd->head->alloc_seq; return (VSM_similar); } return (VSM_invalid); } int VSM_Get(const struct VSM_data *vd, struct VSM_fantom *vf, const char *class, const char *type, const char *ident) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); VSM_FOREACH(vf, vd) { if (strcmp(vf->class, class)) continue; if (type != NULL && strcmp(vf->type, type)) continue; if (ident != NULL && strcmp(vf->ident, ident)) continue; return (1); } memset(vf, 0, sizeof *vf); return (0); } varnish-4.1.1/lib/libvarnishapi/vsl.c0000644000201500234410000002431212652366721014471 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * 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. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include "vdef.h" #include "vas.h" #include "miniobj.h" #include "vbm.h" #include "vmb.h" #include "vqueue.h" #include "vre.h" #include "vsb.h" #include "vapi/vsm.h" #include "vapi/vsl.h" #include "vsl_api.h" #include "vsm_api.h" /*--------------------------------------------------------------------*/ const char * const VSL_tags[SLT__MAX] = { # define SLTM(foo,flags,sdesc,ldesc) [SLT_##foo] = #foo, # include "tbl/vsl_tags.h" # undef SLTM }; const unsigned VSL_tagflags[SLT__MAX] = { # define SLTM(foo, flags, sdesc, ldesc) [SLT_##foo] = flags, # include "tbl/vsl_tags.h" # undef SLTM }; int vsl_diag(struct VSL_data *vsl, const char *fmt, ...) { va_list ap; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); AN(fmt); if (vsl->diag == NULL) vsl->diag = VSB_new_auto(); AN(vsl->diag); VSB_clear(vsl->diag); va_start(ap, fmt); VSB_vprintf(vsl->diag, fmt, ap); va_end(ap); AZ(VSB_finish(vsl->diag)); return (-1); } struct VSL_data * VSL_New(void) { struct VSL_data *vsl; ALLOC_OBJ(vsl, VSL_MAGIC); if (vsl == NULL) return (NULL); vsl->L_opt = 1000; vsl->T_opt = 120.; vsl->vbm_select = vbit_init(SLT__MAX); vsl->vbm_supress = vbit_init(SLT__MAX); VTAILQ_INIT(&vsl->vslf_select); VTAILQ_INIT(&vsl->vslf_suppress); return (vsl); } static void vsl_IX_free(vslf_list *filters) { struct vslf *vslf; while (!VTAILQ_EMPTY(filters)) { vslf = VTAILQ_FIRST(filters); CHECK_OBJ_NOTNULL(vslf, VSLF_MAGIC); VTAILQ_REMOVE(filters, vslf, list); if (vslf->tags) vbit_destroy(vslf->tags); AN(vslf->vre); VRE_free(&vslf->vre); AZ(vslf->vre); } } void VSL_Delete(struct VSL_data *vsl) { CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); vbit_destroy(vsl->vbm_select); vbit_destroy(vsl->vbm_supress); vsl_IX_free(&vsl->vslf_select); vsl_IX_free(&vsl->vslf_suppress); VSL_ResetError(vsl); FREE_OBJ(vsl); } const char * VSL_Error(const struct VSL_data *vsl) { CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); if (vsl->diag == NULL) return (NULL); else return (VSB_data(vsl->diag)); } void VSL_ResetError(struct VSL_data *vsl) { CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); if (vsl->diag == NULL) return; VSB_delete(vsl->diag); vsl->diag = NULL; } static int vsl_match_IX(struct VSL_data *vsl, const vslf_list *list, const struct VSL_cursor *c) { enum VSL_tag_e tag; const char *cdata; int len; const struct vslf *vslf; (void)vsl; tag = VSL_TAG(c->rec.ptr); cdata = VSL_CDATA(c->rec.ptr); len = VSL_LEN(c->rec.ptr); VTAILQ_FOREACH(vslf, list, list) { CHECK_OBJ_NOTNULL(vslf, VSLF_MAGIC); if (vslf->tags != NULL && !vbit_test(vslf->tags, tag)) continue; if (VRE_exec(vslf->vre, cdata, len, 0, 0, NULL, 0, NULL) >= 0) return (1); } return (0); } int VSL_Match(struct VSL_data *vsl, const struct VSL_cursor *c) { enum VSL_tag_e tag; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); if (c == NULL || c->rec.ptr == NULL) return (0); tag = VSL_TAG(c->rec.ptr); if (tag <= SLT__Bogus || tag >= SLT__Reserved) return (0); if (vsl->c_opt && !VSL_CLIENT(c->rec.ptr)) return (0); if (vsl->b_opt && !VSL_BACKEND(c->rec.ptr)) return (0); if (!VTAILQ_EMPTY(&vsl->vslf_select) && vsl_match_IX(vsl, &vsl->vslf_select, c)) return (1); else if (vbit_test(vsl->vbm_select, tag)) return (1); else if (!VTAILQ_EMPTY(&vsl->vslf_suppress) && vsl_match_IX(vsl, &vsl->vslf_suppress, c)) return (0); else if (vbit_test(vsl->vbm_supress, tag)) return (0); /* Default show */ return (1); } static const char * const VSL_transactions[VSL_t__MAX] = { /* 12345678901234 */ [VSL_t_unknown] = "<< Unknown >>", [VSL_t_sess] = "<< Session >>", [VSL_t_req] = "<< Request >>", [VSL_t_bereq] = "<< BeReq >>", [VSL_t_raw] = "<< Record >>", }; #define VSL_PRINT(...) \ do { \ if (0 > fprintf(__VA_ARGS__)) \ return (-5); \ } while (0) int VSL_Print(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo) { enum VSL_tag_e tag; uint32_t vxid; unsigned len; const char *data; int type; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); if (c == NULL || c->rec.ptr == NULL) return (0); if (fo == NULL) fo = stdout; tag = VSL_TAG(c->rec.ptr); vxid = VSL_ID(c->rec.ptr); len = VSL_LEN(c->rec.ptr); type = VSL_CLIENT(c->rec.ptr) ? 'c' : VSL_BACKEND(c->rec.ptr) ? 'b' : '-'; data = VSL_CDATA(c->rec.ptr); if (VSL_tagflags[tag] & SLT_F_BINARY) { VSL_PRINT(fo, "%10u %-14s %c \"", vxid, VSL_tags[tag], type); while (len-- > 0) { if (len == 0 && tag == SLT_Debug && *data == '\0') break; if (*data >= ' ' && *data <= '~') VSL_PRINT(fo, "%c", *data); else VSL_PRINT(fo, "%%%02x", (unsigned char)*data); data++; } VSL_PRINT(fo, "\"\n"); } else VSL_PRINT(fo, "%10u %-14s %c %.*s\n", vxid, VSL_tags[tag], type, (int)len, data); return (0); } int VSL_PrintTerse(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo) { enum VSL_tag_e tag; unsigned len; const char *data; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); if (c == NULL || c->rec.ptr == NULL) return (0); if (fo == NULL) fo = stdout; tag = VSL_TAG(c->rec.ptr); len = VSL_LEN(c->rec.ptr); data = VSL_CDATA(c->rec.ptr); if (VSL_tagflags[tag] & SLT_F_BINARY) { VSL_PRINT(fo, "%-14s \"", VSL_tags[tag]); while (len-- > 0) { if (len == 0 && tag == SLT_Debug && *data == '\0') break; if (*data >= ' ' && *data <= '~') VSL_PRINT(fo, "%c", *data); else VSL_PRINT(fo, "%%%02x", (unsigned char)*data); data++; } VSL_PRINT(fo, "\"\n"); } else VSL_PRINT(fo, "%-14s %.*s\n", VSL_tags[tag], (int)len, data); return (0); } int VSL_PrintAll(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo) { int i; if (c == NULL) return (0); while (1) { i = VSL_Next(c); if (i <= 0) return (i); if (!VSL_Match(vsl, c)) continue; i = VSL_Print(vsl, c, fo); if (i != 0) return (i); } } int __match_proto__(VSLQ_dispatch_f) VSL_PrintTransactions(struct VSL_data *vsl, struct VSL_transaction * const pt[], void *fo) { struct VSL_transaction *t; int i; int delim = 0; int verbose; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); if (fo == NULL) fo = stdout; if (pt[0] == NULL) return (0); for (t = pt[0]; t != NULL; t = *++pt) { if (vsl->c_opt || vsl->b_opt) { switch (t->type) { case VSL_t_req: if (!vsl->c_opt) continue; break; case VSL_t_bereq: if (!vsl->b_opt) continue; break; case VSL_t_raw: break; default: continue; } } verbose = 0; if (t->level == 0 || vsl->v_opt) verbose = 1; if (t->level) { /* Print header */ if (t->level > 3) VSL_PRINT(fo, "*%1.1u* ", t->level); else VSL_PRINT(fo, "%-3.*s ", t->level, "***"); VSL_PRINT(fo, "%*.s%-14s %*.s%-10u\n", verbose ? 10 + 1 : 0, " ", VSL_transactions[t->type], verbose ? 1 + 1 : 0, " ", t->vxid); delim = 1; } while (1) { /* Print records */ i = VSL_Next(t->c); if (i < 0) return (i); if (i == 0) break; if (!VSL_Match(vsl, t->c)) continue; if (t->level > 3) VSL_PRINT(fo, "-%1.1u- ", t->level); else if (t->level) VSL_PRINT(fo, "%-3.*s ", t->level, "---"); if (verbose) i = VSL_Print(vsl, t->c, fo); else i = VSL_PrintTerse(vsl, t->c, fo); if (i != 0) return (i); } } if (delim) VSL_PRINT(fo, "\n");; return (0); } FILE* VSL_WriteOpen(struct VSL_data *vsl, const char *name, int append, int unbuf) { const char head[] = VSL_FILE_ID; FILE* f; f = fopen(name, append ? "a" : "w"); if (f == NULL) { vsl_diag(vsl, "%s", strerror(errno)); return (NULL); } if (unbuf) setbuf(f, NULL); if (0 == ftell(f)) { if (fwrite(head, 1, sizeof head, f) != sizeof head) { vsl_diag(vsl, "%s", strerror(errno)); fclose(f); return (NULL); } } return (f); } int VSL_Write(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo) { size_t r; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); if (c == NULL || c->rec.ptr == NULL) return (0); if (fo == NULL) fo = stdout; r = fwrite(c->rec.ptr, sizeof *c->rec.ptr, VSL_NEXT(c->rec.ptr) - c->rec.ptr, fo); if (r == 0) return (-5); return (0); } int VSL_WriteAll(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo) { int i; if (c == NULL) return (0); while (1) { i = VSL_Next(c); if (i <= 0) return (i); if (!VSL_Match(vsl, c)) continue; i = VSL_Write(vsl, c, fo); if (i != 0) return (i); } } int __match_proto__(VSLQ_dispatch_f) VSL_WriteTransactions(struct VSL_data *vsl, struct VSL_transaction * const pt[], void *fo) { struct VSL_transaction *t; int i; if (pt == NULL) return (0); for (i = 0, t = pt[0]; i == 0 && t != NULL; t = *++pt) i = VSL_WriteAll(vsl, t->c, fo); return (i); } varnish-4.1.1/lib/libvarnishapi/vxp_fixed_token.c0000644000201500234410000000611612652366744017070 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ #include "config.h" #include #include #include "vqueue.h" #include "vre.h" #include "vxp.h" unsigned vxp_fixed_token(const char *p, const char **q) { switch (p[0]) { case '!': if (p[1] == '=' && (isword(p[1]) ? !isword(p[2]) : 1)) { *q = p + 2; return (T_NEQ); } if (p[1] == '~' && (isword(p[1]) ? !isword(p[2]) : 1)) { *q = p + 2; return (T_NOMATCH); } return (0); case '(': if ((isword(p[0]) ? !isword(p[1]) : 1)) { *q = p + 1; return ('('); } return (0); case ')': if ((isword(p[0]) ? !isword(p[1]) : 1)) { *q = p + 1; return (')'); } return (0); case ',': if ((isword(p[0]) ? !isword(p[1]) : 1)) { *q = p + 1; return (','); } return (0); case ':': if ((isword(p[0]) ? !isword(p[1]) : 1)) { *q = p + 1; return (':'); } return (0); case '<': if (p[1] == '=' && (isword(p[1]) ? !isword(p[2]) : 1)) { *q = p + 2; return (T_LEQ); } if ((isword(p[0]) ? !isword(p[1]) : 1)) { *q = p + 1; return ('<'); } return (0); case '=': if (p[1] == '=' && (isword(p[1]) ? !isword(p[2]) : 1)) { *q = p + 2; return (T_EQ); } return (0); case '>': if (p[1] == '=' && (isword(p[1]) ? !isword(p[2]) : 1)) { *q = p + 2; return (T_GEQ); } if ((isword(p[0]) ? !isword(p[1]) : 1)) { *q = p + 1; return ('>'); } return (0); case '[': if ((isword(p[0]) ? !isword(p[1]) : 1)) { *q = p + 1; return ('['); } return (0); case ']': if ((isword(p[0]) ? !isword(p[1]) : 1)) { *q = p + 1; return (']'); } return (0); case 'a': if (p[1] == 'n' && p[2] == 'd' && (isword(p[2]) ? !isword(p[3]) : 1)) { *q = p + 3; return (T_AND); } return (0); case 'e': if (p[1] == 'q' && (isword(p[1]) ? !isword(p[2]) : 1)) { *q = p + 2; return (T_SEQ); } return (0); case 'n': if (p[1] == 'o' && p[2] == 't' && (isword(p[2]) ? !isword(p[3]) : 1)) { *q = p + 3; return (T_NOT); } if (p[1] == 'e' && (isword(p[1]) ? !isword(p[2]) : 1)) { *q = p + 2; return (T_SNEQ); } return (0); case 'o': if (p[1] == 'r' && (isword(p[1]) ? !isword(p[2]) : 1)) { *q = p + 2; return (T_OR); } return (0); case '{': if ((isword(p[0]) ? !isword(p[1]) : 1)) { *q = p + 1; return ('{'); } return (0); case '}': if ((isword(p[0]) ? !isword(p[1]) : 1)) { *q = p + 1; return ('}'); } return (0); case '~': if ((isword(p[0]) ? !isword(p[1]) : 1)) { *q = p + 1; return ('~'); } return (0); default: return (0); } } const char * const vxp_tnames[256] = { ['('] = "'('", [')'] = "')'", [','] = "','", [':'] = "':'", ['<'] = "'<'", ['>'] = "'>'", ['['] = "'['", [']'] = "']'", ['{'] = "'{'", ['}'] = "'}'", ['~'] = "'~'", [EOI] = "EOI", [T_AND] = "and", [T_EQ] = "==", [T_GEQ] = ">=", [T_LEQ] = "<=", [T_NEQ] = "!=", [T_NOMATCH] = "!~", [T_NOT] = "not", [T_OR] = "or", [T_SEQ] = "eq", [T_SNEQ] = "ne", [T_TRUE] = "T_TRUE", [VAL] = "VAL", }; varnish-4.1.1/lib/libvarnish/0000755000201500234410000000000012652366756013115 500000000000000varnish-4.1.1/lib/libvarnish/vsha256.c0000644000201500234410000002227412652366721014376 00000000000000/*- * Copyright 2005 Colin Percival * All rights reserved. * * 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 THE 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. * * From: $FreeBSD: head/lib/libmd/sha256c.c 154479 2006-01-17 15:35:57Z phk $ */ #include "config.h" #if defined(HAVE_SYS_ENDIAN_H) # include # include # define VBYTE_ORDER _BYTE_ORDER # define VBIG_ENDIAN _BIG_ENDIAN #elif defined(HAVE_ENDIAN_H) # include # define VBYTE_ORDER __BYTE_ORDER # define VBIG_ENDIAN __BIG_ENDIAN #endif #include #include #include "vas.h" #include "vend.h" #include "vsha256.h" #if defined(VBYTE_ORDER) && VBYTE_ORDER == VBIG_ENDIAN /* Copy a vector of big-endian uint32_t into a vector of bytes */ #define be32enc_vect(dst, src, len) \ memcpy((void *)dst, (const void *)src, (size_t)len) /* Copy a vector of bytes into a vector of big-endian uint32_t */ #define be32dec_vect(dst, src, len) \ memcpy((void *)dst, (const void *)src, (size_t)len) #else /* BYTE_ORDER != BIG_ENDIAN or in doubt... */ /* * Encode a length len/4 vector of (uint32_t) into a length len vector of * (unsigned char) in big-endian form. Assumes len is a multiple of 4. */ static void be32enc_vect(unsigned char *dst, const uint32_t *src, size_t len) { size_t i; for (i = 0; i < len / 4; i++) vbe32enc(dst + i * 4, src[i]); } /* * Decode a big-endian length len vector of (unsigned char) into a length * len/4 vector of (uint32_t). Assumes len is a multiple of 4. */ static void be32dec_vect(uint32_t *dst, const unsigned char *src, size_t len) { size_t i; for (i = 0; i < len / 4; i++) dst[i] = vbe32dec(src + i * 4); } #endif /* Elementary functions used by SHA256 */ #define Ch(x, y, z) ((x & (y ^ z)) ^ z) #define Maj(x, y, z) ((x & (y | z)) | (y & z)) #define SHR(x, n) (x >> n) #define ROTR(x, n) ((x >> n) | (x << (32 - n))) #define S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) #define S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) #define s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3)) #define s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10)) /* SHA256 round function */ #define RND(a, b, c, d, e, f, g, h, k) \ t0 = h + S1(e) + Ch(e, f, g) + k; \ t1 = S0(a) + Maj(a, b, c); \ d += t0; \ h = t0 + t1; /* Adjusted round function for rotating state */ #define RNDr(S, W, i, k) \ RND(S[(64 - i) % 8], S[(65 - i) % 8], \ S[(66 - i) % 8], S[(67 - i) % 8], \ S[(68 - i) % 8], S[(69 - i) % 8], \ S[(70 - i) % 8], S[(71 - i) % 8], \ (W[i] + k)) /* * SHA256 block compression function. The 256-bit state is transformed via * the 512-bit input block to produce a new state. */ static void SHA256_Transform(uint32_t * state, const unsigned char block[64]) { uint32_t W[64]; uint32_t S[8]; uint32_t t0, t1; int i; /* 1. Prepare message schedule W. */ be32dec_vect(W, block, 64); for (i = 16; i < 64; i++) W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; /* 2. Initialize working variables. */ memcpy(S, state, 32); /* 3. Mix. */ RNDr(S, W, 0, 0x428a2f98); RNDr(S, W, 1, 0x71374491); RNDr(S, W, 2, 0xb5c0fbcf); RNDr(S, W, 3, 0xe9b5dba5); RNDr(S, W, 4, 0x3956c25b); RNDr(S, W, 5, 0x59f111f1); RNDr(S, W, 6, 0x923f82a4); RNDr(S, W, 7, 0xab1c5ed5); RNDr(S, W, 8, 0xd807aa98); RNDr(S, W, 9, 0x12835b01); RNDr(S, W, 10, 0x243185be); RNDr(S, W, 11, 0x550c7dc3); RNDr(S, W, 12, 0x72be5d74); RNDr(S, W, 13, 0x80deb1fe); RNDr(S, W, 14, 0x9bdc06a7); RNDr(S, W, 15, 0xc19bf174); RNDr(S, W, 16, 0xe49b69c1); RNDr(S, W, 17, 0xefbe4786); RNDr(S, W, 18, 0x0fc19dc6); RNDr(S, W, 19, 0x240ca1cc); RNDr(S, W, 20, 0x2de92c6f); RNDr(S, W, 21, 0x4a7484aa); RNDr(S, W, 22, 0x5cb0a9dc); RNDr(S, W, 23, 0x76f988da); RNDr(S, W, 24, 0x983e5152); RNDr(S, W, 25, 0xa831c66d); RNDr(S, W, 26, 0xb00327c8); RNDr(S, W, 27, 0xbf597fc7); RNDr(S, W, 28, 0xc6e00bf3); RNDr(S, W, 29, 0xd5a79147); RNDr(S, W, 30, 0x06ca6351); RNDr(S, W, 31, 0x14292967); RNDr(S, W, 32, 0x27b70a85); RNDr(S, W, 33, 0x2e1b2138); RNDr(S, W, 34, 0x4d2c6dfc); RNDr(S, W, 35, 0x53380d13); RNDr(S, W, 36, 0x650a7354); RNDr(S, W, 37, 0x766a0abb); RNDr(S, W, 38, 0x81c2c92e); RNDr(S, W, 39, 0x92722c85); RNDr(S, W, 40, 0xa2bfe8a1); RNDr(S, W, 41, 0xa81a664b); RNDr(S, W, 42, 0xc24b8b70); RNDr(S, W, 43, 0xc76c51a3); RNDr(S, W, 44, 0xd192e819); RNDr(S, W, 45, 0xd6990624); RNDr(S, W, 46, 0xf40e3585); RNDr(S, W, 47, 0x106aa070); RNDr(S, W, 48, 0x19a4c116); RNDr(S, W, 49, 0x1e376c08); RNDr(S, W, 50, 0x2748774c); RNDr(S, W, 51, 0x34b0bcb5); RNDr(S, W, 52, 0x391c0cb3); RNDr(S, W, 53, 0x4ed8aa4a); RNDr(S, W, 54, 0x5b9cca4f); RNDr(S, W, 55, 0x682e6ff3); RNDr(S, W, 56, 0x748f82ee); RNDr(S, W, 57, 0x78a5636f); RNDr(S, W, 58, 0x84c87814); RNDr(S, W, 59, 0x8cc70208); RNDr(S, W, 60, 0x90befffa); RNDr(S, W, 61, 0xa4506ceb); RNDr(S, W, 62, 0xbef9a3f7); RNDr(S, W, 63, 0xc67178f2); /* 4. Mix local working variables into global state */ for (i = 0; i < 8; i++) state[i] += S[i]; } static const unsigned char PAD[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* Add padding and terminating bit-count. */ static void SHA256_Pad(SHA256_CTX * ctx) { unsigned char len[8]; uint32_t r, plen; /* * Convert length to bits and encode as a vector of bytes * -- we do this now rather than later because the length * will change after we pad. */ vbe64enc(len, ctx->count << 3); /* Add 1--64 bytes so that the resulting length is 56 mod 64 */ r = ctx->count & 0x3f; plen = (r < 56) ? (56 - r) : (120 - r); SHA256_Update(ctx, PAD, (size_t)plen); /* Add the terminating bit-count */ SHA256_Update(ctx, len, 8); } /* SHA-256 initialization. Begins a SHA-256 operation. */ void SHA256_Init(SHA256_CTX * ctx) { /* Zero bits processed so far */ ctx->count = 0; /* Magic initialization constants */ ctx->state[0] = 0x6A09E667; ctx->state[1] = 0xBB67AE85; ctx->state[2] = 0x3C6EF372; ctx->state[3] = 0xA54FF53A; ctx->state[4] = 0x510E527F; ctx->state[5] = 0x9B05688C; ctx->state[6] = 0x1F83D9AB; ctx->state[7] = 0x5BE0CD19; } /* Add bytes into the hash */ void SHA256_Update(SHA256_CTX * ctx, const void *in, size_t len) { uint32_t r, l; const unsigned char *src = in; /* Number of bytes left in the buffer from previous updates */ r = ctx->count & 0x3f; while (len > 0) { l = 64 - r; if (l > len) l = len; memcpy(&ctx->buf[r], src, l); len -= l; src += l; ctx->count += l; r = ctx->count & 0x3f; if (r == 0) SHA256_Transform(ctx->state, ctx->buf); } } /* * SHA-256 finalization. Pads the input data, exports the hash value, * and clears the context state. */ void SHA256_Final(unsigned char digest[32], SHA256_CTX * ctx) { /* Add padding */ SHA256_Pad(ctx); /* Write the hash */ be32enc_vect(digest, ctx->state, 32); /* Clear the context state */ memset((void *)ctx, 0, sizeof(*ctx)); } /* * A few test-vectors, just in case */ static const struct sha256test { const char *input; const unsigned char output[32]; } sha256test[] = { { "", {0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55} }, { "message digest", {0xf7, 0x84, 0x6f, 0x55, 0xcf, 0x23, 0xe1, 0x4e, 0xeb, 0xea, 0xb5, 0xb4, 0xe1, 0x55, 0x0c, 0xad, 0x5b, 0x50, 0x9e, 0x33, 0x48, 0xfb, 0xc4, 0xef, 0xa3, 0xa1, 0x41, 0x3d, 0x39, 0x3c, 0xb6, 0x50} }, { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", {0xdb, 0x4b, 0xfc, 0xbd, 0x4d, 0xa0, 0xcd, 0x85, 0xa6, 0x0c, 0x3c, 0x37, 0xd3, 0xfb, 0xd8, 0x80, 0x5c, 0x77, 0xf1, 0x5f, 0xc6, 0xb1, 0xfd, 0xfe, 0x61, 0x4e, 0xe0, 0xa7, 0xc8, 0xfd, 0xb4, 0xc0} }, { NULL } }; void SHA256_Test(void) { struct SHA256Context c; const struct sha256test *p; unsigned char o[32]; for (p = sha256test; p->input != NULL; p++) { SHA256_Init(&c); SHA256_Update(&c, p->input, strlen(p->input)); SHA256_Final(o, &c); AZ(memcmp(o, p->output, 32)); } } varnish-4.1.1/lib/libvarnish/vrnd.c0000644000201500234410000000441612652366721014147 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Smørgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include #include #include "vas.h" #include "vrnd.h" #include "vtim.h" #include "vsha256.h" void VRND_Seed(void) { unsigned long seed; struct SHA256Context ctx; double d; pid_t p; unsigned char b[SHA256_LEN]; int fd; ssize_t sz; fd = open("/dev/urandom", O_RDONLY); if (fd < 0) fd = open("/dev/random", O_RDONLY); if (fd >= 0) { sz = read(fd, &seed, sizeof seed); AZ(close(fd)); if (sz == sizeof seed) { srandom(seed); return; } } SHA256_Init(&ctx); d = VTIM_mono(); SHA256_Update(&ctx, &d, sizeof d); d = VTIM_real(); SHA256_Update(&ctx, &d, sizeof d); p = getpid(); SHA256_Update(&ctx, &p, sizeof p); p = getppid(); SHA256_Update(&ctx, &p, sizeof p); SHA256_Final(b, &ctx); memcpy(&seed, b, sizeof seed); srandom(seed); } varnish-4.1.1/lib/libvarnish/vin.c0000644000201500234410000000542612652366721013774 00000000000000/*- * Copyright (c) 2007-2010 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Smørgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * XXX: NB: also used in libvarnishapi */ #include "config.h" #include #include #include #include #include #include #include "vsm_priv.h" #include "vas.h" #include "vdef.h" #include "vin.h" int VIN_N_Arg(const char *n_arg, char **name, char **dir, char **vsl) { char nm[PATH_MAX]; char dn[PATH_MAX]; /* First: determine the name */ if (n_arg == NULL || *n_arg == '\0') { if (gethostname(nm, sizeof nm) != 0) return (-1); } else if (strlen(n_arg) >= sizeof nm) { /* preliminary length check to avoid overflowing nm */ errno = ENAMETOOLONG; return (-1); } else bprintf(nm, "%s", n_arg); /* Second: find the directory name */ if (*nm == '/') strcpy(dn, nm); else if (strlen(VARNISH_STATE_DIR) + 1 + strlen(nm) >= sizeof dn){ /* preliminary length check to avoid overflowing dm */ errno = ENAMETOOLONG; return (-1); } else { bprintf(dn, "%s/%s", VARNISH_STATE_DIR, nm); } /* Definitive length check */ if (strlen(dn) + 1 + strlen(VSM_FILENAME) >= sizeof dn) { errno = ENAMETOOLONG; return (-1); } strcat(dn, "/"); if (name != NULL) { *name = strdup(nm); if (*name == NULL) return (-1); } if (dir != NULL) { *dir = strdup(dn); if (*dir == NULL) return (-1); } if (vsl != NULL) { bprintf(nm, "%s%s", dn, VSM_FILENAME); *vsl = strdup(nm); if (*vsl == NULL) return (-1); } return (0); } varnish-4.1.1/lib/libvarnish/vmb.c0000644000201500234410000000363412652366721013763 00000000000000/*- * Copyright (c) 2010 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. */ #include "config.h" #include #include #include "vas.h" #include "vmb.h" #ifdef VMB_NEEDS_PTHREAD_WORKAROUND_THIS_IS_BAD_FOR_PERFORMANCE static pthread_mutex_t mb_mtx; static pthread_once_t mb_mtx_once = PTHREAD_ONCE_INIT; static void vmb_init(void) { AZ(pthread_mutex_init(&mb_mtx, NULL)); } void vmb_pthread(void) { AZ(pthread_once(&mb_mtx_once, vmb_init)); AZ(pthread_mutex_lock(&mb_mtx)); AZ(pthread_mutex_unlock(&mb_mtx)); } #endif /* VMB_NEEDS_PTHREAD_WORKAROUND_THIS_IS_BAD_FOR_PERFORMANCE */ varnish-4.1.1/lib/libvarnish/cli_common.c0000644000201500234410000001174012652366721015313 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "vdef.h" #include "vas.h" #include "miniobj.h" #include "vcli.h" #include "vcli_common.h" #include "vcli_priv.h" #include "vsb.h" /*lint -e{818} cli could be const */ void VCLI_Out(struct cli *cli, const char *fmt, ...) { va_list ap; va_start(ap, fmt); if (cli != NULL) { CHECK_OBJ_NOTNULL(cli, CLI_MAGIC); if (VSB_len(cli->sb) < *cli->limit) (void)VSB_vprintf(cli->sb, fmt, ap); else if (cli->result == CLIS_OK) cli->result = CLIS_TRUNCATED; } else { (void)vfprintf(stdout, fmt, ap); } va_end(ap); } /*lint -e{818} cli could be const */ int VCLI_Overflow(struct cli *cli) { CHECK_OBJ_NOTNULL(cli, CLI_MAGIC); if (cli->result == CLIS_TRUNCATED || VSB_len(cli->sb) >= *cli->limit) return (1); return (0); } /*lint -e{818} cli could be const */ void VCLI_Quote(struct cli *cli, const char *s) { CHECK_OBJ_NOTNULL(cli, CLI_MAGIC); VSB_quote(cli->sb, s, -1, 0); } void VCLI_SetResult(struct cli *cli, unsigned res) { if (cli != NULL) { CHECK_OBJ_NOTNULL(cli, CLI_MAGIC); if (cli->result != CLIS_TRUNCATED || res != CLIS_OK) cli->result = res; /*lint !e64 type mismatch */ } else { printf("CLI result = %u\n", res); } } int VCLI_WriteResult(int fd, unsigned status, const char *result) { int i, l; struct iovec iov[3]; char nl[2] = "\n"; size_t len; char res[CLI_LINE0_LEN + 2]; /* * NUL + one more so we can catch * any misformats by snprintf */ assert(status >= 100); assert(status <= 999); /*lint !e650 const out of range */ len = strlen(result); i = snprintf(res, sizeof res, "%-3d %-8zd\n", status, len); assert(i == CLI_LINE0_LEN); assert(strtoul(res + 3, NULL, 10) == len); iov[0].iov_base = res; iov[0].iov_len = CLI_LINE0_LEN; iov[1].iov_base = (void*)(uintptr_t)result; /* TRUST ME */ iov[1].iov_len = len; iov[2].iov_base = nl; iov[2].iov_len = 1; for (l = i = 0; i < 3; i++) l += iov[i].iov_len; i = writev(fd, iov, 3); return (i != l); } static int read_tmo(int fd, char *ptr, unsigned len, double tmo) { int i, j, to; struct pollfd pfd; if (tmo > 0) to = (int)(tmo * 1e3); else to = -1; pfd.fd = fd; pfd.events = POLLIN; for (j = 0; len > 0; ) { i = poll(&pfd, 1, to); if (i == 0) { errno = ETIMEDOUT; return (-1); } i = read(fd, ptr, len); if (i < 0) return (i); if (i == 0) break; len -= i; ptr += i; j += i; } return (j); } int VCLI_ReadResult(int fd, unsigned *status, char **ptr, double tmo) { char res[CLI_LINE0_LEN]; /* For NUL */ int i, j; unsigned u, v, s; char *p = NULL; const char *err = "CLI communication error (hdr)"; if (status == NULL) status = &s; if (ptr != NULL) *ptr = NULL; do { i = read_tmo(fd, res, CLI_LINE0_LEN, tmo); if (i != CLI_LINE0_LEN) break; if (res[3] != ' ') break; if (res[CLI_LINE0_LEN - 1] != '\n') break; res[CLI_LINE0_LEN - 1] = '\0'; j = sscanf(res, "%u %u\n", &u, &v); if (j != 2) break; err = "CLI communication error (body)"; *status = u; p = malloc(v + 1L); if (p == NULL) break; i = read_tmo(fd, p, v + 1, tmo); if (i < 0) break; if (i != v + 1) break; if (p[v] != '\n') break; p[v] = '\0'; if (ptr == NULL) free(p); else *ptr = p; return (0); } while(0); if (p != NULL) free(p); *status = CLIS_COMMS; if (ptr != NULL) *ptr = strdup(err); return (*status); } varnish-4.1.1/lib/libvarnish/vnum.c0000644000201500234410000001613412652366721014163 00000000000000/*- * Copyright (c) 2008-2009 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. * * Deal with numbers with data storage suffix scaling */ #include "config.h" #include #include #include #include #include #include "vnum.h" #include "vas.h" static const char err_miss_num[] = "Missing number"; static const char err_invalid_num[] = "Invalid number"; static const char err_abs_req[] = "Absolute number required"; static const char err_invalid_suff[] = "Invalid suffix"; /********************************************************************** * Convert (all of!) a string to a floating point number, and if we can * not, return NAN. */ double VNUMpfx(const char *p, const char **t) { double m = 0., ee = 0.; double ms = 1.0; double es = 1.0, e = 1.0, ne = 0.0; AN(p); AN(t); *t = NULL; while (isspace(*p)) p++; if (*p == '-' || *p == '+') ms = (*p++ == '-' ? -1.0 : 1.0); for (; *p != '\0'; p++) { if (isdigit(*p)) { m = m * 10. + *p - '0'; e = ne; if (e) ne = e - 1.0; } else if (*p == '.' && ne == 0.0) { ne = -1.0; } else break; } if (e > 0.0) return(nan("")); // No digits if (*p == 'e' || *p == 'E') { p++; if (*p == '-' || *p == '+') es = (*p++ == '-' ? -1.0 : 1.0); if (!isdigit(*p)) return (nan("")); for (; isdigit(*p); p++) ee = ee * 10. + *p - '0'; } while (isspace(*p)) p++; if (*p != '\0') *t = p; return (ms * m * pow(10., e + es * ee)); } double VNUM(const char *p) { const char *t; double r; r = VNUMpfx(p, &t); if (t != NULL) r = nan(""); return (r); } /**********************************************************************/ const char * VNUM_2bytes(const char *p, uintmax_t *r, uintmax_t rel) { double fval; const char *end; if (p == NULL || *p == '\0') return (err_miss_num); fval = VNUMpfx(p, &end); if (isnan(fval)) return (err_invalid_num); if (end == NULL) { *r = (uintmax_t)fval; return (NULL); } if (end[0] == '%' && end[1] == '\0') { if (rel == 0) return (err_abs_req); fval *= rel / 100.0; } else { /* accept a space before the multiplier */ if (end[0] == ' ' && end[1] != '\0') ++end; switch (end[0]) { case 'k': case 'K': fval *= (uintmax_t)1 << 10; ++end; break; case 'm': case 'M': fval *= (uintmax_t)1 << 20; ++end; break; case 'g': case 'G': fval *= (uintmax_t)1 << 30; ++end; break; case 't': case 'T': fval *= (uintmax_t)1 << 40; ++end; break; case 'p': case 'P': fval *= (uintmax_t)1 << 50; ++end; break; case 'e': case 'E': fval *= (uintmax_t)1 << 60; ++end; break; default: break; } /* [bB] is a generic suffix of no effect */ if (end[0] == 'b' || end[0] == 'B') end++; if (end[0] != '\0') return (err_invalid_suff); } *r = (uintmax_t)round(fval); return (NULL); } #ifdef NUM_C_TEST /* Compile with: "cc -o foo -DNUM_C_TEST -I../.. -I../../include num.c -lm" */ static struct test_case { const char *str; uintmax_t rel; uintmax_t val; const char *err; } test_cases[] = { { "1", (uintmax_t)0, (uintmax_t)1 }, { "1B", (uintmax_t)0, (uintmax_t)1<<0 }, { "1 B", (uintmax_t)0, (uintmax_t)1<<0 }, { "1.3B", (uintmax_t)0, (uintmax_t)1 }, { "1.7B", (uintmax_t)0, (uintmax_t)2 }, { "1024", (uintmax_t)0, (uintmax_t)1024 }, { "1k", (uintmax_t)0, (uintmax_t)1<<10 }, { "1kB", (uintmax_t)0, (uintmax_t)1<<10 }, { "1.3kB", (uintmax_t)0, (uintmax_t)1331 }, { "1.7kB", (uintmax_t)0, (uintmax_t)1741 }, { "1048576", (uintmax_t)0, (uintmax_t)1048576 }, { "1M", (uintmax_t)0, (uintmax_t)1<<20 }, { "1MB", (uintmax_t)0, (uintmax_t)1<<20 }, { "1.3MB", (uintmax_t)0, (uintmax_t)1363149 }, { "1.7MB", (uintmax_t)0, (uintmax_t)1782579 }, { "1073741824", (uintmax_t)0, (uintmax_t)1073741824 }, { "1G", (uintmax_t)0, (uintmax_t)1<<30 }, { "1GB", (uintmax_t)0, (uintmax_t)1<<30 }, { "1.3GB", (uintmax_t)0, (uintmax_t)1395864371 }, { "1.7GB", (uintmax_t)0, (uintmax_t)1825361101 }, { "1099511627776", (uintmax_t)0, (uintmax_t)1099511627776ULL }, { "1T", (uintmax_t)0, (uintmax_t)1<<40 }, { "1TB", (uintmax_t)0, (uintmax_t)1<<40 }, { "1.3TB", (uintmax_t)0, (uintmax_t)1429365116109ULL }, { "1.7TB", (uintmax_t)0, (uintmax_t)1869169767219ULL }, { "1%", (uintmax_t)1024, (uintmax_t)10 }, { "2%", (uintmax_t)1024, (uintmax_t)20 }, { "3%", (uintmax_t)1024, (uintmax_t)31 }, /* Check the error checks */ { "", 0, 0, err_miss_num }, { "m", 0, 0, err_invalid_num }, { "4%", 0, 0, err_abs_req }, { "3*", 0, 0, err_invalid_suff }, /* TODO: add more */ { 0, 0, 0 }, }; const char *vec[] = { " 1", " 12", " 12.", " 12.3", " 12.34", " 12.34e-3", " 12.34e3", " 12.34e+3", " +12.34e-3", " -12.34e3", "N.", "N.12.", "N12..", "N12.,", "N12e,", "N12e+,", "N12ee,", "N1..2", "NA", "N1A", "Ne-3", NULL }; int main(int argc, char *argv[]) { int ec = 0; struct test_case *tc; uintmax_t val; const char **p; const char *e; double d1, d2; (void)argc; for (p = vec; *p != NULL; p++) { e = *p; d1 = VNUM(e + 1); if (*e == 'N') { if (!isnan(d1)) { ec++; printf("VNUM(%s) not NAN (%g)\n", e + 1, d1); } } else { d2 = atof(e + 1); if (isnan(d1)) { printf("VNUM(%s) is NAN (%g)\n", e + 1, d1); ec++; } else if (fabs((d1 - d2) / d2) > 1e-15) { printf("VNUM(%s) differs from atof() (%g)\n", e + 1, d1); ec++; } } } for (tc = test_cases; tc->str; ++tc) { e = VNUM_2bytes(tc->str, &val, tc->rel); if (e != tc->err) { printf("%s: VNUM_2bytes(\"%s\", %ju) (%s) != (%s)\n", *argv, tc->str, tc->rel, tc->err, e); ++ec; } else if (e == NULL && val != tc->val) { printf("%s: VNUM_2bytes(\"%s\", %ju) %ju != %ju (%s)\n", *argv, tc->str, tc->rel, val, tc->val, e); ++ec; } } /* TODO: test invalid strings */ if (!ec) printf("OK\n"); return (ec > 0); } #endif varnish-4.1.1/lib/libvarnish/Makefile.am0000644000201500234410000000156612652366721015071 00000000000000AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ @PCRE_CFLAGS@ AM_LDFLAGS = $(AM_LT_LDFLAGS) pkglib_LTLIBRARIES = libvarnish.la libvarnish_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version libvarnish_la_SOURCES = \ vav.c \ vas.c \ binary_heap.c \ vsub.c \ cli_auth.c \ cli_common.c \ cli_serve.c \ flopen.c \ vnum.c \ vtim.c \ vtcp.c \ vct.c \ version.c \ vev.c \ vfil.c \ vin.c \ vlu.c \ vmb.c \ vpf.c \ vre.c \ vrnd.c \ vsa.c \ vsb.c \ vsha256.c \ vss.c libvarnish_la_CFLAGS = -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM} @PCRE_LIBS@ if ENABLE_TESTS TESTS = vnum_c_test noinst_PROGRAMS = ${TESTS} vnum_c_test_SOURCES = vnum.c vas.c vnum_c_test_CFLAGS = -DNUM_C_TEST -include config.h vnum_c_test_LDADD = ${LIBM} test: ${TESTS} @for test in ${TESTS} ; do ./$${test} ; done endif varnish-4.1.1/lib/libvarnish/vfil.c0000644000201500234410000001656012652366721014141 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Smørgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_SYS_MOUNT_H # include # include #endif #ifdef HAVE_SYS_STATVFS_H # include #endif #ifdef HAVE_SYS_VFS_H # include #endif #if defined(__linux__) && defined(HAVE_FALLOCATE) # include #endif #include "vdef.h" #include "miniobj.h" #include "vas.h" #include "vsb.h" #include "vfil.h" #include "vqueue.h" static char * vfil_readfd(int fd, ssize_t *sz) { struct stat st; char *f; int i; AZ(fstat(fd, &st)); if (!S_ISREG(st.st_mode)) return (NULL); f = malloc(st.st_size + 1); assert(f != NULL); i = read(fd, f, st.st_size + 1); if (i != st.st_size) { free(f); return (NULL); } f[i] = '\0'; if (sz != NULL) *sz = st.st_size; return (f); } char * VFIL_readfile(const char *pfx, const char *fn, ssize_t *sz) { int fd, err; char *r; char fnb[PATH_MAX + 1]; if (fn[0] == '/') fd = open(fn, O_RDONLY); else if (pfx != NULL) { bprintf(fnb, "/%s/%s", pfx, fn); /* XXX: graceful length check */ fd = open(fnb, O_RDONLY); } else fd = open(fn, O_RDONLY); if (fd < 0) return (NULL); r = vfil_readfd(fd, sz); err = errno; AZ(close(fd)); errno = err; return (r); } int VFIL_nonblocking(int fd) { int i; i = fcntl(fd, F_GETFL); assert(i != -1); i |= O_NONBLOCK; i = fcntl(fd, F_SETFL, i); assert(i != -1); return (i); } /* * Get file system information from an fd * Returns block size, total size and space available in the passed pointers * Returns 0 on success, or -1 on failure with errno set */ int VFIL_fsinfo(int fd, unsigned *pbs, uintmax_t *psize, uintmax_t *pspace) { unsigned bs; uintmax_t size, space; #if defined(HAVE_SYS_STATVFS_H) struct statvfs fsst; if (fstatvfs(fd, &fsst)) return (-1); bs = fsst.f_frsize; size = fsst.f_blocks * fsst.f_frsize; space = fsst.f_bavail * fsst.f_frsize; #elif defined(HAVE_SYS_MOUNT_H) || defined(HAVE_SYS_VFS_H) struct statfs fsst; if (fstatfs(fd, &fsst)) return (-1); bs = fsst.f_bsize; size = fsst.f_blocks * fsst.f_bsize; space = fsst.f_bavail * fsst.f_bsize; #else #error no struct statfs / struct statvfs #endif if (pbs) *pbs = bs; if (psize) *psize = size; if (pspace) *pspace = space; return (0); } /* * Make sure that the file system can accommodate the file of the given * size. Will use fallocate if available. If fallocate is not available * and insist is true, it will write size zero bytes. * * Returns 0 on success, -1 on failure with errno set. */ int VFIL_allocate(int fd, off_t size, int insist) { struct stat st; uintmax_t fsspace; size_t l; ssize_t l2; char buf[64 * 1024]; if (ftruncate(fd, size)) return (-1); if (fstat(fd, &st)) return (-1); if (VFIL_fsinfo(fd, NULL, NULL, &fsspace)) return (-1); if ((st.st_blocks * 512) + fsspace < size) { /* Sum of currently allocated blocks and available space is less than requested size */ errno = ENOSPC; return (-1); } #if defined(__linux__) && defined(HAVE_FALLOCATE) { /* fallocate will for some filesystems (e.g. xfs) not take the already allocated blocks of the file into account. This will cause fallocate to report ENOSPC when called on an existing fully allocated file unless the filesystem has enough free space to accommodate the complete new file size. Because of this we enable fallocate only on filesystems that are known to work as we expect. */ struct statfs stfs; if (!fstatfs(fd, &stfs) && stfs.f_type == EXT4_SUPER_MAGIC) { if (!fallocate(fd, 0, 0, size)) return (0); if (errno == ENOSPC) return (-1); } } #endif if (!insist) return (0); /* Write size zero bytes to make sure the entire file is allocated in the file system */ memset(buf, 0, sizeof buf); assert(lseek(fd, 0, SEEK_SET) == 0); for (l = 0; l < size; l += l2) { l2 = sizeof buf; if (l + l2 > size) l2 = size - l; l2 = write(fd, buf, l2); if (l2 < 0) return (-1); } assert(lseek(fd, 0, SEEK_SET) == 0); return (0); } struct vfil_dir { unsigned magic; #define VFIL_DIR_MAGIC 0x3e214967 char *dir; VTAILQ_ENTRY(vfil_dir) list; }; struct vfil_path { unsigned magic; #define VFIL_PATH_MAGIC 0x92dbcc31 char *str; VTAILQ_HEAD(,vfil_dir) paths; }; /* * Path searching functions */ void VFIL_setpath(struct vfil_path **pp, const char *path) { struct vfil_path *vp; struct vfil_dir *vd; char *p, *q; AN(pp); AN(path); vp = *pp; if (vp == NULL) { ALLOC_OBJ(vp, VFIL_PATH_MAGIC); AN(vp); VTAILQ_INIT(&vp->paths); *pp = vp; } REPLACE(vp->str, path); while (!VTAILQ_EMPTY(&vp->paths)) { vd = VTAILQ_FIRST(&vp->paths); VTAILQ_REMOVE(&vp->paths, vd, list); FREE_OBJ(vd); } for (p = vp->str; p != NULL; p = q) { q = strchr(p, ':'); if (q != NULL) *q++ = '\0'; ALLOC_OBJ(vd, VFIL_DIR_MAGIC); AN(vd); vd->dir = p; VTAILQ_INSERT_TAIL(&vp->paths, vd, list); } } static int vfil_path_openfile(void *priv, const char *fn) { char *p, **pp; AN(priv); AN(fn); p = VFIL_readfile(NULL, fn, NULL); if (p == NULL) return (1); pp = priv; *pp = p; return (0); } int VFIL_searchpath(const struct vfil_path *vp, vfil_path_func_f *func, void *priv, const char *fni, char **fno) { struct vsb *vsb; struct vfil_dir *vd; int i, e; CHECK_OBJ_NOTNULL(vp, VFIL_PATH_MAGIC); AN(fno); *fno = NULL; if (func == NULL) { func = vfil_path_openfile; AN(priv); } if (*fni == '/') { i = func(priv, fni); if (i <= 0) REPLACE(*fno, fni); return (i); } vsb = VSB_new_auto(); AN(vsb); VTAILQ_FOREACH(vd, &vp->paths, list) { VSB_clear(vsb); VSB_printf(vsb, "%s/%s", vd->dir, fni); AZ(VSB_finish(vsb)); i = func(priv, VSB_data(vsb)); if (i <= 0) { e = errno; *fno = strdup(VSB_data(vsb)); AN(*fno); VSB_delete(vsb); errno = e; return (i); } } VSB_delete(vsb); return (-1); } varnish-4.1.1/lib/libvarnish/cli_serve.c0000644000201500234410000003024712652366721015152 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Stuff for handling the CLI protocol */ #include "config.h" #include #include #include #include #include #include #include #include #include #include "vdef.h" #include "vas.h" #include "miniobj.h" #include "vav.h" #include "vcli.h" #include "vcli_common.h" #include "vcli_priv.h" #include "vcli_serve.h" #include "vlu.h" #include "vqueue.h" #include "vsb.h" struct VCLS_func { unsigned magic; #define VCLS_FUNC_MAGIC 0x7d280c9b VTAILQ_ENTRY(VCLS_func) list; unsigned auth; struct cli_proto *clp; }; struct VCLS_fd { unsigned magic; #define VCLS_FD_MAGIC 0x010dbd1e VTAILQ_ENTRY(VCLS_fd) list; int fdi, fdo; struct VCLS *cls; struct cli *cli, clis; cls_cb_f *closefunc; void *priv; struct vsb *last_arg; int last_idx; char **argv; }; struct VCLS { unsigned magic; #define VCLS_MAGIC 0x60f044a3 VTAILQ_HEAD(,VCLS_fd) fds; unsigned nfd; VTAILQ_HEAD(,VCLS_func) funcs; cls_cbc_f *before, *after; volatile unsigned *maxlen; volatile unsigned *limit; }; /*--------------------------------------------------------------------*/ void VCLS_func_close(struct cli *cli, const char *const *av, void *priv) { (void)av; (void)priv; VCLI_Out(cli, "Closing CLI connection"); VCLI_SetResult(cli, CLIS_CLOSE); } /*--------------------------------------------------------------------*/ void VCLS_func_ping(struct cli *cli, const char * const *av, void *priv) { time_t t; (void)priv; (void)av; t = time(NULL); VCLI_Out(cli, "PONG %jd 1.0", (intmax_t)t); } /*--------------------------------------------------------------------*/ void VCLS_func_help(struct cli *cli, const char * const *av, void *priv) { struct cli_proto *cp; struct VCLS_func *cfn; unsigned all, debug, u, d, h, i, wc; struct VCLS *cs; (void)priv; cs = cli->cls; CHECK_OBJ_NOTNULL(cs, VCLS_MAGIC); if (av[2] == NULL) { all = debug = 0; } else if (!strcmp(av[2], "-a")) { all = 1; debug = 0; } else if (!strcmp(av[2], "-d")) { all = 0; debug = 1; } else { VTAILQ_FOREACH(cfn, &cs->funcs, list) { if (cfn->auth > cli->auth) continue; for (cp = cfn->clp; cp->request != NULL; cp++) { if (!strcmp(cp->request, av[2])) { VCLI_Out(cli, "%s\n%s\n", cp->syntax, cp->help); return; } for (u = 0; u < sizeof cp->flags; u++) { if (cp->flags[u] == '*') { cp->func(cli,av,priv); return; } } } } VCLI_Out(cli, "Unknown request.\nType 'help' for more info.\n"); VCLI_SetResult(cli, CLIS_UNKNOWN); return; } VTAILQ_FOREACH(cfn, &cs->funcs, list) { if (cfn->auth > cli->auth) continue; for (cp = cfn->clp; cp->request != NULL; cp++) { d = 0; h = 0; i = 0; wc = 0; for (u = 0; u < sizeof cp->flags; u++) { if (cp->flags[u] == '\0') continue; if (cp->flags[u] == 'd') d = 1; if (cp->flags[u] == 'h') h = 1; if (cp->flags[u] == 'i') i = 1; if (cp->flags[u] == '*') wc = 1; } if (i) continue; if (wc) { cp->func(cli, av, priv); continue; } if (debug != d) continue; if (h && !all) continue; if (cp->syntax != NULL) VCLI_Out(cli, "%s\n", cp->syntax); } } } /*-------------------------------------------------------------------- * Look for a CLI command to execute */ static int cls_dispatch(struct cli *cli, struct cli_proto *clp, char * const * av, unsigned ac) { struct cli_proto *cp; AN(av); for (cp = clp; cp->request != NULL; cp++) { if (!strcmp(av[1], cp->request)) break; if (!strcmp("*", cp->request)) break; } if (cp->request == NULL) return (0); if (cp->func == NULL) { VCLI_Out(cli, "Unimplemented\n"); VCLI_SetResult(cli, CLIS_UNIMPL); return(1); } if (ac - 1 < cp->minarg) { VCLI_Out(cli, "Too few parameters\n"); VCLI_SetResult(cli, CLIS_TOOFEW); return(1); } if (ac - 1> cp->maxarg) { VCLI_Out(cli, "Too many parameters\n"); VCLI_SetResult(cli, CLIS_TOOMANY); return(1); } cli->result = CLIS_OK; VSB_clear(cli->sb); cp->func(cli, (const char * const *)av, cp->priv); return (1); } /*-------------------------------------------------------------------- * We have collected a full cli line, parse it and execute, if possible. */ static int cls_vlu2(void *priv, char * const *av) { struct VCLS_fd *cfd; struct VCLS *cs; struct VCLS_func *cfn; struct cli *cli; unsigned na; ssize_t len; char *s; unsigned lim; const char *trunc = "!\n[response was truncated]\n"; CAST_OBJ_NOTNULL(cfd, priv, VCLS_FD_MAGIC); cs = cfd->cls; CHECK_OBJ_NOTNULL(cs, VCLS_MAGIC); cli = cfd->cli; CHECK_OBJ_NOTNULL(cli, CLI_MAGIC); AN(cli->cmd); cli->cls = cs; cli->result = CLIS_UNKNOWN; VSB_clear(cli->sb); VCLI_Out(cli, "Unknown request.\nType 'help' for more info.\n"); if (cs->before != NULL) cs->before(cli); do { if (av[0] != NULL) { VCLI_Out(cli, "Syntax Error: %s\n", av[0]); VCLI_SetResult(cli, CLIS_SYNTAX); break; } if (isupper(av[1][0])) { VCLI_Out(cli, "all commands are in lower-case.\n"); VCLI_SetResult(cli, CLIS_UNKNOWN); break; } if (!islower(av[1][0])) break; for (na = 0; av[na + 1] != NULL; na++) continue; VTAILQ_FOREACH(cfn, &cs->funcs, list) { if (cfn->auth > cli->auth) continue; if (cls_dispatch(cli, cfn->clp, av, na)) break; } } while (0); AZ(VSB_finish(cli->sb)); if (cs->after != NULL) cs->after(cli); cli->cls = NULL; s = VSB_data(cli->sb); len = VSB_len(cli->sb); lim = *cs->limit; if (len > lim) { if (cli->result == CLIS_OK) cli->result = CLIS_TRUNCATED; strcpy(s + (lim - strlen(trunc)), trunc); assert(strlen(s) <= lim); } if (VCLI_WriteResult(cfd->fdo, cli->result, s) || cli->result == CLIS_CLOSE) return (1); return (0); } static int cls_vlu(void *priv, const char *p) { struct VCLS_fd *cfd; struct cli *cli; int i; char **av; CAST_OBJ_NOTNULL(cfd, priv, VCLS_FD_MAGIC); AN(p); cli = cfd->cli; CHECK_OBJ_NOTNULL(cli, CLI_MAGIC); if (cfd->argv == NULL) { /* * Lines with only whitespace are simply ignored, in order * to not complicate CLI-client side scripts and TELNET users */ for (; isspace(*p); p++) continue; if (*p == '\0') return (0); REPLACE(cli->cmd, p); av = VAV_Parse(p, NULL, 0); AN(av); if (av[0] != NULL) { i = cls_vlu2(priv, av); VAV_Free(av); free(cli->cmd); cli->cmd = NULL; return (i); } for (i = 1; av[i] != NULL; i++) continue; if (i < 3 || cli->auth == 0 || strcmp(av[i - 2], "<<")) { i = cls_vlu2(priv, av); VAV_Free(av); free(cli->cmd); cli->cmd = NULL; return (i); } cfd->argv = av; cfd->last_idx = i - 2; cfd->last_arg = VSB_new_auto(); AN(cfd->last_arg); return (0); } else { AN(cfd->argv[cfd->last_idx]); AZ(strcmp(cfd->argv[cfd->last_idx], "<<")); AN(cfd->argv[cfd->last_idx + 1]); if (strcmp(p, cfd->argv[cfd->last_idx + 1])) { VSB_cat(cfd->last_arg, p); VSB_cat(cfd->last_arg, "\n"); return (0); } AZ(VSB_finish(cfd->last_arg)); free(cfd->argv[cfd->last_idx]); cfd->argv[cfd->last_idx] = NULL; free(cfd->argv[cfd->last_idx + 1]); cfd->argv[cfd->last_idx + 1] = NULL; cfd->argv[cfd->last_idx] = VSB_data(cfd->last_arg); i = cls_vlu2(priv, cfd->argv); cfd->argv[cfd->last_idx] = NULL; VAV_Free(cfd->argv); cfd->argv = NULL; free(cli->cmd); cli->cmd = NULL; VSB_delete(cfd->last_arg); cfd->last_arg = NULL; cfd->last_idx = 0; return (i); } } struct VCLS * VCLS_New(cls_cbc_f *before, cls_cbc_f *after, volatile unsigned *maxlen, volatile unsigned *limit) { struct VCLS *cs; ALLOC_OBJ(cs, VCLS_MAGIC); AN(cs); VTAILQ_INIT(&cs->fds); VTAILQ_INIT(&cs->funcs); cs->before = before; cs->after = after; cs->maxlen = maxlen; cs->limit = limit; return (cs); } struct cli * VCLS_AddFd(struct VCLS *cs, int fdi, int fdo, cls_cb_f *closefunc, void *priv) { struct VCLS_fd *cfd; CHECK_OBJ_NOTNULL(cs, VCLS_MAGIC); assert(fdi >= 0); assert(fdo >= 0); ALLOC_OBJ(cfd, VCLS_FD_MAGIC); AN(cfd); cfd->cls = cs; cfd->fdi = fdi; cfd->fdo = fdo; cfd->cli = &cfd->clis; cfd->cli->magic = CLI_MAGIC; cfd->cli->vlu = VLU_New(cfd, cls_vlu, *cs->maxlen); cfd->cli->sb = VSB_new_auto(); cfd->cli->limit = cs->limit; cfd->closefunc = closefunc; cfd->priv = priv; AN(cfd->cli->sb); VTAILQ_INSERT_TAIL(&cs->fds, cfd, list); cs->nfd++; return (cfd->cli); } static void cls_close_fd(struct VCLS *cs, struct VCLS_fd *cfd) { CHECK_OBJ_NOTNULL(cs, VCLS_MAGIC); CHECK_OBJ_NOTNULL(cfd, VCLS_FD_MAGIC); VTAILQ_REMOVE(&cs->fds, cfd, list); cs->nfd--; VLU_Destroy(cfd->cli->vlu); VSB_delete(cfd->cli->sb); if (cfd->closefunc == NULL) { (void)close(cfd->fdi); if (cfd->fdo != cfd->fdi) (void)close(cfd->fdo); } else { cfd->closefunc(cfd->priv); } if (cfd->cli->ident != NULL) free(cfd->cli->ident); FREE_OBJ(cfd); } int VCLS_AddFunc(struct VCLS *cs, unsigned auth, struct cli_proto *clp) { struct VCLS_func *cfn; CHECK_OBJ_NOTNULL(cs, VCLS_MAGIC); ALLOC_OBJ(cfn, VCLS_FUNC_MAGIC); AN(cfn); cfn->clp = clp; cfn->auth = auth; VTAILQ_INSERT_TAIL(&cs->funcs, cfn, list); return (0); } int VCLS_PollFd(struct VCLS *cs, int fd, int timeout) { struct VCLS_fd *cfd; struct pollfd pfd[1]; int i, j, k; CHECK_OBJ_NOTNULL(cs, VCLS_MAGIC); if (cs->nfd == 0) { errno = 0; return (-1); } assert(cs->nfd > 0); i = 0; VTAILQ_FOREACH(cfd, &cs->fds, list) { if (cfd->fdi != fd) continue; pfd[i].fd = cfd->fdi; pfd[i].events = POLLIN; pfd[i].revents = 0; i++; break; } assert(i == 1); CHECK_OBJ_NOTNULL(cfd, VCLS_FD_MAGIC); j = poll(pfd, 1, timeout); if (j <= 0) return (j); if (pfd[0].revents & POLLHUP) k = 1; else k = VLU_Fd(cfd->fdi, cfd->cli->vlu); if (k) cls_close_fd(cs, cfd); return (k); } int VCLS_Poll(struct VCLS *cs, int timeout) { struct VCLS_fd *cfd, *cfd2; int i, j, k; CHECK_OBJ_NOTNULL(cs, VCLS_MAGIC); if (cs->nfd == 0) { errno = 0; return (-1); } assert(cs->nfd > 0); { struct pollfd pfd[cs->nfd]; i = 0; VTAILQ_FOREACH(cfd, &cs->fds, list) { pfd[i].fd = cfd->fdi; pfd[i].events = POLLIN; pfd[i].revents = 0; i++; } assert(i == cs->nfd); j = poll(pfd, cs->nfd, timeout); if (j <= 0) return (j); i = 0; VTAILQ_FOREACH_SAFE(cfd, &cs->fds, list, cfd2) { assert(pfd[i].fd == cfd->fdi); if (pfd[i].revents & POLLHUP) k = 1; else k = VLU_Fd(cfd->fdi, cfd->cli->vlu); if (k) cls_close_fd(cs, cfd); i++; } assert(i == j); } return (j); } void VCLS_Destroy(struct VCLS **csp) { struct VCLS *cs; struct VCLS_fd *cfd, *cfd2; struct VCLS_func *cfn; cs = *csp; *csp = NULL; CHECK_OBJ_NOTNULL(cs, VCLS_MAGIC); VTAILQ_FOREACH_SAFE(cfd, &cs->fds, list, cfd2) cls_close_fd(cs, cfd); while (!VTAILQ_EMPTY(&cs->funcs)) { cfn = VTAILQ_FIRST(&cs->funcs); VTAILQ_REMOVE(&cs->funcs, cfn, list); FREE_OBJ(cfn); } FREE_OBJ(cs); } varnish-4.1.1/lib/libvarnish/vsub.c0000644000201500234410000001030312652366721014145 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Run stuff in a child process */ #include "config.h" #include #include #include #include #include #include #include #include "vas.h" #include "vdef.h" #include "vlu.h" #include "vsb.h" #include "vsub.h" struct vsub_priv { const char *name; struct vsb *sb; int lines; int maxlines; }; void VSUB_closefrom(int fd) { assert(fd >= 0); #ifdef HAVE_CLOSEFROM closefrom(fd); #else int i = sysconf(_SC_OPEN_MAX); assert(i > 0); for (; i > fd; i--) (void)close(i); #endif } static int vsub_vlu(void *priv, const char *str) { struct vsub_priv *sp; sp = priv; if (!sp->lines++) VSB_printf(sp->sb, "Message from %s:\n", sp->name); if (sp->maxlines < 0 || sp->lines <= sp->maxlines) VSB_printf(sp->sb, "%s\n", str); return (0); } /* returns an exit code */ unsigned VSUB_run(struct vsb *sb, vsub_func_f *func, void *priv, const char *name, int maxlines) { int rv, p[2], status; pid_t pid; struct vlu *vlu; struct vsub_priv sp; sp.sb = sb; sp.name = name; sp.lines = 0; sp.maxlines = maxlines; if (pipe(p) < 0) { VSB_printf(sb, "Starting %s: pipe() failed: %s", name, strerror(errno)); return (1); } assert(p[0] > STDERR_FILENO); assert(p[1] > STDERR_FILENO); if ((pid = fork()) < 0) { VSB_printf(sb, "Starting %s: fork() failed: %s", name, strerror(errno)); AZ(close(p[0])); AZ(close(p[1])); return (1); } if (pid == 0) { AZ(close(STDIN_FILENO)); assert(open("/dev/null", O_RDONLY) == STDIN_FILENO); assert(dup2(p[1], STDOUT_FILENO) == STDOUT_FILENO); assert(dup2(p[1], STDERR_FILENO) == STDERR_FILENO); /* Close all other fds */ VSUB_closefrom(STDERR_FILENO + 1); func(priv); /* * func should either exec or exit, so getting here should be * treated like an assertion failure - except that we don't know * if it's safe to trigger an actual assertion */ _exit(4); } AZ(close(p[1])); vlu = VLU_New(&sp, vsub_vlu, 0); while (!VLU_Fd(p[0], vlu)) continue; AZ(close(p[0])); VLU_Destroy(vlu); if (sp.maxlines >= 0 && sp.lines > sp.maxlines) VSB_printf(sb, "[%d lines truncated]\n", sp.lines - sp.maxlines); do { rv = waitpid(pid, &status, 0); if (rv < 0 && errno != EINTR) { VSB_printf(sb, "Running %s: waitpid() failed: %s\n", name, strerror(errno)); return (1); } } while (rv < 0); if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { rv = -1; VSB_printf(sb, "Running %s failed", name); if (WIFEXITED(status)) { rv = WEXITSTATUS(status); VSB_printf(sb, ", exited with %d", rv); } if (WIFSIGNALED(status)) { rv = 2; VSB_printf(sb, ", signal %d", WTERMSIG(status)); } if (WCOREDUMP(status)) VSB_printf(sb, ", core dumped"); VSB_printf(sb, "\n"); assert(rv != -1); return (rv); } return (0); } varnish-4.1.1/lib/libvarnish/version.c0000644000201500234410000000354612652366721014666 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Smørgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Display a standardized version message. */ #include "config.h" #include #include "vcs.h" #include "vcs_version.h" const char *VCS_version = PACKAGE_TARNAME "-" PACKAGE_VERSION " revision " VCS_Version; void VCS_Message(const char *progname) { fprintf(stderr, "%s (%s)\n", progname, VCS_version); fprintf(stderr, "Copyright (c) 2006 Verdens Gang AS\n"); fprintf(stderr, "Copyright (c) 2006-2015 Varnish Software AS\n"); } varnish-4.1.1/lib/libvarnish/Makefile.in0000644000201500234410000017141012652366727015104 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @ENABLE_TESTS_TRUE@TESTS = vnum_c_test$(EXEEXT) @ENABLE_TESTS_TRUE@noinst_PROGRAMS = $(am__EXEEXT_1) subdir = lib/libvarnish DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = libvarnish_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libvarnish_la_OBJECTS = libvarnish_la-vav.lo libvarnish_la-vas.lo \ libvarnish_la-binary_heap.lo libvarnish_la-vsub.lo \ libvarnish_la-cli_auth.lo libvarnish_la-cli_common.lo \ libvarnish_la-cli_serve.lo libvarnish_la-flopen.lo \ libvarnish_la-vnum.lo libvarnish_la-vtim.lo \ libvarnish_la-vtcp.lo libvarnish_la-vct.lo \ libvarnish_la-version.lo libvarnish_la-vev.lo \ libvarnish_la-vfil.lo libvarnish_la-vin.lo \ libvarnish_la-vlu.lo libvarnish_la-vmb.lo libvarnish_la-vpf.lo \ libvarnish_la-vre.lo libvarnish_la-vrnd.lo \ libvarnish_la-vsa.lo libvarnish_la-vsb.lo \ libvarnish_la-vsha256.lo libvarnish_la-vss.lo libvarnish_la_OBJECTS = $(am_libvarnish_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent libvarnish_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libvarnish_la_CFLAGS) \ $(CFLAGS) $(libvarnish_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_TESTS_TRUE@am__EXEEXT_1 = vnum_c_test$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) am__vnum_c_test_SOURCES_DIST = vnum.c vas.c @ENABLE_TESTS_TRUE@am_vnum_c_test_OBJECTS = \ @ENABLE_TESTS_TRUE@ vnum_c_test-vnum.$(OBJEXT) \ @ENABLE_TESTS_TRUE@ vnum_c_test-vas.$(OBJEXT) vnum_c_test_OBJECTS = $(am_vnum_c_test_OBJECTS) @ENABLE_TESTS_TRUE@vnum_c_test_DEPENDENCIES = $(am__DEPENDENCIES_1) vnum_c_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(vnum_c_test_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libvarnish_la_SOURCES) $(vnum_c_test_SOURCES) DIST_SOURCES = $(libvarnish_la_SOURCES) \ $(am__vnum_c_test_SOURCES_DIST) ETAGS = etags CTAGS = ctags # If stdout is a non-dumb tty, use colors. If test -t is not supported, # then this fails; a conservative approach. Of course do not redirect # stdout here, just stderr. am__tty_colors = \ red=; grn=; lgn=; blu=; std=; \ test "X$(AM_COLOR_TESTS)" != Xno \ && test "X$$TERM" != Xdumb \ && { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \ && { \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ std=''; \ } # Restructured Text title and section. am__rst_title = sed 's/.*/ & /;h;s/./=/g;p;x;p;g;p;s/.*//' am__rst_section = sed 'p;s/./=/g;p;g' # Put stdin (possibly several lines separated by ". ") in a box. # Prefix each line by 'col' and terminate each with 'std', for coloring. # Multi line coloring is problematic with "less -R", so we really need # to color each line individually. am__text_box = $(AWK) '{ \ n = split($$0, lines, "\\. "); max = 0; \ for (i = 1; i <= n; ++i) \ if (max < length(lines[i])) \ max = length(lines[i]); \ for (i = 0; i < max; ++i) \ line = line "="; \ print col line std; \ for (i = 1; i <= n; ++i) \ if (lines[i]) \ print col lines[i] std; \ print col line std; \ }' # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log, and passes # TESTS_ENVIRONMENT. Save and restore TERM around use of # TESTS_ENVIRONMENT, in case that unsets it. am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ srcdir=$(srcdir); export srcdir; \ rm -f $@-t; \ am__trap='rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st'; \ trap "st=129; $$am__trap" 1; trap "st=130; $$am__trap" 2; \ trap "st=141; $$am__trap" 13; trap "st=143; $$am__trap" 15; \ am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`; \ test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; __SAVED_TERM=$$TERM; \ $(TESTS_ENVIRONMENT) # To be appended to the command running the test. Handle the stdout # and stderr redirection, and catch the exit status. am__check_post = \ >$@-t 2>&1; \ estatus=$$?; \ if test -n '$(DISABLE_HARD_ERRORS)' \ && test $$estatus -eq 99; then \ estatus=1; \ fi; \ TERM=$$__SAVED_TERM; export TERM; \ $(am__tty_colors); \ xfailed=PASS; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ xfailed=XFAIL;; \ esac; \ case $$estatus.$$xfailed in \ 0.XFAIL) col=$$red; res=XPASS;; \ 0.*) col=$$grn; res=PASS ;; \ 77.*) col=$$blu; res=SKIP ;; \ 99.*) col=$$red; res=FAIL ;; \ *.XFAIL) col=$$lgn; res=XFAIL;; \ *.*) col=$$red; res=FAIL ;; \ esac; \ echo "$${col}$$res$${std}: $$f"; \ echo "$$res: $$f (exit: $$estatus)" | \ $(am__rst_section) >$@; \ cat $@-t >>$@; \ rm -f $@-t RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck check-html recheck-html TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) TEST_LOGS_TMP = $(TEST_LOGS:.log=.log-t) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ @PCRE_CFLAGS@ AM_LDFLAGS = $(AM_LT_LDFLAGS) pkglib_LTLIBRARIES = libvarnish.la libvarnish_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version libvarnish_la_SOURCES = \ vav.c \ vas.c \ binary_heap.c \ vsub.c \ cli_auth.c \ cli_common.c \ cli_serve.c \ flopen.c \ vnum.c \ vtim.c \ vtcp.c \ vct.c \ version.c \ vev.c \ vfil.c \ vin.c \ vlu.c \ vmb.c \ vpf.c \ vre.c \ vrnd.c \ vsa.c \ vsb.c \ vsha256.c \ vss.c libvarnish_la_CFLAGS = -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM} @PCRE_LIBS@ @ENABLE_TESTS_TRUE@vnum_c_test_SOURCES = vnum.c vas.c @ENABLE_TESTS_TRUE@vnum_c_test_CFLAGS = -DNUM_C_TEST -include config.h @ENABLE_TESTS_TRUE@vnum_c_test_LDADD = ${LIBM} all: all-am .SUFFIXES: .SUFFIXES: .c .html .lo .log .o .obj .test .test$(EXEEXT) $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/libvarnish/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/libvarnish/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libvarnish.la: $(libvarnish_la_OBJECTS) $(libvarnish_la_DEPENDENCIES) $(EXTRA_libvarnish_la_DEPENDENCIES) $(AM_V_CCLD)$(libvarnish_la_LINK) -rpath $(pkglibdir) $(libvarnish_la_OBJECTS) $(libvarnish_la_LIBADD) $(LIBS) clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list vnum_c_test$(EXEEXT): $(vnum_c_test_OBJECTS) $(vnum_c_test_DEPENDENCIES) $(EXTRA_vnum_c_test_DEPENDENCIES) @rm -f vnum_c_test$(EXEEXT) $(AM_V_CCLD)$(vnum_c_test_LINK) $(vnum_c_test_OBJECTS) $(vnum_c_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-binary_heap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-cli_auth.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-cli_common.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-cli_serve.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-flopen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vas.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vav.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vct.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-version.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vev.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vfil.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vlu.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vmb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vnum.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vpf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vre.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vrnd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vsa.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vsb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vsha256.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vss.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vsub.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vtcp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-vtim.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vnum_c_test-vas.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vnum_c_test-vnum.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< libvarnish_la-vav.lo: vav.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vav.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vav.Tpo -c -o libvarnish_la-vav.lo `test -f 'vav.c' || echo '$(srcdir)/'`vav.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vav.Tpo $(DEPDIR)/libvarnish_la-vav.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vav.c' object='libvarnish_la-vav.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vav.lo `test -f 'vav.c' || echo '$(srcdir)/'`vav.c libvarnish_la-vas.lo: vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vas.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vas.Tpo -c -o libvarnish_la-vas.lo `test -f 'vas.c' || echo '$(srcdir)/'`vas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vas.Tpo $(DEPDIR)/libvarnish_la-vas.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vas.c' object='libvarnish_la-vas.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vas.lo `test -f 'vas.c' || echo '$(srcdir)/'`vas.c libvarnish_la-binary_heap.lo: binary_heap.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-binary_heap.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-binary_heap.Tpo -c -o libvarnish_la-binary_heap.lo `test -f 'binary_heap.c' || echo '$(srcdir)/'`binary_heap.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-binary_heap.Tpo $(DEPDIR)/libvarnish_la-binary_heap.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='binary_heap.c' object='libvarnish_la-binary_heap.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-binary_heap.lo `test -f 'binary_heap.c' || echo '$(srcdir)/'`binary_heap.c libvarnish_la-vsub.lo: vsub.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vsub.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vsub.Tpo -c -o libvarnish_la-vsub.lo `test -f 'vsub.c' || echo '$(srcdir)/'`vsub.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vsub.Tpo $(DEPDIR)/libvarnish_la-vsub.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsub.c' object='libvarnish_la-vsub.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vsub.lo `test -f 'vsub.c' || echo '$(srcdir)/'`vsub.c libvarnish_la-cli_auth.lo: cli_auth.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-cli_auth.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-cli_auth.Tpo -c -o libvarnish_la-cli_auth.lo `test -f 'cli_auth.c' || echo '$(srcdir)/'`cli_auth.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-cli_auth.Tpo $(DEPDIR)/libvarnish_la-cli_auth.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cli_auth.c' object='libvarnish_la-cli_auth.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-cli_auth.lo `test -f 'cli_auth.c' || echo '$(srcdir)/'`cli_auth.c libvarnish_la-cli_common.lo: cli_common.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-cli_common.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-cli_common.Tpo -c -o libvarnish_la-cli_common.lo `test -f 'cli_common.c' || echo '$(srcdir)/'`cli_common.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-cli_common.Tpo $(DEPDIR)/libvarnish_la-cli_common.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cli_common.c' object='libvarnish_la-cli_common.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-cli_common.lo `test -f 'cli_common.c' || echo '$(srcdir)/'`cli_common.c libvarnish_la-cli_serve.lo: cli_serve.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-cli_serve.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-cli_serve.Tpo -c -o libvarnish_la-cli_serve.lo `test -f 'cli_serve.c' || echo '$(srcdir)/'`cli_serve.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-cli_serve.Tpo $(DEPDIR)/libvarnish_la-cli_serve.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cli_serve.c' object='libvarnish_la-cli_serve.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-cli_serve.lo `test -f 'cli_serve.c' || echo '$(srcdir)/'`cli_serve.c libvarnish_la-flopen.lo: flopen.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-flopen.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-flopen.Tpo -c -o libvarnish_la-flopen.lo `test -f 'flopen.c' || echo '$(srcdir)/'`flopen.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-flopen.Tpo $(DEPDIR)/libvarnish_la-flopen.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='flopen.c' object='libvarnish_la-flopen.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-flopen.lo `test -f 'flopen.c' || echo '$(srcdir)/'`flopen.c libvarnish_la-vnum.lo: vnum.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vnum.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vnum.Tpo -c -o libvarnish_la-vnum.lo `test -f 'vnum.c' || echo '$(srcdir)/'`vnum.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vnum.Tpo $(DEPDIR)/libvarnish_la-vnum.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vnum.c' object='libvarnish_la-vnum.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vnum.lo `test -f 'vnum.c' || echo '$(srcdir)/'`vnum.c libvarnish_la-vtim.lo: vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vtim.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vtim.Tpo -c -o libvarnish_la-vtim.lo `test -f 'vtim.c' || echo '$(srcdir)/'`vtim.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vtim.Tpo $(DEPDIR)/libvarnish_la-vtim.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtim.c' object='libvarnish_la-vtim.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vtim.lo `test -f 'vtim.c' || echo '$(srcdir)/'`vtim.c libvarnish_la-vtcp.lo: vtcp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vtcp.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vtcp.Tpo -c -o libvarnish_la-vtcp.lo `test -f 'vtcp.c' || echo '$(srcdir)/'`vtcp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vtcp.Tpo $(DEPDIR)/libvarnish_la-vtcp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtcp.c' object='libvarnish_la-vtcp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vtcp.lo `test -f 'vtcp.c' || echo '$(srcdir)/'`vtcp.c libvarnish_la-vct.lo: vct.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vct.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vct.Tpo -c -o libvarnish_la-vct.lo `test -f 'vct.c' || echo '$(srcdir)/'`vct.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vct.Tpo $(DEPDIR)/libvarnish_la-vct.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vct.c' object='libvarnish_la-vct.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vct.lo `test -f 'vct.c' || echo '$(srcdir)/'`vct.c libvarnish_la-version.lo: version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-version.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-version.Tpo -c -o libvarnish_la-version.lo `test -f 'version.c' || echo '$(srcdir)/'`version.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-version.Tpo $(DEPDIR)/libvarnish_la-version.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='version.c' object='libvarnish_la-version.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-version.lo `test -f 'version.c' || echo '$(srcdir)/'`version.c libvarnish_la-vev.lo: vev.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vev.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vev.Tpo -c -o libvarnish_la-vev.lo `test -f 'vev.c' || echo '$(srcdir)/'`vev.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vev.Tpo $(DEPDIR)/libvarnish_la-vev.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vev.c' object='libvarnish_la-vev.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vev.lo `test -f 'vev.c' || echo '$(srcdir)/'`vev.c libvarnish_la-vfil.lo: vfil.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vfil.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vfil.Tpo -c -o libvarnish_la-vfil.lo `test -f 'vfil.c' || echo '$(srcdir)/'`vfil.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vfil.Tpo $(DEPDIR)/libvarnish_la-vfil.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vfil.c' object='libvarnish_la-vfil.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vfil.lo `test -f 'vfil.c' || echo '$(srcdir)/'`vfil.c libvarnish_la-vin.lo: vin.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vin.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vin.Tpo -c -o libvarnish_la-vin.lo `test -f 'vin.c' || echo '$(srcdir)/'`vin.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vin.Tpo $(DEPDIR)/libvarnish_la-vin.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vin.c' object='libvarnish_la-vin.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vin.lo `test -f 'vin.c' || echo '$(srcdir)/'`vin.c libvarnish_la-vlu.lo: vlu.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vlu.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vlu.Tpo -c -o libvarnish_la-vlu.lo `test -f 'vlu.c' || echo '$(srcdir)/'`vlu.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vlu.Tpo $(DEPDIR)/libvarnish_la-vlu.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vlu.c' object='libvarnish_la-vlu.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vlu.lo `test -f 'vlu.c' || echo '$(srcdir)/'`vlu.c libvarnish_la-vmb.lo: vmb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vmb.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vmb.Tpo -c -o libvarnish_la-vmb.lo `test -f 'vmb.c' || echo '$(srcdir)/'`vmb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vmb.Tpo $(DEPDIR)/libvarnish_la-vmb.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vmb.c' object='libvarnish_la-vmb.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vmb.lo `test -f 'vmb.c' || echo '$(srcdir)/'`vmb.c libvarnish_la-vpf.lo: vpf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vpf.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vpf.Tpo -c -o libvarnish_la-vpf.lo `test -f 'vpf.c' || echo '$(srcdir)/'`vpf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vpf.Tpo $(DEPDIR)/libvarnish_la-vpf.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vpf.c' object='libvarnish_la-vpf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vpf.lo `test -f 'vpf.c' || echo '$(srcdir)/'`vpf.c libvarnish_la-vre.lo: vre.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vre.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vre.Tpo -c -o libvarnish_la-vre.lo `test -f 'vre.c' || echo '$(srcdir)/'`vre.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vre.Tpo $(DEPDIR)/libvarnish_la-vre.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vre.c' object='libvarnish_la-vre.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vre.lo `test -f 'vre.c' || echo '$(srcdir)/'`vre.c libvarnish_la-vrnd.lo: vrnd.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vrnd.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vrnd.Tpo -c -o libvarnish_la-vrnd.lo `test -f 'vrnd.c' || echo '$(srcdir)/'`vrnd.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vrnd.Tpo $(DEPDIR)/libvarnish_la-vrnd.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vrnd.c' object='libvarnish_la-vrnd.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vrnd.lo `test -f 'vrnd.c' || echo '$(srcdir)/'`vrnd.c libvarnish_la-vsa.lo: vsa.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vsa.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vsa.Tpo -c -o libvarnish_la-vsa.lo `test -f 'vsa.c' || echo '$(srcdir)/'`vsa.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vsa.Tpo $(DEPDIR)/libvarnish_la-vsa.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsa.c' object='libvarnish_la-vsa.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vsa.lo `test -f 'vsa.c' || echo '$(srcdir)/'`vsa.c libvarnish_la-vsb.lo: vsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vsb.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vsb.Tpo -c -o libvarnish_la-vsb.lo `test -f 'vsb.c' || echo '$(srcdir)/'`vsb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vsb.Tpo $(DEPDIR)/libvarnish_la-vsb.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsb.c' object='libvarnish_la-vsb.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vsb.lo `test -f 'vsb.c' || echo '$(srcdir)/'`vsb.c libvarnish_la-vsha256.lo: vsha256.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vsha256.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vsha256.Tpo -c -o libvarnish_la-vsha256.lo `test -f 'vsha256.c' || echo '$(srcdir)/'`vsha256.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vsha256.Tpo $(DEPDIR)/libvarnish_la-vsha256.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vsha256.c' object='libvarnish_la-vsha256.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vsha256.lo `test -f 'vsha256.c' || echo '$(srcdir)/'`vsha256.c libvarnish_la-vss.lo: vss.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -MT libvarnish_la-vss.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vss.Tpo -c -o libvarnish_la-vss.lo `test -f 'vss.c' || echo '$(srcdir)/'`vss.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vss.Tpo $(DEPDIR)/libvarnish_la-vss.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vss.c' object='libvarnish_la-vss.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvarnish_la_CFLAGS) $(CFLAGS) -c -o libvarnish_la-vss.lo `test -f 'vss.c' || echo '$(srcdir)/'`vss.c vnum_c_test-vnum.o: vnum.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vnum_c_test_CFLAGS) $(CFLAGS) -MT vnum_c_test-vnum.o -MD -MP -MF $(DEPDIR)/vnum_c_test-vnum.Tpo -c -o vnum_c_test-vnum.o `test -f 'vnum.c' || echo '$(srcdir)/'`vnum.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vnum_c_test-vnum.Tpo $(DEPDIR)/vnum_c_test-vnum.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vnum.c' object='vnum_c_test-vnum.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vnum_c_test_CFLAGS) $(CFLAGS) -c -o vnum_c_test-vnum.o `test -f 'vnum.c' || echo '$(srcdir)/'`vnum.c vnum_c_test-vnum.obj: vnum.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vnum_c_test_CFLAGS) $(CFLAGS) -MT vnum_c_test-vnum.obj -MD -MP -MF $(DEPDIR)/vnum_c_test-vnum.Tpo -c -o vnum_c_test-vnum.obj `if test -f 'vnum.c'; then $(CYGPATH_W) 'vnum.c'; else $(CYGPATH_W) '$(srcdir)/vnum.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vnum_c_test-vnum.Tpo $(DEPDIR)/vnum_c_test-vnum.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vnum.c' object='vnum_c_test-vnum.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vnum_c_test_CFLAGS) $(CFLAGS) -c -o vnum_c_test-vnum.obj `if test -f 'vnum.c'; then $(CYGPATH_W) 'vnum.c'; else $(CYGPATH_W) '$(srcdir)/vnum.c'; fi` vnum_c_test-vas.o: vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vnum_c_test_CFLAGS) $(CFLAGS) -MT vnum_c_test-vas.o -MD -MP -MF $(DEPDIR)/vnum_c_test-vas.Tpo -c -o vnum_c_test-vas.o `test -f 'vas.c' || echo '$(srcdir)/'`vas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vnum_c_test-vas.Tpo $(DEPDIR)/vnum_c_test-vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vas.c' object='vnum_c_test-vas.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vnum_c_test_CFLAGS) $(CFLAGS) -c -o vnum_c_test-vas.o `test -f 'vas.c' || echo '$(srcdir)/'`vas.c vnum_c_test-vas.obj: vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vnum_c_test_CFLAGS) $(CFLAGS) -MT vnum_c_test-vas.obj -MD -MP -MF $(DEPDIR)/vnum_c_test-vas.Tpo -c -o vnum_c_test-vas.obj `if test -f 'vas.c'; then $(CYGPATH_W) 'vas.c'; else $(CYGPATH_W) '$(srcdir)/vas.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vnum_c_test-vas.Tpo $(DEPDIR)/vnum_c_test-vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vas.c' object='vnum_c_test-vas.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vnum_c_test_CFLAGS) $(CFLAGS) -c -o vnum_c_test-vas.obj `if test -f 'vas.c'; then $(CYGPATH_W) 'vas.c'; else $(CYGPATH_W) '$(srcdir)/vas.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__sh_e_setup); \ list='$(TEST_LOGS)'; \ results=`for f in $$list; do \ test -r $$f && read line < $$f && echo "$$line" \ || echo FAIL; \ done`; \ all=`echo "$$results" | sed '/^$$/d' | wc -l | sed -e 's/^[ ]*//'`; \ fail=`echo "$$results" | grep -c '^FAIL'`; \ pass=`echo "$$results" | grep -c '^PASS'`; \ skip=`echo "$$results" | grep -c '^SKIP'`; \ xfail=`echo "$$results" | grep -c '^XFAIL'`; \ xpass=`echo "$$results" | grep -c '^XPASS'`; \ failures=`expr $$fail + $$xpass`; \ all=`expr $$all - $$skip`; \ if test "$$all" -eq 1; then tests=test; All=; \ else tests=tests; All="All "; fi; \ case fail=$$fail:xpass=$$xpass:xfail=$$xfail in \ fail=0:xpass=0:xfail=0) \ msg="$$All$$all $$tests passed. "; \ exit=true;; \ fail=0:xpass=0:xfail=*) \ msg="$$All$$all $$tests behaved as expected"; \ if test "$$xfail" -eq 1; then xfailures=failure; \ else xfailures=failures; fi; \ msg="$$msg ($$xfail expected $$xfailures). "; \ exit=true;; \ fail=*:xpass=0:xfail=*) \ msg="$$fail of $$all $$tests failed. "; \ exit=false;; \ fail=*:xpass=*:xfail=*) \ msg="$$failures of $$all $$tests did not behave as expected"; \ if test "$$xpass" -eq 1; then xpasses=pass; \ else xpasses=passes; fi; \ msg="$$msg ($$xpass unexpected $$xpasses). "; \ exit=false;; \ *) \ echo >&2 "incorrect case"; exit 4;; \ esac; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ msg="$$msg($$skip test was not run). "; \ else \ msg="$$msg($$skip tests were not run). "; \ fi; \ fi; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ echo "$$msg"; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for f in $$list; do \ test -r $$f && read line < $$f || line=; \ case $$line in \ PASS:*|XFAIL:*);; \ *) echo; cat $$f;; \ esac; \ done; \ } >$(TEST_SUITE_LOG).tmp; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if test "$$failures" -ne 0; then \ msg="$${msg}See $(subdir)/$(TEST_SUITE_LOG). "; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ msg="$${msg}Please report to $(PACKAGE_BUGREPORT). "; \ fi; \ fi; \ test x"$$VERBOSE" = x || $$exit || cat $(TEST_SUITE_LOG); \ $(am__tty_colors); \ if $$exit; then \ col="$$grn"; \ else \ col="$$red"; \ fi; \ echo "$$msg" | $(am__text_box) "col=$$col" "std=$$std"; \ $$exit || exit 1 check-TESTS recheck: @if test $@ != recheck; then \ list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list; \ fi @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @list='' list2='$(TEST_LOGS)'; for f in $$list2; do \ test .log = $$f && continue; \ if test $@ = recheck; then \ test -f $$f || continue; \ if test -r $$f && read line < $$f; then \ case $$line in FAIL*|XPASS*) : ;; *) continue;; esac; \ fi; \ fi; \ if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \ done; \ if test $@ = recheck && test -n "$$list"; then \ echo "am--clean: ; rm -f $$list" \ | $(MAKE) $(AM_MAKEFLAGS) -f - am--clean || exit 1; \ fi; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list" recheck: am--mostlyclean-test-html: list='$(TEST_LOGS:.log=.html)'; test -z "$$list" || rm -f $$list rm -f $(TEST_SUITE_HTML) .log.html: @list='$(RST2HTML) $$RST2HTML rst2html rst2html.py'; \ for r2h in $$list; do \ if ($$r2h --version) >/dev/null 2>&1; then \ R2H=$$r2h; \ fi; \ done; \ if test -z "$$R2H"; then \ echo >&2 "cannot find rst2html, cannot create $@"; \ exit 2; \ fi; \ $$R2H $< >$@.tmp @mv $@.tmp $@ # Be sure to run check first, and then to convert the result. # Beware of concurrent executions. Run "check" not "check-TESTS", as # check-SCRIPTS and other dependencies are rebuilt by the former only. # And expect check to fail. check-html recheck-html: @target=`echo $@ | sed 's/-html$$//'`; \ rv=0; $(MAKE) $(AM_MAKEFLAGS) $$target || rv=$$?; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) TEST_LOGS= || exit 4; \ exit $$rv vnum_c_test.log: vnum_c_test$(EXEEXT) @p='vnum_c_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) .test.log: @p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS_TMP)" || rm -f $(TEST_LOGS_TMP) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ clean-pkglibLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: am--mostlyclean-test-html mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: check-am check-html install-am install-strip recheck-html .PHONY: CTAGS GTAGS all all-am am--mostlyclean-test-html check \ check-TESTS check-am check-html clean clean-generic \ clean-libtool clean-noinstPROGRAMS clean-pkglibLTLIBRARIES \ ctags distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-pkglibLTLIBRARIES install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am recheck recheck-html tags uninstall \ uninstall-am uninstall-pkglibLTLIBRARIES @ENABLE_TESTS_TRUE@test: ${TESTS} @ENABLE_TESTS_TRUE@ @for test in ${TESTS} ; do ./$${test} ; done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/lib/libvarnish/vtim.c0000644000201500234410000002770212652366721014160 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Semi-trivial functions to handle HTTP header timestamps according to * RFC 2616 section 3.3. * * We must parse four different formats: * 000000000011111111112222222222 * 012345678901234567890123456789 * ------------------------------ * "Sun, 06 Nov 1994 08:49:37 GMT" RFC822 & RFC1123 * "Sunday, 06-Nov-94 08:49:37 GMT" RFC850 * "Sun Nov 6 08:49:37 1994" ANSI-C asctime() * "1994-11-06T08:49:37" ISO 8601 * * And always output the RFC1123 format. * * So why are these functions hand-built ? * * Because the people behind POSIX were short-sighted morons who didn't think * anybody would ever need to deal with timestamps in multiple different * timezones at the same time -- for that matter, convert timestamps to * broken down UTC/GMT time. * * We could, and used to, get by by smashing our TZ variable to "UTC" but * that ruins the LOCALE for VMODs. * */ #include "config.h" #include #include #include #include #include #include #include #include "vas.h" #include "vtim.h" static const char * const weekday_name[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static const char * const more_weekday[] = { "day", "day", "sday", "nesday", "rsday", "day", "urday" }; static const char * const month_name[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; static const int days_in_month[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; static const int days_before_month[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; /* * Note on Solaris: for some reason, clock_gettime(CLOCK_MONOTONIC, &ts) is not * implemented in assembly, but falls into a syscall, while gethrtime() doesn't, * so we save a syscall by using gethrtime() if it is defined. */ double VTIM_mono(void) { #ifdef HAVE_GETHRTIME return (gethrtime() * 1e-9); #elif HAVE_CLOCK_GETTIME struct timespec ts; AZ(clock_gettime(CLOCK_MONOTONIC, &ts)); return (ts.tv_sec + 1e-9 * ts.tv_nsec); #else struct timeval tv; AZ(gettimeofday(&tv, NULL)); return (tv.tv_sec + 1e-6 * tv.tv_usec); #endif } double VTIM_real(void) { #ifdef HAVE_CLOCK_GETTIME struct timespec ts; AZ(clock_gettime(CLOCK_REALTIME, &ts)); return (ts.tv_sec + 1e-9 * ts.tv_nsec); #else struct timeval tv; AZ(gettimeofday(&tv, NULL)); return (tv.tv_sec + 1e-6 * tv.tv_usec); #endif } void VTIM_format(double t, char *p) { struct tm tm; time_t tt; tt = (time_t) t; (void)gmtime_r(&tt, &tm); AN(snprintf(p, VTIM_FORMAT_SIZE, "%s, %02d %s %4d %02d:%02d:%02d GMT", weekday_name[tm.tm_wday], tm.tm_mday, month_name[tm.tm_mon], tm.tm_year + 1900, tm.tm_hour, tm.tm_min, tm.tm_sec)); } #ifdef TEST_DRIVER #define FAIL() \ do { printf("\nFAIL <<%d>>\n", __LINE__); return (0); } while (0) #else #define FAIL() \ do { return (0); } while (0) #endif #define DIGIT(mult, fld) \ do { \ if (*p < '0' || *p > '9') \ FAIL(); \ fld += (*p - '0') * mult; \ p++; \ } while(0) #define MUSTBE(chr) \ do { \ if (*p != chr) \ FAIL(); \ p++; \ } while(0) #define WEEKDAY() \ do { \ int i; \ for(i = 0; i < 7; i++) { \ if (!memcmp(p, weekday_name[i], 3)) { \ weekday = i; \ break; \ } \ } \ if (i == 7) \ FAIL(); \ p += 3; \ } while(0) #define MONTH() \ do { \ int i; \ for(i = 0; i < 12; i++) { \ if (!memcmp(p, month_name[i], 3)) { \ month = i + 1; \ break; \ } \ } \ if (i == 12) \ FAIL(); \ p += 3; \ } while(0) #define TIMESTAMP() \ do { \ DIGIT(10, hour); \ DIGIT(1, hour); \ MUSTBE(':'); \ DIGIT(10, min); \ DIGIT(1, min); \ MUSTBE(':'); \ DIGIT(10, sec); \ DIGIT(1, sec); \ } while(0) double VTIM_parse(const char *p) { double t; int month = 0, year = 0, weekday = -1, mday = 0; int hour = 0, min = 0, sec = 0; int d, leap; while (*p == ' ') p++; if (*p >= '0' && *p <= '9') { /* ISO8601 -- "1994-11-06T08:49:37" */ DIGIT(1000, year); DIGIT(100, year); DIGIT(10, year); DIGIT(1, year); MUSTBE('-'); DIGIT(10, month); DIGIT(1, month); MUSTBE('-'); DIGIT(10, mday); DIGIT(1, mday); MUSTBE('T'); TIMESTAMP(); } else { WEEKDAY(); assert(weekday >= 0 && weekday <= 6); if (*p == ',') { /* RFC822 & RFC1123 - "Sun, 06 Nov 1994 08:49:37 GMT" */ p++; MUSTBE(' '); DIGIT(10, mday); DIGIT(1, mday); MUSTBE(' '); MONTH(); MUSTBE(' '); DIGIT(1000, year); DIGIT(100, year); DIGIT(10, year); DIGIT(1, year); MUSTBE(' '); TIMESTAMP(); MUSTBE(' '); MUSTBE('G'); MUSTBE('M'); MUSTBE('T'); } else if (*p == ' ') { /* ANSI-C asctime() -- "Sun Nov 6 08:49:37 1994" */ p++; MONTH(); MUSTBE(' '); if (*p != ' ') DIGIT(10, mday); else p++; DIGIT(1, mday); MUSTBE(' '); TIMESTAMP(); MUSTBE(' '); DIGIT(1000, year); DIGIT(100, year); DIGIT(10, year); DIGIT(1, year); } else if (!memcmp(p, more_weekday[weekday], strlen(more_weekday[weekday]))) { /* RFC850 -- "Sunday, 06-Nov-94 08:49:37 GMT" */ p += strlen(more_weekday[weekday]); MUSTBE(','); MUSTBE(' '); DIGIT(10, mday); DIGIT(1, mday); MUSTBE('-'); MONTH(); MUSTBE('-'); DIGIT(10, year); DIGIT(1, year); year += 1900; if (year < 1969) year += 100; MUSTBE(' '); TIMESTAMP(); MUSTBE(' '); MUSTBE('G'); MUSTBE('M'); MUSTBE('T'); } else FAIL(); } while (*p == ' ') p++; if (*p != '\0') FAIL(); if (sec < 0 || sec > 60) /* Leapseconds! */ FAIL(); if (min < 0 || min > 59) FAIL(); if (hour < 0 || hour > 23) FAIL(); if (month < 1 || month > 12) FAIL(); if (mday < 1 || mday > days_in_month[month - 1]) FAIL(); if (year < 1899) FAIL(); leap = ((year) % 4) == 0 && (((year) % 100) != 0 || ((year) % 400) == 0); if (month == 2 && mday > 28 && !leap) FAIL(); if (sec == 60) /* Ignore Leapseconds */ sec--; t = ((hour * 60.) + min) * 60. + sec; d = (mday - 1) + days_before_month[month - 1]; if (month > 2 && leap) d++; d += (year % 100) * 365; /* There are 365 days in a year */ if ((year % 100) > 0) /* And a leap day every four years */ d += (((year % 100) - 1) / 4); d += ((year / 100) - 20) * /* Days relative to y2000 */ (100 * 365 + 24); /* 24 leapdays per year in a century */ d += ((year - 1) / 400) - 4; /* And one more every 400 years */ /* * Now check weekday, if we have one. * 6 is because 2000-01-01 was a saturday. * 10000 is to make sure the modulus argument is always positive */ if (weekday != -1 && (d + 6 + 7 * 10000) % 7 != weekday) FAIL(); t += d * 86400.; t += 10957. * 86400.; /* 10957 days frm UNIX epoch to y2000 */ return (t); } void VTIM_sleep(double t) { #ifdef HAVE_NANOSLEEP struct timespec ts; ts = VTIM_timespec(t); (void)nanosleep(&ts, NULL); #else if (t >= 1.) { (void)sleep(floor(t)); t -= floor(t); } /* XXX: usleep() is not mandated to be thread safe */ t *= 1e6; if (t > 0) (void)usleep(floor(t)); #endif } struct timeval VTIM_timeval(double t) { struct timeval tv; tv.tv_sec = (time_t)trunc(t); tv.tv_usec = (int)(1e6 * (t - tv.tv_sec)); return (tv); } struct timespec VTIM_timespec(double t) { struct timespec tv; tv.tv_sec = (time_t)trunc(t); tv.tv_nsec = (int)(1e9 * (t - tv.tv_sec)); return (tv); } #ifdef TEST_DRIVER /********************************************************************** * Compile with: * cc -o foo -DTEST_DRIVER -I../.. -I../../include vtim.c vas.c -lm * Test with: * ./foo */ #include static void tst(const char *s, time_t good) { time_t t; char buf[BUFSIZ]; t = VTIM_parse(s); VTIM_format(t, buf); printf("%-30s -> %12jd -> %s\n", s, (intmax_t)t, buf); if (t != good) { printf("Parse error! Got: %jd should have %jd diff %jd\n", (intmax_t)t, (intmax_t)good, (intmax_t)(t - good)); exit(4); } } static int tst_delta_check(const char *name, double begin, double end, double ref) { const double tol_max = 1.1; const double tol_min = 1; printf("%s delta for %fs sleep: %f\n", name, ref, (end - begin)); if ((end - begin) > tol_max * ref) { printf("%s delta above tolerance: ((%f - %f) = %f) > %f\n", name, end, begin, (end - begin), tol_max); return (1); } else if ((end - begin) < tol_min * ref) { printf("%s delta below tolerance: ((%f - %f) = %f) < %f\n", name, end, begin, (end - begin), tol_min); return (1); } return (0); } static void tst_delta() { double m_begin, m_end; double r_begin, r_end; const double ref = 1; int err = 0; r_begin = VTIM_real(); m_begin = VTIM_mono(); VTIM_sleep(ref); r_end = VTIM_real(); m_end = VTIM_mono(); err += tst_delta_check("VTIM_mono", m_begin, m_end, ref); err += tst_delta_check("VTIM_real", r_begin, r_end, ref); if (err) { printf("%d time delta test errrors\n", err); exit(4); } } int main(int argc, char **argv) { time_t t; struct tm tm; double tt; char buf[BUFSIZ]; char buf1[BUFSIZ]; AZ(setenv("TZ", "UTC", 1)); assert(sizeof t >= 8); /* Brute force test against libc version */ for (t = -2209852800; t < 20000000000; t += 3599) { gmtime_r(&t, &tm); strftime(buf1, sizeof buf1, "%a, %d %b %Y %T GMT", &tm); VTIM_format(t, buf); if (strcmp(buf, buf1)) { printf("libc: <%s> Vtim <%s> %jd\n", buf1, buf, (intmax_t)t); exit(2); } tt = VTIM_parse(buf1); if (tt != t) { VTIM_format(tt, buf); printf(" fm: %12jd <%s>\n", (intmax_t)t, buf1); printf(" to: %12.0f <%s>\n", tt, buf); exit(2); } strftime(buf1, sizeof buf1, "%a %b %e %T %Y", &tm); tt = VTIM_parse(buf1); if (tt != t) { VTIM_format(tt, buf); printf(" fm: %12jd <%s>\n", (intmax_t)t, buf1); printf(" to: %12.0f <%s>\n", tt, buf); exit(2); } strftime(buf1, sizeof buf1, "%Y-%m-%dT%T", &tm); tt = VTIM_parse(buf1); if (tt != t) { VTIM_format(tt, buf); printf(" fm: %12jd <%s>\n", (intmax_t)t, buf1); printf(" to: %12.0f <%s>\n", tt, buf); exit(2); } if (tm.tm_year >= 69 && tm.tm_year < 169) { strftime(buf1, sizeof buf1, "%A, %d-%b-%y %T GMT", &tm); tt = VTIM_parse(buf1); if (tt != t) { VTIM_format(tt, buf); printf(" fm: %12jd <%s>\n", (intmax_t)t, buf1); printf(" to: %12.0f <%s>\n", tt, buf); exit(2); } } } /* Examples from RFC2616 section 3.3.1 */ tst("Sun, 06 Nov 1994 08:49:37 GMT", 784111777); tst("Sunday, 06-Nov-94 08:49:37 GMT", 784111777); tst("Sun Nov 6 08:49:37 1994", 784111777); tst("1994-11-06T08:49:37", 784111777); tst_delta(); return (0); } #endif varnish-4.1.1/lib/libvarnish/vas.c0000644000201500234410000000476112652366721013772 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2016 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. * * This is the default backend function for libvarnish' assert facilities. */ #include "config.h" #include #include #include #include #include "vas.h" static void __attribute__((__noreturn__)) VAS_Fail_default(const char *func, const char *file, int line, const char *cond, enum vas_e kind) { int err = errno; if (kind == VAS_MISSING) { fprintf(stderr, "Missing error handling code in %s(), %s line %d:\n" " Condition(%s) not true.\n", func, file, line, cond); } else if (kind == VAS_INCOMPLETE) { fprintf(stderr, "Incomplete code in %s(), %s line %d:\n", func, file, line); } else if (kind == VAS_WRONG) { fprintf(stderr, "Wrong turn in %s(), %s line %d: %s\n", func, file, line, cond); } else { fprintf(stderr, "Assert error in %s(), %s line %d:\n" " Condition(%s) not true.\n", func, file, line, cond); } if (err) fprintf(stderr, " errno = %d (%s)\n", err, strerror(err)); abort(); } vas_f *VAS_Fail __attribute__((__noreturn__)) = VAS_Fail_default; varnish-4.1.1/lib/libvarnish/flopen.c0000644000201500234410000000676212652366721014467 00000000000000/*- * Copyright (c) 2007 Dag-Erling Coïdan Smørgrav * All rights reserved. * * 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 * in this position and unchanged. * 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 THE 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. * Derived from: * $FreeBSD: head/lib/libutil/flopen.c 184094 2008-10-20 18:11:30Z des $ */ #include "config.h" #include #include #include #include #include #include #include "flopen.h" int flopen(const char *path, int flags, ...) { int fd, operation, serrno, trunc; struct flock lock; struct stat sb, fsb; mode_t mode; #ifdef O_EXLOCK flags &= ~O_EXLOCK; #endif mode = 0; if (flags & O_CREAT) { va_list ap; va_start(ap, flags); mode = (mode_t)va_arg(ap, int); /* mode_t promoted to int */ va_end(ap); } memset(&lock, 0, sizeof lock); lock.l_type = ((flags & O_ACCMODE) == O_RDONLY) ? F_RDLCK : F_WRLCK; lock.l_whence = SEEK_SET; operation = (flags & O_NONBLOCK) ? F_SETLK : F_SETLKW; trunc = (flags & O_TRUNC); flags &= ~O_TRUNC; for (;;) { if ((fd = open(path, flags, mode)) == -1) /* non-existent or no access */ return (-1); if (fcntl(fd, operation, &lock) == -1) { /* unsupported or interrupted */ serrno = errno; (void)close(fd); errno = serrno; return (-1); } if (stat(path, &sb) == -1) { /* disappeared from under our feet */ (void)close(fd); continue; } if (fstat(fd, &fsb) == -1) { /* can't happen [tm] */ serrno = errno; (void)close(fd); errno = serrno; return (-1); } if (sb.st_dev != fsb.st_dev || sb.st_ino != fsb.st_ino) { /* changed under our feet */ (void)close(fd); continue; } if (trunc && ftruncate(fd, 0) != 0) { /* can't happen [tm] */ serrno = errno; (void)close(fd); errno = serrno; return (-1); } return (fd); } } /* Tests if the given fd is locked through flopen * If pid is non-NULL, stores the pid of the process holding the lock there * Returns 1 if the file is locked * Returns 0 if the file is unlocked * Returns -1 on error (and errno) */ int fltest(int fd, pid_t *pid) { struct flock lock; memset(&lock, 0, sizeof lock); lock.l_type = F_WRLCK; lock.l_whence = SEEK_SET; if (fcntl(fd, F_GETLK, &lock) == -1) return (-1); if (lock.l_type == F_UNLCK) return (0); if (pid != NULL) *pid = lock.l_pid; return (1); } varnish-4.1.1/lib/libvarnish/vlu.c0000644000201500234410000000560612652366721014006 00000000000000/*- * Copyright (c) 2005-2008 Poul-Henning Kamp * All rights reserved. * * 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. * * Functions for assembling a bytestream into text-lines and calling * a function on each. */ #include "config.h" #include #include #include #include #include "miniobj.h" #include "vas.h" #include "vlu.h" struct vlu { unsigned magic; #define LINEUP_MAGIC 0x8286661 char *buf; unsigned bufl; unsigned bufp; void *priv; vlu_f *func; }; struct vlu * VLU_New(void *priv, vlu_f *func, unsigned bufsize) { struct vlu *l; if (bufsize == 0) bufsize = BUFSIZ; ALLOC_OBJ(l, LINEUP_MAGIC); if (l != NULL) { l->func = func; l->priv = priv; l->bufl = bufsize - 1; l->buf = malloc(l->bufl + 1L); if (l->buf == NULL) { FREE_OBJ(l); l = NULL; } } return (l); } void VLU_Destroy(struct vlu *l) { CHECK_OBJ_NOTNULL(l, LINEUP_MAGIC); free(l->buf); FREE_OBJ(l); } static int LineUpProcess(struct vlu *l) { char *p, *q; int i; l->buf[l->bufp] = '\0'; for (p = l->buf; *p != '\0'; p = q) { /* Find first CR or NL */ for (q = p; *q != '\0'; q++) { if (*q == '\n' || *q == '\r') break; } if (*q == '\0') break; *q++ = '\0'; i = l->func(l->priv, p); if (i != 0) return (i); } if (*p != '\0') { q = strchr(p, '\0'); assert(q != NULL); l->bufp = (unsigned)(q - p); memmove(l->buf, p, l->bufp); l->buf[l->bufp] = '\0'; } else l->bufp = 0; return (0); } int VLU_Fd(int fd, struct vlu *l) { int i; CHECK_OBJ_NOTNULL(l, LINEUP_MAGIC); i = read(fd, l->buf + l->bufp, l->bufl - l->bufp); if (i <= 0) return (-1); l->bufp += i; return (LineUpProcess(l)); } varnish-4.1.1/lib/libvarnish/vsb.c0000644000201500234410000002725712652366721014000 00000000000000/*- * Copyright (c) 2000-2008 Poul-Henning Kamp * Copyright (c) 2000-2008 Dag-Erling Coïdan Smørgrav * All rights reserved. * * 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 * in this position and unchanged. * 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 THE 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. __FBSDID("$FreeBSD: head/sys/kern/subr_vsb.c 222004 2011-05-17 06:36:32Z phk $") */ #include "config.h" #include #include #include #include #include #include #include "vdef.h" #include "vas.h" #include "vsb.h" #define KASSERT(e, m) assert(e) #define SBMALLOC(size) malloc(size) #define SBFREE(buf) free(buf) #define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ /* * Predicates */ #define VSB_ISDYNAMIC(s) ((s)->s_flags & VSB_DYNAMIC) #define VSB_ISDYNSTRUCT(s) ((s)->s_flags & VSB_DYNSTRUCT) #define VSB_HASROOM(s) ((s)->s_len < (s)->s_size - 1) #define VSB_FREESPACE(s) ((s)->s_size - ((s)->s_len + 1)) #define VSB_CANEXTEND(s) ((s)->s_flags & VSB_AUTOEXTEND) /* * Set / clear flags */ #define VSB_SETFLAG(s, f) do { (s)->s_flags |= (f); } while (0) #define VSB_CLEARFLAG(s, f) do { (s)->s_flags &= ~(f); } while (0) #define VSB_MINEXTENDSIZE 16 /* Should be power of 2. */ #ifdef PAGE_SIZE #define VSB_MAXEXTENDSIZE PAGE_SIZE #define VSB_MAXEXTENDINCR PAGE_SIZE #else #define VSB_MAXEXTENDSIZE 4096 #define VSB_MAXEXTENDINCR 4096 #endif /* * Debugging support */ #if !defined(NDEBUG) static void _assert_VSB_integrity(const char *fun, const struct vsb *s) { (void)fun; (void)s; KASSERT(s != NULL, ("%s called with a NULL 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, ("wrote past end of vsb (%d >= %d)", s->s_len, s->s_size)); } static void _assert_VSB_state(const char *fun, const struct vsb *s, int state) { (void)fun; (void)s; (void)state; KASSERT((s->s_flags & VSB_FINISHED) == state, ("%s called with %sfinished or corrupt vsb", fun, (state ? "un" : ""))); } #define assert_VSB_integrity(s) _assert_VSB_integrity(__func__, (s)) #define assert_VSB_state(s, i) _assert_VSB_state(__func__, (s), (i)) #else #define assert_VSB_integrity(s) do { } while (0) #define assert_VSB_state(s, i) do { } while (0) #endif #ifdef CTASSERT CTASSERT(powerof2(VSB_MAXEXTENDSIZE)); CTASSERT(powerof2(VSB_MAXEXTENDINCR)); #endif static int VSB_extendsize(int size) { int newsize; if (size < (int)VSB_MAXEXTENDSIZE) { newsize = VSB_MINEXTENDSIZE; while (newsize < size) newsize *= 2; } else { newsize = roundup2(size, VSB_MAXEXTENDINCR); } KASSERT(newsize >= size, ("%s: %d < %d\n", __func__, newsize, size)); return (newsize); } /* * Extend an vsb. */ static int VSB_extend(struct vsb *s, int addlen) { char *newbuf; int newsize; if (!VSB_CANEXTEND(s)) return (-1); newsize = VSB_extendsize(s->s_size + addlen); if (VSB_ISDYNAMIC(s)) newbuf = realloc(s->s_buf, newsize); else newbuf = SBMALLOC(newsize); if (newbuf == NULL) return (-1); if (!VSB_ISDYNAMIC(s)) { memcpy(newbuf, s->s_buf, s->s_size); VSB_SETFLAG(s, VSB_DYNAMIC); } s->s_buf = newbuf; s->s_size = newsize; return (0); } static void _vsb_indent(struct vsb *s) { if (s->s_indent == 0 || s->s_error != 0 || (s->s_len > 0 && s->s_buf[s->s_len - 1] != '\n')) return; if (VSB_FREESPACE(s) <= s->s_indent && VSB_extend(s, s->s_indent) < 0) { s->s_error = ENOMEM; return; } memset(s->s_buf + s->s_len, ' ', s->s_indent); s->s_len += s->s_indent; } /* * Initialize the internals of an vsb. * If buf is non-NULL, it points to a static or already-allocated string * big enough to hold at least length characters. */ static struct vsb * VSB_newbuf(struct vsb *s, char *buf, int length, int flags) { memset(s, 0, sizeof(*s)); s->magic = VSB_MAGIC; s->s_flags = flags; s->s_size = length; s->s_buf = buf; if ((s->s_flags & VSB_AUTOEXTEND) == 0) { KASSERT(s->s_size > 1, ("attempt to create a too small vsb")); } if (s->s_buf != NULL) return (s); if ((flags & VSB_AUTOEXTEND) != 0) s->s_size = VSB_extendsize(s->s_size); s->s_buf = SBMALLOC(s->s_size); if (s->s_buf == NULL) return (NULL); VSB_SETFLAG(s, VSB_DYNAMIC); return (s); } /* * Initialize an vsb. * If buf is non-NULL, it points to a static or already-allocated string * big enough to hold at least length characters. */ struct vsb * VSB_new(struct vsb *s, char *buf, int length, int flags) { KASSERT(length >= 0, ("attempt to create an vsb of negative length (%d)", length)); KASSERT((flags & ~VSB_USRFLAGMSK) == 0, ("%s called with invalid flags", __func__)); flags &= VSB_USRFLAGMSK; if (s != NULL) return (VSB_newbuf(s, buf, length, flags)); s = SBMALLOC(sizeof(*s)); if (s == NULL) return (NULL); if (VSB_newbuf(s, buf, length, flags) == NULL) { SBFREE(s); return (NULL); } VSB_SETFLAG(s, VSB_DYNSTRUCT); return (s); } /* * Clear an vsb and reset its position. */ void VSB_clear(struct vsb *s) { assert_VSB_integrity(s); /* don't care if it's finished or not */ VSB_CLEARFLAG(s, VSB_FINISHED); s->s_error = 0; s->s_len = 0; s->s_indent = 0; } /* * Append a byte to an vsb. This is the core function for appending * to an vsb and is the main place that deals with extending the * buffer and marking overflow. */ static void VSB_put_byte(struct vsb *s, int c) { assert_VSB_integrity(s); assert_VSB_state(s, 0); if (s->s_error != 0) return; _vsb_indent(s); if (VSB_FREESPACE(s) <= 0) { if (VSB_extend(s, 1) < 0) s->s_error = ENOMEM; if (s->s_error != 0) return; } s->s_buf[s->s_len++] = (char)c; } /* * Append a byte string to an vsb. */ int VSB_bcat(struct vsb *s, const void *buf, ssize_t len) { assert_VSB_integrity(s); assert_VSB_state(s, 0); assert(len >= 0); if (s->s_error != 0) return (-1); if (len == 0) return (0); _vsb_indent(s); if (len > VSB_FREESPACE(s)) { if (VSB_extend(s, len - VSB_FREESPACE(s)) < 0) s->s_error = ENOMEM; if (s->s_error != 0) return (-1); } memcpy(s->s_buf + s->s_len, buf, len); s->s_len += len; return (0); } /* * Append a string to an vsb. */ int VSB_cat(struct vsb *s, const char *str) { assert_VSB_integrity(s); assert_VSB_state(s, 0); if (s->s_error != 0) return (-1); while (*str != '\0') { VSB_put_byte(s, *str++); if (s->s_error != 0) return (-1); } return (0); } /* * Format the given argument list and append the resulting string to an vsb. */ int VSB_vprintf(struct vsb *s, const char *fmt, va_list ap) { va_list ap_copy; int len; assert_VSB_integrity(s); assert_VSB_state(s, 0); KASSERT(fmt != NULL, ("%s called with a NULL format string", __func__)); if (s->s_error != 0) return (-1); _vsb_indent(s); /* * For the moment, there is no way to get vsnprintf(3) to hand * back a character at a time, to push everything into * VSB_putc_func() as was done for the kernel. * * In userspace, while drains are useful, there's generally * not a problem attempting to malloc(3) on out of space. So * expand a userland vsb if there is not enough room for the * data produced by VSB_[v]printf(3). */ do { va_copy(ap_copy, ap); len = vsnprintf(&s->s_buf[s->s_len], VSB_FREESPACE(s) + 1, fmt, ap_copy); if (len < 0) { s->s_error = errno; return (-1); } va_end(ap_copy); } while (len > VSB_FREESPACE(s) && VSB_extend(s, len - VSB_FREESPACE(s)) == 0); /* * s->s_len is the length of the string, without the terminating nul. * When updating s->s_len, we must subtract 1 from the length that * we passed into vsnprintf() because that length includes the * terminating nul. * * vsnprintf() returns the amount that would have been copied, * given sufficient space, so don't over-increment s_len. */ if (VSB_FREESPACE(s) < len) len = VSB_FREESPACE(s); s->s_len += len; if (!VSB_HASROOM(s) && !VSB_CANEXTEND(s)) s->s_error = ENOMEM; KASSERT(s->s_len < s->s_size, ("wrote past end of vsb (%d >= %d)", s->s_len, s->s_size)); if (s->s_error != 0) return (-1); return (0); } /* * Format the given arguments and append the resulting string to an vsb. */ int VSB_printf(struct vsb *s, const char *fmt, ...) { va_list ap; int result; va_start(ap, fmt); result = VSB_vprintf(s, fmt, ap); va_end(ap); return (result); } /* * Append a character to an vsb. */ int VSB_putc(struct vsb *s, int c) { VSB_put_byte(s, c); if (s->s_error != 0) return (-1); return (0); } /* * Check if an vsb has an error. */ int VSB_error(const struct vsb *s) { return (s->s_error); } /* * Finish off an vsb. */ int VSB_finish(struct vsb *s) { assert_VSB_integrity(s); assert_VSB_state(s, 0); s->s_buf[s->s_len] = '\0'; VSB_SETFLAG(s, VSB_FINISHED); errno = s->s_error; if (s->s_error) return (-1); return (0); } /* * Return a pointer to the vsb data. */ char * VSB_data(const struct vsb *s) { assert_VSB_integrity(s); assert_VSB_state(s, VSB_FINISHED); return (s->s_buf); } /* * Return the length of the vsb data. */ ssize_t VSB_len(const struct vsb *s) { assert_VSB_integrity(s); /* don't care if it's finished or not */ if (s->s_error != 0) return (-1); return (s->s_len); } /* * Clear an vsb, free its buffer if necessary. */ void VSB_delete(struct vsb *s) { int isdyn; assert_VSB_integrity(s); /* don't care if it's finished or not */ if (VSB_ISDYNAMIC(s)) SBFREE(s->s_buf); isdyn = VSB_ISDYNSTRUCT(s); memset(s, 0, sizeof(*s)); if (isdyn) SBFREE(s); } /* * Quote a string */ void VSB_quote(struct vsb *s, const char *p, int len, int how) { const char *q; int quote = 0; (void)how; /* For future enhancements */ if (len == -1) len = strlen(p); for (q = p; q < p + len; q++) { if (!isgraph(*q) || *q == '"' || *q == '\\') { quote++; break; } } if (!quote) { (void)VSB_bcat(s, p, len); return; } (void)VSB_putc(s, '"'); for (q = p; q < p + len; q++) { switch (*q) { case ' ': (void)VSB_putc(s, *q); break; case '\\': case '"': (void)VSB_putc(s, '\\'); (void)VSB_putc(s, *q); break; case '\n': if (how & VSB_QUOTE_NONL) (void)VSB_cat(s, "\n"); else (void)VSB_cat(s, "\\n"); break; case '\r': (void)VSB_cat(s, "\\r"); break; case '\t': (void)VSB_cat(s, "\\t"); break; default: if (isgraph(*q)) (void)VSB_putc(s, *q); else (void)VSB_printf(s, "\\%o", *q & 0xff); break; } } (void)VSB_putc(s, '"'); } /* * Indentation */ void VSB_indent(struct vsb * s, int i) { assert_VSB_integrity(s); if (s->s_indent + i < 0) s->s_error = EINVAL; else s->s_indent += i; } varnish-4.1.1/lib/libvarnish/vtcp.c0000644000201500234410000003056012652366721014151 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include #ifdef HAVE_SYS_FILIO_H # include #endif #include #ifdef __linux # include #endif #include #include #include #include #include #include #include #include #include "vdef.h" #include "vas.h" #include "vsa.h" #include "vss.h" #include "vtcp.h" /*--------------------------------------------------------------------*/ static void vtcp_sa_to_ascii(const void *sa, socklen_t l, char *abuf, unsigned alen, char *pbuf, unsigned plen) { int i; assert(abuf == NULL || alen > 0); assert(pbuf == NULL || plen > 0); i = getnameinfo(sa, l, abuf, alen, pbuf, plen, NI_NUMERICHOST | NI_NUMERICSERV); if (i) { /* * XXX this printf is shitty, but we may not have space * for the gai_strerror in the bufffer :-( */ printf("getnameinfo = %d %s\n", i, gai_strerror(i)); if (abuf != NULL) (void)snprintf(abuf, alen, "Conversion"); if (pbuf != NULL) (void)snprintf(pbuf, plen, "Failed"); return; } /* XXX dirty hack for v4-to-v6 mapped addresses */ if (abuf != NULL && strncmp(abuf, "::ffff:", 7) == 0) { for (i = 0; abuf[i + 7]; ++i) abuf[i] = abuf[i + 7]; abuf[i] = '\0'; } } /*--------------------------------------------------------------------*/ void VTCP_name(const struct suckaddr *addr, char *abuf, unsigned alen, char *pbuf, unsigned plen) { const struct sockaddr *sa; socklen_t sl; sa = VSA_Get_Sockaddr(addr, &sl); vtcp_sa_to_ascii(sa, sl, abuf, alen, pbuf, plen); } /*--------------------------------------------------------------------*/ struct suckaddr * VTCP_my_suckaddr(int sock) { struct sockaddr_storage addr_s; socklen_t l; l = sizeof addr_s; AZ(getsockname(sock, (void *)&addr_s, &l)); return (VSA_Malloc(&addr_s, l)); } /*--------------------------------------------------------------------*/ void VTCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen) { struct sockaddr_storage addr_s; socklen_t l; l = sizeof addr_s; AZ(getsockname(sock, (void *)&addr_s, &l)); vtcp_sa_to_ascii(&addr_s, l, abuf, alen, pbuf, plen); } /*--------------------------------------------------------------------*/ void VTCP_hisname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen) { struct sockaddr_storage addr_s; socklen_t l; l = sizeof addr_s; if (!getpeername(sock, (void*)&addr_s, &l)) vtcp_sa_to_ascii(&addr_s, l, abuf, alen, pbuf, plen); else { (void)snprintf(abuf, alen, ""); (void)snprintf(pbuf, plen, ""); } } /*--------------------------------------------------------------------*/ #ifdef HAVE_ACCEPT_FILTERS int VTCP_filter_http(int sock) { int retval; struct accept_filter_arg afa; memset(&afa, 0, sizeof(afa)); strcpy(afa.af_name, "httpready"); retval = setsockopt(sock, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof afa ); return (retval); } #elif defined(__linux) int VTCP_filter_http(int sock) { int retval; int defer = 1; retval = setsockopt(sock, SOL_TCP,TCP_DEFER_ACCEPT, &defer, sizeof defer); return (retval); } #else int VTCP_filter_http(int sock) { errno = EOPNOTSUPP; (void)sock; return (-1); } #endif /*-------------------------------------------------------------------- * Functions for controlling NONBLOCK mode. * * We use FIONBIO because it is cheaper than fcntl(2), which requires * us to do two syscalls, one to get and one to set, the latter of * which mucks about a bit before it ends up calling ioctl(FIONBIO), * at least on FreeBSD. */ int VTCP_blocking(int sock) { int i, j; i = 0; j = ioctl(sock, FIONBIO, &i); VTCP_Assert(j); return (j); } int VTCP_nonblocking(int sock) { int i, j; i = 1; j = ioctl(sock, FIONBIO, &i); VTCP_Assert(j); return (j); } /*-------------------------------------------------------------------- * On TCP a connect(2) can block for a looong time, and we don't want that. * Unfortunately, the SocketWizards back in those days were happy to wait * any amount of time for a connection, so the connect(2) syscall does not * take an argument for patience. * * There is a little used work-around, and we employ it at our peril. * */ int VTCP_connected(int s) { int k; socklen_t l; /* Find out if we got a connection */ l = sizeof k; AZ(getsockopt(s, SOL_SOCKET, SO_ERROR, &k, &l)); /* An error means no connection established */ errno = k; if (k) { AZ(close(s)); return (-1); } (void)VTCP_blocking(s); return (s); } int VTCP_connect(const struct suckaddr *name, int msec) { int s, i; struct pollfd fds[1]; const struct sockaddr *sa; socklen_t sl; if (name == NULL) return (-1); /* Attempt the connect */ AN(VSA_Sane(name)); sa = VSA_Get_Sockaddr(name, &sl); AN(sa); AN(sl); s = socket(sa->sa_family, SOCK_STREAM, 0); if (s < 0) return (s); /* Set the socket non-blocking */ if (msec != 0) (void)VTCP_nonblocking(s); i = connect(s, sa, sl); if (i == 0) return (s); if (errno != EINPROGRESS) { AZ(close(s)); return (-1); } if (msec < 0) { /* * Caller is responsible for waiting and * calling VTCP_connected */ return (s); } assert(msec > 0); /* Exercise our patience, polling for write */ fds[0].fd = s; fds[0].events = POLLWRNORM; fds[0].revents = 0; i = poll(fds, 1, msec); if (i == 0) { /* Timeout, close and give up */ AZ(close(s)); errno = ETIMEDOUT; return (-1); } return (VTCP_connected(s)); } /*-------------------------------------------------------------------- * When closing a TCP connection, a couple of errno's are legit, we * can't be held responsible for the other end wanting to talk to us. */ void VTCP_close(int *s) { int i; i = close(*s); assert(VTCP_Check(i)); *s = -1; } void VTCP_set_read_timeout(int s, double seconds) { #ifdef SO_RCVTIMEO_WORKS struct timeval timeout; timeout.tv_sec = (int)floor(seconds); timeout.tv_usec = (int)(1e6 * (seconds - timeout.tv_sec)); /* * Solaris bug (present at least in snv_151 and older): If this fails * with EINVAL, the socket is half-closed (SS_CANTSENDMORE) and the * timeout does not get set. Needs to be fixed in Solaris, there is * nothing we can do about this. */ VTCP_Assert(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout)); #else (void)s; (void)seconds; #endif } /*-------------------------------------------------------------------- */ static int __match_proto__(vss_resolved_f) vtcp_open_callback(void *priv, const struct suckaddr *sa) { double *p = priv; return (VTCP_connect(sa, (int)floor(*p * 1e3))); } int VTCP_open(const char *addr, const char *def_port, double timeout, const char **errp) { int error; const char *err; if (errp != NULL) *errp = NULL; assert(timeout >= 0); error = VSS_resolver(addr, def_port, vtcp_open_callback, &timeout, &err); if (err != NULL) { if (errp != NULL) *errp = err; return (-1); } return (error); } /*-------------------------------------------------------------------- * Given a struct suckaddr, open a socket of the appropriate type, and bind * it to the requested address. * * If the address is an IPv6 address, the IPV6_V6ONLY option is set to * avoid conflicts between INADDR_ANY and IN6ADDR_ANY. */ int VTCP_bind(const struct suckaddr *sa, const char **errp) { int sd, val, e; socklen_t sl; const struct sockaddr *so; int proto; if (errp != NULL) *errp = NULL; proto = VSA_Get_Proto(sa); sd = socket(proto, SOCK_STREAM, 0); if (sd < 0) { if (errp != NULL) *errp = "socket(2)"; return (-1); } val = 1; if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof val) != 0) { if (errp != NULL) *errp = "setsockopt(SO_REUSEADDR, 1)"; e = errno; AZ(close(sd)); errno = e; return (-1); } #ifdef IPV6_V6ONLY /* forcibly use separate sockets for IPv4 and IPv6 */ val = 1; if (proto == AF_INET6 && setsockopt(sd, IPPROTO_IPV6, IPV6_V6ONLY, &val, sizeof val) != 0) { if (errp != NULL) *errp = "setsockopt(IPV6_V6ONLY, 1)"; e = errno; AZ(close(sd)); errno = e; return (-1); } #endif so = VSA_Get_Sockaddr(sa, &sl); if (bind(sd, so, sl) != 0) { if (errp != NULL) *errp = "bind(2)"; e = errno; AZ(close(sd)); errno = e; return (-1); } return (sd); } /*-------------------------------------------------------------------- * Given a struct suckaddr, open a socket of the appropriate type, bind it * to the requested address, and start listening. */ int VTCP_listen(const struct suckaddr *sa, int depth, const char **errp) { int sd; int e; if (errp != NULL) *errp = NULL; sd = VTCP_bind(sa, errp); if (sd >= 0) { if (listen(sd, depth) != 0) { e = errno; AZ(close(sd)); errno = e; if (errp != NULL) *errp = "listen(2)"; return (-1); } } return (sd); } /*--------------------------------------------------------------------*/ struct helper { int depth; const char **errp; }; static int __match_proto__(vss_resolved_f) vtcp_lo_cb(void *priv, const struct suckaddr *sa) { int sock; struct helper *hp = priv; sock = VTCP_listen(sa, hp->depth, hp->errp); if (sock > 0) { *hp->errp = NULL; return (sock); } AN(*hp->errp); return (0); } int VTCP_listen_on(const char *addr, const char *def_port, int depth, const char **errp) { struct helper h; int sock; h.depth = depth; h.errp = errp; sock = VSS_resolver(addr, def_port, vtcp_lo_cb, &h, errp); if (*errp != NULL) return (-1); return(sock); } /*-------------------------------------------------------------------- * Set or reset SO_LINGER flag */ int VTCP_linger(int sock, int linger) { struct linger lin; int i; memset(&lin, 0, sizeof lin); lin.l_onoff = linger; i = setsockopt(sock, SOL_SOCKET, SO_LINGER, &lin, sizeof lin); VTCP_Assert(i); return (i); } /*-------------------------------------------------------------------- * Do a poll to check for remote HUP */ int VTCP_check_hup(int sock) { struct pollfd pfd; assert(sock > 0); pfd.fd = sock; pfd.events = POLLOUT; pfd.revents = 0; if (poll(&pfd, 1, 0) == 1 && pfd.revents & POLLHUP) return (1); return (0); } /*-------------------------------------------------------------------- * Check if a TCP syscall return value is fatal */ int VTCP_Check(int a) { if (a == 0) return (1); if (errno == ECONNRESET || errno == ENOTCONN) return (1); #if (defined (__SVR4) && defined (__sun)) || defined (__NetBSD__) /* * Solaris returns EINVAL if the other end unexpectedly reset the * connection. * This is a bug in Solaris and documented behaviour on NetBSD. */ if (errno == EINVAL || errno == ETIMEDOUT) return (1); #endif return (0); } /*-------------------------------------------------------------------- * */ int VTCP_read(int fd, void *ptr, size_t len, double tmo) { struct pollfd pfd[1]; int i, j; if (tmo > 0.0) { pfd[0].fd = fd; pfd[0].events = POLLIN; pfd[0].revents = 0; j = (int)floor(tmo * 1e3); if (j == 0) j++; j = poll(pfd, 1, j); if (j == 0) return (-2); } i = read(fd, ptr, len); return (i < 0 ? -1 : i); } varnish-4.1.1/lib/libvarnish/vsa.c0000644000201500234410000002434012652366721013765 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Struct sockaddr_* is not even close to a convenient API. * * These functions try to mitigate the madness, at the cost of actually * knowing something about address families. */ #include "config.h" #include #include #include #include #include "vas.h" #include "vsa.h" #include "vrt.h" #include "miniobj.h" /* * Struct sockaddr{|_in|_in6|_storage} is absolutely the worst data * structure I have ever seen gold-plated in international standards. * * Network addresses have multiple different forms, many fewer today * than in last century, but imagine that in addition to IPv4 and IPv6 * we had 40 other protocols. Actually, you don't need to imagine that * just count the AF_* macros in /usr/include/sys/socket.h. * * So what do we pass the kernel API for an address to bind(2), connect(2) & * listen(2) etc. etc ? * * We could define a struct which is big enough to hold any and all * of these addresses. That would make it a fixed size argument. * obviously the struct would have to be something like: * struct bla { * int family; * char address[MAX_ADDR_LEN]; * } * and MAX_ADDR_LEN would have to be quite large, 128 byte or so. * * Back in last century that was TOTALLY unacceptable waste of space. * * The way which was chosen instead, was to make a "generic" address, * and have per protocol "specific" addresses, and pass the length * argument explicitly to the KPI functions. * * The generic address was called "struct sockaddr", and the specific * were called "struct sockaddr_${whatever}". All of these must have * a "family" field as first element, so the kernel can figure out * which protocol it is. * * The generic struct sockaddr was made big enough for all protocols * supported in the kernel, so it would have different sizes depending * on your machine and kernel configuration. * * However, that allowed you to write protocol-agnostic programs, by * using "struct sockaddr" throughout, and relying on libray APIs for * things like name to address (and vice versa) resolution, and since * nobody were in the business of shipping random UNIX binaries around * the lack of binary portability didn't matter. * * Along the way the BSD people figured out that it was a bother * to carry the length argument separately, and added that to the * format of sockaddr, but other groups found this unclean, as * the length was already an explicit paramter. * * The net result of this is that your "portable" code, must take * care to handle the "sa_len" member on kernels which have it, * while still tracking the separate length argument for all other * kernels. * * Needless to say, there were no neat #define to tell you which * was which, so each programmer found a different heuristic to * decide, often not understanding it fully, which caused the kind * of portability issues which lead to the autocrap tools. * * Then all the other protocols died, we were left with IP and * life were good, the dot-com madness multiplied the IT-business * by a factor 1000, by making any high-school student who had * programmed PERL for 6 weeks a "senior web-programmer". * * Next IPv6 happened, in a rush even, (no seriously, I'm not kidding!), * and since IPv6 addresses were HUGE, like 16 bytes HUGE, the generic * struct sockaddr was not increased in size. * * At least "not yet", because it would break all the shitty code written * by the dot-com generation. * * Nobody used IPv6 anyway so that didn't matter that much. * * Then people actually started using IPv6 and its struct sockaddr_in6, * and realized that all the code which used "struct sockaddr" to allocate * space at compile time were broken. * * Some people took to using sockaddr_in6, since that was known to * be big enough for both IPv4 and IPv6, but "purist" found that * ugly and "prone to future trouble". * * So instead they came up with a "clean solution": The added * "struct sockaddr_storage" which is defined to be "Large enough * to accommodate all supported protocol-specific address structures". * * Since we cannot possibly know what zany protocols will exist in * the future, and since some people think that we will add future * protocols, while retaining ABI compatibility, (totally overlooking * the fact that no code for name-resolution supports that) it is * usually defined so it can cope with 128 byte addresses. * * Does that ring a bell ? * * Only, not quite: Remember that all APIs require you to track * the address and the length separately, so you only get the * size of the specific protocols sockaddr_${whatever} from API * functions, not a full sockaddr_storage, and besides the * prototype for the KPI is still "struct sockaddr *", so you * cannot gain C type-safety back by using sockaddr_storage * as the "generic network address" type. * * So we have come full circle, while causing maximum havoc along * the way and for the forseeable future. * * Do I need to tell you that static code analysis tools have a * really hard time coping with this, and that they give a lot of * false negatives which confuse people ? * * I have decided to try to contain this crap in this single * source-file, with only minimum leakage into the rest of Varnish, * which will only know of pointers to "struct suckaddr", the naming * of which is my of the historical narrative above. * * And you don't need to take my word for this, you can see it all * in various #include files on your own system. If you are on * a Solaris derivative, don't miss the beautiful horror hidden in the * variant definition of IPv6 addresses between kernel and userland. * */ struct suckaddr { unsigned magic; #define SUCKADDR_MAGIC 0x4b1e9335 union { struct sockaddr sa; struct sockaddr_in sa4; struct sockaddr_in6 sa6; }; }; const int vsa_suckaddr_len = sizeof(struct suckaddr); /* * This VRT interface is for the VCC generated ACL code, which needs * to know the address family and a pointer to the actual address. */ int VRT_VSA_GetPtr(const struct suckaddr *sua, const unsigned char ** dst) { AN(dst); if (sua == NULL) return (-1); CHECK_OBJ_NOTNULL(sua, SUCKADDR_MAGIC); switch(sua->sa.sa_family) { case PF_INET: assert(sua->sa.sa_family == sua->sa4.sin_family); *dst = (const unsigned char *)&sua->sa4.sin_addr; return (sua->sa4.sin_family); case PF_INET6: assert(sua->sa.sa_family == sua->sa6.sin6_family); *dst = (const unsigned char *)&sua->sa6.sin6_addr; return (sua->sa6.sin6_family); default: *dst = NULL; return (-1); } } /* * Malloc a suckaddr from a sockaddr of some kind. */ struct suckaddr * VSA_Malloc(const void *s, unsigned sal) { struct suckaddr *sua = NULL; const struct sockaddr *sa = s; unsigned l = 0; AN(s); switch(sa->sa_family) { case PF_INET: if (sal == sizeof sua->sa4) l = sal; break; case PF_INET6: if (sal == sizeof sua->sa6) l = sal; break; default: break; } if (l != 0) { ALLOC_OBJ(sua, SUCKADDR_MAGIC); if (sua != NULL) memcpy(&sua->sa, s, l); } return (sua); } /* 'd' SHALL point to vsa_suckaddr_len aligned bytes of storage */ struct suckaddr * VSA_Build(void *d, const void *s, unsigned sal) { struct suckaddr *sua = d; const struct sockaddr *sa = s; unsigned l = 0; AN(d); AN(s); switch(sa->sa_family) { case PF_INET: if (sal == sizeof sua->sa4) l = sal; break; case PF_INET6: if (sal == sizeof sua->sa6) l = sal; break; default: break; } if (l != 0) { memset(sua, 0, sizeof *sua); sua->magic = SUCKADDR_MAGIC; memcpy(&sua->sa, s, l); return (sua); } return (NULL); } const struct sockaddr * VSA_Get_Sockaddr(const struct suckaddr *sua, socklen_t *sl) { CHECK_OBJ_NOTNULL(sua, SUCKADDR_MAGIC); AN(sl); switch(sua->sa.sa_family) { case PF_INET: *sl = sizeof sua->sa4; break; case PF_INET6: *sl = sizeof sua->sa6; break; default: return (NULL); } return (&sua->sa); } int VSA_Get_Proto(const struct suckaddr *sua) { CHECK_OBJ_NOTNULL(sua, SUCKADDR_MAGIC); return (sua->sa.sa_family); } int VSA_Sane(const struct suckaddr *sua) { CHECK_OBJ_NOTNULL(sua, SUCKADDR_MAGIC); switch(sua->sa.sa_family) { case PF_INET: case PF_INET6: return (1); default: return (0); } } int VSA_Compare(const struct suckaddr *sua1, const struct suckaddr *sua2) { CHECK_OBJ_NOTNULL(sua1, SUCKADDR_MAGIC); CHECK_OBJ_NOTNULL(sua2, SUCKADDR_MAGIC); return (memcmp(sua1, sua2, vsa_suckaddr_len)); } struct suckaddr * VSA_Clone(const struct suckaddr *sua) { struct suckaddr *sua2; assert(VSA_Sane(sua)); sua2 = calloc(1, vsa_suckaddr_len); XXXAN(sua2); memcpy(sua2, sua, vsa_suckaddr_len); return (sua2); } unsigned VSA_Port(const struct suckaddr *sua) { CHECK_OBJ_NOTNULL(sua, SUCKADDR_MAGIC); switch(sua->sa.sa_family) { case PF_INET: return (ntohs(sua->sa4.sin_port)); case PF_INET6: return (ntohs(sua->sa6.sin6_port)); default: return (0); } } varnish-4.1.1/lib/libvarnish/vct.c0000644000201500234410000001711112652366721013766 00000000000000/*- * Copyright (c) 2006-2010 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. * * ctype(3) like functions, according to RFC2616 */ #include "config.h" #include #include "vct.h" /* NB: VCT always operate in ASCII, don't replace 0x0d with \r etc. */ #define VCT_UPALPHA VCT_ALPHA #define VCT_LOALPHA VCT_ALPHA const uint16_t vct_typtab[256] = { [0x00] = VCT_CTL, [0x01] = VCT_CTL, [0x02] = VCT_CTL, [0x03] = VCT_CTL, [0x04] = VCT_CTL, [0x05] = VCT_CTL, [0x06] = VCT_CTL, [0x07] = VCT_CTL, [0x08] = VCT_CTL, [0x09] = VCT_CTL | VCT_SP | VCT_SEPARATOR, [0x0a] = VCT_CTL | VCT_CRLF, [0x0b] = VCT_CTL, [0x0c] = VCT_CTL, [0x0d] = VCT_CTL | VCT_CRLF, [0x0e] = VCT_CTL, [0x0f] = VCT_CTL, [0x10] = VCT_CTL, [0x11] = VCT_CTL, [0x12] = VCT_CTL, [0x13] = VCT_CTL, [0x14] = VCT_CTL, [0x15] = VCT_CTL, [0x16] = VCT_CTL, [0x17] = VCT_CTL, [0x18] = VCT_CTL, [0x19] = VCT_CTL, [0x1a] = VCT_CTL, [0x1b] = VCT_CTL, [0x1c] = VCT_CTL, [0x1d] = VCT_CTL, [0x1e] = VCT_CTL, [0x1f] = VCT_CTL, [0x20] = VCT_SP | VCT_SEPARATOR, [0x21] = VCT_TCHAR, [0x22] = VCT_SEPARATOR, [0x23] = VCT_TCHAR, [0x24] = VCT_TCHAR, [0x25] = VCT_TCHAR, [0x26] = VCT_TCHAR, [0x27] = VCT_TCHAR, [0x28] = VCT_SEPARATOR, [0x29] = VCT_SEPARATOR, [0x2a] = VCT_TCHAR, [0x2b] = VCT_TCHAR, [0x2c] = VCT_SEPARATOR, [0x2d] = VCT_XMLNAME | VCT_TCHAR, [0x2e] = VCT_XMLNAME | VCT_TCHAR, [0x2f] = VCT_SEPARATOR, [0x30] = VCT_DIGIT | VCT_HEX | VCT_XMLNAME, [0x31] = VCT_DIGIT | VCT_HEX | VCT_XMLNAME, [0x32] = VCT_DIGIT | VCT_HEX | VCT_XMLNAME, [0x33] = VCT_DIGIT | VCT_HEX | VCT_XMLNAME, [0x34] = VCT_DIGIT | VCT_HEX | VCT_XMLNAME, [0x35] = VCT_DIGIT | VCT_HEX | VCT_XMLNAME, [0x36] = VCT_DIGIT | VCT_HEX | VCT_XMLNAME, [0x37] = VCT_DIGIT | VCT_HEX | VCT_XMLNAME, [0x38] = VCT_DIGIT | VCT_HEX | VCT_XMLNAME, [0x39] = VCT_DIGIT | VCT_HEX | VCT_XMLNAME, [0x3a] = VCT_SEPARATOR | VCT_XMLNAMESTART, [0x3b] = VCT_SEPARATOR, [0x3c] = VCT_SEPARATOR, [0x3d] = VCT_SEPARATOR, [0x3e] = VCT_SEPARATOR, [0x3f] = VCT_SEPARATOR, [0x40] = VCT_SEPARATOR, [0x41] = VCT_UPALPHA | VCT_HEX | VCT_XMLNAMESTART, [0x42] = VCT_UPALPHA | VCT_HEX | VCT_XMLNAMESTART, [0x43] = VCT_UPALPHA | VCT_HEX | VCT_XMLNAMESTART, [0x44] = VCT_UPALPHA | VCT_HEX | VCT_XMLNAMESTART, [0x45] = VCT_UPALPHA | VCT_HEX | VCT_XMLNAMESTART, [0x46] = VCT_UPALPHA | VCT_HEX | VCT_XMLNAMESTART, [0x47] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x48] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x49] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x4a] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x4b] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x4c] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x4d] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x4e] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x4f] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x50] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x51] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x52] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x53] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x54] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x55] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x56] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x57] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x58] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x59] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x5a] = VCT_UPALPHA | VCT_XMLNAMESTART, [0x5b] = VCT_SEPARATOR, [0x5c] = VCT_SEPARATOR, [0x5d] = VCT_SEPARATOR, [0x5e] = VCT_TCHAR, [0x5f] = VCT_XMLNAMESTART | VCT_TCHAR, [0x60] = VCT_TCHAR, [0x61] = VCT_LOALPHA | VCT_HEX | VCT_XMLNAMESTART, [0x62] = VCT_LOALPHA | VCT_HEX | VCT_XMLNAMESTART, [0x63] = VCT_LOALPHA | VCT_HEX | VCT_XMLNAMESTART, [0x64] = VCT_LOALPHA | VCT_HEX | VCT_XMLNAMESTART, [0x65] = VCT_LOALPHA | VCT_HEX | VCT_XMLNAMESTART, [0x66] = VCT_LOALPHA | VCT_HEX | VCT_XMLNAMESTART, [0x67] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x68] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x69] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x6a] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x6b] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x6c] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x6d] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x6e] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x6f] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x70] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x71] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x72] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x73] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x74] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x75] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x76] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x77] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x78] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x79] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x7a] = VCT_LOALPHA | VCT_XMLNAMESTART, [0x7b] = VCT_SEPARATOR, [0x7c] = VCT_TCHAR, [0x7d] = VCT_SEPARATOR, [0x7e] = VCT_TCHAR, [0x7f] = VCT_CTL, [0xb7] = VCT_XMLNAME, [0xc0] = VCT_XMLNAMESTART, [0xc1] = VCT_XMLNAMESTART, [0xc2] = VCT_XMLNAMESTART, [0xc3] = VCT_XMLNAMESTART, [0xc4] = VCT_XMLNAMESTART, [0xc5] = VCT_XMLNAMESTART, [0xc6] = VCT_XMLNAMESTART, [0xc7] = VCT_XMLNAMESTART, [0xc8] = VCT_XMLNAMESTART, [0xc9] = VCT_XMLNAMESTART, [0xca] = VCT_XMLNAMESTART, [0xcb] = VCT_XMLNAMESTART, [0xcc] = VCT_XMLNAMESTART, [0xcd] = VCT_XMLNAMESTART, [0xce] = VCT_XMLNAMESTART, [0xcf] = VCT_XMLNAMESTART, [0xd0] = VCT_XMLNAMESTART, [0xd1] = VCT_XMLNAMESTART, [0xd2] = VCT_XMLNAMESTART, [0xd3] = VCT_XMLNAMESTART, [0xd4] = VCT_XMLNAMESTART, [0xd5] = VCT_XMLNAMESTART, [0xd6] = VCT_XMLNAMESTART, [0xd8] = VCT_XMLNAMESTART, [0xd9] = VCT_XMLNAMESTART, [0xda] = VCT_XMLNAMESTART, [0xdb] = VCT_XMLNAMESTART, [0xdc] = VCT_XMLNAMESTART, [0xdd] = VCT_XMLNAMESTART, [0xde] = VCT_XMLNAMESTART, [0xdf] = VCT_XMLNAMESTART, [0xe0] = VCT_XMLNAMESTART, [0xe1] = VCT_XMLNAMESTART, [0xe2] = VCT_XMLNAMESTART, [0xe3] = VCT_XMLNAMESTART, [0xe4] = VCT_XMLNAMESTART, [0xe5] = VCT_XMLNAMESTART, [0xe6] = VCT_XMLNAMESTART, [0xe7] = VCT_XMLNAMESTART, [0xe8] = VCT_XMLNAMESTART, [0xe9] = VCT_XMLNAMESTART, [0xea] = VCT_XMLNAMESTART, [0xeb] = VCT_XMLNAMESTART, [0xec] = VCT_XMLNAMESTART, [0xed] = VCT_XMLNAMESTART, [0xee] = VCT_XMLNAMESTART, [0xef] = VCT_XMLNAMESTART, [0xf0] = VCT_XMLNAMESTART, [0xf1] = VCT_XMLNAMESTART, [0xf2] = VCT_XMLNAMESTART, [0xf3] = VCT_XMLNAMESTART, [0xf4] = VCT_XMLNAMESTART, [0xf5] = VCT_XMLNAMESTART, [0xf6] = VCT_XMLNAMESTART, [0xf8] = VCT_XMLNAMESTART, [0xf9] = VCT_XMLNAMESTART, [0xfa] = VCT_XMLNAMESTART, [0xfb] = VCT_XMLNAMESTART, [0xfc] = VCT_XMLNAMESTART, [0xfd] = VCT_XMLNAMESTART, [0xfe] = VCT_XMLNAMESTART, [0xff] = VCT_XMLNAMESTART, }; varnish-4.1.1/lib/libvarnish/vev.c0000644000201500234410000002620212652366721013773 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 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. */ #include "config.h" #include #include #include #include #include #include #include #include #include "vdef.h" #include "miniobj.h" #include "vas.h" #include "binary_heap.h" #include "vqueue.h" #include "vev.h" #include "vtim.h" #undef DEBUG_EVENTS /* INFTIM indicates an infinite timeout for poll(2) */ #ifndef INFTIM #define INFTIM -1 #endif struct vevsig { struct vev_base *vevb; struct vev *vev; struct sigaction sigact; unsigned char happened; }; static struct vevsig *vev_sigs; static int vev_nsig; struct vev_base { unsigned magic; #define VEV_BASE_MAGIC 0x477bcf3d VTAILQ_HEAD(,vev) events; struct pollfd *pfd; unsigned npfd; unsigned lpfd; struct binheap *binheap; unsigned char compact_pfd; unsigned char disturbed; unsigned psig; pthread_t thread; #ifdef DEBUG_EVENTS FILE *debug; #endif }; /*--------------------------------------------------------------------*/ #ifdef DEBUG_EVENTS #define DBG(evb, ...) do { \ if ((evb)->debug != NULL) \ fprintf((evb)->debug, __VA_ARGS__); \ } while (0); #else #define DBG(evb, ...) /* ... */ #endif /*--------------------------------------------------------------------*/ static void __match_proto__(binheap_update_t) vev_bh_update(void *priv, void *a, unsigned u) { struct vev_base *evb; struct vev *e; CAST_OBJ_NOTNULL(evb, priv, VEV_BASE_MAGIC); CAST_OBJ_NOTNULL(e, a, VEV_MAGIC); e->__binheap_idx = u; } static int __match_proto__(binheap_cmp_t) vev_bh_cmp(void *priv, const void *a, const void *b) { struct vev_base *evb; const struct vev *ea, *eb; CAST_OBJ_NOTNULL(evb, priv, VEV_BASE_MAGIC); CAST_OBJ_NOTNULL(ea, a, VEV_MAGIC); CAST_OBJ_NOTNULL(eb, b, VEV_MAGIC); return (ea->__when < eb->__when); } /*--------------------------------------------------------------------*/ static int vev_get_pfd(struct vev_base *evb) { unsigned u; void *p; if (evb->lpfd + 1 < evb->npfd) return (0); if (evb->npfd < 8) u = 8; else if (evb->npfd > 256) u = evb->npfd + 256; else u = evb->npfd * 2; p = realloc(evb->pfd, sizeof *evb->pfd * u); if (p == NULL) return (1); evb->npfd = u; evb->pfd = p; return (0); } /*--------------------------------------------------------------------*/ static int vev_get_sig(int sig) { struct vevsig *os; if (sig < vev_nsig) return (0); os = calloc(sizeof *os, (sig + 1L)); if (os == NULL) return (ENOMEM); memcpy(os, vev_sigs, vev_nsig * sizeof *os); free(vev_sigs); vev_sigs = os; vev_nsig = sig + 1; return (0); } /*--------------------------------------------------------------------*/ static void vev_sighandler(int sig) { struct vevsig *es; assert(sig < vev_nsig); assert(vev_sigs != NULL); es = &vev_sigs[sig]; if (!es->happened) es->vevb->psig++; es->happened = 1; } /*--------------------------------------------------------------------*/ struct vev_base * vev_new_base(void) { struct vev_base *evb; evb = calloc(sizeof *evb, 1); if (evb == NULL) return (evb); if (vev_get_pfd(evb)) { free(evb); return (NULL); } evb->magic = VEV_BASE_MAGIC; VTAILQ_INIT(&evb->events); evb->binheap = binheap_new(evb, vev_bh_cmp, vev_bh_update); evb->thread = pthread_self(); #ifdef DEBUG_EVENTS evb->debug = fopen("/tmp/_.events", "w"); AN(evb->debug); setbuf(evb->debug, NULL); DBG(evb, "\n\nStart debugging\n"); #endif return (evb); } /*--------------------------------------------------------------------*/ void vev_destroy_base(struct vev_base *evb) { CHECK_OBJ_NOTNULL(evb, VEV_BASE_MAGIC); assert(evb->thread == pthread_self()); evb->magic = 0; free(evb); } /*--------------------------------------------------------------------*/ struct vev * vev_new(void) { struct vev *e; e = calloc(sizeof *e, 1); if (e != NULL) { e->fd = -1; } return (e); } /*--------------------------------------------------------------------*/ int vev_add(struct vev_base *evb, struct vev *e) { struct vevsig *es; CHECK_OBJ_NOTNULL(evb, VEV_BASE_MAGIC); assert(e->magic != VEV_MAGIC); assert(e->callback != NULL); assert(e->sig >= 0); assert(e->timeout >= 0.0); assert(e->fd < 0 || e->fd_flags); assert(evb->thread == pthread_self()); DBG(evb, "ev_add(%p) fd = %d\n", e, e->fd); if (e->sig > 0 && vev_get_sig(e->sig)) return (ENOMEM); if (e->fd >= 0 && vev_get_pfd(evb)) return (ENOMEM); if (e->sig > 0) { es = &vev_sigs[e->sig]; if (es->vev != NULL) return (EBUSY); AZ(es->happened); es->vev = e; es->vevb = evb; es->sigact.sa_flags = e->sig_flags; es->sigact.sa_handler = vev_sighandler; } else { es = NULL; } if (e->fd >= 0) { assert(evb->lpfd < evb->npfd); evb->pfd[evb->lpfd].fd = e->fd; evb->pfd[evb->lpfd].events = e->fd_flags & (EV_RD|EV_WR|EV_ERR|EV_HUP); e->__poll_idx = evb->lpfd; evb->lpfd++; DBG(evb, "... pidx = %d lpfd = %d\n", e->__poll_idx, evb->lpfd); } else e->__poll_idx = -1; e->magic = VEV_MAGIC; /* before binheap_insert() */ if (e->timeout != 0.0) { e->__when += VTIM_mono() + e->timeout; binheap_insert(evb->binheap, e); assert(e->__binheap_idx > 0); DBG(evb, "... bidx = %d\n", e->__binheap_idx); } else { e->__when = 0.0; e->__binheap_idx = 0; } e->__vevb = evb; e->__privflags = 0; if (e->fd < 0) VTAILQ_INSERT_TAIL(&evb->events, e, __list); else VTAILQ_INSERT_HEAD(&evb->events, e, __list); if (e->sig > 0) { assert(es != NULL); AZ(sigaction(e->sig, &es->sigact, NULL)); } return (0); } /*--------------------------------------------------------------------*/ void vev_del(struct vev_base *evb, struct vev *e) { struct vevsig *es; CHECK_OBJ_NOTNULL(evb, VEV_BASE_MAGIC); CHECK_OBJ_NOTNULL(e, VEV_MAGIC); DBG(evb, "ev_del(%p) fd = %d\n", e, e->fd); assert(evb == e->__vevb); assert(evb->thread == pthread_self()); if (e->__binheap_idx != 0) binheap_delete(evb->binheap, e->__binheap_idx); AZ(e->__binheap_idx); if (e->fd >= 0) { DBG(evb, "... pidx = %d\n", e->__poll_idx); evb->pfd[e->__poll_idx].fd = -1; if (e->__poll_idx == evb->lpfd - 1) evb->lpfd--; else evb->compact_pfd++; e->fd = -1; DBG(evb, "... lpfd = %d\n", evb->lpfd); } if (e->sig > 0) { assert(e->sig < vev_nsig); es = &vev_sigs[e->sig]; assert(es->vev == e); es->vev = NULL; es->vevb = NULL; es->sigact.sa_flags = e->sig_flags; es->sigact.sa_handler = SIG_DFL; AZ(sigaction(e->sig, &es->sigact, NULL)); es->happened = 0; } VTAILQ_REMOVE(&evb->events, e, __list); e->magic = 0; e->__vevb = NULL; evb->disturbed = 1; } /*--------------------------------------------------------------------*/ int vev_schedule(struct vev_base *evb) { int i; CHECK_OBJ_NOTNULL(evb, VEV_BASE_MAGIC); assert(evb->thread == pthread_self()); do i = vev_schedule_one(evb); while (i == 1); return (i); } /*--------------------------------------------------------------------*/ static void vev_compact_pfd(struct vev_base *evb) { unsigned u; struct pollfd *p; struct vev *ep; int lfd; DBG(evb, "compact_pfd() lpfd = %d\n", evb->lpfd); p = evb->pfd; for (u = 0; u < evb->lpfd; u++, p++) { DBG(evb, "...[%d] fd = %d\n", u, p->fd); if (p->fd >= 0) continue; if (u == evb->lpfd - 1) break; lfd = evb->pfd[evb->lpfd - 1].fd; VTAILQ_FOREACH(ep, &evb->events, __list) if (ep->fd == lfd) break; AN(ep); DBG(evb, "...[%d] move %p pidx %d\n", u, ep, ep->__poll_idx); *p = evb->pfd[--evb->lpfd]; ep->__poll_idx = u; } evb->lpfd = u; evb->compact_pfd = 0; DBG(evb, "... lpfd = %d\n", evb->lpfd); } /*--------------------------------------------------------------------*/ static int vev_sched_timeout(struct vev_base *evb, struct vev *e, double t) { int i; i = e->callback(e, 0); if (i) { vev_del(evb, e); free(e); } else { e->__when = t + e->timeout; binheap_delete(evb->binheap, e->__binheap_idx); binheap_insert(evb->binheap, e); } return (1); } static int vev_sched_signal(struct vev_base *evb) { int i, j; struct vevsig *es; struct vev *e; es = vev_sigs; for (j = 0; j < vev_nsig; j++, es++) { if (!es->happened || es->vevb != evb) continue; evb->psig--; es->happened = 0; e = es->vev; assert(e != NULL); i = e->callback(e, EV_SIG); if (i) { vev_del(evb, e); free(e); } } return (1); } int vev_schedule_one(struct vev_base *evb) { double t; struct vev *e, *e2, *e3; int i, j, tmo; struct pollfd *pfd; CHECK_OBJ_NOTNULL(evb, VEV_BASE_MAGIC); assert(evb->thread == pthread_self()); e = binheap_root(evb->binheap); if (e != NULL) { CHECK_OBJ_NOTNULL(e, VEV_MAGIC); assert(e->__binheap_idx == 1); t = VTIM_mono(); if (e->__when <= t) return (vev_sched_timeout(evb, e, t)); tmo = (int)((e->__when - t) * 1e3); if (tmo == 0) tmo = 1; } else tmo = INFTIM; if (evb->compact_pfd) vev_compact_pfd(evb); if (tmo == INFTIM && evb->lpfd == 0) return (0); if (evb->psig) return (vev_sched_signal(evb)); assert(evb->lpfd < evb->npfd); i = poll(evb->pfd, evb->lpfd, tmo); if (i == -1 && errno == EINTR) return (vev_sched_signal(evb)); if (i == 0) { assert(e != NULL); t = VTIM_mono(); if (e->__when <= t) return (vev_sched_timeout(evb, e, t)); } evb->disturbed = 0; VTAILQ_FOREACH_SAFE(e, &evb->events, __list, e2) { if (i == 0) break; if (e->fd < 0) continue; assert(e->__poll_idx < evb->lpfd); pfd = &evb->pfd[e->__poll_idx]; assert(pfd->fd == e->fd); if (!pfd->revents) continue; DBG(evb, "callback(%p) fd = %d what = 0x%x pidx = %d\n", e, e->fd, pfd->revents, e->__poll_idx); j = e->callback(e, pfd->revents); i--; if (evb->disturbed) { VTAILQ_FOREACH(e3, &evb->events, __list) { if (e3 == e) { e3 = VTAILQ_NEXT(e, __list); break; } else if (e3 == e2) break; } e2 = e3; evb->disturbed = 0; } if (j) { vev_del(evb, e); evb->disturbed = 0; free(e); } } AZ(i); return (1); } varnish-4.1.1/lib/libvarnish/vav.c0000644000201500234410000001220312652366721013763 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * const char **VAV_Parse(const char *s, int comment) * Parse a command like line into an argv[] * Index zero contains NULL or an error message * "double quotes" and backslash substitution is handled. * * void VAV_Free(const char **argv) * Free the result of VAV_Parse() * */ #include "config.h" #include #include #include #include #include "vas.h" #include "vav.h" int VAV_BackSlash(const char *s, char *res) { int r; char c; unsigned u; assert(*s == '\\'); r = c = 0; switch(s[1]) { case 'n': c = '\n'; r = 2; break; case 'r': c = '\r'; r = 2; break; case 't': c = '\t'; r = 2; break; case '"': c = '"'; r = 2; break; case '\\': c = '\\'; r = 2; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': for (r = 1; r < 4; r++) { if (!isdigit(s[r])) break; if (s[r] - '0' > 7) break; c <<= 3; /*lint !e701 signed left shift */ c |= s[r] - '0'; } break; case 'x': if (1 == sscanf(s + 1, "x%02x", &u)) { AZ(u & ~0xff); c = u; /*lint !e734 loss of precision */ r = 4; } break; default: break; } if (res != NULL) *res = c; return (r); } char * VAV_BackSlashDecode(const char *s, const char *e) { const char *q; char *p, *r; int i; if (e == NULL) e = strchr(s, '\0'); assert(e != NULL); p = calloc((e - s) + 1, 1); if (p == NULL) return (p); for (r = p, q = s; q < e; ) { if (*q != '\\') { *r++ = *q++; continue; } i = VAV_BackSlash(q, r); q += i; r++; } *r = '\0'; return (p); } static char err_invalid_backslash[] = "Invalid backslash sequence"; static char err_missing_quote[] = "Missing '\"'"; char ** VAV_Parse(const char *s, int *argc, int flag) { char **argv; const char *p; int nargv, largv; int i, quote; assert(s != NULL); nargv = 1; largv = 16; argv = calloc(sizeof *argv, largv); if (argv == NULL) return (NULL); for (;;) { if (*s == '\0') break; if (isspace(*s)) { s++; continue; } if ((flag & ARGV_COMMENT) && *s == '#') break; if (*s == '"' && !(flag & ARGV_NOESC)) { p = ++s; quote = 1; } else { p = s; quote = 0; } while (1) { if (*s == '\\' && !(flag & ARGV_NOESC)) { i = VAV_BackSlash(s, NULL); if (i == 0) { argv[0] = err_invalid_backslash; return (argv); } s += i; continue; } if (!quote) { if (*s == '\0' || isspace(*s)) break; if ((flag & ARGV_COMMA) && *s == ',') break; s++; continue; } if (*s == '"' && !(flag & ARGV_NOESC)) break; if (*s == '\0') { argv[0] = err_missing_quote; return (argv); } s++; } if (nargv + 1 >= largv) { argv = realloc(argv, sizeof (*argv) * (largv += largv)); assert(argv != NULL); } if (flag & ARGV_NOESC) { argv[nargv] = malloc(1 + (s - p)); assert(argv[nargv] != NULL); memcpy(argv[nargv], p, s - p); argv[nargv][s - p] = '\0'; nargv++; } else { argv[nargv++] = VAV_BackSlashDecode(p, s); } if (*s != '\0') s++; } argv[nargv] = NULL; if (argc != NULL) *argc = nargv; return (argv); } void VAV_Free(char **argv) { int i; for (i = 1; argv[i] != NULL; i++) free(argv[i]); free(argv); } #ifdef TESTPROG #include static void VAV_Print(char **argv) { int i; printf("---- %p\n", argv); if (argv[0] != NULL) printf("err %V\n", argv[0]); for (i = 1; argv[i] != NULL; i++) printf("%3d %V\n", i, argv[i]); } static void Test(const char *str) { char **av; printf("Test: <%V>\n", str); av = VAV_Parse(str, 0); VAV_Print(av); } int main(int argc, char **argv) { char buf[BUFSIZ]; (void)argc; (void)argv; register_printf_render_std("V"); while (fgets(buf, sizeof buf, stdin)) Test(buf); return (0); } #endif varnish-4.1.1/lib/libvarnish/vpf.c0000644000201500234410000001270212652366721013766 00000000000000/*- * Copyright (c) 2005 Pawel Jakub Dawidek * All rights reserved. * * 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 AUTHORS 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 THE AUTHORS 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. * Derived from: * $FreeBSD: head/lib/libutil/pidfile.c 184091 2008-10-20 17:41:08Z des $ */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include "flopen.h" #include "vas.h" #include "vpf.h" struct vpf_fh { int pf_fd; char pf_path[MAXPATHLEN + 1]; dev_t pf_dev; ino_t pf_ino; }; static int _VPF_Remove(struct vpf_fh *pfh, int freeit); static int vpf_verify(const struct vpf_fh *pfh) { struct stat sb; if (pfh == NULL || pfh->pf_fd == -1) return (EINVAL); /* * Check remembered descriptor. */ if (fstat(pfh->pf_fd, &sb) == -1) return (errno); if (sb.st_dev != pfh->pf_dev || sb.st_ino != pfh->pf_ino) return (EINVAL); return (0); } static int vpf_read(const char *path, pid_t *pidptr) { char buf[16], *endptr; int error, fd, i; fd = open(path, O_RDONLY); if (fd == -1) return (errno); i = read(fd, buf, sizeof(buf) - 1); error = errno; /* Remember errno in case close() wants to change it. */ (void)close(fd); if (i == -1) return (error); buf[i] = '\0'; *pidptr = strtol(buf, &endptr, 10); if (endptr != &buf[i]) return (EINVAL); return (0); } struct vpf_fh * VPF_Open(const char *path, mode_t mode, pid_t *pidptr) { struct vpf_fh *pfh; struct stat sb; int error, fd, len; pfh = malloc(sizeof(*pfh)); if (pfh == NULL) return (NULL); #if 0 if (path == NULL) len = snprintf(pfh->pf_path, sizeof(pfh->pf_path), "/var/run/%s.pid", getprogname()); else #endif { assert(path != NULL); len = snprintf(pfh->pf_path, sizeof(pfh->pf_path), "%s", path); } if (len >= (int)sizeof(pfh->pf_path)) { free(pfh); errno = ENAMETOOLONG; return (NULL); } /* * Open the PID file and obtain exclusive lock. * We truncate PID file here only to remove old PID immediatelly, * PID file will be truncated again in VPF_Write(), so * VPF_Write() can be called multiple times. */ fd = flopen(pfh->pf_path, O_WRONLY | O_CREAT | O_TRUNC | O_NONBLOCK, mode); if (fd == -1) { if (errno == EWOULDBLOCK && pidptr != NULL) { errno = vpf_read(pfh->pf_path, pidptr); if (errno == 0) errno = EEXIST; } free(pfh); return (NULL); } /* * Remember file information, so in VPF_Write() we are sure we write * to the proper descriptor. */ if (fstat(fd, &sb) == -1) { error = errno; (void)unlink(pfh->pf_path); (void)close(fd); free(pfh); errno = error; return (NULL); } pfh->pf_fd = fd; pfh->pf_dev = sb.st_dev; pfh->pf_ino = sb.st_ino; return (pfh); } int VPF_Write(struct vpf_fh *pfh) { char pidstr[16]; int error, fd; /* * Check remembered descriptor, so we don't overwrite some other * file if pidfile was closed and descriptor reused. */ errno = vpf_verify(pfh); if (errno != 0) { /* * Don't close descriptor, because we are not sure if it's ours. */ return (-1); } fd = pfh->pf_fd; /* * Truncate PID file, so multiple calls of VPF_Write() are allowed. */ if (ftruncate(fd, 0) == -1) { error = errno; (void)_VPF_Remove(pfh, 0); errno = error; return (-1); } error = snprintf(pidstr, sizeof(pidstr), "%ju", (uintmax_t)getpid()); assert(error < sizeof pidstr); if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) { error = errno; (void)_VPF_Remove(pfh, 0); errno = error; return (-1); } return (0); } int VPF_Close(struct vpf_fh *pfh) { int error; error = vpf_verify(pfh); if (error != 0) { errno = error; return (-1); } if (close(pfh->pf_fd) == -1) error = errno; free(pfh); if (error != 0) { errno = error; return (-1); } return (0); } static int _VPF_Remove(struct vpf_fh *pfh, int freeit) { int error; error = vpf_verify(pfh); if (error != 0) { errno = error; return (-1); } if (unlink(pfh->pf_path) == -1) error = errno; if (close(pfh->pf_fd) == -1) { if (error == 0) error = errno; } if (freeit) free(pfh); else pfh->pf_fd = -1; if (error != 0) { errno = error; return (-1); } return (0); } int VPF_Remove(struct vpf_fh *pfh) { return (_VPF_Remove(pfh, 1)); } varnish-4.1.1/lib/libvarnish/vre.c0000644000201500234410000000760112652366721013771 00000000000000/*- * Copyright (c) 2006-2011 Varnish Software AS * All rights reserved. * * Author: Tollef Fog Heen * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include "miniobj.h" #include "vas.h" #include "vre.h" #if defined(USE_PCRE_JIT) #define VRE_STUDY_JIT_COMPILE PCRE_STUDY_JIT_COMPILE #else #define VRE_STUDY_JIT_COMPILE 0 #endif const unsigned VRE_has_jit = VRE_STUDY_JIT_COMPILE; #if PCRE_MAJOR < 8 || (PCRE_MAJOR == 8 && PCRE_MINOR < 20) # define pcre_free_study pcre_free #endif struct vre { unsigned magic; #define VRE_MAGIC 0xe83097dc pcre *re; pcre_extra *re_extra; int my_extra; }; /* * We don't want to spread or even expose the majority of PCRE options * so we establish our own options and implement hard linkage to PCRE * here. */ const unsigned VRE_CASELESS = PCRE_CASELESS; const unsigned VRE_NOTEMPTY = PCRE_NOTEMPTY; vre_t * VRE_compile(const char *pattern, int options, const char **errptr, int *erroffset) { vre_t *v; *errptr = NULL; *erroffset = 0; ALLOC_OBJ(v, VRE_MAGIC); if (v == NULL) { *errptr = "Out of memory for VRE"; return (NULL); } v->re = pcre_compile(pattern, options, errptr, erroffset, NULL); if (v->re == NULL) { VRE_free(&v); return (NULL); } v->re_extra = pcre_study(v->re, VRE_STUDY_JIT_COMPILE, errptr); if (*errptr != NULL) { VRE_free(&v); return (NULL); } if (v->re_extra == NULL) { /* allocate our own */ v->re_extra = calloc(1, sizeof(pcre_extra)); v->my_extra = 1; if (v->re_extra == NULL) { *errptr = "Out of memory for pcre_extra"; VRE_free(&v); return (NULL); } } return (v); } int VRE_exec(const vre_t *code, const char *subject, int length, int startoffset, int options, int *ovector, int ovecsize, const volatile struct vre_limits *lim) { CHECK_OBJ_NOTNULL(code, VRE_MAGIC); int ov[30]; if (ovector == NULL) { ovector = ov; ovecsize = sizeof(ov)/sizeof(ov[0]); } if (lim != NULL) { code->re_extra->match_limit = lim->match; code->re_extra->flags |= PCRE_EXTRA_MATCH_LIMIT; code->re_extra->match_limit_recursion = lim->match_recursion; code->re_extra->flags |= PCRE_EXTRA_MATCH_LIMIT_RECURSION; } else { code->re_extra->flags &= ~PCRE_EXTRA_MATCH_LIMIT; code->re_extra->flags &= ~PCRE_EXTRA_MATCH_LIMIT_RECURSION; } return (pcre_exec(code->re, code->re_extra, subject, length, startoffset, options, ovector, ovecsize)); } void VRE_free(vre_t **vv) { vre_t *v = *vv; *vv = NULL; CHECK_OBJ(v, VRE_MAGIC); if (v->re_extra != NULL) { if (v->my_extra) free(v->re_extra); else pcre_free_study(v->re_extra); } if (v->re != NULL) pcre_free(v->re); FREE_OBJ(v); } varnish-4.1.1/lib/libvarnish/cli_auth.c0000644000201500234410000000414112652366721014761 00000000000000/*- * Copyright (c) 2010-2011 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. */ #include "config.h" #include #include #include #include #include "vas.h" #include "vcli.h" #include "vsha256.h" void VCLI_AuthResponse(int S_fd, const char *challenge, char response[CLI_AUTH_RESPONSE_LEN + 1]) { SHA256_CTX ctx; uint8_t buf[SHA256_LEN]; int i; assert(CLI_AUTH_RESPONSE_LEN == (SHA256_LEN * 2)); SHA256_Init(&ctx); SHA256_Update(&ctx, challenge, 32); SHA256_Update(&ctx, "\n", 1); do { i = read(S_fd, buf, 1); if (i == 1) SHA256_Update(&ctx, buf, i); } while (i > 0); SHA256_Update(&ctx, challenge, 32); SHA256_Update(&ctx, "\n", 1); SHA256_Final(buf, &ctx); for(i = 0; i < SHA256_LEN; i++) sprintf(response + 2 * i, "%02x", buf[i]); } varnish-4.1.1/lib/libvarnish/binary_heap.c0000644000201500234410000003425112652366721015457 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Implementation of a binary heap API * * See also: * http://dl.acm.org/citation.cfm?doid=1785414.1785434 * (or: http://queue.acm.org/detail.cfm?id=1814327) */ #include "config.h" #include #include #include #include #include "binary_heap.h" #include "vas.h" /* Parameters --------------------------------------------------------*/ /* * The number of elements in a row has to be a compromise between * wasted space and number of memory allocations. * With 64k objects per row, there will be at least 5...10 seconds * between row additions on a very busy server. * At the same time, the worst case amount of wasted memory is kept * at a reasonable 1 MB -- two rows on 64bit system. * Finally, but without practical significance: 16 bits should be * easier for the compiler to optimize. */ #define ROW_SHIFT 16 #undef PARANOIA /* Private definitions -----------------------------------------------*/ #define ROOT_IDX 1 #define ROW_WIDTH (1 << ROW_SHIFT) /*lint -emacro(572, ROW) shift 0 >> by 16 */ /*lint -emacro(835, ROW) 0 left of >> */ /*lint -emacro(778, ROW) const >> evaluates to zero */ #define ROW(b, n) ((b)->array[(n) >> ROW_SHIFT]) /*lint -emacro(835, A) 0 left of & */ #define A(b, n) ROW(b, n)[(n) & (ROW_WIDTH - 1)] struct binheap { unsigned magic; #define BINHEAP_MAGIC 0xf581581aU /* from /dev/random */ void *priv; binheap_cmp_t *cmp; binheap_update_t *update; void ***array; unsigned rows; unsigned length; unsigned next; unsigned page_size; unsigned page_mask; unsigned page_shift; }; #define VM_AWARE #ifdef VM_AWARE static unsigned parent(const struct binheap *bh, unsigned u) { unsigned po; unsigned v; assert(u != UINT_MAX); po = u & bh->page_mask; if (u < bh->page_size || po > 3) { v = (u & ~bh->page_mask) | (po >> 1); } else if (po < 2) { v = (u - bh->page_size) >> bh->page_shift; v += v & ~(bh->page_mask >> 1); v |= bh->page_size / 2; } else { v = u - 2; } return (v); } static void child(const struct binheap *bh, unsigned u, unsigned *a, unsigned *b) { uintmax_t uu; if (u > bh->page_mask && (u & (bh->page_mask - 1)) == 0) { /* First two elements are magical except on the first page */ *a = *b = u + 2; } else if (u & (bh->page_size >> 1)) { /* The bottom row is even more magical */ *a = (u & ~bh->page_mask) >> 1; *a |= u & (bh->page_mask >> 1); *a += 1; uu = (uintmax_t)*a << bh->page_shift; *a = uu; if (*a == uu) { *b = *a + 1; } else { /* * An unsigned is not big enough: clamp instead * of truncating. We do not support adding * more than UINT_MAX elements anyway, so this * is without consequence. */ *a = UINT_MAX; *b = UINT_MAX; } } else { /* The rest is as usual, only inside the page */ *a = u + (u & bh->page_mask); *b = *a + 1; } #ifdef PARANOIA assert(*a > 0); assert(*b > 0); if (*a != UINT_MAX) { assert(parent(bh, *a) == u); assert(parent(bh, *b) == u); } #endif } #else static unsigned parent(const struct binheap *bh, unsigned u) { (void)bh; return (u / 2); } static void child(const struct binheap *bh, unsigned u, unsigned *a, unsigned *b) { (void)bh; *a = u * 2; *b = *a + 1; } #endif /* Implementation ----------------------------------------------------*/ static void binheap_addrow(struct binheap *bh) { unsigned u; /* First make sure we have space for another row */ if (&ROW(bh, bh->length) >= bh->array + bh->rows) { u = bh->rows * 2; bh->array = realloc(bh->array, sizeof(*bh->array) * u); assert(bh->array != NULL); /* NULL out new pointers */ while (bh->rows < u) bh->array[bh->rows++] = NULL; } assert(ROW(bh, bh->length) == NULL); ROW(bh, bh->length) = malloc(sizeof(**bh->array) * ROW_WIDTH); assert(ROW(bh, bh->length)); bh->length += ROW_WIDTH; } struct binheap * binheap_new(void *priv, binheap_cmp_t *cmp_f, binheap_update_t *update_f) { struct binheap *bh; unsigned u; bh = calloc(sizeof *bh, 1); if (bh == NULL) return (bh); bh->priv = priv; bh->page_size = (unsigned)getpagesize() / sizeof (void *); bh->page_mask = bh->page_size - 1; AZ(bh->page_size & bh->page_mask); /* power of two */ for (u = 1; (1U << u) != bh->page_size; u++) ; bh->page_shift = u; assert(bh->page_size <= (sizeof(**bh->array) * ROW_WIDTH)); bh->cmp = cmp_f; bh->update = update_f; bh->next = ROOT_IDX; bh->rows = 16; /* A tiny-ish number */ bh->array = calloc(sizeof *bh->array, bh->rows); assert(bh->array != NULL); binheap_addrow(bh); A(bh, ROOT_IDX) = NULL; bh->magic = BINHEAP_MAGIC; return (bh); } static void binheap_update(const struct binheap *bh, unsigned u) { assert(bh != NULL); assert(bh->magic == BINHEAP_MAGIC); assert(u < bh->next); assert(A(bh, u) != NULL); if (bh->update != NULL) bh->update(bh->priv, A(bh, u), u); } static void binhead_swap(const struct binheap *bh, unsigned u, unsigned v) { void *p; assert(bh != NULL); assert(bh->magic == BINHEAP_MAGIC); assert(u < bh->next); assert(A(bh, u) != NULL); assert(v < bh->next); assert(A(bh, v) != NULL); p = A(bh, u); A(bh, u) = A(bh, v); A(bh, v) = p; binheap_update(bh, u); binheap_update(bh, v); } static unsigned binheap_trickleup(const struct binheap *bh, unsigned u) { unsigned v; assert(bh != NULL); assert(bh->magic == BINHEAP_MAGIC); assert(u < bh->next); assert(A(bh, u) != NULL); while (u > ROOT_IDX) { assert(u < bh->next); assert(A(bh, u) != NULL); v = parent(bh, u); assert(v < u); assert(v < bh->next); assert(A(bh, v) != NULL); if (!bh->cmp(bh->priv, A(bh, u), A(bh, v))) break; binhead_swap(bh, u, v); u = v; } return (u); } static unsigned binheap_trickledown(const struct binheap *bh, unsigned u) { unsigned v1, v2; assert(bh != NULL); assert(bh->magic == BINHEAP_MAGIC); assert(u < bh->next); assert(A(bh, u) != NULL); while (1) { assert(u < bh->next); assert(A(bh, u) != NULL); child(bh, u, &v1, &v2); assert(v1 > 0); assert(v2 > 0); assert(v1 <= v2); if (v1 >= bh->next) return (u); assert(A(bh, v1) != NULL); if (v1 != v2 && v2 < bh->next) { assert(A(bh, v2) != NULL); if (bh->cmp(bh->priv, A(bh, v2), A(bh, v1))) v1 = v2; } assert(v1 < bh->next); assert(A(bh, v1) != NULL); if (bh->cmp(bh->priv, A(bh, u), A(bh, v1))) return (u); binhead_swap(bh, u, v1); u = v1; } } void binheap_insert(struct binheap *bh, void *p) { unsigned u; assert(bh != NULL); assert(bh->magic == BINHEAP_MAGIC); assert(bh->length >= bh->next); if (bh->length == bh->next) binheap_addrow(bh); assert(bh->length > bh->next); u = bh->next++; A(bh, u) = p; binheap_update(bh, u); (void)binheap_trickleup(bh, u); assert(u < bh->next); assert(A(bh, u) != NULL); } #ifdef PARANOIA static void chk(const struct binheap *bh) { unsigned u, v; for (u = 2; u < bh->next; u++) { v = parent(bh, u); AZ(bh->cmp(bh->priv, A(bh, u), A(bh, v))); } } #endif void * binheap_root(const struct binheap *bh) { assert(bh != NULL); assert(bh->magic == BINHEAP_MAGIC); #ifdef PARANOIA chk(bh); #endif return (A(bh, ROOT_IDX)); } /* * It may seem counter-intuitive that we delete by replacement with * the tail object. "That's almost certain to not belong there, in * particular when we delete the root ?" is the typical reaction. * * If we tried to trickle up into the empty position, we would, * eventually, end up with a hole in the bottom row, at which point * we would move the tail object there. * But there is no guarantee that the tail object would not need to * trickle up from that position, in fact, it might be the new root * of this half of the subtree. * The total number of operations is guaranteed to be at least * N{height} downward selections, because we have to get the hole * all the way down, but in addition to that, we may get up to * N{height}-1 upward trickles. * * When we fill the hole with the tail object, the worst case is * that it trickles all the way up to of this half-tree, or down * to become the tail object again. * * In other words worst case is N{height} up or downward trickles. * But there is a decent chance that it does not make it all the way. */ void binheap_delete(struct binheap *bh, unsigned idx) { assert(bh != NULL); assert(bh->magic == BINHEAP_MAGIC); assert(bh->next > ROOT_IDX); assert(idx < bh->next); assert(idx > 0); assert(A(bh, idx) != NULL); bh->update(bh->priv, A(bh, idx), BINHEAP_NOIDX); if (idx == --bh->next) { A(bh, bh->next) = NULL; return; } A(bh, idx) = A(bh, bh->next); A(bh, bh->next) = NULL; binheap_update(bh, idx); idx = binheap_trickleup(bh, idx); assert(idx < bh->next); assert(idx > 0); assert(A(bh, idx) != NULL); idx = binheap_trickledown(bh, idx); assert(idx < bh->next); assert(idx > 0); assert(A(bh, idx) != NULL); /* * We keep a hysteresis of one full row before we start to * return space to the OS to avoid silly behaviour around * row boundaries. */ if (bh->next + 2 * ROW_WIDTH <= bh->length) { free(ROW(bh, bh->length - 1)); ROW(bh, bh->length - 1) = NULL; bh->length -= ROW_WIDTH; } } /* * Move an item up/down after changing its key value */ void binheap_reorder(const struct binheap *bh, unsigned idx) { assert(bh != NULL); assert(bh->magic == BINHEAP_MAGIC); assert(bh->next > ROOT_IDX); assert(idx < bh->next); assert(idx > 0); assert(A(bh, idx) != NULL); idx = binheap_trickleup(bh, idx); assert(idx < bh->next); assert(idx > 0); assert(A(bh, idx) != NULL); idx = binheap_trickledown(bh, idx); assert(idx < bh->next); assert(idx > 0); assert(A(bh, idx) != NULL); } #ifdef TEST_DRIVER #include #include "miniobj.h" /* Test driver -------------------------------------------------------*/ static void vasfail(const char *func, const char *file, int line, const char *cond, int err, int xxx) { fprintf(stderr, "PANIC: %s %s %d %s %d %d\n", func, file, line, cond, err, xxx); abort(); } vas_f *VAS_Fail = vasfail; struct foo { unsigned magic; #define FOO_MAGIC 0x23239823 unsigned idx; unsigned key; unsigned n; }; #if 1 #define M 31011091 /* Number of operations */ #define N 17313102 /* Number of items */ #else #define M 3401 /* Number of operations */ #define N 1131 /* Number of items */ #endif #define R -1 /* Random modulus */ struct foo *ff[N]; static int cmp(void *priv, void *a, void *b) { struct foo *fa, *fb; CAST_OBJ_NOTNULL(fa, a, FOO_MAGIC); CAST_OBJ_NOTNULL(fb, b, FOO_MAGIC); return (fa->key < fb->key); } void update(void *priv, void *a, unsigned u) { struct foo *fa; CAST_OBJ_NOTNULL(fa, a, FOO_MAGIC); fa->idx = u; } void chk2(struct binheap *bh) { unsigned u, v; struct foo *fa, *fb; for (u = 2; u < bh->next; u++) { v = parent(bh, u); fa = A(bh, u); fb = A(bh, v); assert(fa->key >= fb->key); } } int main(int argc, char **argv) { struct binheap *bh; unsigned u, v, lr, n; struct foo *fp; if (0) { srandomdev(); u = random(); printf("Seed %u\n", u); srandom(u); } bh = binheap_new(NULL, cmp, update); for (n = 2; n; n += n) { child(bh, n - 1, &u, &v); child(bh, n, &u, &v); child(bh, n + 1, &u, &v); } while (1) { /* First insert our N elements */ for (u = 0; u < N; u++) { lr = random() % R; ALLOC_OBJ(ff[u], FOO_MAGIC); assert(ff[u] != NULL); ff[u]->key = lr; ff[u]->n = u; binheap_insert(bh, ff[u]); fp = binheap_root(bh); assert(fp->idx == 1); assert(fp->key <= lr); } fprintf(stderr, "%d inserts OK\n", N); /* For M cycles, pick the root, insert new */ for (u = 0; u < M; u++) { fp = binheap_root(bh); CHECK_OBJ_NOTNULL(fp, FOO_MAGIC); assert(fp->idx == 1); /* * It cannot possibly be larger than the last * value we added */ assert(fp->key <= lr); binheap_delete(bh, fp->idx); n = fp->n; ALLOC_OBJ(ff[n], FOO_MAGIC); assert(ff[n] != NULL); FREE_OBJ(fp); fp = ff[n]; fp->n = n; lr = random() % R; fp->key = lr; binheap_insert(bh, fp); } fprintf(stderr, "%d replacements OK\n", M); /* The remove everything */ lr = 0; for (u = 0; u < N; u++) { fp = binheap_root(bh); CHECK_OBJ_NOTNULL(fp, FOO_MAGIC); assert(fp->idx == 1); assert(fp->key >= lr); lr = fp->key; binheap_delete(bh, fp->idx); ff[fp->n] = NULL; FREE_OBJ(fp); } fprintf(stderr, "%d removes OK\n", N); for (u = 0; u < M; u++) { v = random() % N; if (ff[v] != NULL) { CHECK_OBJ_NOTNULL(ff[v], FOO_MAGIC); AN(ff[v]->idx); if (ff[v]->key & 1) { binheap_delete(bh, ff[v]->idx); assert(ff[v]->idx == BINHEAP_NOIDX); FREE_OBJ(ff[v]); ff[v] = NULL; } else { ff[v]->key = random() % R; binheap_reorder(bh, ff[v]->idx); } } else { ALLOC_OBJ(ff[v], FOO_MAGIC); assert(ff[v] != NULL); ff[v]->key = random() % R; binheap_insert(bh, ff[v]); CHECK_OBJ_NOTNULL(ff[v], FOO_MAGIC); AN(ff[v]->idx); } if (0) chk2(bh); } fprintf(stderr, "%d updates OK\n", M); } return (0); } #endif varnish-4.1.1/lib/libvarnish/vss.c0000644000201500234410000000743312652366721014013 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2010 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Smørgrav * Author: Cecilie Fritzvold * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include #include #include #include #include #include "vas.h" #include "vsa.h" #include "vss.h" /*lint -esym(754, _storage) not ref */ /* * Take a string provided by the user and break it up into address and * port parts. Examples of acceptable input include: * * "localhost" - "localhost:80" * "127.0.0.1" - "127.0.0.1:80" * "0.0.0.0" - "0.0.0.0:80" * "[::1]" - "[::1]:80" * "[::]" - "[::]:80" * "::1" * * See also RFC5952 */ static const char * vss_parse(char *str, char **addr, char **port) { char *p; *addr = *port = NULL; if (str[0] == '[') { /* IPv6 address of the form [::1]:80 */ *addr = str + 1; p = strchr(str, ']'); if (p == NULL) return ("IPv6 address lacks ']'"); *p++ = '\0'; if (*p == '\0') return (NULL); if (*p != ' ' && *p != ':') return ("IPv6 address has wrong port separator"); } else { /* IPv4 address of the form 127.0.0.1:80, or non-numeric */ *addr = str; p = strchr(str, ' '); if (p == NULL) p = strchr(str, ':'); if (p == NULL) return (NULL); if (p[0] == ':' && strchr(&p[1], ':')) return (NULL); if (p == str) *addr = NULL; } *p++ = '\0'; *port = p; return (NULL); } /* * Look up an address, using a default port if provided, and call * the callback function with the suckaddrs we find. * If the callback function returns anything but zero, we terminate * and pass that value. */ int VSS_resolver(const char *addr, const char *def_port, vss_resolved_f *func, void *priv, const char **err) { struct addrinfo hints, *res0, *res; struct suckaddr *vsa; char *h; char *adp, *hop; int ret; *err = NULL; h = strdup(addr); AN(h); *err = vss_parse(h, &hop, &adp); if (*err != NULL) { free(h); return (-1); } if (adp != NULL) def_port = adp; memset(&hints, 0, sizeof hints); hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; ret = getaddrinfo(hop, def_port, &hints, &res0); free(h); if (ret != 0) { *err = gai_strerror(ret); return (-1); } for (res = res0; res != NULL; res = res->ai_next) { vsa = VSA_Malloc(res->ai_addr, res->ai_addrlen); if (vsa != NULL) { ret = func(priv, vsa); free(vsa); if (ret) break; } } freeaddrinfo(res0); return (ret); } varnish-4.1.1/lib/Makefile.am0000644000201500234410000000047412652366721012725 00000000000000# SUBDIRS = \ libvarnishcompat \ libvarnish \ libvarnishapi \ libvarnishtools \ libvcc \ libvgz \ libvmod_debug \ libvmod_std \ libvmod_directors DIST_SUBDIRS = \ libvarnishcompat \ libvarnish \ libvarnishapi \ libvarnishtools \ libvcc \ libvgz \ libvmod_debug \ libvmod_std \ libvmod_directors varnish-4.1.1/lib/libvarnishcompat/0000755000201500234410000000000012652366756014321 500000000000000varnish-4.1.1/lib/libvarnishcompat/Makefile.am0000644000201500234410000000041012652366721016260 00000000000000# AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include AM_LDFLAGS = $(AM_LT_LDFLAGS) pkglib_LTLIBRARIES = libvarnishcompat.la libvarnishcompat_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version libvarnishcompat_la_SOURCES = \ daemon.c \ execinfo.c varnish-4.1.1/lib/libvarnishcompat/Makefile.in0000644000201500234410000004564512652366727016322 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = lib/libvarnishcompat DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) libvarnishcompat_la_LIBADD = am_libvarnishcompat_la_OBJECTS = daemon.lo execinfo.lo libvarnishcompat_la_OBJECTS = $(am_libvarnishcompat_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent libvarnishcompat_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libvarnishcompat_la_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libvarnishcompat_la_SOURCES) DIST_SOURCES = $(libvarnishcompat_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include AM_LDFLAGS = $(AM_LT_LDFLAGS) pkglib_LTLIBRARIES = libvarnishcompat.la libvarnishcompat_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version libvarnishcompat_la_SOURCES = \ daemon.c \ execinfo.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/libvarnishcompat/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/libvarnishcompat/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libvarnishcompat.la: $(libvarnishcompat_la_OBJECTS) $(libvarnishcompat_la_DEPENDENCIES) $(EXTRA_libvarnishcompat_la_DEPENDENCIES) $(AM_V_CCLD)$(libvarnishcompat_la_LINK) -rpath $(pkglibdir) $(libvarnishcompat_la_OBJECTS) $(libvarnishcompat_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/daemon.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/execinfo.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/lib/libvarnishcompat/daemon.c0000644000201500234410000000527112652366721015645 00000000000000/*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * 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. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 THE REGENTS 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. * Derived from: * $FreeBSD: src/lib/libc/gen/daemon.c,v 1.8 2007/01/09 00:27:53 imp Exp $ */ #include "config.h" #ifndef HAVE_DAEMON #include #include #include #include #include #include "compat/daemon.h" int varnish_daemon(int nochdir, int noclose) { struct sigaction osa, sa; int fd; pid_t newgrp; int oerrno; int osa_ok; /* A SIGHUP may be thrown when the parent exits below. */ sigemptyset(&sa.sa_mask); sa.sa_handler = SIG_IGN; sa.sa_flags = 0; osa_ok = sigaction(SIGHUP, &sa, &osa); switch (fork()) { case -1: return (-1); case 0: break; default: /* * A fine point: _exit(0), not exit(0), to avoid triggering * atexit(3) processing */ _exit(0); } newgrp = setsid(); oerrno = errno; if (osa_ok != -1) sigaction(SIGHUP, &osa, NULL); if (newgrp == -1) { errno = oerrno; return (-1); } if (!nochdir) (void)chdir("/"); if (!noclose && (fd = open("/dev/null", O_RDWR, 0)) != -1) { (void)dup2(fd, STDIN_FILENO); (void)dup2(fd, STDOUT_FILENO); (void)dup2(fd, STDERR_FILENO); if (fd > 2) (void)close(fd); } return (0); } #endif varnish-4.1.1/lib/libvarnishcompat/execinfo.c0000644000201500234410000001157712652366721016210 00000000000000/* * Copyright (c) 2003 Maxim Sobolev * All rights reserved. * * 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 THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #ifndef HAVE_BACKTRACE #include "compat/execinfo.h" #if defined (__GNUC__) && __GNUC__ >= 4 /* XXX Correct version to check for ? */ #include #include #include #include #include #include #include #include #include static void *getreturnaddr(int); static void *getframeaddr(int); int backtrace(void **buffer, int size) { int i; for (i = 1; getframeaddr(i + 1) != NULL && i != size + 1; i++) { buffer[i - 1] = getreturnaddr(i); if (buffer[i - 1] == NULL) break; } return (i - 1); } /* * XXX: This implementation should be changed to a much more conservative * XXX: memory strategy: Allocate 4k up front, realloc 4K more as needed. */ char ** backtrace_symbols(void *const *buffer, int size) { size_t clen, alen; int i; char **rval; clen = size * sizeof(char *); rval = malloc(clen); if (rval == NULL) return (NULL); for (i = 0; i < size; i++) { #ifdef HAVE_DLADDR { Dl_info info; int offset; if (dladdr(buffer[i], &info) != 0) { if (info.dli_sname == NULL) info.dli_sname = "?"; if (info.dli_saddr == NULL) info.dli_saddr = buffer[i]; offset = (const char*)buffer[i] - (const char*)info.dli_saddr; /* "0x01234567 at filename" */ alen = 2 + /* "0x" */ (sizeof(void *) * 2) + /* "01234567" */ 2 + /* " <" */ strlen(info.dli_sname) + /* "function" */ 1 + /* "+" */ 10 + /* "offset */ 5 + /* "> at " */ strlen(info.dli_fname) + /* "filename" */ 1; /* "\0" */ rval = realloc(rval, clen + alen); if (rval == NULL) return NULL; (void)snprintf((char *) rval + clen, alen, "%p <%s+%d> at %s", buffer[i], info.dli_sname, offset, info.dli_fname); rval[i] = (char *) clen; clen += alen; continue; } } #endif alen = 2 + /* "0x" */ (sizeof(void *) * 2) + /* "01234567" */ 1; /* "\0" */ rval = realloc(rval, clen + alen); if (rval == NULL) return NULL; (void)snprintf((char *) rval + clen, alen, "%p", buffer[i]); rval[i] = (char *) clen; clen += alen; } for (i = 0; i < size; i++) rval[i] += (long) rval; return (rval); } /* Binary expansion */ #define DO_P2_TIMES_1(x) DO_P2_TIMES_0(x); DO_P2_TIMES_0((x) + (1<<0)) #define DO_P2_TIMES_2(x) DO_P2_TIMES_1(x); DO_P2_TIMES_1((x) + (1<<1)) #define DO_P2_TIMES_3(x) DO_P2_TIMES_2(x); DO_P2_TIMES_2((x) + (1<<2)) #define DO_P2_TIMES_4(x) DO_P2_TIMES_3(x); DO_P2_TIMES_3((x) + (1<<3)) #define DO_P2_TIMES_5(x) DO_P2_TIMES_4(x); DO_P2_TIMES_4((x) + (1<<4)) #define DO_P2_TIMES_6(x) DO_P2_TIMES_5(x); DO_P2_TIMES_5((x) + (1<<5)) #define DO_P2_TIMES_7(x) DO_P2_TIMES_6(x); DO_P2_TIMES_6((x) + (1<<6)) static void * getreturnaddr(int level) { switch(level) { #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; } } static void * getframeaddr(int level) { switch(level) { #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; } } #else int backtrace(void **buffer, int size) { (void)buffer; (void)size; return (0); } char ** backtrace_symbols(void *const *buffer, int size) { (void)buffer; (void)size; return (0); } #endif /* (__GNUC__) && __GNUC__ >= 4 */ #endif /* HAVE_BACKTRACE */ varnish-4.1.1/lib/libvcc/0000755000201500234410000000000012652366756012216 500000000000000varnish-4.1.1/lib/libvcc/vcc_symb.c0000644000201500234410000000735712652366721014113 00000000000000/*- * Copyright (c) 2010 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. */ #include "config.h" #include #include #include #include "vcc_compile.h" /*--------------------------------------------------------------------*/ const char * VCC_SymKind(struct vcc *tl, const struct symbol *s) { switch(s->kind) { #define VCC_SYMB(uu, ll) case SYM_##uu: return(#ll); #include "tbl/symbol_kind.h" #undef VCC_SYMB default: ErrInternal(tl); VSB_printf(tl->sb, "Symbol Kind 0x%x\n", s->kind); return("INTERNALERROR"); } } static struct symbol * vcc_AddSymbol(struct vcc *tl, const char *nb, int l, enum symkind kind) { struct symbol *sym; VTAILQ_FOREACH(sym, &tl->symbols, list) { if (sym->nlen != l) continue; if (memcmp(nb, sym->name, l)) continue; if (kind != sym->kind) continue; VSB_printf(tl->sb, "Name Collision: <%.*s> <%s>\n", l, nb, VCC_SymKind(tl, sym)); ErrInternal(tl); return (NULL); } ALLOC_OBJ(sym, SYMBOL_MAGIC); AN(sym); sym->name = malloc(l + 1L); AN(sym->name); memcpy(sym->name, nb, l); sym->name[l] = '\0'; sym->nlen = l; VTAILQ_INSERT_HEAD(&tl->symbols, sym, list); sym->kind = kind; return (sym); } struct symbol * VCC_AddSymbolStr(struct vcc *tl, const char *name, enum symkind kind) { return (vcc_AddSymbol(tl, name, strlen(name), kind)); } struct symbol * VCC_AddSymbolTok(struct vcc *tl, const struct token *t, enum symkind kind) { return (vcc_AddSymbol(tl, t->b, t->e - t->b, kind)); } struct symbol * VCC_GetSymbolTok(struct vcc *tl, const struct token *tok, enum symkind kind) { struct symbol *sym; sym = VCC_FindSymbol(tl, tok, kind); if (sym == NULL) { sym = vcc_AddSymbol(tl, tok->b, tok->e - tok->b, kind); AN(sym); sym->def_b = tok; } return (sym); } struct symbol * VCC_FindSymbol(struct vcc *tl, const struct token *t, enum symkind kind) { struct symbol *sym; assert(t->tok == ID); VTAILQ_FOREACH(sym, &tl->symbols, list) { if (sym->kind == SYM_WILDCARD && (t->e - t->b > sym->nlen) && !memcmp(sym->name, t->b, sym->nlen)) { AN(sym->wildcard); return (sym->wildcard(tl, t, sym)); } if (kind != SYM_NONE && kind != sym->kind) continue; if (vcc_IdIs(t, sym->name)) return (sym); } return (NULL); } void VCC_WalkSymbols(struct vcc *tl, symwalk_f *func, enum symkind kind) { struct symbol *sym; VTAILQ_FOREACH(sym, &tl->symbols, list) { if (kind == SYM_NONE || kind == sym->kind) func(tl, sym); ERRCHK(tl); } } varnish-4.1.1/lib/libvcc/vcc_obj.c0000644000201500234410000004036212652366743013710 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ #include "config.h" #include #include "vcc_compile.h" const struct var vcc_vars[] = { { "bereq", HTTP, 5, "VRT_r_bereq(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE, NULL, /* No writes allowed */ 0, }, { "bereq.backend", BACKEND, 13, "VRT_r_bereq_backend(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_PIPE, "VRT_l_bereq_backend(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_PIPE, }, { "bereq.between_bytes_timeout", DURATION, 27, "VRT_r_bereq_between_bytes_timeout(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE, "VRT_l_bereq_between_bytes_timeout(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE, }, { "bereq.connect_timeout", DURATION, 21, "VRT_r_bereq_connect_timeout(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_PIPE, "VRT_l_bereq_connect_timeout(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_PIPE, }, { "bereq.first_byte_timeout", DURATION, 24, "VRT_r_bereq_first_byte_timeout(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE, "VRT_l_bereq_first_byte_timeout(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE, }, { "bereq.http.", HEADER, 11, "HDR_BEREQ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_PIPE, "HDR_BEREQ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_PIPE, }, { "bereq.method", STRING, 12, "VRT_r_bereq_method(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_PIPE, "VRT_l_bereq_method(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_PIPE, }, { "bereq.proto", STRING, 11, "VRT_r_bereq_proto(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_PIPE, "VRT_l_bereq_proto(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_PIPE, }, { "bereq.retries", INT, 13, "VRT_r_bereq_retries(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE, NULL, /* No writes allowed */ 0, }, { "bereq.uncacheable", BOOL, 17, "VRT_r_bereq_uncacheable(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE, NULL, /* No writes allowed */ 0, }, { "bereq.url", STRING, 9, "VRT_r_bereq_url(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_PIPE, "VRT_l_bereq_url(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_PIPE, }, { "bereq.xid", STRING, 9, "VRT_r_bereq_xid(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE, NULL, /* No writes allowed */ 0, }, { "beresp", HTTP, 6, "VRT_r_beresp(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, NULL, /* No writes allowed */ 0, }, { "beresp.age", DURATION, 10, "VRT_r_beresp_age(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, NULL, /* No writes allowed */ 0, }, { "beresp.backend", BACKEND, 14, "VRT_r_beresp_backend(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, NULL, /* No writes allowed */ 0, }, { "beresp.backend.ip", IP, 17, "VRT_r_beresp_backend_ip(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, NULL, /* No writes allowed */ 0, }, { "beresp.backend.name", STRING, 19, "VRT_r_beresp_backend_name(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, NULL, /* No writes allowed */ 0, }, { "beresp.do_esi", BOOL, 13, "VRT_r_beresp_do_esi(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "VRT_l_beresp_do_esi(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.do_gunzip", BOOL, 16, "VRT_r_beresp_do_gunzip(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "VRT_l_beresp_do_gunzip(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.do_gzip", BOOL, 14, "VRT_r_beresp_do_gzip(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "VRT_l_beresp_do_gzip(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.do_stream", BOOL, 16, "VRT_r_beresp_do_stream(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "VRT_l_beresp_do_stream(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.grace", DURATION, 12, "VRT_r_beresp_grace(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "VRT_l_beresp_grace(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.http.", HEADER, 12, "HDR_BERESP", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "HDR_BERESP", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.keep", DURATION, 11, "VRT_r_beresp_keep(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "VRT_l_beresp_keep(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.proto", STRING, 12, "VRT_r_beresp_proto(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "VRT_l_beresp_proto(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.reason", STRING, 13, "VRT_r_beresp_reason(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "VRT_l_beresp_reason(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.status", INT, 13, "VRT_r_beresp_status(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "VRT_l_beresp_status(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.storage_hint", STRING, 19, "VRT_r_beresp_storage_hint(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "VRT_l_beresp_storage_hint(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.ttl", DURATION, 10, "VRT_r_beresp_ttl(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "VRT_l_beresp_ttl(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.uncacheable", BOOL, 18, "VRT_r_beresp_uncacheable(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, "VRT_l_beresp_uncacheable(ctx, ", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, }, { "beresp.was_304", BOOL, 14, "VRT_r_beresp_was_304(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE, NULL, /* No writes allowed */ 0, }, { "client.identity", STRING, 15, "VRT_r_client_identity(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, "VRT_l_client_identity(ctx, ", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, }, { "client.ip", IP, 9, "VRT_r_client_ip(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "local.ip", IP, 8, "VRT_r_local_ip(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "now", TIME, 3, "VRT_r_now(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_DELIVER | VCL_MET_FINI | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_INIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "obj.age", DURATION, 7, "VRT_r_obj_age(ctx)", VCL_MET_HIT, NULL, /* No writes allowed */ 0, }, { "obj.grace", DURATION, 9, "VRT_r_obj_grace(ctx)", VCL_MET_HIT, NULL, /* No writes allowed */ 0, }, { "obj.hits", INT, 8, "VRT_r_obj_hits(ctx)", VCL_MET_DELIVER | VCL_MET_HIT, NULL, /* No writes allowed */ 0, }, { "obj.http.", HEADER, 9, "HDR_OBJ", VCL_MET_HIT, NULL, /* No writes allowed */ 0, }, { "obj.keep", DURATION, 8, "VRT_r_obj_keep(ctx)", VCL_MET_HIT, NULL, /* No writes allowed */ 0, }, { "obj.proto", STRING, 9, "VRT_r_obj_proto(ctx)", VCL_MET_HIT, NULL, /* No writes allowed */ 0, }, { "obj.reason", STRING, 10, "VRT_r_obj_reason(ctx)", VCL_MET_HIT, NULL, /* No writes allowed */ 0, }, { "obj.status", INT, 10, "VRT_r_obj_status(ctx)", VCL_MET_HIT, NULL, /* No writes allowed */ 0, }, { "obj.ttl", DURATION, 7, "VRT_r_obj_ttl(ctx)", VCL_MET_HIT, NULL, /* No writes allowed */ 0, }, { "obj.uncacheable", BOOL, 15, "VRT_r_obj_uncacheable(ctx)", VCL_MET_DELIVER, NULL, /* No writes allowed */ 0, }, { "remote.ip", IP, 9, "VRT_r_remote_ip(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "req", HTTP, 3, "VRT_r_req(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "req.backend_hint", BACKEND, 16, "VRT_r_req_backend_hint(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, "VRT_l_req_backend_hint(ctx, ", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, }, { "req.can_gzip", BOOL, 12, "VRT_r_req_can_gzip(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "req.esi", BOOL, 7, "VRT_r_req_esi(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, "VRT_l_req_esi(ctx, ", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, }, { "req.esi_level", INT, 13, "VRT_r_req_esi_level(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "req.hash_always_miss", BOOL, 20, "VRT_r_req_hash_always_miss(ctx)", VCL_MET_RECV, "VRT_l_req_hash_always_miss(ctx, ", VCL_MET_RECV, }, { "req.hash_ignore_busy", BOOL, 20, "VRT_r_req_hash_ignore_busy(ctx)", VCL_MET_RECV, "VRT_l_req_hash_ignore_busy(ctx, ", VCL_MET_RECV, }, { "req.http.", HEADER, 9, "HDR_REQ", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, "HDR_REQ", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, }, { "req.method", STRING, 10, "VRT_r_req_method(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, "VRT_l_req_method(ctx, ", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, }, { "req.proto", STRING, 9, "VRT_r_req_proto(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, "VRT_l_req_proto(ctx, ", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, }, { "req.restarts", INT, 12, "VRT_r_req_restarts(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "req.ttl", DURATION, 7, "VRT_r_req_ttl(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, "VRT_l_req_ttl(ctx, ", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, }, { "req.url", STRING, 7, "VRT_r_req_url(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, "VRT_l_req_url(ctx, ", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, }, { "req.xid", STRING, 7, "VRT_r_req_xid(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "req_top.http.", HEADER, 13, "HDR_REQ_TOP", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "req_top.method", STRING, 14, "VRT_r_req_top_method(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "req_top.proto", STRING, 13, "VRT_r_req_top_proto(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "req_top.url", STRING, 11, "VRT_r_req_top_url(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "resp", HTTP, 4, "VRT_r_resp(ctx)", VCL_MET_DELIVER | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "resp.http.", HEADER, 10, "HDR_RESP", VCL_MET_DELIVER | VCL_MET_SYNTH, "HDR_RESP", VCL_MET_DELIVER | VCL_MET_SYNTH, }, { "resp.is_streaming", BOOL, 17, "VRT_r_resp_is_streaming(ctx)", VCL_MET_DELIVER | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "resp.proto", STRING, 10, "VRT_r_resp_proto(ctx)", VCL_MET_DELIVER | VCL_MET_SYNTH, "VRT_l_resp_proto(ctx, ", VCL_MET_DELIVER | VCL_MET_SYNTH, }, { "resp.reason", STRING, 11, "VRT_r_resp_reason(ctx)", VCL_MET_DELIVER | VCL_MET_SYNTH, "VRT_l_resp_reason(ctx, ", VCL_MET_DELIVER | VCL_MET_SYNTH, }, { "resp.status", INT, 11, "VRT_r_resp_status(ctx)", VCL_MET_DELIVER | VCL_MET_SYNTH, "VRT_l_resp_status(ctx, ", VCL_MET_DELIVER | VCL_MET_SYNTH, }, { "server.hostname", STRING, 15, "VRT_r_server_hostname(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_DELIVER | VCL_MET_FINI | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_INIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "server.identity", STRING, 15, "VRT_r_server_identity(ctx)", VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE | VCL_MET_DELIVER | VCL_MET_FINI | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_INIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { "server.ip", IP, 9, "VRT_r_server_ip(ctx)", VCL_MET_DELIVER | VCL_MET_HASH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV | VCL_MET_SYNTH, NULL, /* No writes allowed */ 0, }, { NULL } }; varnish-4.1.1/lib/libvcc/vcc_compile.h0000644000201500234410000002333012652366721014563 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include #include #include #include "miniobj.h" #include "vas.h" #include "vcl.h" #include "vdef.h" #include "vqueue.h" #include "vsb.h" #include "vcc_token_defs.h" #ifndef NULL #define NULL ((void*)0) #endif struct vsb; struct token; struct sockaddr_storage; #define isident1(c) (isalpha(c)) #define isident(c) (isalpha(c) || isdigit(c) || (c) == '_' || (c) == '-') #define isvar(c) (isident(c) || (c) == '.') int vcc_isCid(const struct token *t); unsigned vcl_fixed_token(const char *p, const char **q); extern const char * const vcl_tnames[256]; void vcl_output_lang_h(struct vsb *sb); #define PF(t) (int)((t)->e - (t)->b), (t)->b #define INDENT 2 struct acl_e; struct proc; struct expr; struct vcc; struct symbol; enum var_type { #define VCC_TYPE(foo) foo, #include "tbl/vcc_types.h" #undef VCC_TYPE }; struct membit { VTAILQ_ENTRY(membit) list; void *ptr; }; struct source { VTAILQ_ENTRY(source) list; char *name; const char *b; const char *e; unsigned idx; char *freeit; }; struct token { unsigned tok; const char *b; const char *e; struct source *src; VTAILQ_ENTRY(token) list; unsigned cnt; char *dec; }; enum symkind { #define VCC_SYMB(uu, ll) SYM_##uu, #include "tbl/symbol_kind.h" #undef VCC_SYMB }; typedef void sym_expr_t(struct vcc *tl, struct expr **, const struct symbol *sym); typedef struct symbol *sym_wildcard_t(struct vcc *tl, const struct token *t, const struct symbol *sym); struct symbol { unsigned magic; #define SYMBOL_MAGIC 0x3368c9fb VTAILQ_ENTRY(symbol) list; char *name; unsigned nlen; sym_wildcard_t *wildcard; enum symkind kind; const struct token *def_b, *def_e; enum var_type fmt; sym_expr_t *eval; void *eval_priv; /* xref.c */ struct proc *proc; unsigned nref, ndef; /* SYM_PROC, SYM_FUNC */ const char *cfunc; const char *extra; const char *args; /* SYM_VAR */ const struct var *var; unsigned r_methods; }; VTAILQ_HEAD(tokenhead, token); struct inifin { unsigned magic; #define INIFIN_MAGIC 0x583c274c unsigned n; struct vsb *ini; struct vsb *fin; struct vsb *event; VTAILQ_ENTRY(inifin) list; }; VTAILQ_HEAD(inifinhead, inifin); struct vcp { unsigned magic; #define VCP_MAGIC 0xd90acfbc char *builtin_vcl; char *vcl_dir; struct vfil_path *vcl_path; char *vmod_dir; struct vfil_path *vmod_path; unsigned err_unref; unsigned allow_inline_c; unsigned unsafe_path; }; struct vcc { unsigned magic; #define VCC_MAGIC 0x24ad719d /* Parameter/Template section */ const struct vcp *param; const struct var *vars; VTAILQ_HEAD(, symbol) symbols; struct inifinhead inifin; unsigned ninifin; /* Instance section */ struct tokenhead tokens; VTAILQ_HEAD(, source) sources; VTAILQ_HEAD(, membit) membits; unsigned nsources; struct source *src; struct token *t; int indent; int hindent; unsigned cnt; struct vsb *fc; /* C-code */ struct vsb *fh; /* H-code (before C-code) */ struct vsb *fb; /* Body of current sub * NULL otherwise */ struct vsb *fm[VCL_MET_MAX]; /* Method bodies */ struct vsb *sb; int err; struct proc *curproc; struct proc *mprocs[VCL_MET_MAX]; VTAILQ_HEAD(, acl_e) acl; int nprobe; const char *default_director; struct token *t_default_director; const char *default_probe; unsigned unique; }; struct var { const char *name; enum var_type fmt; unsigned len; const char *rname; unsigned r_methods; const char *lname; unsigned w_methods; }; struct method { const char *name; unsigned ret_bitmap; unsigned bitval; }; /*--------------------------------------------------------------------*/ /* vcc_acl.c */ void vcc_ParseAcl(struct vcc *tl); void vcc_Acl_Hack(struct vcc *tl, char *b); /* vcc_action.c */ int vcc_ParseAction(struct vcc *tl); /* vcc_backend.c */ #define MAX_BACKEND_NAME 64 struct fld_spec; void vcc_ParseProbe(struct vcc *tl); void vcc_ParseBackend(struct vcc *tl); struct fld_spec * vcc_FldSpec(struct vcc *tl, const char *first, ...); void vcc_IsField(struct vcc *tl, struct token **t, struct fld_spec *fs); void vcc_FieldsOk(struct vcc *tl, const struct fld_spec *fs); /* vcc_compile.c */ extern struct method method_tab[]; struct inifin *New_IniFin(struct vcc *tl); /* * H -> Header, before the C code * C -> C-code * B -> Body of function, ends up in C once function is completed * I -> Initializer function * F -> Finish function */ void Fh(const struct vcc *tl, int indent, const char *fmt, ...) __v_printflike(3, 4); void Fc(const struct vcc *tl, int indent, const char *fmt, ...) __v_printflike(3, 4); void Fb(const struct vcc *tl, int indent, const char *fmt, ...) __v_printflike(3, 4); void EncToken(struct vsb *sb, const struct token *t); int IsMethod(const struct token *t); void *TlAlloc(struct vcc *tl, unsigned len); char *TlDup(struct vcc *tl, const char *s); char *TlDupTok(struct vcc *tl, const struct token *tok); void EncString(struct vsb *sb, const char *b, const char *e, int mode); /* vcc_expr.c */ double vcc_DoubleVal(struct vcc *tl); void vcc_Duration(struct vcc *tl, double *); unsigned vcc_UintVal(struct vcc *tl); void vcc_Expr(struct vcc *tl, enum var_type typ); void vcc_Expr_Call(struct vcc *tl, const struct symbol *sym); void vcc_Expr_Init(struct vcc *tl); sym_expr_t vcc_Eval_Var; sym_expr_t vcc_Eval_SymFunc; void vcc_Eval_Func(struct vcc *tl, const char *cfunc, const char *extra, const char *name, const char *args); sym_expr_t vcc_Eval_Backend; sym_expr_t vcc_Eval_Probe; /* vcc_obj.c */ extern const struct var vcc_vars[]; /* vcc_parse.c */ void vcc_Parse(struct vcc *tl); /* vcc_storage.c */ sym_wildcard_t vcc_Stv_Wildcard; /* vcc_utils.c */ const char *vcc_regexp(struct vcc *tl); void Resolve_Sockaddr(struct vcc *tl, const char *host, const char *defport, const char **ipv4, const char **ipv4_ascii, const char **ipv6, const char **ipv6_ascii, const char **p_ascii, int maxips, const struct token *t_err, const char *errid); /* vcc_symb.c */ struct symbol *VCC_AddSymbolStr(struct vcc *tl, const char *name, enum symkind); struct symbol *VCC_AddSymbolTok(struct vcc *tl, const struct token *t, enum symkind kind); struct symbol *VCC_GetSymbolTok(struct vcc *tl, const struct token *tok, enum symkind); struct symbol *VCC_FindSymbol(struct vcc *tl, const struct token *t, enum symkind kind); const char * VCC_SymKind(struct vcc *tl, const struct symbol *s); typedef void symwalk_f(struct vcc *tl, const struct symbol *s); void VCC_WalkSymbols(struct vcc *tl, symwalk_f *func, enum symkind kind); /* vcc_token.c */ void vcc_Coord(const struct vcc *tl, struct vsb *vsb, const struct token *t); void vcc_ErrToken(const struct vcc *tl, const struct token *t); void vcc_ErrWhere(struct vcc *, const struct token *); void vcc_ErrWhere2(struct vcc *, const struct token *, const struct token *); void vcc__Expect(struct vcc *tl, unsigned tok, unsigned line); int vcc_IdIs(const struct token *t, const char *p); void vcc_ExpectCid(struct vcc *tl); void vcc_Lexer(struct vcc *tl, struct source *sp); void vcc_NextToken(struct vcc *tl); void vcc__ErrInternal(struct vcc *tl, const char *func, unsigned line); void vcc_AddToken(struct vcc *tl, unsigned tok, const char *b, const char *e); /* vcc_var.c */ sym_wildcard_t vcc_Var_Wildcard; const struct var *vcc_FindVar(struct vcc *tl, const struct token *t, int wr_access, const char *use); /* vcc_vmod.c */ void vcc_ParseImport(struct vcc *tl); /* vcc_xref.c */ int vcc_AddDef(struct vcc *tl, const struct token *t, enum symkind type); void vcc_AddRef(struct vcc *tl, const struct token *t, enum symkind type); int vcc_CheckReferences(struct vcc *tl); void vcc_AddCall(struct vcc *tl, struct token *t); struct proc *vcc_AddProc(struct vcc *tl, struct token *t); void vcc_ProcAction(struct proc *p, unsigned action, struct token *t); int vcc_CheckAction(struct vcc *tl); void vcc_AddUses(struct vcc *tl, const struct token *t, unsigned mask, const char *use); int vcc_CheckUses(struct vcc *tl); #define ERRCHK(tl) do { if ((tl)->err) return; } while (0) #define ErrInternal(tl) vcc__ErrInternal(tl, __func__, __LINE__) #define Expect(a, b) vcc__Expect(a, b, __LINE__) #define ExpectErr(a, b) \ do { vcc__Expect(a, b, __LINE__); ERRCHK(a);} while (0) #define SkipToken(a, b) \ do { vcc__Expect(a, b, __LINE__); ERRCHK(a); vcc_NextToken(a); } while (0) varnish-4.1.1/lib/libvcc/vcc_xref.c0000644000201500234410000002136112652366721014074 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * This file contains code for two cross-reference or consistency checks. * * The first check is simply that all subroutine, acls and backends are * both defined and referenced. Complaints about referenced but undefined * or defined but unreferenced objects will be emitted. * * The second check recursively decends through subroutine calls to make * sure that action actions are correct for the methods through which * they are called. */ #include "config.h" #include #include "vcc_compile.h" /*--------------------------------------------------------------------*/ struct proccall { VTAILQ_ENTRY(proccall) list; struct proc *p; struct token *t; }; struct procuse { VTAILQ_ENTRY(procuse) list; const struct token *t; unsigned mask; const char *use; }; struct proc { VTAILQ_HEAD(,proccall) calls; VTAILQ_HEAD(,procuse) uses; struct token *name; unsigned ret_bitmap; unsigned exists; unsigned called; unsigned active; struct token *return_tok[VCL_RET_MAX]; }; /*-------------------------------------------------------------------- * Keep track of definitions and references */ void vcc_AddRef(struct vcc *tl, const struct token *t, enum symkind kind) { struct symbol *sym; sym = VCC_GetSymbolTok(tl, t, kind); AN(sym); sym->nref++; } int vcc_AddDef(struct vcc *tl, const struct token *t, enum symkind kind) { struct symbol *sym; sym = VCC_GetSymbolTok(tl, t, kind); AN(sym); sym->ndef++; return (sym->ndef); } /*--------------------------------------------------------------------*/ static void vcc_checkref(struct vcc *tl, const struct symbol *sym) { if (sym->ndef == 0 && sym->nref != 0) { VSB_printf(tl->sb, "Undefined %s %.*s, first reference:\n", VCC_SymKind(tl, sym), PF(sym->def_b)); vcc_ErrWhere(tl, sym->def_b); } else if (sym->ndef != 0 && sym->nref == 0) { VSB_printf(tl->sb, "Unused %s %.*s, defined:\n", VCC_SymKind(tl, sym), PF(sym->def_b)); vcc_ErrWhere(tl, sym->def_b); if (!tl->param->err_unref) { VSB_printf(tl->sb, "(That was just a warning)\n"); tl->err = 0; } } } int vcc_CheckReferences(struct vcc *tl) { VCC_WalkSymbols(tl, vcc_checkref, SYM_NONE); return (tl->err); } /*-------------------------------------------------------------------- * Returns checks */ static struct proc * vcc_findproc(struct vcc *tl, struct token *t) { struct symbol *sym; struct proc *p; sym = VCC_GetSymbolTok(tl, t, SYM_SUB); AN(sym); if (sym->proc != NULL) return (sym->proc); p = TlAlloc(tl, sizeof *p); assert(p != NULL); VTAILQ_INIT(&p->calls); VTAILQ_INIT(&p->uses); p->name = t; sym->proc = p; return (p); } struct proc * vcc_AddProc(struct vcc *tl, struct token *t) { struct proc *p; p = vcc_findproc(tl, t); p->name = t; /* make sure the name matches the definition */ p->exists++; return (p); } void vcc_AddUses(struct vcc *tl, const struct token *t, unsigned mask, const char *use) { struct procuse *pu; if (tl->curproc == NULL) /* backend */ return; pu = TlAlloc(tl, sizeof *pu); assert(pu != NULL); pu->t = t; pu->mask = mask; pu->use = use; VTAILQ_INSERT_TAIL(&tl->curproc->uses, pu, list); } void vcc_AddCall(struct vcc *tl, struct token *t) { struct proccall *pc; struct proc *p; p = vcc_findproc(tl, t); pc = TlAlloc(tl, sizeof *pc); assert(pc != NULL); pc->p = p; pc->t = t; VTAILQ_INSERT_TAIL(&tl->curproc->calls, pc, list); } void vcc_ProcAction(struct proc *p, unsigned returns, struct token *t) { assert(returns < VCL_RET_MAX); p->ret_bitmap |= (1U << returns); /* Record the first instance of this return */ if (p->return_tok[returns] == NULL) p->return_tok[returns] = t; } static int vcc_CheckActionRecurse(struct vcc *tl, struct proc *p, unsigned bitmap) { unsigned u; struct proccall *pc; if (!p->exists) { VSB_printf(tl->sb, "Function %.*s does not exist\n", PF(p->name)); return (1); } if (p->active) { VSB_printf(tl->sb, "Function recurses on\n"); vcc_ErrWhere(tl, p->name); return (1); } u = p->ret_bitmap & ~bitmap; if (u) { #define VCL_RET_MAC(l, U, B) \ if (u & (1 << (VCL_RET_##U))) { \ VSB_printf(tl->sb, "Invalid return \"" #l "\"\n");\ vcc_ErrWhere(tl, p->return_tok[VCL_RET_##U]); \ } #include "tbl/vcl_returns.h" #undef VCL_RET_MAC VSB_printf(tl->sb, "\n...in subroutine \"%.*s\"\n", PF(p->name)); vcc_ErrWhere(tl, p->name); return (1); } p->active = 1; VTAILQ_FOREACH(pc, &p->calls, list) { if (vcc_CheckActionRecurse(tl, pc->p, bitmap)) { VSB_printf(tl->sb, "\n...called from \"%.*s\"\n", PF(p->name)); vcc_ErrWhere(tl, pc->t); return (1); } } p->active = 0; p->called++; return (0); } /*--------------------------------------------------------------------*/ static void vcc_checkaction1(struct vcc *tl, const struct symbol *sym) { struct proc *p; struct method *m; int i; p = sym->proc; AN(p); i = IsMethod(p->name); if (i < 0) return; m = method_tab + i; if (vcc_CheckActionRecurse(tl, p, m->ret_bitmap)) { VSB_printf(tl->sb, "\n...which is the \"%s\" method\n", m->name); VSB_printf(tl->sb, "Legal returns are:"); #define VCL_RET_MAC(l, U, B) \ if (m->ret_bitmap & ((1 << VCL_RET_##U))) \ VSB_printf(tl->sb, " \"%s\"", #l); #include "tbl/vcl_returns.h" #undef VCL_RET_MAC VSB_printf(tl->sb, "\n"); tl->err = 1; } } static void vcc_checkaction2(struct vcc *tl, const struct symbol *sym) { struct proc *p; p = sym->proc; AN(p); if (p->called) return; VSB_printf(tl->sb, "Function unused\n"); vcc_ErrWhere(tl, p->name); if (!tl->param->err_unref) { VSB_printf(tl->sb, "(That was just a warning)\n"); tl->err = 0; } } int vcc_CheckAction(struct vcc *tl) { VCC_WalkSymbols(tl, vcc_checkaction1, SYM_SUB); if (tl->err) return (tl->err); VCC_WalkSymbols(tl, vcc_checkaction2, SYM_SUB); return (tl->err); } /*--------------------------------------------------------------------*/ static struct procuse * vcc_FindIllegalUse(const struct proc *p, const struct method *m) { struct procuse *pu; VTAILQ_FOREACH(pu, &p->uses, list) if (!(pu->mask & m->bitval)) return (pu); return (NULL); } static int vcc_CheckUseRecurse(struct vcc *tl, const struct proc *p, struct method *m) { struct proccall *pc; struct procuse *pu; pu = vcc_FindIllegalUse(p, m); if (pu != NULL) { VSB_printf(tl->sb, "'%.*s': %s from method '%.*s'.\n", PF(pu->t), pu->use, PF(p->name)); vcc_ErrWhere(tl, pu->t); VSB_printf(tl->sb, "\n...in subroutine \"%.*s\"\n", PF(p->name)); vcc_ErrWhere(tl, p->name); return (1); } VTAILQ_FOREACH(pc, &p->calls, list) { if (vcc_CheckUseRecurse(tl, pc->p, m)) { VSB_printf(tl->sb, "\n...called from \"%.*s\"\n", PF(p->name)); vcc_ErrWhere(tl, pc->t); return (1); } } return (0); } static void vcc_checkuses(struct vcc *tl, const struct symbol *sym) { struct proc *p; struct method *m; struct procuse *pu; int i; p = sym->proc; AN(p); i = IsMethod(p->name); if (i < 0) return; m = method_tab + i; pu = vcc_FindIllegalUse(p, m); if (pu != NULL) { VSB_printf(tl->sb, "'%.*s': %s in method '%.*s'.", PF(pu->t), pu->use, PF(p->name)); VSB_cat(tl->sb, "\nAt: "); vcc_ErrWhere(tl, pu->t); return; } if (vcc_CheckUseRecurse(tl, p, m)) { VSB_printf(tl->sb, "\n...which is the \"%s\" method\n", m->name); return; } } int vcc_CheckUses(struct vcc *tl) { VCC_WalkSymbols(tl, vcc_checkuses, SYM_SUB); return (tl->err); } varnish-4.1.1/lib/libvcc/Makefile.am0000644000201500234410000000135312652366721014164 00000000000000# AM_LDFLAGS = $(AM_LT_LDFLAGS) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include pkglib_LTLIBRARIES = libvcc.la libvcc_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version libvcc_la_SOURCES = \ vcc_compile.h \ vcc_token_defs.h \ \ vcc_acl.c \ vcc_action.c \ vcc_backend.c \ vcc_backend_util.c \ vcc_compile.c \ vcc_expr.c \ vcc_parse.c \ vcc_fixed_token.c \ vcc_obj.c \ vcc_storage.c \ vcc_utils.c \ vcc_symb.c \ vcc_token.c \ vcc_var.c \ vcc_vmod.c \ vcc_xref.c EXTRA_DIST = \ generate.py dist_pkgdata_SCRIPTS = \ vmodtool.py vcc_obj.c vcc_fixed_token.c vcc_token_defs.h: \ $(top_builddir)/include/vcl.h CLEANFILES = $(builddir)/vcc_token_defs.h \ $(builddir)/vcc_fixed_token.c \ $(builddir)/vcc_obj.c varnish-4.1.1/lib/libvcc/vcc_expr.c0000644000201500234410000010034112652366721014102 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * XXX: add VRT_count()'s */ #include "config.h" #include #include #include #include #include #include "vcc_compile.h" static const char * vcc_Type(enum var_type fmt) { switch(fmt) { #define VCC_TYPE(a) case a: return(#a); #include "tbl/vcc_types.h" #undef VCC_TYPE default: assert("Unknown Type"); return(NULL); } } /*-------------------------------------------------------------------- * Recognize and convert units of time, return seconds. */ static double vcc_TimeUnit(struct vcc *tl) { double sc = 1.0; assert(tl->t->tok == ID); if (vcc_IdIs(tl->t, "ms")) sc = 1e-3; else if (vcc_IdIs(tl->t, "s")) sc = 1.0; else if (vcc_IdIs(tl->t, "m")) sc = 60.0; else if (vcc_IdIs(tl->t, "h")) sc = 60.0 * 60.0; else if (vcc_IdIs(tl->t, "d")) sc = 60.0 * 60.0 * 24.0; else if (vcc_IdIs(tl->t, "w")) sc = 60.0 * 60.0 * 24.0 * 7.0; else if (vcc_IdIs(tl->t, "y")) sc = 60.0 * 60.0 * 24.0 * 365.0; else { VSB_printf(tl->sb, "Unknown time unit "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, ". Legal are 'ms', 's', 'm', 'h', 'd', 'w' and 'y'\n"); vcc_ErrWhere(tl, tl->t); return (1.0); } vcc_NextToken(tl); return (sc); } /*-------------------------------------------------------------------- * Recognize and convert { CNUM } to unsigned value * The tokenizer made sure we only get digits. */ unsigned vcc_UintVal(struct vcc *tl) { unsigned d = 0; const char *p; Expect(tl, CNUM); for (p = tl->t->b; p < tl->t->e; p++) { d *= 10; d += *p - '0'; } vcc_NextToken(tl); return (d); } /*-------------------------------------------------------------------- * Recognize and convert { CNUM [ '.' [ CNUM ] ] } to double value * The tokenizer made sure we only get digits and a '.' */ static void vcc_NumVal(struct vcc *tl, double *d, int *frac) { double e = 0.1; const char *p; *frac = 0; *d = 0.0; Expect(tl, CNUM); if (tl->err) { *d = NAN; return; } for (p = tl->t->b; p < tl->t->e; p++) { *d *= 10; *d += *p - '0'; } vcc_NextToken(tl); if (tl->t->tok != '.') return; *frac = 1; vcc_NextToken(tl); if (tl->t->tok != CNUM) return; for (p = tl->t->b; p < tl->t->e; p++) { *d += (*p - '0') * e; e *= 0.1; } vcc_NextToken(tl); } double vcc_DoubleVal(struct vcc *tl) { double d; int i; vcc_NumVal(tl, &d, &i); return (d); } /*--------------------------------------------------------------------*/ void vcc_Duration(struct vcc *tl, double *d) { double v, sc; v = vcc_DoubleVal(tl); ERRCHK(tl); ExpectErr(tl, ID); sc = vcc_TimeUnit(tl); *d = v * sc; } /*--------------------------------------------------------------------*/ static void vcc_ByteVal(struct vcc *tl, double *d) { double v, sc; v = vcc_DoubleVal(tl); ERRCHK(tl); if (tl->t->tok != ID) { VSB_printf(tl->sb, "Expected BYTES unit (B, KB, MB...) got "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, "\n"); vcc_ErrWhere(tl, tl->t); return; } if (vcc_IdIs(tl->t, "B")) sc = 1.; else if (vcc_IdIs(tl->t, "KB")) sc = 1024.; else if (vcc_IdIs(tl->t, "MB")) sc = 1024. * 1024.; else if (vcc_IdIs(tl->t, "GB")) sc = 1024. * 1024. * 1024.; else if (vcc_IdIs(tl->t, "TB")) sc = 1024. * 1024. * 1024. * 1024.; else { VSB_printf(tl->sb, "Unknown BYTES unit "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, ". Legal are 'B', 'KB', 'MB', 'GB' and 'TB'\n"); vcc_ErrWhere(tl, tl->t); return; } vcc_NextToken(tl); *d = v * sc; } /*-------------------------------------------------------------------- * Facility for carrying expressions around and do text-processing on * them. */ struct expr { unsigned magic; #define EXPR_MAGIC 0x38c794ab enum var_type fmt; struct vsb *vsb; uint8_t constant; #define EXPR_VAR (1<<0) #define EXPR_CONST (1<<1) #define EXPR_STR_CONST (1<<2) struct token *t1, *t2; }; static inline int vcc_isconst(const struct expr *e) { AN(e->constant); return (e->constant & EXPR_CONST); } static void vcc_expr0(struct vcc *tl, struct expr **e, enum var_type fmt); static struct expr * vcc_new_expr(void) { struct expr *e; /* XXX: use TlAlloc() ? */ ALLOC_OBJ(e, EXPR_MAGIC); AN(e); e->vsb = VSB_new_auto(); e->fmt = VOID; e->constant = EXPR_VAR; return (e); } static struct expr * vcc_mk_expr(enum var_type fmt, const char *str, ...) __v_printflike(2, 3); static struct expr * vcc_mk_expr(enum var_type fmt, const char *str, ...) { va_list ap; struct expr *e; e = vcc_new_expr(); e->fmt = fmt; va_start(ap, str); VSB_vprintf(e->vsb, str, ap); va_end(ap); AZ(VSB_finish(e->vsb)); return (e); } static void vcc_delete_expr(struct expr *e) { if (e == NULL) return; CHECK_OBJ_NOTNULL(e, EXPR_MAGIC); VSB_delete(e->vsb); FREE_OBJ(e); } /*-------------------------------------------------------------------- * We want to get the indentation right in the emitted C code so we have * to represent it symbolically until we are ready to render. * * Many of the operations have very schematic output syntaxes, so we * use the same facility to simplify the text-processing of emitting * a given operation on two subexpressions. * * We use '\v' as the magic escape character. * \v1 insert subexpression 1 * \v2 insert subexpression 2 * \v+ increase indentation * \v- increase indentation * anything else is literal * * When editing, we check if any of the subexpressions contain a newline * and issue it as an indented block of so. * * XXX: check line lengths in edit, should pass indent in for this */ static struct expr * vcc_expr_edit(enum var_type fmt, const char *p, struct expr *e1, struct expr *e2) { struct expr *e; int nl = 1; AN(e1); e = vcc_new_expr(); while (*p != '\0') { if (*p != '\v') { if (*p != '\n' || !nl) VSB_putc(e->vsb, *p); nl = (*p == '\n'); p++; continue; } assert(*p == '\v'); switch(*++p) { case '+': VSB_cat(e->vsb, "\v+"); break; case '-': VSB_cat(e->vsb, "\v-"); break; case '1': VSB_cat(e->vsb, VSB_data(e1->vsb)); break; case '2': AN(e2); VSB_cat(e->vsb, VSB_data(e2->vsb)); break; default: WRONG("Illegal edit in VCC expression"); } p++; } AZ(VSB_finish(e->vsb)); e->t1 = e1->t1; e->t2 = e1->t2; if (e2 != NULL) e->t2 = e2->t2; vcc_delete_expr(e1); vcc_delete_expr(e2); e->fmt = fmt; return (e); } /*-------------------------------------------------------------------- * Expand finished expression into C-source code */ static void vcc_expr_fmt(struct vsb *d, int ind, const struct expr *e1) { char *p; int i; for (i = 0; i < ind; i++) VSB_cat(d, " "); p = VSB_data(e1->vsb); while (*p != '\0') { if (*p == '\n') { VSB_putc(d, '\n'); if (p[1] != '\0') { for (i = 0; i < ind; i++) VSB_cat(d, " "); } p++; continue; } if (*p != '\v') { VSB_putc(d, *p); p++; continue; } p++; switch(*p) { case '+': ind += 2; break; case '-': ind -= 2; break; default: WRONG("Illegal format in VCC expression"); } p++; } } /*-------------------------------------------------------------------- */ static enum var_type vcc_arg_type(const char **p) { #define VCC_TYPE(a) if (!strcmp(#a, *p)) { *p += strlen(#a) + 1; return (a);} #include "tbl/vcc_types.h" #undef VCC_TYPE return (VOID); } /*-------------------------------------------------------------------- */ static void vcc_expr_tostring(struct vcc *tl, struct expr **e, enum var_type fmt) { const char *p; uint8_t constant = EXPR_VAR; CHECK_OBJ_NOTNULL(*e, EXPR_MAGIC); AN(fmt == STRING || fmt == STRING_LIST); p = NULL; switch((*e)->fmt) { case BACKEND: p = "VRT_BACKEND_string(\v1)"; break; case BOOL: p = "VRT_BOOL_string(\v1)"; break; case DURATION: p = "VRT_REAL_string(ctx, \v1)"; break; /* XXX: should DURATION insist on "s" suffix ? */ case INT: if (vcc_isconst(*e)) { p = "\"\v1\""; constant = EXPR_CONST; } else { p = "VRT_INT_string(ctx, \v1)"; } break; case IP: p = "VRT_IP_string(ctx, \v1)"; break; case BYTES: p = "VRT_REAL_string(ctx, \v1)"; break; /* XXX */ case REAL: p = "VRT_REAL_string(ctx, \v1)"; break; case TIME: p = "VRT_TIME_string(ctx, \v1)"; break; case HEADER: p = "VRT_GetHdr(ctx, \v1)"; break; case ENUM: case STRING: case STRING_LIST: break; case BLOB: VSB_printf(tl->sb, "Wrong use of BLOB value.\n" "BLOBs can only be used as arguments to VMOD" " functions.\n"); vcc_ErrWhere2(tl, (*e)->t1, tl->t); return; default: INCOMPL(); break; } if (p != NULL) { *e = vcc_expr_edit(fmt, p, *e, NULL); (*e)->constant = constant; } } /*-------------------------------------------------------------------- */ static void vcc_Eval_Regsub(struct vcc *tl, struct expr **e, const struct symbol *sym) { struct expr *e2; int all = sym->eval_priv == NULL ? 0 : 1; const char *p; char buf[128]; vcc_delete_expr(*e); SkipToken(tl, ID); SkipToken(tl, '('); vcc_expr0(tl, &e2, STRING); if (e2 == NULL) return; SkipToken(tl, ','); ExpectErr(tl, CSTR); p = vcc_regexp(tl); vcc_NextToken(tl); bprintf(buf, "VRT_regsub(ctx, %d,\v+\n\v1,\n%s", all, p); *e = vcc_expr_edit(STRING, buf, e2, *e); SkipToken(tl, ','); vcc_expr0(tl, &e2, STRING); if (e2 == NULL) return; *e = vcc_expr_edit(STRING, "\v1,\n\v2)\v-", *e, e2); SkipToken(tl, ')'); } /*-------------------------------------------------------------------- */ static void vcc_Eval_BoolConst(struct vcc *tl, struct expr **e, const struct symbol *sym) { vcc_NextToken(tl); *e = vcc_mk_expr(BOOL, "(0==%d)", sym->eval_priv == NULL ? 1 : 0); (*e)->constant = EXPR_CONST; } /*-------------------------------------------------------------------- */ void vcc_Eval_Backend(struct vcc *tl, struct expr **e, const struct symbol *sym) { assert(sym->kind == SYM_BACKEND); vcc_ExpectCid(tl); vcc_AddRef(tl, tl->t, SYM_BACKEND); *e = vcc_mk_expr(BACKEND, "%s", (const char *)sym->eval_priv); (*e)->constant = EXPR_VAR; /* XXX ? */ vcc_NextToken(tl); } /*-------------------------------------------------------------------- */ void vcc_Eval_Probe(struct vcc *tl, struct expr **e, const struct symbol *sym) { assert(sym->kind == SYM_PROBE); vcc_ExpectCid(tl); vcc_AddRef(tl, tl->t, SYM_PROBE); *e = vcc_mk_expr(PROBE, "&vgc_probe_%.*s", PF(tl->t)); (*e)->constant = EXPR_VAR; /* XXX ? */ vcc_NextToken(tl); } /*-------------------------------------------------------------------- */ void vcc_Eval_Var(struct vcc *tl, struct expr **e, const struct symbol *sym) { const struct var *vp; assert(sym->kind == SYM_VAR); vcc_AddUses(tl, tl->t, sym->r_methods, "Not available"); vp = vcc_FindVar(tl, tl->t, 0, "cannot be read"); ERRCHK(tl); assert(vp != NULL); *e = vcc_mk_expr(vp->fmt, "%s", vp->rname); vcc_NextToken(tl); } /*-------------------------------------------------------------------- */ static struct expr * vcc_priv_arg(struct vcc *tl, const char *p, const char *name) { const char *r; struct expr *e2; char buf[32]; struct inifin *ifp; if (!strcmp(p, "PRIV_VCL")) { r = strchr(name, '.'); AN(r); e2 = vcc_mk_expr(VOID, "&vmod_priv_%.*s", (int) (r - name), name); } else if (!strcmp(p, "PRIV_CALL")) { bprintf(buf, "vmod_priv_%u", tl->unique++); ifp = New_IniFin(tl); Fh(tl, 0, "static struct vmod_priv %s;\n", buf); VSB_printf(ifp->fin, "\tVRT_priv_fini(&%s);", buf); e2 = vcc_mk_expr(VOID, "&%s", buf); } else if (!strcmp(p, "PRIV_TASK")) { r = strchr(name, '.'); AN(r); e2 = vcc_mk_expr(VOID, "VRT_priv_task(ctx, &VGC_vmod_%.*s)", (int) (r - name), name); } else if (!strcmp(p, "PRIV_TOP")) { r = strchr(name, '.'); AN(r); e2 = vcc_mk_expr(VOID, "VRT_priv_top(ctx, &VGC_vmod_%.*s)", (int) (r - name), name); } else { WRONG("Wrong PRIV_ type"); } return (e2); } struct func_arg { enum var_type type; const char *enum_bits; const char *name; const char *val; struct expr *result; VTAILQ_ENTRY(func_arg) list; }; static void vcc_do_arg(struct vcc *tl, struct func_arg *fa) { const char *p, *r; struct expr *e2; if (fa->type == ENUM) { ExpectErr(tl, ID); ERRCHK(tl); r = p = fa->enum_bits; do { if (vcc_IdIs(tl->t, p)) break; p += strlen(p) + 1; } while (*p != '\0'); if (*p == '\0') { VSB_printf(tl->sb, "Wrong enum value."); VSB_printf(tl->sb, " Expected one of:\n"); do { VSB_printf(tl->sb, "\t%s\n", r); r += strlen(r) + 1; } while (*r != '\0'); vcc_ErrWhere(tl, tl->t); return; } fa->result = vcc_mk_expr(VOID, "\"%.*s\"", PF(tl->t)); SkipToken(tl, ID); } else { vcc_expr0(tl, &e2, fa->type); ERRCHK(tl); if (e2->fmt != fa->type) { VSB_printf(tl->sb, "Wrong argument type."); VSB_printf(tl->sb, " Expected %s.", vcc_Type(fa->type)); VSB_printf(tl->sb, " Got %s.\n", vcc_Type(e2->fmt)); vcc_ErrWhere2(tl, e2->t1, tl->t); return; } assert(e2->fmt == fa->type); if (e2->fmt == STRING_LIST) { e2 = vcc_expr_edit(STRING_LIST, "\v+\n\v1,\nvrt_magic_string_end\v-", e2, NULL); } fa->result = e2; } } static void vcc_func(struct vcc *tl, struct expr **e, const char *cfunc, const char *extra, const char *name, const char *args) { const char *p; struct expr *e1; struct func_arg *fa, *fa2; enum var_type rfmt; VTAILQ_HEAD(,func_arg) head; struct token *t1; AN(cfunc); AN(args); AN(name); SkipToken(tl, '('); p = args; if (extra == NULL) extra = ""; rfmt = vcc_arg_type(&p); VTAILQ_INIT(&head); while (*p != '\0') { fa = calloc(sizeof *fa, 1); AN(fa); VTAILQ_INSERT_TAIL(&head, fa, list); fa->type = vcc_arg_type(&p); if (fa->type == VOID && !memcmp(p, "PRIV_", 5)) { fa->result = vcc_priv_arg(tl, p, name); fa->name = ""; p += strlen(p) + 1; continue; } if (fa->type == ENUM) { fa->enum_bits = p; while (*p != '\0') p += strlen(p) + 1; p += strlen(p) + 1; } if (*p == '\1') { fa->name = p + 1; p = strchr(p, '\0') + 1; if (*p == '\2') { fa->val = p + 1; p = strchr(p, '\0') + 1; } } } VTAILQ_FOREACH(fa, &head, list) { if (tl->t->tok == ')') break; if (fa->result != NULL) continue; if (tl->t->tok == ID) { t1 = VTAILQ_NEXT(tl->t, list); if (t1->tok == '=') break; } vcc_do_arg(tl, fa); ERRCHK(tl); if (tl->t->tok == ')') break; SkipToken(tl, ','); } while (tl->t->tok == ID) { VTAILQ_FOREACH(fa, &head, list) { if (fa->name == NULL) continue; if (vcc_IdIs(tl->t, fa->name)) break; } if (fa == NULL) { VSB_printf(tl->sb, "Unknown argument '%.*s'\n", PF(tl->t)); vcc_ErrWhere(tl, tl->t); return; } if (fa->result != NULL) { VSB_printf(tl->sb, "Argument '%s' already used\n", fa->name); vcc_ErrWhere(tl, tl->t); return; } vcc_NextToken(tl); SkipToken(tl, '='); vcc_do_arg(tl, fa); ERRCHK(tl); if (tl->t->tok == ')') break; SkipToken(tl, ','); } e1 = vcc_mk_expr(rfmt, "%s(ctx%s\v+", cfunc, extra); VTAILQ_FOREACH_SAFE(fa, &head, list, fa2) { if (fa->result == NULL && fa->val != NULL) fa->result = vcc_mk_expr(fa->type, "%s", fa->val); if (fa->result != NULL) e1 = vcc_expr_edit(e1->fmt, "\v1,\n\v2", e1, fa->result); else { VSB_printf(tl->sb, "Argument '%s' missing\n", fa->name); vcc_ErrWhere(tl, tl->t); } free(fa); } e1 = vcc_expr_edit(e1->fmt, "\v1\n)\v-", e1, NULL); *e = e1; SkipToken(tl, ')'); } /*-------------------------------------------------------------------- */ void vcc_Eval_Func(struct vcc *tl, const char *cfunc, const char *extra, const char *name, const char *args) { struct expr *e = NULL; struct token *t1; t1 = tl->t; vcc_func(tl, &e, cfunc, extra, name, args); if (!tl->err) { vcc_expr_fmt(tl->fb, tl->indent, e); VSB_cat(tl->fb, ";\n"); } else if (t1 != tl->t) { vcc_ErrWhere2(tl, t1, tl->t); } vcc_delete_expr(e); } /*-------------------------------------------------------------------- */ void vcc_Eval_SymFunc(struct vcc *tl, struct expr **e, const struct symbol *sym) { assert(sym->kind == SYM_FUNC || sym->kind == SYM_PROC); AN(sym->cfunc); AN(sym->name); AN(sym->args); SkipToken(tl, ID); vcc_func(tl, e, sym->cfunc, sym->extra, sym->name, sym->args); } /*-------------------------------------------------------------------- * SYNTAX: * Expr4: * '(' Expr0 ')' * symbol * CNUM * CSTR */ static void vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt) { struct expr *e1, *e2; const char *ip; const struct symbol *sym; double d; int i; *e = NULL; if (tl->t->tok == '(') { SkipToken(tl, '('); vcc_expr0(tl, &e2, fmt); ERRCHK(tl); SkipToken(tl, ')'); *e = vcc_expr_edit(e2->fmt, "(\v1)", e2, NULL); return; } switch(tl->t->tok) { case ID: /* * XXX: what if var and func/proc had same name ? * XXX: look for SYM_VAR first for consistency ? */ sym = NULL; if (fmt == BACKEND) sym = VCC_FindSymbol(tl, tl->t, SYM_BACKEND); if (fmt == PROBE) sym = VCC_FindSymbol(tl, tl->t, SYM_PROBE); if (sym == NULL) sym = VCC_FindSymbol(tl, tl->t, SYM_VAR); if (sym == NULL) sym = VCC_FindSymbol(tl, tl->t, SYM_FUNC); if (sym == NULL) sym = VCC_FindSymbol(tl, tl->t, SYM_NONE); if (sym == NULL || sym->eval == NULL) { VSB_printf(tl->sb, "Symbol not found: "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " (expected type %s):\n", vcc_Type(fmt)); vcc_ErrWhere(tl, tl->t); return; } AN(sym); switch(sym->kind) { case SYM_VAR: case SYM_FUNC: case SYM_BACKEND: case SYM_PROBE: AN(sym->eval); AZ(*e); sym->eval(tl, e, sym); /* Unless asked for a HEADER, fold to string here */ if (*e && fmt != HEADER && (*e)->fmt == HEADER) { vcc_expr_tostring(tl, e, STRING); ERRCHK(tl); } return; default: break; } VSB_printf(tl->sb, "Symbol type (%s) can not be used in expression.\n", VCC_SymKind(tl, sym)); vcc_ErrWhere(tl, tl->t); return; case CSTR: assert(fmt != VOID); if (fmt == IP) { Resolve_Sockaddr(tl, tl->t->dec, "80", &ip, NULL, &ip, NULL, NULL, 1, tl->t, "IP constant"); ERRCHK(tl); e1 = vcc_mk_expr(IP, "%s", ip); ERRCHK(tl); } else { e1 = vcc_new_expr(); EncToken(e1->vsb, tl->t); e1->fmt = STRING; AZ(VSB_finish(e1->vsb)); } e1->t1 = tl->t; e1->constant = EXPR_CONST; vcc_NextToken(tl); *e = e1; break; case CNUM: /* * XXX: %g may not have enough decimals by default * XXX: but %a is ugly, isn't it ? */ assert(fmt != VOID); if (fmt == DURATION) { vcc_Duration(tl, &d); ERRCHK(tl); e1 = vcc_mk_expr(DURATION, "%g", d); } else if (fmt == BYTES) { vcc_ByteVal(tl, &d); ERRCHK(tl); e1 = vcc_mk_expr(BYTES, "%.1f", d); ERRCHK(tl); } else if (fmt == REAL) { e1 = vcc_mk_expr(REAL, "%f", vcc_DoubleVal(tl)); ERRCHK(tl); } else if (fmt == INT) { e1 = vcc_mk_expr(INT, "%.*s", PF(tl->t)); vcc_NextToken(tl); } else { vcc_NumVal(tl, &d, &i); if (i) e1 = vcc_mk_expr(REAL, "%f", d); else e1 = vcc_mk_expr(INT, "%ld", (long)d); } e1->constant = EXPR_CONST; *e = e1; break; default: VSB_printf(tl->sb, "Unknown token "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " when looking for %s\n\n", vcc_Type(fmt)); vcc_ErrWhere(tl, tl->t); break; } } /*-------------------------------------------------------------------- * SYNTAX: * Expr3: * Expr4 { {'*'|'/'} Expr4 } * */ static void vcc_expr_mul(struct vcc *tl, struct expr **e, enum var_type fmt) { struct expr *e2; enum var_type f2, f3; struct token *tk; *e = NULL; vcc_expr4(tl, e, fmt); ERRCHK(tl); f3 = f2 = (*e)->fmt; switch(f2) { case INT: f2 = INT; break; case DURATION: f2 = REAL; break; case BYTES: f2 = REAL; break; default: if (tl->t->tok != '*' && tl->t->tok != '/') return; VSB_printf(tl->sb, "Operator %.*s not possible on type %s.\n", PF(tl->t), vcc_Type(f2)); vcc_ErrWhere(tl, tl->t); return; } while (tl->t->tok == '*' || tl->t->tok == '/') { tk = tl->t; vcc_NextToken(tl); vcc_expr4(tl, &e2, f2); ERRCHK(tl); assert(e2->fmt == f2); if (tk->tok == '*') *e = vcc_expr_edit(f3, "(\v1*\v2)", *e, e2); else *e = vcc_expr_edit(f3, "(\v1/\v2)", *e, e2); } } /*-------------------------------------------------------------------- * SYNTAX: * ExprAdd: * ExprMul { {'+'|'-'} ExprMul } * * * For reasons of memory allocation/copying and general performance, * STRINGs in VCL are quite special. Addition/concatenation is split * into it's own subfunction to encapsulate this. */ static void vcc_expr_string_add(struct vcc *tl, struct expr **e, struct expr *e2) { enum var_type f2; AN(e); AN(*e); AN(e2); f2 = (*e)->fmt; assert (f2 == STRING || f2 == STRING_LIST); while (e2 != NULL || tl->t->tok == '+') { if (e2 == NULL) { vcc_NextToken(tl); vcc_expr_mul(tl, &e2, STRING); } ERRCHK(tl); if (e2->fmt != STRING && e2->fmt != STRING_LIST) { vcc_expr_tostring(tl, &e2, f2); ERRCHK(tl); } ERRCHK(tl); assert(e2->fmt == STRING || e2->fmt == STRING_LIST); if (vcc_isconst(*e) && vcc_isconst(e2)) { assert((*e)->fmt == STRING); assert(e2->fmt == STRING); *e = vcc_expr_edit(STRING, "\v1\n\v2", *e, e2); (*e)->constant = EXPR_CONST; } else if (((*e)->constant & EXPR_STR_CONST) && vcc_isconst(e2)) { assert((*e)->fmt == STRING_LIST); assert(e2->fmt == STRING); *e = vcc_expr_edit(STRING_LIST, "\v1\n\v2", *e, e2); (*e)->constant = EXPR_VAR | EXPR_STR_CONST; } else if (e2->fmt == STRING && vcc_isconst(e2)) { *e = vcc_expr_edit(STRING_LIST, "\v1,\n\v2", *e, e2); (*e)->constant = EXPR_VAR | EXPR_STR_CONST; } else { *e = vcc_expr_edit(STRING_LIST, "\v1,\n\v2", *e, e2); (*e)->constant = EXPR_VAR; } e2 = NULL; } } static void vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt) { struct expr *e2; enum var_type f2; struct token *tk; *e = NULL; vcc_expr_mul(tl, e, fmt); ERRCHK(tl); f2 = (*e)->fmt; while (tl->t->tok == '+' || tl->t->tok == '-') { tk = tl->t; vcc_NextToken(tl); if (f2 == TIME) vcc_expr_mul(tl, &e2, DURATION); else vcc_expr_mul(tl, &e2, f2); ERRCHK(tl); if (tk->tok == '-' && (*e)->fmt == TIME && e2->fmt == TIME) { /* OK */ } else if ((*e)->fmt == TIME && e2->fmt == DURATION) { f2 = TIME; /* OK */ } else if ((*e)->fmt == BYTES && e2->fmt == BYTES) { /* OK */ } else if ((*e)->fmt == INT && e2->fmt == INT) { /* OK */ } else if ((*e)->fmt == DURATION && e2->fmt == DURATION) { /* OK */ } else if (tk->tok == '+' && (*e)->fmt == STRING && e2->fmt == STRING) { vcc_expr_string_add(tl, e, e2); return; } else if (tk->tok == '+' && (fmt == STRING || fmt == STRING_LIST)) { /* Time to fold and add as string */ vcc_expr_tostring(tl, e, STRING); vcc_expr_string_add(tl, e, e2); return; } else { VSB_printf(tl->sb, "%s %.*s %s not possible.\n", vcc_Type((*e)->fmt), PF(tk), vcc_Type(e2->fmt)); vcc_ErrWhere2(tl, tk, tl->t); return; } if (tk->tok == '+') *e = vcc_expr_edit(f2, "(\v1+\v2)", *e, e2); else if (f2 == TIME && e2->fmt == TIME) *e = vcc_expr_edit(DURATION, "(\v1-\v2)", *e, e2); else *e = vcc_expr_edit(f2, "(\v1-\v2)", *e, e2); } } /*-------------------------------------------------------------------- * Fold the STRING types correctly */ static void vcc_expr_strfold(struct vcc *tl, struct expr **e, enum var_type fmt) { vcc_expr_add(tl, e, fmt); ERRCHK(tl); if (fmt != STRING_LIST && (*e)->fmt == STRING_LIST) *e = vcc_expr_edit(STRING, "\v+VRT_CollectString(ctx,\n\v1,\nvrt_magic_string_end)\v-", *e, NULL); if (fmt == STRING_LIST && (*e)->fmt == STRING) (*e)->fmt = STRING_LIST; } /*-------------------------------------------------------------------- * SYNTAX: * ExprCmp: * ExprAdd * ExprAdd Relation ExprAdd * ExprAdd(STRING) '~' CString * ExprAdd(STRING) '!~' CString * ExprAdd(IP) '~' IP * ExprAdd(IP) '!~' IP */ #define NUM_REL(typ) \ {typ, T_EQ, "(\v1 == \v2)" }, \ {typ, T_NEQ, "(\v1 != \v2)" }, \ {typ, T_LEQ, "(\v1 <= \v2)" }, \ {typ, T_GEQ, "(\v1 >= \v2)" }, \ {typ, '<', "(\v1 < \v2)" }, \ {typ, '>', "(\v1 > \v2)" } static const struct cmps { enum var_type fmt; unsigned token; const char *emit; } vcc_cmps[] = { NUM_REL(INT), NUM_REL(DURATION), NUM_REL(BYTES), NUM_REL(REAL), NUM_REL(TIME), {STRING, T_EQ, "!VRT_strcmp(\v1, \v2)" }, {STRING, T_NEQ, "VRT_strcmp(\v1, \v2)" }, {VOID, 0, NULL} }; #undef NUM_REL static void vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt) { struct expr *e2; const struct cmps *cp; char buf[256]; const char *re; const char *not; struct token *tk; struct symbol *sym; *e = NULL; vcc_expr_strfold(tl, e, fmt); ERRCHK(tl); if ((*e)->fmt == BOOL) return; tk = tl->t; for (cp = vcc_cmps; cp->fmt != VOID; cp++) if ((*e)->fmt == cp->fmt && tl->t->tok == cp->token) break; if (cp->fmt != VOID) { vcc_NextToken(tl); vcc_expr_strfold(tl, &e2, (*e)->fmt); ERRCHK(tl); if (e2->fmt != (*e)->fmt) { /* XXX */ VSB_printf(tl->sb, "Comparison of different types: "); VSB_printf(tl->sb, "%s ", vcc_Type((*e)->fmt)); vcc_ErrToken(tl, tk); VSB_printf(tl->sb, " %s\n", vcc_Type(e2->fmt)); vcc_ErrWhere(tl, tk); return; } *e = vcc_expr_edit(BOOL, cp->emit, *e, e2); return; } if ((*e)->fmt == STRING && (tl->t->tok == '~' || tl->t->tok == T_NOMATCH)) { not = tl->t->tok == '~' ? "" : "!"; vcc_NextToken(tl); ExpectErr(tl, CSTR); re = vcc_regexp(tl); ERRCHK(tl); vcc_NextToken(tl); bprintf(buf, "%sVRT_re_match(ctx, \v1, %s)", not, re); *e = vcc_expr_edit(BOOL, buf, *e, NULL); return; } if ((*e)->fmt == IP && (tl->t->tok == '~' || tl->t->tok == T_NOMATCH)) { not = tl->t->tok == '~' ? "" : "!"; vcc_NextToken(tl); ExpectErr(tl, ID); vcc_AddRef(tl, tl->t, SYM_ACL); bprintf(buf, "%smatch_acl_named_%.*s(ctx, \v1)", not, PF(tl->t)); vcc_NextToken(tl); *e = vcc_expr_edit(BOOL, buf, *e, NULL); return; } if ((*e)->fmt == IP && (tl->t->tok == T_EQ || tl->t->tok == T_NEQ)) { vcc_Acl_Hack(tl, buf); *e = vcc_expr_edit(BOOL, buf, *e, NULL); return; } if ((*e)->fmt == BACKEND && (tl->t->tok == T_EQ || tl->t->tok == T_NEQ)) { // XXX: just ask for a BACKEND expression instead ? vcc_NextToken(tl); ExpectErr(tl, ID); sym = VCC_FindSymbol(tl, tl->t, SYM_BACKEND); if (sym == NULL) { VSB_printf(tl->sb, "Backend not found: "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, "\n"); vcc_ErrWhere(tl, tl->t); return; } vcc_AddRef(tl, tl->t, SYM_BACKEND); bprintf(buf, "(\v1 %.*s %s)", PF(tk), (const char *)sym->eval_priv); vcc_NextToken(tl); *e = vcc_expr_edit(BOOL, buf, *e, NULL); return; } switch (tl->t->tok) { case T_EQ: case T_NEQ: case '<': case T_LEQ: case '>': case T_GEQ: case '~': case T_NOMATCH: VSB_printf(tl->sb, "Operator %.*s not possible on %s\n", PF(tl->t), vcc_Type((*e)->fmt)); vcc_ErrWhere(tl, tl->t); return; default: break; } if (fmt == BOOL && (*e)->fmt == STRING) { *e = vcc_expr_edit(BOOL, "(\v1 != 0)", *e, NULL); return; } } /*-------------------------------------------------------------------- * SYNTAX: * ExprNot: * '!' ExprCmp */ static void vcc_expr_not(struct vcc *tl, struct expr **e, enum var_type fmt) { struct expr *e2; struct token *tk; *e = NULL; if (fmt != BOOL || tl->t->tok != '!') { vcc_expr_cmp(tl, e, fmt); return; } vcc_NextToken(tl); tk = tl->t; vcc_expr_cmp(tl, &e2, fmt); ERRCHK(tl); if (e2->fmt == BOOL) { *e = vcc_expr_edit(BOOL, "!(\v1)", e2, NULL); return; } VSB_printf(tl->sb, "'!' must be followed by BOOL, found "); VSB_printf(tl->sb, "%s.\n", vcc_Type(e2->fmt)); vcc_ErrWhere2(tl, tk, tl->t); } /*-------------------------------------------------------------------- * SYNTAX: * ExprCand: * ExprNot { '&&' ExprNot } * */ static void vcc_expr_cand(struct vcc *tl, struct expr **e, enum var_type fmt) { struct expr *e2; struct token *tk; *e = NULL; vcc_expr_not(tl, e, fmt); ERRCHK(tl); if ((*e)->fmt != BOOL || tl->t->tok != T_CAND) return; *e = vcc_expr_edit(BOOL, "(\v+\n\v1", *e, NULL); while (tl->t->tok == T_CAND) { vcc_NextToken(tl); tk = tl->t; vcc_expr_not(tl, &e2, fmt); ERRCHK(tl); if (e2->fmt != BOOL) { VSB_printf(tl->sb, "'&&' must be followed by BOOL, found "); VSB_printf(tl->sb, "%s.\n", vcc_Type(e2->fmt)); vcc_ErrWhere2(tl, tk, tl->t); return; } *e = vcc_expr_edit(BOOL, "\v1\v-\n&&\v+\n\v2", *e, e2); } *e = vcc_expr_edit(BOOL, "\v1\v-\n)", *e, NULL); } /*-------------------------------------------------------------------- * SYNTAX: * Expr0: * ExprCand { '||' ExprCand } * */ static void vcc_expr0(struct vcc *tl, struct expr **e, enum var_type fmt) { struct expr *e2; struct token *tk; *e = NULL; vcc_expr_cand(tl, e, fmt); ERRCHK(tl); if ((*e)->fmt == BOOL && tl->t->tok == T_COR) { *e = vcc_expr_edit(BOOL, "(\v+\n\v1", *e, NULL); while (tl->t->tok == T_COR) { vcc_NextToken(tl); tk = tl->t; vcc_expr_cand(tl, &e2, fmt); ERRCHK(tl); if (e2->fmt != BOOL) { VSB_printf(tl->sb, "'||' must be followed by BOOL, found "); VSB_printf(tl->sb, "%s.\n", vcc_Type(e2->fmt)); vcc_ErrWhere2(tl, tk, tl->t); return; } *e = vcc_expr_edit(BOOL, "\v1\v-\n||\v+\n\v2", *e, e2); } *e = vcc_expr_edit(BOOL, "\v1\v-\n)", *e, NULL); } if (fmt == STRING || fmt == STRING_LIST) { vcc_expr_tostring(tl, e, fmt); ERRCHK(tl); } } /*-------------------------------------------------------------------- * This function parses and emits the C-code to evaluate an expression * * We know up front what kind of type we want the expression to be, * and this function is the backstop if that doesn't succeed. */ void vcc_Expr(struct vcc *tl, enum var_type fmt) { struct expr *e; struct token *t1; assert(fmt != VOID); t1 = tl->t; vcc_expr0(tl, &e, fmt); ERRCHK(tl); e->t1 = t1; if (!tl->err && fmt != e->fmt) { VSB_printf(tl->sb, "Expression has type %s, expected %s\n", vcc_Type(e->fmt), vcc_Type(fmt)); tl->err = 1; } if (!tl->err) { if (e->fmt == STRING_LIST) { e = vcc_expr_edit(STRING_LIST, "\v+\n\v1,\nvrt_magic_string_end\v-", e, NULL); } vcc_expr_fmt(tl->fb, tl->indent, e); VSB_putc(tl->fb, '\n'); } else { if (t1 != tl->t) vcc_ErrWhere2(tl, t1, tl->t); } vcc_delete_expr(e); } /*-------------------------------------------------------------------- */ void vcc_Expr_Call(struct vcc *tl, const struct symbol *sym) { struct expr *e; struct token *t1; t1 = tl->t; e = NULL; vcc_Eval_SymFunc(tl, &e, sym); if (!tl->err) { vcc_expr_fmt(tl->fb, tl->indent, e); VSB_cat(tl->fb, ";\n"); } else if (t1 != tl->t) { vcc_ErrWhere2(tl, t1, tl->t); } vcc_delete_expr(e); } /*-------------------------------------------------------------------- */ void vcc_Expr_Init(struct vcc *tl) { struct symbol *sym; sym = VCC_AddSymbolStr(tl, "regsub", SYM_FUNC); AN(sym); sym->eval = vcc_Eval_Regsub; sym->eval_priv = NULL; sym = VCC_AddSymbolStr(tl, "regsuball", SYM_FUNC); AN(sym); sym->eval = vcc_Eval_Regsub; sym->eval_priv = sym; sym = VCC_AddSymbolStr(tl, "true", SYM_FUNC); AN(sym); sym->eval = vcc_Eval_BoolConst; sym->eval_priv = sym; sym = VCC_AddSymbolStr(tl, "false", SYM_FUNC); AN(sym); sym->eval = vcc_Eval_BoolConst; sym->eval_priv = NULL; } varnish-4.1.1/lib/libvcc/vcc_fixed_token.c0000644000201500234410000006047112652366743015440 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ #include "config.h" #include #include #include "vcc_compile.h" #define M1() do {*q = p + 1; return (p[0]); } while (0) #define M2(c,t) do {if (p[1] == (c)) { *q = p + 2; return (t); }} while (0) unsigned vcl_fixed_token(const char *p, const char **q) { switch (p[0]) { case '!': M2('=', T_NEQ); M2('~', T_NOMATCH); M1(); case '%': M1(); case '&': M2('&', T_CAND); M1(); case '(': M1(); case ')': M1(); case '*': M2('=', T_MUL); M1(); case '+': M2('+', T_INC); M2('=', T_INCR); M1(); case ',': M1(); case '-': M2('-', T_DEC); M2('=', T_DECR); M1(); case '.': M1(); case '/': M2('=', T_DIV); M1(); case ';': M1(); case '<': M2('<', T_SHL); M2('=', T_LEQ); M1(); case '=': M2('=', T_EQ); M1(); case '>': M2('=', T_GEQ); M2('>', T_SHR); M1(); case '{': M1(); case '|': M2('|', T_COR); M1(); case '}': M1(); case '~': M1(); default: return (0); } } const char * const vcl_tnames[256] = { ['!'] = "'!'", ['%'] = "'%'", ['&'] = "'&'", ['('] = "'('", [')'] = "')'", ['*'] = "'*'", ['+'] = "'+'", [','] = "','", ['-'] = "'-'", ['.'] = "'.'", ['/'] = "'/'", [';'] = "';'", ['<'] = "'<'", ['='] = "'='", ['>'] = "'>'", ['{'] = "'{'", ['|'] = "'|'", ['}'] = "'}'", ['~'] = "'~'", [CNUM] = "CNUM", [CSRC] = "CSRC", [CSTR] = "CSTR", [EOI] = "EOI", [ID] = "ID", [T_CAND] = "&&", [T_COR] = "||", [T_DEC] = "--", [T_DECR] = "-=", [T_DIV] = "/=", [T_EQ] = "==", [T_GEQ] = ">=", [T_INC] = "++", [T_INCR] = "+=", [T_LEQ] = "<=", [T_MUL] = "*=", [T_NEQ] = "!=", [T_NOMATCH] = "!~", [T_SHL] = "<<", [T_SHR] = ">>", }; void vcl_output_lang_h(struct vsb *sb) { /* ../include/vdef.h */ VSB_cat(sb, "/* ---===### include/vdef.h ###===--- */\n\n"); VSB_cat(sb, "/*-\n * Copyright (c) 2006 Verdens Gang AS\n" " * Copyright (c) 2012 Fastly Inc\n * Copyright (c) 2006-2015 " "Varnish Software AS\n * All rights reserved.\n *\n" " * Author: Poul-Henning Kamp \n" " * Author: Rogier 'DocWilco' Mulhuijzen \n" " *\n * Inspired by FreeBSD's \n *\n * Redistributio" "n and use in source and binary forms, with or without\n" " * modification, are permitted provided that the following " "conditions\n * are met:\n * 1. Redistributions of source code " "must retain the above copyright\n * notice, this list of " "conditions and the following disclaimer.\n * 2. Redistributions " "in binary form must reproduce the above copyright\n" " * notice, this list of conditions and the following disclaim" "er in the\n * documentation and/or other materials provided " "with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY " "THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS " "OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A " "PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL " "AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, " "INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" " * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF " "SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS;" " OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY " "OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR " "TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" " * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE " "POSSIBILITY OF\n * SUCH DAMAGE.\n *\n */\n\n#ifndef VDEF_H_INCLU" "DED\n#define VDEF_H_INCLUDED\n\n/* Safe printf into a fixed-size" " buffer */\n#define bprintf(buf, fmt, ...)\t\t\t\t\t\t\\\n" "\tdo {\t\t\t\t\t\t\t\t\\\n\t\tassert(snprintf(buf, sizeof " "buf, fmt, __VA_ARGS__)\t\\\n\t\t < sizeof buf);\t\t\t\t\t" "\\\n\t} while (0)\n\n/* Safe printf into a fixed-size buffer " "*/\n#define vbprintf(buf, fmt, ap)\t\t\t\t\t\t\\\n" "\tdo {\t\t\t\t\t\t\t\t\\\n\t\tassert(vsnprintf(buf, sizeof " "buf, fmt, ap)\t\t\\\n\t\t < sizeof buf);\t\t\t\t\t\\\n" "\t} while (0)\n\n\n#ifndef __GNUC_PREREQ\n# if defined __GNUC__ " "&& defined __GNUC_MINOR__\n# define __GNUC_PREREQ(maj, min) " "\\\n\t(__GNUC__ > (maj) || (__GNUC__ == (maj) && __GNUC_MINOR__ " ">= (min)))\n# else\n# define __GNUC_PREREQ(maj, min) 0\n" "# endif\n#endif\n\n#ifdef __printflike\n# define __v_printflike" "(f,a) __printflike(f,a)\n#elif __GNUC_PREREQ(2, 95) || defined(_" "_INTEL_COMPILER)\n# define __v_printflike(f,a) __attribute__((f" "ormat(printf, f, a)))\n#else\n# define __v_printflike(f,a)\n" "#endif\n\n/*****************************************************" "*****************\n * FlexeLint and compiler shutuppery\n" " */\n\n/*\n * In OO-light situations, functions have to match " "their prototype\n * even if that means not const'ing a const'abl" "e argument.\n * The typedef should be specified as argument " "to the macro.\n */\n#define __match_proto__(xxx)\t\t/*lint " "-e{818} */\n\n#define NEEDLESS_RETURN(foo)\treturn (foo)\n" "\n#endif /* VDEF_H_INCLUDED */\n" ); VSB_cat(sb, "\n"); /* ../include/vcl.h */ VSB_cat(sb, "/* ---===### include/vcl.h ###===--- */\n\n"); VSB_cat(sb, "/*\n * NB: This file is machine generated, DO " "NOT EDIT!\n *\n * Edit and run generate.py instead\n" " */\n\nstruct vrt_ctx;\n#define VRT_CTX const struct vrt_ctx " "*ctx\nstruct req;\nstruct busyobj;\nstruct ws;\nstruct cli;\n" "struct worker;\n\nenum vcl_event_e {\n\tVCL_EVENT_LOAD,\n" "\tVCL_EVENT_WARM,\n\tVCL_EVENT_USE,\n\tVCL_EVENT_COLD,\n" "\tVCL_EVENT_DISCARD,\n};\n\ntypedef int vcl_event_f(VRT_CTX, " "enum vcl_event_e);\ntypedef int vcl_init_f(VRT_CTX);\n" "typedef void vcl_fini_f(VRT_CTX);\ntypedef int vcl_func_f(VRT_CT" "X);\n\n/* VCL Methods */\n#define VCL_MET_RECV\t\t\t(1U << " "1)\n#define VCL_MET_PIPE\t\t\t(1U << 2)\n#define VCL_MET_PASS\t" "\t\t(1U << 3)\n#define VCL_MET_HASH\t\t\t(1U << 4)\n" "#define VCL_MET_PURGE\t\t\t(1U << 5)\n#define VCL_MET_MISS\t" "\t\t(1U << 6)\n#define VCL_MET_HIT\t\t\t(1U << 7)\n" "#define VCL_MET_DELIVER\t\t\t(1U << 8)\n#define VCL_MET_SYNTH\t" "\t\t(1U << 9)\n#define VCL_MET_BACKEND_FETCH\t\t(1U << 10)\n" "#define VCL_MET_BACKEND_RESPONSE\t(1U << 11)\n#define VCL_MET_BA" "CKEND_ERROR\t\t(1U << 12)\n#define VCL_MET_INIT\t\t\t(1U << " "13)\n#define VCL_MET_FINI\t\t\t(1U << 14)\n\n#define VCL_MET_MAX" "\t\t\t15\n\n#define VCL_MET_MASK\t\t\t0x7fff\n\n/* VCL Returns " "*/\n#define VCL_RET_ABANDON\t\t\t0\n#define VCL_RET_DELIVER\t" "\t\t1\n#define VCL_RET_FAIL\t\t\t2\n#define VCL_RET_FETCH\t" "\t\t3\n#define VCL_RET_HASH\t\t\t4\n#define VCL_RET_LOOKUP\t" "\t\t5\n#define VCL_RET_MISS\t\t\t6\n#define VCL_RET_OK\t\t\t" "7\n#define VCL_RET_PASS\t\t\t8\n#define VCL_RET_PIPE\t\t\t9\n" "#define VCL_RET_PURGE\t\t\t10\n#define VCL_RET_RESTART\t\t\t" "11\n#define VCL_RET_RETRY\t\t\t12\n#define VCL_RET_SYNTH\t\t" "\t13\n\n#define VCL_RET_MAX\t\t\t14\n\nstruct VCL_conf {\n" "\tunsigned\t\t\tmagic;\n#define VCL_CONF_MAGIC\t\t\t0x7406c509\t" "/* from /dev/random */\n\n\tstruct director\t\t\t**default_direc" "tor;\n\tconst struct vrt_backend_probe\t*default_probe;\n" "\tunsigned\t\t\tnref;\n\tstruct vrt_ref\t\t\t*ref;\n" "\n\tunsigned\t\t\tnsrc;\n\tconst char\t\t\t**srcname;\n" "\tconst char\t\t\t**srcbody;\n\n\tvcl_event_f\t\t\t*event_vcl;\n" "\tvcl_func_f\t*recv_func;\n\tvcl_func_f\t*pipe_func;\n" "\tvcl_func_f\t*pass_func;\n\tvcl_func_f\t*hash_func;\n" "\tvcl_func_f\t*purge_func;\n\tvcl_func_f\t*miss_func;\n" "\tvcl_func_f\t*hit_func;\n\tvcl_func_f\t*deliver_func;\n" "\tvcl_func_f\t*synth_func;\n\tvcl_func_f\t*backend_fetch_func;\n" "\tvcl_func_f\t*backend_response_func;\n\tvcl_func_f\t*backend_er" "ror_func;\n\tvcl_func_f\t*init_func;\n\tvcl_func_f\t*fini_func;\n" "\n};\n" ); VSB_cat(sb, "\n"); /* ../include/vrt.h */ VSB_cat(sb, "/* ---===### include/vrt.h ###===--- */\n\n"); VSB_cat(sb, "/*-\n * Copyright (c) 2006 Verdens Gang AS\n" " * Copyright (c) 2006-2015 Varnish Software AS\n * All rights " "reserved.\n *\n * Author: Poul-Henning Kamp " "\n *\n * Redistribution and use in source and binary forms, " "with or without\n * modification, are permitted provided that " "the following conditions\n * are met:\n * 1. Redistributions " "of source code must retain the above copyright\n * notice, " "this list of conditions and the following disclaimer.\n" " * 2. Redistributions in binary form must reproduce the above " "copyright\n * notice, this list of conditions and the followi" "ng disclaimer in the\n * documentation and/or other materials" " provided with the distribution.\n *\n * THIS SOFTWARE IS " "PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" " * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED" " TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS " "FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT " "SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, " "INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" " * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF " "SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS;" " OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY " "OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR " "TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" " * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE " "POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Runtime support for " "compiled VCL programs and VMODs.\n *\n * NB: When this file " "is changed, lib/libvcc/generate.py *MUST* be rerun.\n" " */\n\n/********************************************************" "***************\n * Major and minor VRT API versions.\n" " *\n * Whenever something is added, increment MINOR version\n" " * Whenever something is deleted or changed in a way which " "is not\n * binary/load-time compatible, increment MAJOR version\n" " *\n * changes to consider with next VRT_MAJOR_VERSION bump:\n" " * - cache_vrt.c: -> ssize_t VRT_CacheReqBody(VRT_CTX, size_t)\n" " */\n\n#define VRT_MAJOR_VERSION\t3U\n\n#define VRT_MINOR_VERSIO" "N\t1U\n\n\n/****************************************************" "*******************/\n\nstruct VCL_conf;\nstruct busyobj;\n" "struct director;\nstruct http;\nstruct req;\nstruct suckaddr;\n" "struct vcl;\nstruct vmod;\nstruct vsb;\nstruct vsl_log;\n" "struct ws;\n\n/*************************************************" "**********************\n * This is the central definition " "of the mapping from VCL types to\n * C-types. The python " "scripts read these from here.\n * (alphabetic order)\n" " */\n\ntypedef const struct director *\t\t\tVCL_BACKEND;\n" "typedef const struct vmod_priv *\t\tVCL_BLOB;\ntypedef unsigned\t" "\t\t\tVCL_BOOL;\ntypedef double\t\t\t\t\tVCL_BYTES;\n" "typedef double\t\t\t\t\tVCL_DURATION;\ntypedef const char " "*\t\t\t\tVCL_ENUM;\ntypedef const struct gethdr_s *\t\t\tVCL_HEA" "DER;\ntypedef struct http *\t\t\t\tVCL_HTTP;\ntypedef long\t" "\t\t\t\tVCL_INT;\ntypedef const struct suckaddr *\t\t\tVCL_IP;\n" "typedef const struct vrt_backend_probe *\tVCL_PROBE;\n" "typedef double\t\t\t\t\tVCL_REAL;\ntypedef const char *\t\t" "\t\tVCL_STRING;\ntypedef double\t\t\t\t\tVCL_TIME;\n" "typedef void\t\t\t\t\tVCL_VOID;\n\n/****************************" "*******************************************\n * This is the " "composite argument we pass to compiled VCL and VRT\n" " * functions.\n */\n\nstruct vrt_ctx {\n\tunsigned\t\t\tmagic;\n" "#define VRT_CTX_MAGIC\t\t\t0x6bb8f0db\n\n\tunsigned\t\t\tmethod;" "\n\tunsigned\t\t\t*handling;\n\n\tstruct vsb\t\t\t*msg;\t// " "Only in ...init()\n\tstruct vsl_log\t\t\t*vsl;\n\tstruct vcl\t" "\t\t*vcl;\n\tstruct ws\t\t\t*ws;\n\n\tstruct req\t\t\t*req;\n" "\tstruct http\t\t\t*http_req;\n\tstruct http\t\t\t*http_req_top;" "\n\tstruct http\t\t\t*http_resp;\n\n\tstruct busyobj\t\t\t*bo;\n" "\tstruct http\t\t\t*http_bereq;\n\tstruct http\t\t\t*http_beresp" ";\n\n\tdouble\t\t\t\tnow;\n\n\t/*\n\t * method specific argument" ":\n\t * hash:\t\tstruct SHA256Context\n\t * synth+error:\t" "struct vsb *\n\t */\n\tvoid\t\t\t\t*specific;\n};\n" "\n#define VRT_CTX\t\tconst struct vrt_ctx *ctx\n\n" "/***************************************************************" "********/\n\nstruct vmod_data {\n\t/* The version/id fields " "must be first, they protect the rest */\n\tunsigned\t\t\tvrt_maj" "or;\n\tunsigned\t\t\tvrt_minor;\n\tconst char\t\t\t*file_id;\n" "\n\tconst char\t\t\t*name;\n\tconst void\t\t\t*func;\n" "\tint\t\t\t\tfunc_len;\n\tconst char\t\t\t*proto;\n" "\tconst char\t\t\t* const *spec;\n\tconst char\t\t\t*abi;\n" "};\n\n/*********************************************************" "**************/\n\nenum gethdr_e { HDR_REQ, HDR_REQ_TOP, HDR_RES" "P, HDR_OBJ, HDR_BEREQ,\n\t\tHDR_BERESP };\n\nstruct gethdr_s " "{\n\tenum gethdr_e\twhere;\n\tconst char\t*what;\n" "};\n\nextern const void * const vrt_magic_string_end;\n" "extern const void * const vrt_magic_string_unset;\n" "\n/*************************************************************" "**********\n * We want the VCC to spit this structs out as " "const, but when VMODs\n * come up with them we want to clone " "them into malloc'ed space which\n * we can free again.\n" " * We collect all the knowledge here by macroizing the fields " "and make\n * a macro for handling them all.\n * See also: " " cache_backend.h & cache_backend_cfg.c\n * One of those things.." ".\n */\n\n#define VRT_BACKEND_FIELDS(rigid)\t\t\t\t\\\n" "\trigid char\t\t\t*vcl_name;\t\t\\\n\trigid char\t\t\t*ipv4_addr" ";\t\t\\\n\trigid char\t\t\t*ipv6_addr;\t\t\\\n\trigid char\t" "\t\t*port;\t\t\t\\\n\trigid char\t\t\t*hosthdr;\t\t\\\n" "\tdouble\t\t\t\tconnect_timeout;\t\\\n\tdouble\t\t\t\tfirst_byte" "_timeout;\t\\\n\tdouble\t\t\t\tbetween_bytes_timeout;\t\\\n" "\tunsigned\t\t\tmax_connections;\n\n#define VRT_BACKEND_HANDLE()" "\t\t\t\\\n\tdo {\t\t\t\t\t\\\n\t\tDA(vcl_name);\t\t\t\\\n" "\t\tDA(ipv4_addr);\t\t\t\\\n\t\tDA(ipv6_addr);\t\t\t\\\n" "\t\tDA(port);\t\t\t\\\n\t\tDA(hosthdr);\t\t\t\\\n" "\t\tDN(connect_timeout);\t\t\\\n\t\tDN(first_byte_timeout);\t" "\t\\\n\t\tDN(between_bytes_timeout);\t\\\n\t\tDN(max_connections" ");\t\t\\\n\t} while(0)\n\nstruct vrt_backend {\n\tunsigned\t" "\t\tmagic;\n#define VRT_BACKEND_MAGIC\t\t0x4799ce6b\n" "\tVRT_BACKEND_FIELDS(const)\n\tconst struct suckaddr\t\t*ipv4_su" "ckaddr;\n\tconst struct suckaddr\t\t*ipv6_suckaddr;\n" "\tconst struct vrt_backend_probe\t*probe;\n};\n\n" "#define VRT_BACKEND_PROBE_FIELDS(rigid)\t\t\t\t\\\n" "\tdouble\t\t\t\ttimeout;\t\t\\\n\tdouble\t\t\t\tinterval;\t" "\t\\\n\tunsigned\t\t\texp_status;\t\t\\\n\tunsigned\t\t\twindow;" "\t\t\t\\\n\tunsigned\t\t\tthreshold;\t\t\\\n\tunsigned\t\t\t" "initial;\n\n#define VRT_BACKEND_PROBE_HANDLE()\t\t\\\n" "\tdo {\t\t\t\t\t\\\n\t\tDN(timeout);\t\t\t\\\n\t\tDN(interval);\t" "\t\t\\\n\t\tDN(exp_status);\t\t\t\\\n\t\tDN(window);\t\t\t\\\n" "\t\tDN(threshold);\t\t\t\\\n\t\tDN(initial);\t\t\t\\\n" "\t} while (0)\n\nstruct vrt_backend_probe {\n\tunsigned\t\t" "\tmagic;\n#define VRT_BACKEND_PROBE_MAGIC\t\t0x84998490\n" "\tconst char\t\t\t*url;\n\tconst char\t\t\t*request;\n" "\tVRT_BACKEND_PROBE_FIELDS(const)\n};\n\n/**********************" "*************************************************/\n" "\n/*\n * other stuff.\n * XXX: document when bored\n" " */\n\nstruct vrt_ref {\n\tunsigned\tsource;\n\tunsigned\toffset" ";\n\tunsigned\tline;\n\tunsigned\tpos;\n\tconst char\t*token;\n" "};\n\n/* ACL related */\n#define VRT_ACL_MAXADDR\t\t16\t/* " "max(IPv4, IPv6) */\n\nvoid VRT_acl_log(VRT_CTX, const char " "*msg);\n\n/* req related */\n\nint VRT_CacheReqBody(VRT_CTX, " "long long maxsize);\n\n/* Regexp related */\nvoid VRT_re_init(vo" "id **, const char *);\nvoid VRT_re_fini(void *);\n" "int VRT_re_match(VRT_CTX, const char *, void *re);\n" "const char *VRT_regsub(VRT_CTX, int all, const char *, void " "*, const char *);\n\nvoid VRT_ban_string(VRT_CTX, const char " "*);\nvoid VRT_purge(VRT_CTX, double ttl, double grace, double " "keep);\n\nvoid VRT_count(VRT_CTX, unsigned);\nvoid VRT_synth(VRT" "_CTX, unsigned, const char *);\n\nstruct http *VRT_selecthttp(VR" "T_CTX, enum gethdr_e);\nconst char *VRT_GetHdr(VRT_CTX, const " "struct gethdr_s *);\nvoid VRT_SetHdr(VRT_CTX, const struct " "gethdr_s *, const char *, ...);\nvoid VRT_handling(VRT_CTX, " "unsigned hand);\n\nvoid VRT_hashdata(VRT_CTX, const char *str, " "...);\n\n/* Simple stuff */\nint VRT_strcmp(const char *s1, " "const char *s2);\nvoid VRT_memmove(void *dst, const void *src, " "unsigned len);\n\nvoid VRT_Rollback(VRT_CTX, const struct " "http *);\n\n/* Synthetic pages */\nvoid VRT_synth_page(VRT_CTX, " "const char *, ...);\n\n/* Backend related */\nstruct director " "*VRT_new_backend(VRT_CTX, const struct vrt_backend *);\n" "void VRT_delete_backend(VRT_CTX, struct director **);\n" "\n/* Suckaddr related */\nint VRT_VSA_GetPtr(const struct " "suckaddr *sua, const unsigned char ** dst);\n\n/* VMOD/Modules " "related */\nint VRT_Vmod_Init(struct vmod **hdl, void *ptr, " "int len, const char *nm,\n const char *path, const char " "*file_id, VRT_CTX);\nvoid VRT_Vmod_Fini(struct vmod **hdl);\n" "\nstruct vmod_priv;\ntypedef void vmod_priv_free_f(void *);\n" "struct vmod_priv {\n\tvoid\t\t\t*priv;\n\tint\t\t\tlen;\n" "\tvmod_priv_free_f\t*free;\n};\n\n#ifdef VCL_RET_MAX\n" "typedef int vmod_event_f(VRT_CTX, struct vmod_priv *, enum " "vcl_event_e);\n#endif\n\nstruct vclref;\nstruct vclref * VRT_ref" "_vcl(VRT_CTX, const char *);\nvoid VRT_rel_vcl(VRT_CTX, struct " "vclref **);\n\nvoid VRT_priv_fini(const struct vmod_priv *p);\n" "struct vmod_priv *VRT_priv_task(VRT_CTX, void *vmod_id);\n" "struct vmod_priv *VRT_priv_top(VRT_CTX, void *vmod_id);\n" "\n/* Stevedore related functions */\nint VRT_Stv(const char " "*nm);\n\n/* Convert things to string */\n\nchar *VRT_IP_string(V" "RT_CTX, VCL_IP);\nchar *VRT_INT_string(VRT_CTX, VCL_INT);\n" "char *VRT_REAL_string(VRT_CTX, VCL_REAL);\nchar *VRT_TIME_string" "(VRT_CTX, VCL_TIME);\nconst char *VRT_BOOL_string(VCL_BOOL);\n" "const char *VRT_BACKEND_string(VCL_BACKEND);\nconst char *VRT_Co" "llectString(VRT_CTX, const char *p, ...);\n" ); VSB_cat(sb, "\n"); /* ../include/vrt_obj.h */ VSB_cat(sb, "/* ---===### include/vrt_obj.h ###===--- */\n\n"); VSB_cat(sb, "/*\n * NB: This file is machine generated, DO " "NOT EDIT!\n *\n * Edit and run generate.py instead\n" " */\n\nVCL_HTTP VRT_r_bereq(VRT_CTX);\n\nVCL_BACKEND VRT_r_bereq" "_backend(VRT_CTX);\nvoid VRT_l_bereq_backend(VRT_CTX, VCL_BACKEN" "D);\n\nVCL_DURATION VRT_r_bereq_between_bytes_timeout(VRT_CTX);\n" "void VRT_l_bereq_between_bytes_timeout(VRT_CTX, VCL_DURATION);\n" "\nVCL_DURATION VRT_r_bereq_connect_timeout(VRT_CTX);\n" "void VRT_l_bereq_connect_timeout(VRT_CTX, VCL_DURATION);\n" "\nVCL_DURATION VRT_r_bereq_first_byte_timeout(VRT_CTX);\n" "void VRT_l_bereq_first_byte_timeout(VRT_CTX, VCL_DURATION);\n" "\n\nVCL_STRING VRT_r_bereq_method(VRT_CTX);\nvoid VRT_l_bereq_me" "thod(VRT_CTX, const char *, ...);\n\nVCL_STRING VRT_r_bereq_prot" "o(VRT_CTX);\nvoid VRT_l_bereq_proto(VRT_CTX, const char *, " "...);\n\nVCL_INT VRT_r_bereq_retries(VRT_CTX);\n\n" "VCL_BOOL VRT_r_bereq_uncacheable(VRT_CTX);\n\nVCL_STRING VRT_r_b" "ereq_url(VRT_CTX);\nvoid VRT_l_bereq_url(VRT_CTX, const char " "*, ...);\n\nVCL_STRING VRT_r_bereq_xid(VRT_CTX);\n" "\nVCL_HTTP VRT_r_beresp(VRT_CTX);\n\nVCL_DURATION VRT_r_beresp_a" "ge(VRT_CTX);\n\nVCL_BACKEND VRT_r_beresp_backend(VRT_CTX);\n" "\nVCL_IP VRT_r_beresp_backend_ip(VRT_CTX);\n\nVCL_STRING VRT_r_b" "eresp_backend_name(VRT_CTX);\n\nVCL_BOOL VRT_r_beresp_do_esi(VRT" "_CTX);\nvoid VRT_l_beresp_do_esi(VRT_CTX, VCL_BOOL);\n" "\nVCL_BOOL VRT_r_beresp_do_gunzip(VRT_CTX);\nvoid VRT_l_beresp_d" "o_gunzip(VRT_CTX, VCL_BOOL);\n\nVCL_BOOL VRT_r_beresp_do_gzip(VR" "T_CTX);\nvoid VRT_l_beresp_do_gzip(VRT_CTX, VCL_BOOL);\n" "\nVCL_BOOL VRT_r_beresp_do_stream(VRT_CTX);\nvoid VRT_l_beresp_d" "o_stream(VRT_CTX, VCL_BOOL);\n\nVCL_DURATION VRT_r_beresp_grace(" "VRT_CTX);\nvoid VRT_l_beresp_grace(VRT_CTX, VCL_DURATION);\n" "\n\nVCL_DURATION VRT_r_beresp_keep(VRT_CTX);\nvoid VRT_l_beresp_" "keep(VRT_CTX, VCL_DURATION);\n\nVCL_STRING VRT_r_beresp_proto(VR" "T_CTX);\nvoid VRT_l_beresp_proto(VRT_CTX, const char *, ...);\n" "\nVCL_STRING VRT_r_beresp_reason(VRT_CTX);\nvoid VRT_l_beresp_re" "ason(VRT_CTX, const char *, ...);\n\nVCL_INT VRT_r_beresp_status" "(VRT_CTX);\nvoid VRT_l_beresp_status(VRT_CTX, VCL_INT);\n" "\nVCL_STRING VRT_r_beresp_storage_hint(VRT_CTX);\n" "void VRT_l_beresp_storage_hint(VRT_CTX, const char *, ...);\n" "\nVCL_DURATION VRT_r_beresp_ttl(VRT_CTX);\nvoid VRT_l_beresp_ttl" "(VRT_CTX, VCL_DURATION);\n\nVCL_BOOL VRT_r_beresp_uncacheable(VR" "T_CTX);\nvoid VRT_l_beresp_uncacheable(VRT_CTX, VCL_BOOL);\n" "\nVCL_BOOL VRT_r_beresp_was_304(VRT_CTX);\n\nVCL_STRING VRT_r_cl" "ient_identity(VRT_CTX);\nvoid VRT_l_client_identity(VRT_CTX, " "const char *, ...);\n\nVCL_IP VRT_r_client_ip(VRT_CTX);\n" "\nVCL_IP VRT_r_local_ip(VRT_CTX);\n\nVCL_TIME VRT_r_now(VRT_CTX)" ";\n\nVCL_DURATION VRT_r_obj_age(VRT_CTX);\n\nVCL_DURATION " "VRT_r_obj_grace(VRT_CTX);\n\nVCL_INT VRT_r_obj_hits(VRT_CTX);\n" "\n\nVCL_DURATION VRT_r_obj_keep(VRT_CTX);\n\nVCL_STRING VRT_r_ob" "j_proto(VRT_CTX);\n\nVCL_STRING VRT_r_obj_reason(VRT_CTX);\n" "\nVCL_INT VRT_r_obj_status(VRT_CTX);\n\nVCL_DURATION VRT_r_obj_t" "tl(VRT_CTX);\n\nVCL_BOOL VRT_r_obj_uncacheable(VRT_CTX);\n" "\nVCL_IP VRT_r_remote_ip(VRT_CTX);\n\nVCL_HTTP VRT_r_req(VRT_CTX" ");\n\nVCL_BACKEND VRT_r_req_backend_hint(VRT_CTX);\n" "void VRT_l_req_backend_hint(VRT_CTX, VCL_BACKEND);\n" "\nVCL_BOOL VRT_r_req_can_gzip(VRT_CTX);\n\nVCL_BOOL VRT_r_req_es" "i(VRT_CTX);\nvoid VRT_l_req_esi(VRT_CTX, VCL_BOOL);\n" "\nVCL_INT VRT_r_req_esi_level(VRT_CTX);\n\nVCL_BOOL VRT_r_req_ha" "sh_always_miss(VRT_CTX);\nvoid VRT_l_req_hash_always_miss(VRT_CT" "X, VCL_BOOL);\n\nVCL_BOOL VRT_r_req_hash_ignore_busy(VRT_CTX);\n" "void VRT_l_req_hash_ignore_busy(VRT_CTX, VCL_BOOL);\n" "\n\nVCL_STRING VRT_r_req_method(VRT_CTX);\nvoid VRT_l_req_method" "(VRT_CTX, const char *, ...);\n\nVCL_STRING VRT_r_req_proto(VRT_" "CTX);\nvoid VRT_l_req_proto(VRT_CTX, const char *, ...);\n" "\nVCL_INT VRT_r_req_restarts(VRT_CTX);\n\nVCL_DURATION VRT_r_req" "_ttl(VRT_CTX);\nvoid VRT_l_req_ttl(VRT_CTX, VCL_DURATION);\n" "\nVCL_STRING VRT_r_req_url(VRT_CTX);\nvoid VRT_l_req_url(VRT_CTX" ", const char *, ...);\n\nVCL_STRING VRT_r_req_xid(VRT_CTX);\n" "\n\nVCL_STRING VRT_r_req_top_method(VRT_CTX);\n\n" "VCL_STRING VRT_r_req_top_proto(VRT_CTX);\n\nVCL_STRING VRT_r_req" "_top_url(VRT_CTX);\n\nVCL_HTTP VRT_r_resp(VRT_CTX);\n" "\n\nVCL_BOOL VRT_r_resp_is_streaming(VRT_CTX);\n\n" "VCL_STRING VRT_r_resp_proto(VRT_CTX);\nvoid VRT_l_resp_proto(VRT" "_CTX, const char *, ...);\n\nVCL_STRING VRT_r_resp_reason(VRT_CT" "X);\nvoid VRT_l_resp_reason(VRT_CTX, const char *, ...);\n" "\nVCL_INT VRT_r_resp_status(VRT_CTX);\nvoid VRT_l_resp_status(VR" "T_CTX, VCL_INT);\n\nVCL_STRING VRT_r_server_hostname(VRT_CTX);\n" "\nVCL_STRING VRT_r_server_identity(VRT_CTX);\n\nVCL_IP VRT_r_ser" "ver_ip(VRT_CTX);\n\ndouble VRT_Stv_free_space(const char *);\n" "double VRT_Stv_used_space(const char *);\nunsigned VRT_Stv_happy" "(const char *);\n" ); VSB_cat(sb, "\n"); } varnish-4.1.1/lib/libvcc/vcc_utils.c0000644000201500234410000001561412652366721014274 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include #include #include "vcc_compile.h" #include "vre.h" #include "vrt.h" #include "vsa.h" #include "vss.h" #include "vtcp.h" /*--------------------------------------------------------------------*/ const char * vcc_regexp(struct vcc *tl) { char buf[BUFSIZ], *p; vre_t *t; const char *error; int erroroffset; struct inifin *ifp; Expect(tl, CSTR); if (tl->err) return (NULL); memset(&t, 0, sizeof t); t = VRE_compile(tl->t->dec, 0, &error, &erroroffset); if (t == NULL) { VSB_printf(tl->sb, "Regexp compilation error:\n\n%s\n\n", error); vcc_ErrWhere(tl, tl->t); return (NULL); } VRE_free(&t); sprintf(buf, "VGC_re_%u", tl->unique++); p = TlAlloc(tl, strlen(buf) + 1); strcpy(p, buf); Fh(tl, 0, "static void *%s;\n", buf); ifp = New_IniFin(tl); VSB_printf(ifp->ini, "\tVRT_re_init(&%s, ",buf); EncToken(ifp->ini, tl->t); VSB_printf(ifp->ini, ");"); VSB_printf(ifp->fin, "\t\tVRT_re_fini(%s);", buf); return (p); } /* * The IPv6 crew royally screwed up the entire idea behind * struct sockaddr, see libvarnish/vsa.c for blow-by-blow account. * * There is no sane or even remotely portable way to initialize * a sockaddr for random protocols at compile time. * * In our case it is slightly more tricky than that, because we don't * even want to #include the struct sockaddr* definitions. * * Instead we make sure the sockaddr is sane (for our values of * sane) and dump it as our own "struct suckaddr" type, in binary, * using the widest integertype, hoping that this will ensure sufficient * alignment. */ static void vcc_suckaddr(struct vcc *tl, const char *host, const struct suckaddr *vsa, const char **ip, const char **ip_ascii, const char **p_ascii) { char a[VTCP_ADDRBUFSIZE]; char p[VTCP_PORTBUFSIZE]; const int sz = sizeof(unsigned long long); const unsigned n = (vsa_suckaddr_len + sz - 1) / sz; unsigned long long b[n]; int len; char *q; VTCP_name(vsa, a, sizeof a, p, sizeof p); Fh(tl, 0, "\n/* \"%s\" -> %s */\n", host, a); if (ip_ascii != NULL) *ip_ascii = TlDup(tl, a); if (p_ascii != NULL && *p_ascii == NULL) *p_ascii = TlDup(tl, p); Fh(tl, 0, "static const unsigned long long"); Fh(tl, 0, " suckaddr_%u[%d] = {\n", tl->unique, n); memcpy(b, vsa, vsa_suckaddr_len); for (len = 0; len < n; len++) Fh(tl, 0, "%s 0x%0*llxULL", len ? ",\n" : "", sz * 2, b[len]); Fh(tl, 0, "\n};\n"); q = TlAlloc(tl, 40); AN(q); sprintf(q, "(const void*)suckaddr_%u", tl->unique); *ip = q; tl->unique++; } /*-------------------------------------------------------------------- * This routine is a monster, but at least we only have one such monster. * Look up a IP number, and return IPv4/IPv6 address as VGC produced names * and optionally ascii strings. * * For IP compile time constants we only want one IP#, but it can be * IPv4 or IPv6. * * For backends, we accept up to one IPv4 and one IPv6. */ struct rss { unsigned magic; #define RSS_MAGIC 0x11e966ab struct suckaddr *vsa4; struct suckaddr *vsa6; struct vsb *vsb; int retval; int wrong; }; static int __match_proto__(vss_resolved_f) rs_callback(void *priv, const struct suckaddr *vsa) { struct rss *rss; int v; char a[VTCP_ADDRBUFSIZE]; char p[VTCP_PORTBUFSIZE]; CAST_OBJ_NOTNULL(rss, priv, RSS_MAGIC); assert(VSA_Sane(vsa)); v = VSA_Get_Proto(vsa); VTCP_name(vsa, a, sizeof a, p, sizeof p); VSB_printf(rss->vsb, "\t%s:%s\n", a, p); if (v == AF_INET) { if (rss->vsa4 == NULL) rss->vsa4 = VSA_Clone(vsa); else if (VSA_Compare(vsa, rss->vsa4)) rss->wrong++; rss->retval++; } else if (v == AF_INET6) { if (rss->vsa6 == NULL) rss->vsa6 = VSA_Clone(vsa); else if (VSA_Compare(vsa, rss->vsa6)) rss->wrong++; rss->retval++; } return (0); } void Resolve_Sockaddr(struct vcc *tl, const char *host, const char *def_port, const char **ipv4, const char **ipv4_ascii, const char **ipv6, const char **ipv6_ascii, const char **p_ascii, int maxips, const struct token *t_err, const char *errid) { int error; struct rss *rss; const char *err; *ipv4 = NULL; *ipv6 = NULL; if (p_ascii != NULL) *p_ascii = NULL; ALLOC_OBJ(rss, RSS_MAGIC); AN(rss); rss->vsb = VSB_new_auto(); AN(rss->vsb); error = VSS_resolver(host, def_port, rs_callback, rss, &err); AZ(VSB_finish(rss->vsb)); if (err != NULL) { VSB_printf(tl->sb, "%s '%.*s' could not be resolved to an IP address:\n" "\t%s\n" "(Sorry if that error message is gibberish.)\n", errid, PF(t_err), err); vcc_ErrWhere(tl, t_err); free(rss->vsa4); free(rss->vsa6); VSB_delete(rss->vsb); FREE_OBJ(rss); return; } AZ(error); if (rss->vsa4 != NULL) { vcc_suckaddr(tl, host, rss->vsa4, ipv4, ipv4_ascii, p_ascii); free(rss->vsa4); } if (rss->vsa6 != NULL) { vcc_suckaddr(tl, host, rss->vsa6, ipv6, ipv6_ascii, p_ascii); free(rss->vsa6); } if (rss->retval == 0) { VSB_printf(tl->sb, "%s '%.*s': resolves to " "neither IPv4 nor IPv6 addresses.\n", errid, PF(t_err) ); vcc_ErrWhere(tl, t_err); } if (rss->wrong || rss->retval > maxips) { VSB_printf(tl->sb, "%s %.*s: resolves to too many addresses.\n" "Only one IPv4 %s IPv6 are allowed.\n" "Please specify which exact address " "you want to use, we found all of these:\n%s", errid, PF(t_err), maxips > 1 ? "and one" : "or", VSB_data(rss->vsb)); vcc_ErrWhere(tl, t_err); } VSB_delete(rss->vsb); FREE_OBJ(rss); } varnish-4.1.1/lib/libvcc/generate.py0000755000201500234410000006772712652366721014320 00000000000000#!/usr/bin/env python #- # Copyright (c) 2006 Verdens Gang AS # Copyright (c) 2006-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # Generate various .c and .h files for the VCL compiler and the interfaces # for it. ####################################################################### # These are our tokens # We could drop all words such as "include", "if" etc, and use the # ID type instead, but declaring them tokens makes them reserved words # which hopefully makes for better error messages. # XXX: does it actually do that ? import sys srcroot = "../.." buildroot = "../.." if len(sys.argv) == 3: srcroot = sys.argv[1] buildroot = sys.argv[2] tokens = { "T_INC": "++", "T_DEC": "--", "T_CAND": "&&", "T_COR": "||", "T_LEQ": "<=", "T_EQ": "==", "T_NEQ": "!=", "T_GEQ": ">=", "T_SHR": ">>", "T_SHL": "<<", "T_INCR": "+=", "T_DECR": "-=", "T_MUL": "*=", "T_DIV": "/=", "T_NOMATCH": "!~", # Single char tokens, for convenience on one line None: "{}()*+-/%><=;!&.|~,", # These have handwritten recognizers "ID": None, "CNUM": None, "CSTR": None, "EOI": None, "CSRC": None, } ####################################################################### # Our methods and actions returns =( ############################################################### # Client side ('recv', "C", ('synth', 'pass', 'pipe', 'hash', 'purge',) ), ('pipe', "C", ('synth', 'pipe',) ), ('pass', "C", ('synth', 'restart', 'fetch',) ), ('hash', "C", ('lookup',) ), ('purge', "C", ('synth', 'restart',) ), ('miss', "C", ('synth', 'restart', 'pass', 'fetch',) ), ('hit', "C", ('synth', 'restart', 'pass', 'fetch', 'miss', 'deliver',) ), ('deliver', "C", ('synth', 'restart', 'deliver',) ), ('synth', "C", ('restart', 'deliver',) ), ############################################################### # Backend-fetch ('backend_fetch', "B", ('fetch', 'abandon') ), ('backend_response', "B", ('deliver', 'retry', 'abandon') ), ('backend_error', "B", ('deliver', 'retry', 'abandon') ), ############################################################### # Housekeeping ('init', "H", ('ok', 'fail') ), ('fini', "H", ('ok',) ), ) ####################################################################### # Variables available in sessions # # 'all' means all methods # 'client' means all methods tagged "C" # 'backend' means all methods tagged "B" # 'both' means all methods tagged "B" or "C" sp_variables = [ ('remote.ip', 'IP', ( 'client',), ( ), """ The IP address of the other end of the TCP connection. This can either be the clients IP, or the outgoing IP of a proxy server. """ ), ('client.ip', 'IP', ( 'client',), ( ), """ The client's IP address. """ ), ('client.identity', 'STRING', ( 'client',), ( 'client',), """ Identification of the client, used to load balance in the client director. """ ), ('local.ip', 'IP', ( 'client',), ( ), """ The IP address of the local end of the TCP connection. """ ), ('server.ip', 'IP', ( 'client',), ( ), """ The IP address of the socket on which the client connection was received. """ ), ('server.hostname', 'STRING', ( 'all',), ( ), """ The host name of the server. """ ), ('server.identity', 'STRING', ( 'all',), ( ), """ The identity of the server, as set by the -i parameter. If the -i parameter is not passed to varnishd, server.identity will be set to the name of the instance, as specified by the -n parameter. """ ), ('req', 'HTTP', ( 'client',), ( ), """ The entire request HTTP data structure """ ), ('req.method', 'STRING', ( 'client',), ( 'client',), """ The request type (e.g. "GET", "HEAD"). """ ), ('req.url', 'STRING', ( 'client',), ( 'client',), """ The requested URL. """ ), ('req.proto', 'STRING', ( 'client',), ( 'client',), """ The HTTP protocol version used by the client. """ ), ('req.http.', 'HEADER', ( 'client',), ( 'client',), """ The corresponding HTTP header. """ ), ('req.restarts', 'INT', ( 'client',), ( ), """ A count of how many times this request has been restarted. """ ), ('req.esi_level', 'INT', ( 'client',), ( ), """ A count of how many levels of ESI requests we're currently at. """ ), ('req.ttl', 'DURATION', ( 'client',), ( 'client',), """ """ ), ('req.xid', 'STRING', ( 'client',), ( ), """ Unique ID of this request. """ ), ('req.esi', 'BOOL', ( 'client',), ( 'client',), """ Boolean. Set to false to disable ESI processing regardless of any value in beresp.do_esi. Defaults to true. This variable is subject to change in future versions, you should avoid using it. """ ), ('req.can_gzip', 'BOOL', ( 'client',), ( ), """ Does the client accept the gzip transfer encoding. """ ), ('req.backend_hint', 'BACKEND', ( 'client', ), ( 'client',), """ Set bereq.backend to this if we attempt to fetch. """ ), ('req.hash_ignore_busy', 'BOOL', ( 'recv',), ( 'recv',), """ Ignore any busy object during cache lookup. You would want to do this if you have two server looking up content from each other to avoid potential deadlocks. """ ), ('req.hash_always_miss', 'BOOL', ( 'recv',), ( 'recv',), """ Force a cache miss for this request. If set to true Varnish will disregard any existing objects and always (re)fetch from the backend. """ ), ('req_top.method', 'STRING', ( 'client',), (), """ The request method of the top-level request in a tree of ESI requests. (e.g. "GET", "HEAD"). Identical to req.method in non-ESI requests. """ ), ('req_top.url', 'STRING', ( 'client',), (), """ The requested URL of the top-level request in a tree of ESI requests. Identical to req.url in non-ESI requests. """ ), ('req_top.http.', 'HEADER', ( 'client',), (), """ HTTP headers of the top-level request in a tree of ESI requests. Identical to req.http. in non-ESI requests. """ ), ('req_top.proto', 'STRING', ( 'client',), (), """ HTTP protocol version of the top-level request in a tree of ESI requests. Identical to req.proto in non-ESI requests. """ ), ('bereq', 'HTTP', ( 'backend',), ( ), """ The entire backend request HTTP data structure """ ), ('bereq.xid', 'STRING', ( 'backend',), ( ), """ Unique ID of this request. """ ), ('bereq.retries', 'INT', ( 'backend',), ( ), """ A count of how many times this request has been retried. """ ), ('bereq.backend', 'BACKEND', ( 'pipe', 'backend', ), ( 'pipe', 'backend', ), """ This is the backend or director we attempt to fetch from. """ ), ('bereq.method', 'STRING', ( 'pipe', 'backend', ), ( 'pipe', 'backend', ), """ The request type (e.g. "GET", "HEAD"). """ ), ('bereq.url', 'STRING', ( 'pipe', 'backend', ), ( 'pipe', 'backend', ), """ The requested URL. """ ), ('bereq.proto', 'STRING', ( 'pipe', 'backend', ), ( 'pipe', 'backend', ), """ The HTTP protocol version used to talk to the server. """ ), ('bereq.http.', 'HEADER', ( 'pipe', 'backend', ), ( 'pipe', 'backend', ), """ The corresponding HTTP header. """ ), ('bereq.uncacheable', 'BOOL', ( 'backend', ), ( ), """ Indicates whether this request is uncacheable due to a pass in the client side or a hit on an existing uncacheable object (aka hit-for-pass). """ ), ('bereq.connect_timeout', 'DURATION', ( 'pipe', 'backend', ), ( 'pipe', 'backend', ), """ The time in seconds to wait for a backend connection. """ ), ('bereq.first_byte_timeout', 'DURATION', ( 'backend', ), ( 'backend', ), """ The time in seconds to wait for the first byte from the backend. Not available in pipe mode. """ ), ('bereq.between_bytes_timeout', 'DURATION', ( 'backend', ), ( 'backend', ), """ The time in seconds to wait between each received byte from the backend. Not available in pipe mode. """ ), ('beresp', 'HTTP', ( 'backend_response', 'backend_error'), ( ), """ The entire backend response HTTP data structure """ ), ('beresp.proto', 'STRING', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ The HTTP protocol version used the backend replied with. """ ), ('beresp.status', 'INT', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ The HTTP status code returned by the server. """ ), ('beresp.reason', 'STRING', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ The HTTP status message returned by the server. """ ), ('beresp.http.', 'HEADER', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ The corresponding HTTP header. """ ), ('beresp.do_esi', 'BOOL', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ Boolean. ESI-process the object after fetching it. Defaults to false. Set it to true to parse the object for ESI directives. Will only be honored if req.esi is true. """ ), ('beresp.do_stream', 'BOOL', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ Deliver the object to the client directly without fetching the whole object into varnish. If this request is pass'ed it will not be stored in memory. """ ), ('beresp.do_gzip', 'BOOL', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ Boolean. Gzip the object before storing it. Defaults to false. When http_gzip_support is on Varnish will request already compressed content from the backend and as such compression in Varnish is not needed. """ ), ('beresp.do_gunzip', 'BOOL', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ Boolean. Unzip the object before storing it in the cache. Defaults to false. """ ), ('beresp.was_304', 'BOOL', ( 'backend_response', 'backend_error'), ( ), """ Boolean. If this is a successful 304 response to a backend conditional request refreshing an existing cache object. """ ), ('beresp.uncacheable', 'BOOL', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ Inherited from bereq.uncacheable, see there. Setting this variable makes the object uncacheable, which may get stored as a hit-for-pass object in the cache. Clearing the variable has no effect and will log the warning "Ignoring attempt to reset beresp.uncacheable". """ ), ('beresp.ttl', 'DURATION', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ The object's remaining time to live, in seconds. """ ), ('beresp.age', 'DURATION', ( 'backend_response', 'backend_error'), ( ), """ The age of the object. """ ), ('beresp.grace', 'DURATION', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ Set to a period to enable grace. """ ), ('beresp.keep', 'DURATION', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ Set to a period to enable conditional backend requests. The keep time is cache lifetime in addition to the ttl. Objects with ttl expired but with keep time left may be used to issue conditional (If-Modified-Since / If-None-Match) requests to the backend to refresh them. """ ), ('beresp.backend', 'BACKEND', ( 'backend_response', 'backend_error'), ( ), """ This is the backend we fetched from. If bereq.backend was set to a director, this will be the backend selected by the director. """ ), ('beresp.backend.name', 'STRING', ( 'backend_response', 'backend_error'), ( ), """ Name of the backend this response was fetched from. """ ), ('beresp.backend.ip', 'IP', ( 'backend_response', 'backend_error'), ( ), """ IP of the backend this response was fetched from. """ ), ('beresp.storage_hint', 'STRING', ( 'backend_response', 'backend_error'), ( 'backend_response', 'backend_error'), """ Hint to Varnish that you want to save this object to a particular storage backend. """ ), ('obj.proto', 'STRING', ( 'hit', ), ( ), """ The HTTP protocol version used when the object was retrieved. """ ), ('obj.status', 'INT', ( 'hit',), ( ), """ The HTTP status code returned by the server. """ ), ('obj.reason', 'STRING', ( 'hit',), ( ), """ The HTTP status message returned by the server. """ ), ('obj.hits', 'INT', ( 'hit', 'deliver',), ( ), """ The count of cache-hits on this object. A value of 0 indicates a cache miss. """ ), ('obj.http.', 'HEADER', ( 'hit', ), ( ), """ The corresponding HTTP header. """ ), ('obj.ttl', 'DURATION', ( 'hit', ), ( ), """ The object's remaining time to live, in seconds. """ ), ('obj.age', 'DURATION', ( 'hit', ), ( ), """ The age of the object. """ ), ('obj.grace', 'DURATION', ( 'hit', ), ( ), """ The object's remaining grace period in seconds. """ ), ('obj.keep', 'DURATION', ( 'hit', ), ( ), """ The object's remaining keep period in seconds. """ ), ('obj.uncacheable', 'BOOL', ( 'deliver', ), ( ), """ Whether the object is uncacheable (pass or hit-for-pass). """ ), ('resp', 'HTTP', ( 'deliver', 'synth'), ( ), """ The entire response HTTP data structure. """ ), ('resp.proto', 'STRING', ( 'deliver', 'synth', ), ( 'deliver', 'synth', ), """ The HTTP protocol version to use for the response. """ ), ('resp.status', 'INT', ( 'deliver', 'synth', ), ( 'deliver', 'synth', ), """ The HTTP status code that will be returned. Assigning a HTTP standardized code to resp.status will also set resp.reason to the corresponding status message. """ ), ('resp.reason', 'STRING', ( 'deliver', 'synth', ), ( 'deliver', 'synth', ), """ The HTTP status message that will be returned. """ ), ('resp.http.', 'HEADER', ( 'deliver', 'synth', ), ( 'deliver', 'synth', ), """ The corresponding HTTP header. """ ), ('resp.is_streaming', 'BOOL', ( 'deliver', 'synth', ), ( ), """ Returns true when the response will be streamed from the backend. """ ), ('now', 'TIME', ( 'all',), ( ), """ The current time, in seconds since the epoch. When used in string context it returns a formatted string. """ ), ] # Backwards compatibility: aliases = [ ] stv_variables = ( ('free_space', 'BYTES', "0.", 'storage..free_space', """ Free space available in the named stevedore. Only available for the malloc stevedore. """), ('used_space', 'BYTES', "0.", 'storage..used_space', """ Used space in the named stevedore. Only available for the malloc stevedore. """), ('happy', 'BOOL', "0", 'storage..happy', """ Health status for the named stevedore. Not available in any of the current stevedores. """), ) ####################################################################### # VCL to C type conversion vcltypes = { 'STRING_LIST': "void*", } fi = open(srcroot + "/include/vrt.h") for i in fi: j = i.split(); if len(j) < 3: continue if j[0] != "typedef": continue if j[-1][-1] != ";": continue if j[-1][:4] != "VCL_": continue d = " ".join(j[1:-1]) vcltypes[j[-1][4:-1]] = d fi.close() ####################################################################### # Nothing is easily configurable below this line. ####################################################################### import sys import copy ####################################################################### # Emit a function to recognize tokens in a string def emit_vcl_fixed_token(fo, tokens): recog = list() emit = dict() for i in tokens: j = tokens[i] if (j != None): recog.append(j) emit[j] = i recog.sort() rrecog = copy.copy(recog) rrecog.sort(key = lambda x: -len(x)) fo.write(""" #define M1()\tdo {*q = p + 1; return (p[0]); } while (0) #define M2(c,t)\tdo {if (p[1] == (c)) { *q = p + 2; return (t); }} while (0) unsigned vcl_fixed_token(const char *p, const char **q) { \tswitch (p[0]) { """) last_initial = None for i in recog: if (i[0] == last_initial): continue last_initial = i[0] fo.write("\tcase '%s':\n" % last_initial) need_ret = True for j in rrecog: if (j[0] != last_initial): continue if len(j) == 2: fo.write("\t\tM2('%s', %s);\n" % (j[1], emit[j])) elif len(j) == 1: fo.write("\t\tM1();\n") need_ret = False else: fo.write("\t\tif (") k = 1 l = len(j) while (k < l): fo.write("p[%d] == '%s'" % (k, j[k])) fo.write(" &&") if (k % 3) == 0: fo.write("\n\t\t ") else: fo.write(" ") k += 1 fo.write("!isvar(p[%d])) {\n" % l) fo.write("\t\t\t*q = p + %d;\n" % l) fo.write("\t\t\treturn (%s);\n" % emit[j]) fo.write("\t\t}\n") if need_ret: fo.write("\t\treturn (0);\n") fo.write("\tdefault:\n\t\treturn (0);\n\t}\n}\n") ####################################################################### # Emit the vcl_tnames (token->string) conversion array def emit_vcl_tnames(fo, tokens): fo.write("\nconst char * const vcl_tnames[256] = {\n") l = list(tokens.keys()) l.sort() for i in l: j = tokens[i] if j == None: j = i if i[0] == "'": j = i fo.write("\t[%s] = \"%s\",\n" % (i, j)) fo.write("};\n") ####################################################################### # Read a C-source file and spit out code that outputs it with VSB_cat() def emit_file(fo, fd, bn): fn = fd + "/" + bn fi = open(fn) fc = fi.read() fi.close() w = 66 # Width of lines, after white space prefix maxlen = 10240 # Max length of string literal x = 0 l = 0 fo.write("\n\t/* %s */\n\n" % fn) fo.write('\tVSB_cat(sb, "/* ---===### %s ###===--- */\\n\\n");\n' % bn) for c in fc: if l == 0: fo.write("\tVSB_cat(sb, \"") l += 12 x += 12 if x == 0: fo.write("\t \"") d = c if c == '\n': d = "\\n" elif c == '\t': d = "\\t" elif c == '"': d = "\\\"" elif c == '\\': d = "\\\\" if c == '\n' and x > w - 20: fo.write(d + "\"\n") x = 0 continue if c.isspace() and x > w - 10: fo.write(d + "\"\n") x = 0 continue fo.write(d) x += len(d) l += len(d) if l > maxlen: fo.write("\");\n") l = 0; x = 0 if x > w - 3: fo.write("\"\n") x = 0 if x != 0: fo.write("\"\n") if l != 0: fo.write("\t);\n") fo.write('\tVSB_cat(sb, "\\n");\n') ####################################################################### def polish_tokens(tokens): # Expand single char tokens st = tokens[None] del tokens[None] for i in st: tokens["'" + i + "'"] = i ####################################################################### def file_header(fo): fo.write("""/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ """) ####################################################################### polish_tokens(tokens) fo = open(buildroot + "/lib/libvcc/vcc_token_defs.h", "w") file_header(fo) j = 128 l = list(tokens.keys()) l.sort() for i in l: if i[0] == "'": continue fo.write("#define\t%s %d\n" % (i, j)) j += 1 assert j < 256 fo.close() ####################################################################### rets = dict() vcls = list() vcls_client = list() vcls_backend = list() for i in returns: vcls.append(i[0]) for j in i[1]: if j == "B": vcls_backend.append(i[0]) elif j == "C": vcls_client.append(i[0]) for j in i[2]: rets[j] = True ####################################################################### fo = open(buildroot + "/include/tbl/vcl_returns.h", "w") file_header(fo) fo.write("\n/*lint -save -e525 -e539 */\n") fo.write("\n#ifdef VCL_RET_MAC\n") l = list(rets.keys()) l.sort() ll = list(returns) ll.sort() for i in l: fo.write("VCL_RET_MAC(%s, %s" % (i.lower(), i.upper())) s=",\n\t" for j in ll: if i in j[2]: fo.write("%sVCL_MET_%s" % (s, j[0].upper())) s = " |\n\t" fo.write("\n)\n") fo.write("#endif\n") fo.write("\n#ifdef VCL_MET_MAC\n") for i in ll: fo.write("VCL_MET_MAC(%s, %s, %s," % (i[0].lower(), i[0].upper(), i[1])) p = " (\n\t" lll = list(i[2]) lll.sort() for j in lll: fo.write("%s(1U << VCL_RET_%s)" % (p, j.upper())) p = " |\n\t" fo.write("\n))\n") fo.write("#endif\n") fo.write("\n/*lint -restore */\n") fo.close() ####################################################################### fo = open(buildroot + "/include/vcl.h", "w") file_header(fo) fo.write(""" struct vrt_ctx; #define VRT_CTX const struct vrt_ctx *ctx struct req; struct busyobj; struct ws; struct cli; struct worker; enum vcl_event_e { VCL_EVENT_LOAD, VCL_EVENT_WARM, VCL_EVENT_USE, VCL_EVENT_COLD, VCL_EVENT_DISCARD, }; typedef int vcl_event_f(VRT_CTX, enum vcl_event_e); typedef int vcl_init_f(VRT_CTX); typedef void vcl_fini_f(VRT_CTX); typedef int vcl_func_f(VRT_CTX); """) def tbl40(a, b): while len(a.expandtabs()) < 40: a += "\t" return a + b fo.write("\n/* VCL Methods */\n") n = 1 for i in returns: fo.write( tbl40("#define VCL_MET_%s" % i[0].upper(), "(1U << %d)\n" % n) ) n += 1 fo.write("\n" + tbl40("#define VCL_MET_MAX", "%d\n" % n)) fo.write("\n" + tbl40("#define VCL_MET_MASK", "0x%x\n" % ((1 << n) - 1))) fo.write("\n/* VCL Returns */\n") n = 0 l = list(rets.keys()) l.sort() for i in l: fo.write(tbl40("#define VCL_RET_%s" % i.upper(), "%d\n" % n)) n += 1 fo.write("\n" + tbl40("#define VCL_RET_MAX", "%d\n" % n)) fo.write(""" struct VCL_conf { unsigned magic; #define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */ struct director **default_director; const struct vrt_backend_probe *default_probe; unsigned nref; struct vrt_ref *ref; unsigned nsrc; const char **srcname; const char **srcbody; vcl_event_f *event_vcl; """) for i in returns: fo.write("\tvcl_func_f\t*" + i[0] + "_func;\n") fo.write(""" }; """) fo.close() ####################################################################### def restrict(fo, spec): d = dict() for j in spec: if j == 'all': for i in vcls: d[i] = True elif j == 'backend': for i in vcls_backend: d[i] = True elif j == 'client': for i in vcls_client: d[i] = True elif j == 'both': for i in vcls_client: d[i] = True for i in vcls_backend: d[i] = True else: assert j in vcls d[j] = True p = "" n = 0 l = list(d.keys()) l.sort() w = 0 fo.write("\t\t") for j in l: x = p + "VCL_MET_" + j.upper() if w + len(x) > 60: fo.write("\n\t\t") w = 0 fo.write(x) w += len(x) p = " | " if len(d) == 0: fo.write("0") fo.write(",\n") ####################################################################### fh = open(buildroot + "/include/vrt_obj.h", "w") file_header(fh) fo = open(buildroot + "/lib/libvcc/vcc_obj.c", "w") file_header(fo) fo.write(""" #include "config.h" #include #include "vcc_compile.h" const struct var vcc_vars[] = { """) def one_var(nm, spec): fh.write("\n") typ = spec[1] cnam = i[0].replace(".", "_") ctyp = vcltypes[typ] fo.write("\t{ \"%s\", %s, %d,\n" % (nm, typ, len(nm))) if len(spec[2]) == 0: fo.write('\t NULL,\t/* No reads allowed */\n') elif typ == "HEADER": fo.write('\t "HDR_') fo.write(nm.split(".")[0].upper()) fo.write('",\n') else: fo.write('\t "VRT_r_%s(ctx)",\n' % cnam) if nm == i[0]: fh.write("VCL_" + typ + " VRT_r_%s(VRT_CTX);\n" % cnam ) restrict(fo, spec[2]) if len(spec[3]) == 0: fo.write('\t NULL,\t/* No writes allowed */\n') elif typ == "HEADER": fo.write('\t "HDR_') fo.write(nm.split(".")[0].upper()) fo.write('",\n') else: fo.write('\t "VRT_l_%s(ctx, ",\n' % cnam) if nm == i[0]: fh.write( "void VRT_l_%s(VRT_CTX, " % cnam) if typ != "STRING": fh.write("VCL_" + typ + ");\n") else: fh.write(ctyp + ", ...);\n") restrict(fo, spec[3]) fo.write("\t},\n") sp_variables.sort() aliases.sort() for i in sp_variables: one_var(i[0], i) for j in aliases: if j[1] == i[0]: one_var(j[0], i) fo.write("\t{ NULL }\n};\n") fh.write("\n") for i in stv_variables: fh.write(vcltypes[i[1]] + " VRT_Stv_" + i[0] + "(const char *);\n") fo.close() fh.close() ####################################################################### fo = open(buildroot + "/lib/libvcc/vcc_fixed_token.c", "w") file_header(fo) fo.write(""" #include "config.h" #include #include #include "vcc_compile.h" """) emit_vcl_fixed_token(fo, tokens) emit_vcl_tnames(fo, tokens) fo.write(""" void vcl_output_lang_h(struct vsb *sb) { """) emit_file(fo, srcroot, "include/vdef.h") emit_file(fo, buildroot, "include/vcl.h") emit_file(fo, srcroot, "include/vrt.h") emit_file(fo, buildroot, "include/vrt_obj.h") fo.write(""" } """) fo.close() ####################################################################### ft = open(buildroot + "/include/tbl/vcc_types.h", "w") file_header(ft) ft.write("/*lint -save -e525 -e539 */\n") i = list(vcltypes.keys()) i.sort() for j in i: ft.write("VCC_TYPE(" + j + ")\n") ft.write("/*lint -restore */\n") ft.close() ####################################################################### fo = open(buildroot + "/include/tbl/vrt_stv_var.h", "w") file_header(fo) fo.write(""" #ifndef VRTSTVTYPE #define VRTSTVTYPE(ct) #define VRTSTVTYPEX #endif #ifndef VRTSTVVAR #define VRTSTVVAR(nm, vtype, ctype, dval) #define VRTSTVVARX #endif """) x=dict() for i in stv_variables: ct = vcltypes[i[1]] if not ct in x: fo.write("VRTSTVTYPE(" + ct + ")\n") x[ct] = 1 fo.write("VRTSTVVAR(" + i[0] + ",\t" + i[1] + ",\t") fo.write(ct + ",\t" + i[2] + ")") fo.write("\n") fo.write(""" #ifdef VRTSTVTYPEX #undef VRTSTVTYPEX #undef VRTSTVTYPE #endif #ifdef VRTSTVVARX #undef VRTSTVVARX #undef VRTSTVVAR #endif """) fo.close ####################################################################### fp_vclvar = open(buildroot + "/doc/sphinx/include/vcl_var.rst", "w") l = list() for i in sp_variables: l.append(i) l.sort() def rst_where(fo, h, l): ll = list() if len(l) == 0: return fo.write("\t" + h) s = "" for j in l: if j == "both": ll.append("client") ll.append("backend") elif j == "client": ll.append(j) elif j == "backend": ll.append(j) elif j == "all": ll.append(j) else: ll.append("vcl_" + j) for j in ll: fo.write(s + j) s = ", " fo.write("\n\n") hdr="" for i in l: j = i[0].split(".") if j[0] != hdr: fp_vclvar.write("\n" + j[0] + "\n") fp_vclvar.write("~" * len(j[0]) + "\n") hdr = j[0] fp_vclvar.write("\n" + i[0] + "\n\n") fp_vclvar.write("\tType: " + i[1] + "\n\n") rst_where(fp_vclvar, "Readable from: ", i[2]) rst_where(fp_vclvar, "Writable from: ", i[3]) for j in i[4].split("\n"): fp_vclvar.write("\t%s\n" % j.strip()) hdr="storage" fp_vclvar.write("\n" + hdr + "\n"); fp_vclvar.write("~" * len(hdr) + "\n"); for i in stv_variables: fp_vclvar.write("\n" + i[3] + "\n\n") fp_vclvar.write("\tType: " + i[1] + "\n\n") fp_vclvar.write("\tReadable from: client, backend\n\n") for j in i[4].split("\n"): fp_vclvar.write("\t%s\n" % j.strip()) fp_vclvar.close() varnish-4.1.1/lib/libvcc/Makefile.in0000644000201500234410000005416412652366727014213 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = lib/libvcc DIST_COMMON = $(dist_pkgdata_SCRIPTS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(pkgdatadir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) libvcc_la_LIBADD = am_libvcc_la_OBJECTS = vcc_acl.lo vcc_action.lo vcc_backend.lo \ vcc_backend_util.lo vcc_compile.lo vcc_expr.lo vcc_parse.lo \ vcc_fixed_token.lo vcc_obj.lo vcc_storage.lo vcc_utils.lo \ vcc_symb.lo vcc_token.lo vcc_var.lo vcc_vmod.lo vcc_xref.lo libvcc_la_OBJECTS = $(am_libvcc_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent libvcc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libvcc_la_LDFLAGS) $(LDFLAGS) -o $@ SCRIPTS = $(dist_pkgdata_SCRIPTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libvcc_la_SOURCES) DIST_SOURCES = $(libvcc_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ AM_LDFLAGS = $(AM_LT_LDFLAGS) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include pkglib_LTLIBRARIES = libvcc.la libvcc_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version libvcc_la_SOURCES = \ vcc_compile.h \ vcc_token_defs.h \ \ vcc_acl.c \ vcc_action.c \ vcc_backend.c \ vcc_backend_util.c \ vcc_compile.c \ vcc_expr.c \ vcc_parse.c \ vcc_fixed_token.c \ vcc_obj.c \ vcc_storage.c \ vcc_utils.c \ vcc_symb.c \ vcc_token.c \ vcc_var.c \ vcc_vmod.c \ vcc_xref.c EXTRA_DIST = \ generate.py dist_pkgdata_SCRIPTS = \ vmodtool.py CLEANFILES = $(builddir)/vcc_token_defs.h \ $(builddir)/vcc_fixed_token.c \ $(builddir)/vcc_obj.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/libvcc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/libvcc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libvcc.la: $(libvcc_la_OBJECTS) $(libvcc_la_DEPENDENCIES) $(EXTRA_libvcc_la_DEPENDENCIES) $(AM_V_CCLD)$(libvcc_la_LINK) -rpath $(pkglibdir) $(libvcc_la_OBJECTS) $(libvcc_la_LIBADD) $(LIBS) install-dist_pkgdataSCRIPTS: $(dist_pkgdata_SCRIPTS) @$(NORMAL_INSTALL) test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" @list='$(dist_pkgdata_SCRIPTS)'; test -n "$(pkgdatadir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(pkgdatadir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(pkgdatadir)$$dir" || exit $$?; \ } \ ; done uninstall-dist_pkgdataSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(dist_pkgdata_SCRIPTS)'; test -n "$(pkgdatadir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_acl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_action.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_backend.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_backend_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_compile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_expr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_fixed_token.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_obj.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_parse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_storage.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_symb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_token.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_utils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_var.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_vmod.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_xref.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(pkgdatadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dist_pkgdataSCRIPTS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_pkgdataSCRIPTS \ uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-dist_pkgdataSCRIPTS install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-pkglibLTLIBRARIES install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-dist_pkgdataSCRIPTS \ uninstall-pkglibLTLIBRARIES vcc_obj.c vcc_fixed_token.c vcc_token_defs.h: \ $(top_builddir)/include/vcl.h # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/lib/libvcc/vcc_acl.c0000644000201500234410000002646712652366721013703 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2010 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. */ #include "config.h" #include #include #include #include #include #include #include #include #include "vcc_compile.h" #include "vrt.h" struct acl_e { VTAILQ_ENTRY(acl_e) list; unsigned char data[VRT_ACL_MAXADDR + 1]; unsigned mask; unsigned not; unsigned para; char *addr; struct token *t_addr; struct token *t_mask; }; /* Compare two acl rules for ordering */ #define CMP(a, b) \ do { \ if ((a) < (b)) \ return (-1); \ else if ((b) < (a)) \ return (1); \ } while (0) static int vcl_acl_cmp(struct acl_e *ae1, struct acl_e *ae2) { unsigned char *p1, *p2; unsigned m; p1 = ae1->data; p2 = ae2->data; m = ae1->mask; if (ae2->mask < m) m = ae2->mask; for (; m >= 8; m -= 8) { CMP(*p1, *p2); p1++; p2++; } if (m) { m = 0xff00 >> m; m &= 0xff; CMP(*p1 & m, *p2 & m); } /* Long mask is less than short mask */ CMP(ae2->mask, ae1->mask); return (0); } static void vcc_acl_add_entry(struct vcc *tl, const struct acl_e *ae, int l, const unsigned char *u, int fam) { struct acl_e *ae2, *aen; int i; if (fam == PF_INET && ae->mask > 32) { VSB_printf(tl->sb, "Too wide mask (%u) for IPv4 address\n", ae->mask); if (ae->t_mask != NULL) vcc_ErrWhere(tl, ae->t_mask); else vcc_ErrWhere(tl, ae->t_addr); return; } if (fam == PF_INET6 && ae->mask > 128) { VSB_printf(tl->sb, "Too wide mask (%u) for IPv6 address\n", ae->mask); vcc_ErrWhere(tl, ae->t_mask); return; } /* Make a copy from the template */ aen = TlAlloc(tl, sizeof *ae2); AN(aen); *aen = *ae; /* We treat family as part of address, it saves code */ assert(fam <= 0xff); aen->data[0] = fam & 0xff; aen->mask += 8; memcpy(aen->data + 1, u, l); VTAILQ_FOREACH(ae2, &tl->acl, list) { i = vcl_acl_cmp(aen, ae2); if (i == 0) { /* * If the two rules agree, silently ignore it * XXX: is that counter intuitive ? */ if (aen->not == ae2->not) return; VSB_printf(tl->sb, "Conflicting ACL entries:\n"); vcc_ErrWhere(tl, ae2->t_addr); VSB_printf(tl->sb, "vs:\n"); vcc_ErrWhere(tl, aen->t_addr); return; } /* * We could eliminate pointless rules here, for instance in: * "10.1.0.1"; * "10.1"; * The first rule is clearly pointless, as the second one * covers it. * * We do not do this however, because the shmlog may * be used to gather statistics. */ if (i < 0) { VTAILQ_INSERT_BEFORE(ae2, aen, list); return; } } VTAILQ_INSERT_TAIL(&tl->acl, aen, list); } static void vcc_acl_try_getaddrinfo(struct vcc *tl, struct acl_e *ae) { struct addrinfo *res0, *res, hint; struct sockaddr_in *sin4; struct sockaddr_in6 *sin6; unsigned char *u, i4, i6; int error; memset(&hint, 0, sizeof hint); hint.ai_family = PF_UNSPEC; hint.ai_socktype = SOCK_STREAM; error = getaddrinfo(ae->addr, "0", &hint, &res0); if (error) { if (ae->para) { VSB_printf(tl->sb, "Warning: %s ignored\n -- %s\n", ae->addr, gai_strerror(error)); Fh(tl, 1, "/* Ignored ACL entry: %s%s", ae->para ? "\"(\" " : "", ae->not ? "\"!\" " : ""); EncToken(tl->fh, ae->t_addr); if (ae->t_mask) Fh(tl, 0, "/%u", ae->mask); Fh(tl, 0, "%s\n", ae->para ? " \")\"" : ""); Fh(tl, 1, " * getaddrinfo: %s */\n", gai_strerror(error)); } else { VSB_printf(tl->sb, "DNS lookup(%s): %s\n", ae->addr, gai_strerror(error)); vcc_ErrWhere(tl, ae->t_addr); } return; } i4 = i6 = 0; for(res = res0; res != NULL; res = res->ai_next) { switch(res->ai_family) { case PF_INET: assert(PF_INET < 256); sin4 = (void*)res->ai_addr; assert(sizeof(sin4->sin_addr) == 4); u = (void*)&sin4->sin_addr; if (ae->t_mask == NULL) ae->mask = 32; i4++; vcc_acl_add_entry(tl, ae, 4, u, res->ai_family); break; case PF_INET6: assert(PF_INET6 < 256); sin6 = (void*)res->ai_addr; assert(sizeof(sin6->sin6_addr) == 16); u = (void*)&sin6->sin6_addr; if (ae->t_mask == NULL) ae->mask = 128; i6++; vcc_acl_add_entry(tl, ae, 16, u, res->ai_family); break; default: VSB_printf(tl->sb, "Ignoring unknown protocol family (%d) for %.*s\n", res->ai_family, PF(ae->t_addr)); continue; } ERRCHK(tl); } freeaddrinfo(res0); if (ae->t_mask != NULL && i4 > 0 && i6 > 0) { VSB_printf(tl->sb, "Mask (%u) specified, but string resolves to" " both IPv4 and IPv6 addresses.\n", ae->mask); vcc_ErrWhere(tl, ae->t_mask); return; } } /*-------------------------------------------------------------------- * Ancient stupidity on the part of X/Open and other standards orgs * dictate that "192.168" be translated to 192.0.0.168. Ever since * CIDR happened, "192.168/16" notation has been used, but apparently * no API supports parsing this, so roll our own. */ static int vcc_acl_try_netnotation(struct vcc *tl, struct acl_e *ae) { unsigned char b[4]; int i, j, k; unsigned u; const char *p; memset(b, 0, sizeof b); p = ae->addr; for (i = 0; i < 4; i++) { j = sscanf(p, "%u%n", &u, &k); if (j != 1) return (0); if (u & ~0xff) return (0); b[i] = (unsigned char)u; if (p[k] == '\0') break; if (p[k] != '.') return (0); p += k + 1; } if (ae->t_mask == NULL) ae->mask = 8 + 8 * i; vcc_acl_add_entry(tl, ae, 4, b, AF_INET); return (1); } static void vcc_acl_entry(struct vcc *tl) { struct acl_e *ae; char *sl, *e; ae = TlAlloc(tl, sizeof *ae); AN(ae); if (tl->t->tok == '!') { ae->not = 1; vcc_NextToken(tl); } if (tl->t->tok == '(') { ae->para = 1; vcc_NextToken(tl); } if (!ae->not && tl->t->tok == '!') { ae->not = 1; vcc_NextToken(tl); } ExpectErr(tl, CSTR); ae->t_addr = tl->t; ae->addr = strdup(ae->t_addr->dec); AN(ae->addr); vcc_NextToken(tl); if (strchr(ae->t_addr->dec, '/') != NULL) { sl = strchr(ae->addr, '/'); AN(sl); *sl++ = '\0'; e = NULL; ae->mask = strtoul(sl, &e, 10); if (*e != '\0') { VSB_printf(tl->sb, ".../mask is not numeric.\n"); vcc_ErrWhere(tl, ae->t_addr); return; } ae->t_mask = ae->t_addr; if (tl->t->tok == '/') { VSB_printf(tl->sb, "/mask only allowed once.\n"); vcc_ErrWhere(tl, tl->t); return; } } else if (tl->t->tok == '/') { vcc_NextToken(tl); ae->t_mask = tl->t; ExpectErr(tl, CNUM); ae->mask = vcc_UintVal(tl); } if (ae->para) SkipToken(tl, ')'); if (!vcc_acl_try_netnotation(tl, ae)) { ERRCHK(tl); vcc_acl_try_getaddrinfo(tl, ae); } ERRCHK(tl); } /********************************************************************* * Emit a function to match the ACL we have collected */ static void vcc_acl_emit(struct vcc *tl, const char *acln, int anon) { struct acl_e *ae; int depth, l, m, i; unsigned at[VRT_ACL_MAXADDR + 1]; struct token *t; struct inifin *ifp; Fh(tl, 0, "\nstatic int\n"); Fh(tl, 0, "match_acl_%s_%s(VRT_CTX, const VCL_IP p)\n", anon ? "anon" : "named", acln); Fh(tl, 0, "{\n"); Fh(tl, 0, "\tconst unsigned char *a;\n"); Fh(tl, 0, "\tint fam;\n"); Fh(tl, 0, "\n"); Fh(tl, 0, "\tfam = VRT_VSA_GetPtr(p, &a);\n"); Fh(tl, 0, "\tif (fam < 0) {\n"); Fh(tl, 0, "\t\tVRT_acl_log(ctx, \"NO_FAM %s\");\n", acln); Fh(tl, 0, "\t\treturn(0);\n"); Fh(tl, 0, "\t}\n\n"); if (!tl->param->err_unref && !anon ) { ifp = New_IniFin(tl); VSB_printf(ifp->ini, "\tif (0) match_acl_named_%s(0, 0);\n", acln); } depth = -1; at[0] = 256; VTAILQ_FOREACH(ae, &tl->acl, list) { /* Find how much common prefix we have */ for (l = 0; l <= depth && l * 8 < ae->mask - 7; l++) { assert(l >= 0); if (ae->data[l] != at[l]) break; } /* Back down, if necessary */ while (l <= depth) { Fh(tl, 0, "\t%*s}\n", -depth, ""); depth--; } m = ae->mask; m -= l * 8; assert(m >= 0); /* Do whole byte compares */ for (i = l; m >= 8; m -= 8, i++) { if (i == 0) Fh(tl, 0, "\t%*s%sif (fam == %d) {\n", -i, "", "", ae->data[i]); else Fh(tl, 0, "\t%*s%sif (a[%d] == %d) {\n", -i, "", "", i - 1, ae->data[i]); at[i] = ae->data[i]; depth = i; } if (m > 0) { /* Do fractional byte compares */ Fh(tl, 0, "\t%*s%sif ((a[%d] & 0x%x) == %d) {\n", -i, "", "", i - 1, (0xff00 >> m) & 0xff, ae->data[i] & ((0xff00 >> m) & 0xff)); at[i] = 256; depth = i; } i = (ae->mask + 7) / 8; if (!anon) { Fh(tl, 0, "\t%*sVRT_acl_log(ctx, \"%sMATCH %s \" ", -i, "", ae->not ? "NEG_" : "", acln); t = ae->t_addr; do { if (t->tok == CSTR) { Fh(tl, 0, " \"\\\"\" " ); EncToken(tl->fh, t); Fh(tl, 0, " \"\\\"\" " ); } else Fh(tl, 0, " \"%.*s\"", PF(t)); if (t == ae->t_mask) break; t = VTAILQ_NEXT(t, list); AN(t); } while (ae->t_mask != NULL); Fh(tl, 0, ");\n"); } Fh(tl, 0, "\t%*sreturn (%d);\n", -i, "", ae->not ? 0 : 1); } /* Unwind */ for (; 0 <= depth; depth--) Fh(tl, 0, "\t%*.*s}\n", depth, depth, ""); /* Deny by default */ if (!anon) Fh(tl, 0, "\tVRT_acl_log(ctx, \"NO_MATCH %s\");\n", acln); Fh(tl, 0, "\treturn (0);\n}\n"); } void vcc_Acl_Hack(struct vcc *tl, char *b) { char acln[32]; unsigned tcond; VTAILQ_INIT(&tl->acl); tcond = tl->t->tok; vcc_NextToken(tl); bprintf(acln, "%u", tl->unique++); vcc_acl_entry(tl); vcc_acl_emit(tl, acln, 1); sprintf(b, "%smatch_acl_anon_%s(ctx, \v1)", (tcond == T_NEQ ? "!" : ""), acln); } void vcc_ParseAcl(struct vcc *tl) { struct token *an; int i; char acln[1024]; vcc_NextToken(tl); VTAILQ_INIT(&tl->acl); ExpectErr(tl, ID); if (!vcc_isCid(tl->t)) { VSB_printf(tl->sb, "Names of VCL acl's cannot contain '-'\n"); vcc_ErrWhere(tl, tl->t); return; } an = tl->t; vcc_NextToken(tl); i = vcc_AddDef(tl, an, SYM_ACL); if (i > 1) { VSB_printf(tl->sb, "ACL %.*s redefined\n", PF(an)); vcc_ErrWhere(tl, an); return; } bprintf(acln, "%.*s", PF(an)); SkipToken(tl, '{'); while (tl->t->tok != '}') { vcc_acl_entry(tl); ERRCHK(tl); SkipToken(tl, ';'); } SkipToken(tl, '}'); vcc_acl_emit(tl, acln, 0); } varnish-4.1.1/lib/libvcc/vcc_storage.c0000644000201500234410000001030212652366721014565 00000000000000/*- * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * All stuff related to the storage.* part of the namespace. * * "All" is actually only a wildcard function, which instantiates variables * on demand under the storage.* tree of the namespace. * * About the syntax: * ----------------- * * One of our long term goals is to have dynamic storage configuration, such * as the ability to add or remove a stevedore on the fly, without restarting * the worker process. * * Even though this goal is far out in the future, it influences the syntax * design of storage selection from VCL. * * In difference from backends, where we know the possible set of backends at * compile time, we will not in the future know the identity of the stevedores * available at compile time, so we have to rely on VRT name resolution. * * This indicates a namespace on the form storage.. * * For each property, we must define a default value if the named stevedore * does not exists, such that for instance stevedore.forgetit.freespace * returns zero etc. * */ #include "config.h" #include #include #include #include #include "vcc_compile.h" #define PFX "storage." /*-------------------------------------------------------------------- * */ static struct var * vcc_Stv_mkvar(struct vcc *tl, const struct token *t, enum var_type fmt) { struct var *v; v = TlAlloc(tl, sizeof *v); AN(v); v->name = TlDupTok(tl, t); v->r_methods = 0; #define VCL_MET_MAC(l,u,t,b) v->r_methods |= VCL_MET_##u; #include "tbl/vcl_returns.h" #undef VCL_MET_MAC v->fmt = fmt; return (v); } static struct stvars { const char *name; enum var_type fmt; } stvars[] = { #define VRTSTVVAR(nm, vtype, ctype, dval) { #nm, vtype }, #include "tbl/vrt_stv_var.h" #undef VRTSTVVAR { NULL, BOOL } }; struct symbol * vcc_Stv_Wildcard(struct vcc *tl, const struct token *t, const struct symbol *wcsym) { const char *p, *q; struct var *v = NULL; struct symbol *sym; struct stvars *sv; char stv[1024]; char buf[1024]; (void)wcsym; assert((t->e - t->b) > strlen(PFX)); AZ(memcmp(t->b, PFX, strlen(PFX))); p = t->b + strlen(PFX); for (q = p; q < t->e && *q != '.'; q++) continue; bprintf(stv, "%.*s", (int)(q - p), p); if (q == t->e) { v = vcc_Stv_mkvar(tl, t, BOOL); bprintf(buf, "VRT_Stv(\"%s\")", stv); v->rname = TlDup(tl, buf); } else { assert(*q == '.'); q++; for(sv = stvars; sv->name != NULL; sv++) { if (strncmp(q, sv->name, t->e - q)) continue; if (sv->name[t->e - q] != '\0') continue; v = vcc_Stv_mkvar(tl, t, sv->fmt); bprintf(buf, "VRT_Stv_%s(\"%s\")", sv->name, stv); v->rname = TlDup(tl, buf); break; } } if (v == NULL) return (NULL); sym = VCC_AddSymbolTok(tl, t, SYM_VAR); AN(sym); sym->var = v; sym->fmt = v->fmt; sym->eval = vcc_Eval_Var; sym->r_methods = v->r_methods; return (sym); } varnish-4.1.1/lib/libvcc/vcc_token_defs.h0000644000201500234410000000071112652366743015256 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ #define CNUM 128 #define CSRC 129 #define CSTR 130 #define EOI 131 #define ID 132 #define T_CAND 133 #define T_COR 134 #define T_DEC 135 #define T_DECR 136 #define T_DIV 137 #define T_EQ 138 #define T_GEQ 139 #define T_INC 140 #define T_INCR 141 #define T_LEQ 142 #define T_MUL 143 #define T_NEQ 144 #define T_NOMATCH 145 #define T_SHL 146 #define T_SHR 147 varnish-4.1.1/lib/libvcc/vcc_vmod.c0000644000201500234410000001630712652366721014101 00000000000000/*- * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include #include "vcc_compile.h" #include "vcs_version.h" #include "vfil.h" #include "vmod_abi.h" #include "vrt.h" static int vcc_path_dlopen(void *priv, const char *fn) { void *hdl, **pp; AN(priv); AN(fn); hdl = dlopen(fn, RTLD_NOW | RTLD_LOCAL); if (hdl == NULL) return (1); pp = priv; *pp = hdl; return (0); } void vcc_ParseImport(struct vcc *tl) { void *hdl; char fn[1024], *fnp; char buf[256]; struct token *mod, *t1; struct inifin *ifp; const char * const *spec; struct symbol *sym; const struct symbol *osym; const char *p; // int *modlen; const struct vmod_data *vmd; t1 = tl->t; SkipToken(tl, ID); /* "import" */ ExpectErr(tl, ID); mod = tl->t; vcc_NextToken(tl); osym = VCC_FindSymbol(tl, mod, SYM_NONE); if (osym != NULL && osym->kind != SYM_VMOD) { VSB_printf(tl->sb, "Module %.*s conflicts with other symbol.\n", PF(mod)); vcc_ErrWhere2(tl, t1, tl->t); return; } if (osym != NULL) { VSB_printf(tl->sb, "Module %.*s already imported.\n", PF(mod)); vcc_ErrWhere2(tl, t1, tl->t); VSB_printf(tl->sb, "Previous import was here:\n"); vcc_ErrWhere2(tl, osym->def_b, osym->def_e); return; } bprintf(fn, "%.*s", PF(mod)); sym = VCC_AddSymbolStr(tl, fn, SYM_VMOD); ERRCHK(tl); AN(sym); sym->def_b = t1; sym->def_e = tl->t; if (tl->t->tok == ID) { if (!vcc_IdIs(tl->t, "from")) { VSB_printf(tl->sb, "Expected 'from path ...'\n"); vcc_ErrWhere(tl, tl->t); return; } vcc_NextToken(tl); if (!tl->param->unsafe_path && strchr(tl->t->dec, '/')) { VSB_printf(tl->sb, "'import ... from path ...' is unsafe.\nAt:"); vcc_ErrToken(tl, tl->t); vcc_ErrWhere(tl, tl->t); return; } ExpectErr(tl, CSTR); p = strrchr(tl->t->dec, '/'); if (p != NULL && p[1] == '\0') bprintf(fn, "%slibvmod_%.*s.so", tl->t->dec, PF(mod)); else bprintf(fn, "%s", tl->t->dec); vcc_NextToken(tl); } else { bprintf(fn, "libvmod_%.*s.so", PF(mod)); } SkipToken(tl, ';'); if (VFIL_searchpath(tl->param->vmod_path, vcc_path_dlopen, &hdl, fn, &fnp)) { VSB_printf(tl->sb, "Could not load VMOD %.*s\n", PF(mod)); VSB_printf(tl->sb, "\tFile name: %s\n", fnp != NULL ? fnp : fn); VSB_printf(tl->sb, "\tdlerror: %s\n", dlerror()); vcc_ErrWhere(tl, mod); return; } bprintf(buf, "Vmod_%.*s_Data", PF(mod)); vmd = dlsym(hdl, buf); if (vmd == NULL) { VSB_printf(tl->sb, "Malformed VMOD %.*s\n", PF(mod)); VSB_printf(tl->sb, "\tFile name: %s\n", fnp); VSB_printf(tl->sb, "\t(no Vmod_Data symbol)\n"); vcc_ErrWhere(tl, mod); return; } if (strcmp(VCS_Branch, "master") == 0 && strcmp(vmd->abi, VMOD_ABI_Version) != 0) { VSB_printf(tl->sb, "Incompatible VMOD %.*s\n", PF(mod)); VSB_printf(tl->sb, "\tFile name: %s\n", fnp); VSB_printf(tl->sb, "\tABI mismatch, expected <%s>, got <%s>\n", VMOD_ABI_Version, vmd->abi); vcc_ErrWhere(tl, mod); return; } if (vmd->vrt_major != VRT_MAJOR_VERSION || vmd->vrt_minor > VRT_MINOR_VERSION) { VSB_printf(tl->sb, "Incompatible VMOD %.*s\n", PF(mod)); VSB_printf(tl->sb, "\tFile name: %s\n", fnp); VSB_printf(tl->sb, "\tVMOD version %u.%u\n", vmd->vrt_major, vmd->vrt_minor); VSB_printf(tl->sb, "\tvarnishd version %u.%u\n", VRT_MAJOR_VERSION, VRT_MINOR_VERSION); vcc_ErrWhere(tl, mod); return; } if (vmd->name == NULL || vmd->func == NULL || vmd->func_len <= 0 || vmd->proto == NULL || vmd->abi == NULL) { VSB_printf(tl->sb, "Mangled VMOD %.*s\n", PF(mod)); VSB_printf(tl->sb, "\tFile name: %s\n", fnp); VSB_printf(tl->sb, "\tInconsistent metadata\n"); vcc_ErrWhere(tl, mod); return; } if (!vcc_IdIs(mod, vmd->name)) { VSB_printf(tl->sb, "Wrong VMOD file %.*s\n", PF(mod)); VSB_printf(tl->sb, "\tFile name: %s\n", fnp); VSB_printf(tl->sb, "\tContains vmod \"%s\"\n", vmd->name); vcc_ErrWhere(tl, mod); return; } ifp = New_IniFin(tl); VSB_printf(ifp->ini, "\tif (VRT_Vmod_Init(&VGC_vmod_%.*s,\n", PF(mod)); VSB_printf(ifp->ini, "\t &Vmod_%.*s_Func,\n", PF(mod)); VSB_printf(ifp->ini, "\t sizeof(Vmod_%.*s_Func),\n", PF(mod)); VSB_printf(ifp->ini, "\t \"%.*s\",\n", PF(mod)); VSB_printf(ifp->ini, "\t "); EncString(ifp->ini, fnp, NULL, 0); free(fnp); VSB_printf(ifp->ini, ",\n"); AN(vmd); AN(vmd->file_id); VSB_printf(ifp->ini, "\t \"%s\",\n", vmd->file_id); VSB_printf(ifp->ini, "\t ctx))\n"); VSB_printf(ifp->ini, "\t\treturn(1);"); /* XXX: zero the function pointer structure ?*/ VSB_printf(ifp->fin, "\t\tVRT_priv_fini(&vmod_priv_%.*s);", PF(mod)); VSB_printf(ifp->fin, "\n\t\tVRT_Vmod_Fini(&VGC_vmod_%.*s);", PF(mod)); ifp = NULL; spec = vmd->spec; for (; *spec != NULL; spec++) { p = *spec; if (!strcmp(p, "$OBJ")) { p += strlen(p) + 1; sym = VCC_AddSymbolStr(tl, p, SYM_OBJECT); XXXAN(sym); sym->args = p; } else if (!strcmp(p, "$EVENT")) { p += strlen(p) + 1; if (ifp == NULL) ifp = New_IniFin(tl); VSB_printf(ifp->ini, "\tif (%s(ctx, &vmod_priv_%.*s, VCL_EVENT_LOAD))\n" "\t\treturn(1);", p, PF(mod)); VSB_printf(ifp->fin, "\t\t(void)%s(ctx, &vmod_priv_%.*s,\n" "\t\t VCL_EVENT_DISCARD);\n", p, PF(mod)); VSB_printf(ifp->event, "\t%s(ctx, &vmod_priv_%.*s, ev)", p, PF(mod)); } else { sym = VCC_AddSymbolStr(tl, p, SYM_FUNC); ERRCHK(tl); AN(sym); sym->eval = vcc_Eval_SymFunc; p += strlen(p) + 1; sym->cfunc = p; p += strlen(p) + 1; sym->args = p; /* Functions which return VOID are procedures */ if (!memcmp(p, "VOID\0", 5)) sym->kind = SYM_PROC; } } Fh(tl, 0, "\n/* --- BEGIN VMOD %.*s --- */\n\n", PF(mod)); Fh(tl, 0, "static struct vmod *VGC_vmod_%.*s;\n", PF(mod)); Fh(tl, 0, "static struct vmod_priv vmod_priv_%.*s;\n", PF(mod)); Fh(tl, 0, "\n%s\n", vmd->proto); Fh(tl, 0, "\n/* --- END VMOD %.*s --- */\n\n", PF(mod)); } varnish-4.1.1/lib/libvcc/vmodtool.py0000755000201500234410000005462012652366721014355 00000000000000#!/usr/bin/env python #- # Copyright (c) 2010-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. """ Read the vmod.vcc file (inputvcc) and produce: vmod_if.h -- Prototypes for the implementation vmod_if.c -- Magic glue & datastructures to make things a VMOD. vmod_${name}.rst -- Extracted documentation """ # This script should work with both Python 2 and Python 3. from __future__ import print_function import sys import re import optparse import unittest import random from os import unlink from os.path import dirname, realpath, exists from pprint import pprint, pformat ctypes = { 'BACKEND': "VCL_BACKEND", 'BLOB': "VCL_BLOB", 'BOOL': "VCL_BOOL", 'BYTES': "VCL_BYTES", 'DURATION': "VCL_DURATION", 'ENUM': "VCL_ENUM", 'HEADER': "VCL_HEADER", 'HTTP': "VCL_HTTP", 'INT': "VCL_INT", 'IP': "VCL_IP", 'PRIV_CALL': "struct vmod_priv *", 'PRIV_VCL': "struct vmod_priv *", 'PRIV_TASK': "struct vmod_priv *", 'PRIV_TOP': "struct vmod_priv *", 'PROBE': "VCL_PROBE", 'REAL': "VCL_REAL", 'STRING': "VCL_STRING", 'STRING_LIST': "const char *, ...", 'TIME': "VCL_TIME", 'VOID': "VCL_VOID", } ####################################################################### def write_file_warning(fo, a, b, c): fo.write(a + "\n") fo.write(b + " NB: This file is machine generated, DO NOT EDIT!\n") fo.write(b + "\n") fo.write(b + " Edit vmod.vcc and run make instead\n") fo.write(c + "\n\n") def write_c_file_warning(fo): write_file_warning(fo, "/*", " *", " */") def write_rst_file_warning(fo): write_file_warning(fo, "..", "..", "..") ####################################################################### def lwrap(s, w=72): """ Wrap a c-prototype like string into a number of lines """ l = [] p = "" while len(s) > w: y = s[:w].rfind(',') if y == -1: y = s[:w].rfind('(') if y == -1: break l.append(p + s[:y + 1]) s = s[y + 1:].lstrip() p = " " if len(s) > 0: l.append(p + s) return l def quote(s): t = "" for i in s: if i == '"': t += '\\"' else: t += i return t ####################################################################### def is_c_name(s): return None != re.match("^[a-zA-Z][a-zA-Z0-9_]*$", s) class ParseError(Exception): "An error reading the input file." pass class FormatError(Exception): """ Raised if the content of the (otherwise well-formed) input file is invalid. """ def __init__(self, msg, details): self.msg = msg self.details = details Exception.__init__(self) ####################################################################### class Token(object): def __init__(self, ln, ch, tokstr): self.ln = ln self.ch = ch self.str = tokstr def __repr__(self): return "<@%d \"%s\">" % (self.ln, self.str) ####################################################################### class Vmod(object): def __init__(self, nam, dnam, sec): if not is_c_name(nam): raise ParseError("Module name '%s' is illegal", nam) self.nam = nam self.dnam = dnam self.sec = sec self.event = None self.funcs = list() self.objs = list() self.doc_str = [] self.doc_order = [] def set_event(self, nam): if self.event != None: raise ParseError("Module %s already has $Event", self.nam) if not is_c_name(nam): raise ParseError("$Event name '%s' is illegal", nam) self.event = nam def add_func(self, fn): self.funcs.append(fn) self.doc_order.append(fn) def add_obj(self, o): self.objs.append(o) self.doc_order.append(o) def c_proto(self, fo): for o in self.objs: fo.write("/* Object %s */\n" % o.nam) o.fixup(self.nam) o.c_proto(fo) fo.write("\n") if len(self.funcs) > 0: fo.write("/* Functions */\n") for f in self.funcs: for i in lwrap(f.c_proto()): fo.write(i + "\n") if self.event != None: fo.write("\n") fo.write("#ifdef VCL_MET_MAX\n") fo.write("vmod_event_f " + self.event + ";\n") fo.write("#endif\n") def c_typedefs_(self): l = list() for o in self.objs: for t in o.c_typedefs(self.nam): l.append(t) l.append("") if len(self.funcs) > 0: l.append("/* Functions */") for f in self.funcs: l.append(f.c_typedef(self.nam)) l.append("") return l def c_typedefs(self, fo): for i in self.c_typedefs_(): for j in lwrap(i): fo.write(j + "\n") def c_vmod(self, fo): cs = self.c_struct() fo.write(cs + ';\n') vfn = 'Vmod_%s_Func' % self.nam fo.write("/*lint -esym(754, %s::*) */\n" % vfn) fo.write("\nstatic const struct %s Vmod_Func =" % vfn) fo.write(self.c_initializer()) fo.write("\n") fo.write("\nstatic const char Vmod_Proto[] =\n") for t in self.c_typedefs_(): for i in lwrap(t, w=64): fo.write('\t"' + i + '\\n"\n') fo.write('\t"\\n"\n') for i in (cs + ";").split("\n"): fo.write('\n\t"' + i + '\\n"') fo.write('\n\t"static struct ' + vfn + " " + vfn + ';";\n\n') fo.write(self.c_strspec()) fo.write("\n") nm = "Vmod_" + self.nam + "_Data" fo.write("/*lint -esym(759, %s) */\n" % nm) fo.write("const struct vmod_data " + nm + " = {\n") fo.write("\t.vrt_major = VRT_MAJOR_VERSION,\n"); fo.write("\t.vrt_minor = VRT_MINOR_VERSION,\n"); fo.write("\t.name = \"%s\",\n" % self.nam) fo.write("\t.func = &Vmod_Func,\n") fo.write("\t.func_len = sizeof(Vmod_Func),\n") fo.write("\t.proto = Vmod_Proto,\n") fo.write("\t.spec = Vmod_Spec,\n") fo.write("\t.abi = VMOD_ABI_Version,\n") # NB: Sort of hackish: # Fill file_id with random stuff, so we can tell if # VCC and VRT_Vmod_Init() dlopens the same file # fo.write("\t.file_id = \"") for i in range(32): fo.write("%c" % random.randint(0x40,0x5a)) fo.write("\",\n") fo.write("};\n") def c_initializer(self): s = '{\n' for o in self.objs: s += o.c_initializer() s += "\n\t/* Functions */\n" for f in self.funcs: s += f.c_initializer() s += "\n\t/* Init/Fini */\n" if self.event != None: s += "\t" + self.event + ",\n" s += "};" return s def c_struct(self): s = 'struct Vmod_' + self.nam + '_Func {\n' for o in self.objs: s += o.c_struct(self.nam) s += "\n\t/* Functions */\n" for f in self.funcs: s += f.c_struct(self.nam) s += "\n\t/* Init/Fini */\n" if self.event != None: s += "\tvmod_event_f\t*_event;\n" s += '}' return s def c_strspec(self): s = "/*lint -save -e786 -e840 */\n" s += "static const char * const Vmod_Spec[] = {\n" for o in self.objs: s += o.c_strspec(self.nam) + ",\n\n" if len(self.funcs) > 0: s += "\t/* Functions */\n" for f in self.funcs: s += f.c_strspec(self.nam) + ',\n\n' if self.event != None: s += "\t/* Init/Fini */\n" s += '\t"$EVENT\\0Vmod_' + self.nam + '_Func._event",\n' s += "\t0\n" s += "};\n" s += "/*lint -restore */\n" return s def doc(self, l): self.doc_str.append(l) def doc_dump(self, fo, suf): fo.write(".. role:: ref(emphasis)\n\n") i = "vmod_" + self.nam fo.write(".. _" + i + "(" + self.sec + "):\n\n") fo.write("=" * len(i) + "\n") fo.write(i + "\n") fo.write("=" * len(i) + "\n") fo.write("\n") i = self.dnam fo.write("-" * len(i) + "\n") fo.write(i + "\n") fo.write("-" * len(i) + "\n") fo.write("\n") fo.write(":Manual section: %s\n" % self.sec) fo.write("\n") fo.write("SYNOPSIS\n") fo.write("========\n") fo.write("\n") fo.write("import %s [from \"path\"] ;\n" % self.nam) fo.write("\n") for i in self.doc_str: fo.write(i + "\n") fo.write("CONTENTS\n") fo.write("========\n") fo.write("\n") l = [] for i in self.funcs: l.append(i.doc_idx(suf)) for i in self.objs: l += i.doc_idx(suf) l.sort() for i in l: fo.write("* " + i[1] + "\n") fo.write("\n") for i in self.doc_order: i.doc_dump(fo) ####################################################################### class Func(object): def __init__(self, nam, retval, al): #if not is_c_name(nam): # raise Exception("Func name '%s' is illegal" % nam) if retval not in ctypes: raise TypeError( "Return type '%s' not a valid type", retval) self.nam = nam self.cnam = nam.replace(".", "_") self.al = al self.retval = retval self.pfx = None self.doc_str = [] def __repr__(self): return "" % (self.retval, self.nam) def set_pfx(self, s): self.pfx = s def c_proto(self, fini=False): s = ctypes[self.retval] + " vmod_" + self.cnam + "(" p = "" if not fini: s += "VRT_CTX" p = ", " if self.pfx != None: s += p + self.pfx p = ", " for a in self.al: s += p + ctypes[a.typ] p = ", " s += ");" return s def c_typedef(self, modname, fini=False): s = "typedef " s += ctypes[self.retval] s += " td_" + modname + "_" + self.cnam + "(" p = "" if not fini: s += "VRT_CTX" p = ", " if self.pfx != None: s += p + self.pfx p = ", " for a in self.al: s += p + ctypes[a.typ] p = ", " s += ");" return s def c_struct(self, modname): s = '\ttd_' + modname + "_" + self.cnam if len(s.expandtabs()) >= 40: s += "\n\t\t\t\t\t" else: while len(s.expandtabs()) < 40: s += "\t" s += "*" + self.cnam + ";\n" return s def c_initializer(self): return "\tvmod_" + self.cnam + ",\n" def c_strspec(self, modnam, pfx="\t"): s = pfx + '"' + modnam + "." + self.nam + '\\0"\n' s += pfx + '"' s += "Vmod_" + modnam + "_Func." + self.cnam + '\\0"\n' s += pfx + ' "' + self.retval + '\\0"\n' for a in self.al: s += pfx + '\t"' + a.c_strspec() + '"\n' s += pfx + '"\\0"' return s def doc(self, l): self.doc_str.append(l) def doc_proto(self): s = self.retval + " " + self.nam + "(" d = "" for i in self.al: s += d + i.typ d = ", " s += ")" return s def doc_idx(self, suf): if suf == "": return (self.nam, ":ref:`func_" + self.nam + "`") else: return (self.nam, self.doc_proto()) def doc_dump(self, fo): s = self.doc_proto() fo.write(".. _func_" + self.nam + ":\n\n") fo.write(s + "\n") fo.write("-" * len(s) + "\n") fo.write("\n") fo.write("Prototype\n") s = "\t" + self.retval + " " + self.nam + "(" d = "" for i in self.al: s += d + i.typ if i.nam != None: s += " " + i.nam d = ", " fo.write(s + ")\n") for i in self.doc_str: fo.write(i + "\n") ####################################################################### class Obj(object): def __init__(self, nam): self.nam = nam self.init = None self.fini = None self.methods = list() self.doc_str = [] self.st = None def fixup(self, modnam): assert self.nam != None self.st = "struct vmod_" + modnam + "_" + self.nam self.init.set_pfx(self.st + " **, const char *") self.fini.set_pfx(self.st + " **") for m in self.methods: m.set_pfx(self.st + " *") def set_init(self, f): self.init = f self.fini = Func(f.nam, "VOID", []) self.init.cnam += "__init" self.fini.cnam += "__fini" def add_method(self, m): self.methods.append(m) def c_typedefs(self, modnam): l = list() l.append("/* Object " + self.nam + " */") l.append(self.st + ";") l.append(self.init.c_typedef(modnam) + "") l.append(self.fini.c_typedef(modnam, fini=True) + "") for m in self.methods: l.append(m.c_typedef(modnam) + "") return l def c_proto(self, fo): fo.write(self.st + ";\n") l = [] l += lwrap(self.init.c_proto()) l += lwrap(self.fini.c_proto(fini=True)) for m in self.methods: l += lwrap(m.c_proto()) for i in l: fo.write(i + "\n") def c_struct(self, modnam): s = "\t/* Object " + self.nam + " */\n" s += self.init.c_struct(modnam) s += self.fini.c_struct(modnam) for m in self.methods: s += m.c_struct(modnam) return s def c_initializer(self): s = "\t/* Object " + self.nam + " */\n" s += self.init.c_initializer() s += self.fini.c_initializer() for m in self.methods: s += m.c_initializer() return s def c_strspec(self, modnam): s = "\t/* Object " + self.nam + " */\n" s += '\t"$OBJ\\0"\n' s += self.init.c_strspec(modnam, pfx="\t\t") + '\n' s += '\t\t"' + self.st + '\\0"\n' s += self.fini.c_strspec(modnam, pfx="\t\t") + '\n' for m in self.methods: s += m.c_strspec(modnam, pfx="\t\t") + '\n' s += '\t"\\0"' return s def doc(self, l): self.doc_str.append(l) def doc_idx(self, suf): l = [] if suf == "": l.append((self.nam, ":ref:`obj_" + self.nam + "`")) else: l.append((self.nam, "Object " + self.nam)) for i in self.methods: l.append(i.doc_idx(suf)) return l def doc_dump(self, fo): fo.write(".. _obj_" + self.nam + ":\n\n") s = "Object " + self.nam fo.write(s + "\n") fo.write("=" * len(s) + "\n") fo.write("\n") for i in self.doc_str: fo.write(i + "\n") for i in self.methods: i.doc_dump(fo) ####################################################################### class Arg(object): def __init__(self, typ, nam=None, det=None): self.nam = nam self.typ = typ self.det = det self.val = None def __repr__(self): return "" % (self.nam, self.typ, str(self.det)) def c_strspec(self): if self.det == None: s = self.typ + "\\0" else: s = self.det if self.nam != None: s += '"\n\t\t "\\1' + self.nam + '\\0' if self.val != None: # The space before the value is important to # terminate the \2 escape sequence s += '"\n\t\t\t"\\2 ' + quote(self.val) + "\\0" return s ####################################################################### # # def parse_enum2(tl): t = tl.get_token() if t.str != "{": raise ParseError("expected \"{\"") s = "ENUM\\0" t = None while True: if t == None: t = tl.get_token() if t.str == "}": break s += t.str + "\\0" t = tl.get_token() if t.str == ",": t = None elif t.str == "}": break else: raise ParseError( "Expected \"}\" or \",\" not \"%s\"" % t.str) s += "\\0" return Arg("ENUM", det=s) def parse_arg(tl, al): t = tl.get_token() assert t != None if t.str == ")": return t if t.str == "ENUM": al.append(parse_enum2(tl)) elif t.str in ctypes: al.append(Arg(t.str)) else: raise Exception("ARG? %s", t.str) t = tl.get_token() if t.str == "," or t.str == ")": return t if not is_c_name(t.str): raise ParseError( 'Expected ")", "," or argument name, not "%s"' % t.str) al[-1].nam = t.str t = tl.get_token() if t.str == "," or t.str == ")": return t if t.str != "=": raise ParseError( 'Expected ")", "," or "=", not "%s"' % t.str) t = tl.get_token() al[-1].val = t.str t = tl.get_token() return t ####################################################################### # # def parse_module(tl): nm = tl.get_token().str sec = tl.get_token().str s = "" while len(tl.tl) > 0: s += " " + tl.get_token().str dnm = s[1:] return Vmod(nm, dnm, sec) ####################################################################### # # def parse_func(tl, rt_type=None, pobj=None): al = list() if rt_type == None: t = tl.get_token() rt_type = t.str if rt_type not in ctypes: raise TypeError( "Return type '%s' not a valid type" % rt_type) t = tl.get_token() fname = t.str if pobj != None and fname[0] == "." and is_c_name(fname[1:]): fname = pobj + fname elif not is_c_name(fname): raise ParseError("Function name '%s' is illegal", fname) t = tl.get_token() if t.str != "(": raise ParseError("Expected \"(\" got \"%s\"", t.str) while True: t = parse_arg(tl, al) if t.str == ")": break if t.str != ",": raise ParseError("End Of Input looking for ')' or ','") f = Func(fname, rt_type, al) return f ####################################################################### # # def parse_obj(tl): f = parse_func(tl, "VOID") o = Obj(f.nam) o.set_init(f) return o ####################################################################### # A section of the inputvcc, starting at a keyword class FileSection(object): def __init__(self): self.l = [] self.tl = [] def add_line(self, ln, l): self.l.append((ln, l)) def get_token(self): while True: if len(self.tl) > 0: # print("T\t", self.tl[0]) return self.tl.pop(0) if len(self.l) == 0: break self.more_tokens() return None def more_tokens(self): ln, l = self.l.pop(0) if l == "": return l = re.sub("[ \t]*#.*$", "", l) l = re.sub("[ \t]*\n", "", l) if re.match("['\"]", l): m = re.match("(['\"]).*?(\\1)", l) if not m: raise FormatError("Unbalanced quote", "Unbalanced quote on line %d" % ln) self.tl.append(Token(ln, 0, l[:m.end()])) self.l.insert(0, (ln, l[m.end():])) return m = re.search("['\"]", l) if m: rest = l[m.start():] self.l.insert(0, (ln, rest)) l = l[:m.start()] l = re.sub("([(){},=])", r' \1 ', l) if l == "": return for j in l.split(): self.tl.append(Token(ln, 0, j)) def parse(self, vx): t = self.get_token() if t == None: return t0 = t.str if t.str == "$Module": o = parse_module(self) vx.append(o) elif t.str == "$Event": x = self.get_token() vx[0].set_event(x.str) o = None elif t.str == "$Function": if len(vx) == 2: vx.pop(-1) o = parse_func(self) vx[0].add_func(o) elif t.str == "$Object": if len(vx) == 2: vx.pop(-1) o = parse_obj(self) vx[0].add_obj(o) vx.append(o) elif t.str == "$Method": if len(vx) != 2: raise FormatError("$Method outside $Object", "") o = parse_func(self, pobj=vx[1].nam) vx[1].add_method(o) else: raise FormatError("Unknown keyword: %s" % t.str, "") assert len(self.tl) == 0 if o is None and len(self.l) > 0: m = "%s description is not included in .rst" % t0 details = pformat(self.l) if opts.strict: raise FormatError(m, details) else: print("WARNING: %s:" % m, file=sys.stderr) print(details, file=sys.stderr) else: for ln, i in self.l: o.doc(i) ####################################################################### # Polish the copyright message # def polish(l): if len(l[0]) == 0: l.pop(0) return True c = l[0][0] for i in l: if len(i) == 0: continue if i[0] != c: c = None break if c != None: for i in range(len(l)): l[i] = l[i][1:] return True return False class SimpleTestCase(unittest.TestCase): def test_included_vccs(self): from tempfile import mktemp from glob import glob tmpfile = mktemp() bdir = dirname(realpath(__file__)) for inputfile in glob(bdir + "/../libvmod_*/vmod.vcc"): runmain(inputfile, outputname=tmpfile) for suffix in [".c", ".h"]: unlink(tmpfile + suffix) ####################################################################### def runmain(inputvcc, outputname="vcc_if"): # Read the file in lines = [] with open(inputvcc, "r") as fp: for i in fp: lines.append(i.rstrip()) ln = 0 ####################################################################### # First collect the copyright: All initial lines starting with '#' copy_right = [] while len(lines[0]) > 0 and lines[0][0] == "#": ln += 1 copy_right.append(lines.pop(0)) if len(copy_right) > 0: if copy_right[0] == "#-": copy_right = [] else: while polish(copy_right): continue if False: for i in copy_right: print("(C)\t", i) ####################################################################### # Break into sections sl = [] sc = FileSection() sl.append(sc) while len(lines) > 0: ln += 1 l = lines.pop(0) j = l.split() if len(j) > 0 and re.match("^\$", j[0]): sc = FileSection() sl.append(sc) sc.add_line(ln, l) ####################################################################### # Parse each section try: vx = [] for i in sl: i.parse(vx) assert len(i.tl) == 0 except ParseError as e: print("ERROR: Parse error reading \"%s\":" % inputvcc) pprint(str(e)) exit(-1) except FormatError as e: print("ERROR: Format error reading \"%s\": %s" % (inputvcc, pformat(e.msg))) print(e.details) exit(-2) ####################################################################### # Parsing done, now process # fc = open("%s.c" % outputname, "w") fh = open("%s.h" % outputname, "w") write_c_file_warning(fc) write_c_file_warning(fh) fh.write('struct vmod_priv;\n\n') fh.write('extern const struct vmod_data Vmod_%s_Data;\n\n' % vx[0].nam) vx[0].c_proto(fh) fc.write('#include "config.h"\n') fc.write('#include "vcl.h"\n') fc.write('#include "vrt.h"\n') fc.write('#include "vcc_if.h"\n') fc.write('#include "vmod_abi.h"\n') fc.write('\n') vx[0].c_typedefs(fc) vx[0].c_vmod(fc) fc.close() fh.close() for suf in ("", ".man"): fp = open("vmod_%s%s.rst" % (vx[0].nam, suf), "w") write_rst_file_warning(fp) vx[0].doc_dump(fp, suf) if len(copy_right) > 0: fp.write("\n") fp.write("COPYRIGHT\n") fp.write("=========\n") fp.write("\n::\n\n") for i in copy_right: fp.write(" %s\n" % i) fp.write("\n") if __name__ == "__main__": usagetext = "Usage: %prog [options] " oparser = optparse.OptionParser(usage=usagetext) oparser.add_option('-N', '--strict', action='store_true', default=False, help="Be strict when parsing input file. (vmod.vcc)") oparser.add_option('', '--runtests', action='store_true', default=False, dest="runtests", help=optparse.SUPPRESS_HELP) (opts, args) = oparser.parse_args() if opts.runtests: # Pop off --runtests, pass remaining to unittest. del sys.argv[1] unittest.main() exit() i_vcc = None if len(args) == 1 and exists(args[0]): i_vcc = args[0] elif exists("vmod.vcc"): if not i_vcc: i_vcc = "vmod.vcc" else: print("ERROR: No vmod.vcc file supplied or found.", file=sys.stderr) oparser.print_help() exit(-1) runmain(i_vcc) varnish-4.1.1/lib/libvcc/vcc_var.c0000644000201500234410000000754612652366721013731 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. */ #include "config.h" #include #include #include "vcc_compile.h" #include "vct.h" /*--------------------------------------------------------------------*/ struct symbol * vcc_Var_Wildcard(struct vcc *tl, const struct token *t, const struct symbol *wc) { struct symbol *sym; struct var *v; const struct var *vh; unsigned u; const char *p, *leaf; struct vsb *vsb; vh = wc->var; assert(vh->fmt == HEADER); v = TlAlloc(tl, sizeof *v); AN(v); v->name = TlDupTok(tl, t); v->r_methods = vh->r_methods; v->w_methods = vh->w_methods; v->fmt = vh->fmt; leaf = v->name + vh->len; /* Create a C-name version of the header name */ vsb = VSB_new_auto(); AN(vsb); VSB_printf(vsb, "&VGC_%s_", vh->rname); for (p = leaf, u = 1; *p != '\0'; p++, u++) if (vct_isalpha(*p) || vct_isdigit(*p)) VSB_putc(vsb, *p); else VSB_printf(vsb, "_%02x_", *p); AZ(VSB_finish(vsb)); /* Create the static identifier */ Fh(tl, 0, "static const struct gethdr_s %s =\n", VSB_data(vsb) + 1); Fh(tl, 0, " { %s, \"\\%03o%s:\"};\n", vh->rname, u, leaf); /* Create the symbol r/l values */ v->rname = TlDup(tl, VSB_data(vsb)); VSB_clear(vsb); VSB_printf(vsb, "VRT_SetHdr(ctx, %s,", v->rname); AZ(VSB_finish(vsb)); v->lname = TlDup(tl, VSB_data(vsb)); VSB_delete(vsb); sym = VCC_AddSymbolTok(tl, t, SYM_VAR); AN(sym); sym->var = v; sym->fmt = v->fmt; sym->eval = vcc_Eval_Var; sym->r_methods = v->r_methods; return (sym); } /*--------------------------------------------------------------------*/ const struct var * vcc_FindVar(struct vcc *tl, const struct token *t, int wr_access, const char *use) { const struct var *v; const struct symbol *sym; AN(tl->vars); sym = VCC_FindSymbol(tl, t, SYM_VAR); if (sym != NULL) { v = sym->var; AN(v); if (wr_access && v->w_methods == 0) { VSB_printf(tl->sb, "Variable "); vcc_ErrToken(tl, t); VSB_printf(tl->sb, " is read only."); VSB_cat(tl->sb, "\nAt: "); vcc_ErrWhere(tl, t); return (NULL); } else if (wr_access) { vcc_AddUses(tl, t, v->w_methods, use); } else if (v->r_methods == 0) { VSB_printf(tl->sb, "Variable "); vcc_ErrToken(tl, t); VSB_printf(tl->sb, " is write only."); VSB_cat(tl->sb, "\nAt: "); vcc_ErrWhere(tl, t); return (NULL); } else { vcc_AddUses(tl, t, v->r_methods, use); } return (v); } VSB_printf(tl->sb, "Unknown variable "); vcc_ErrToken(tl, t); VSB_cat(tl->sb, "\nAt: "); vcc_ErrWhere(tl, t); return (NULL); } varnish-4.1.1/lib/libvcc/vcc_compile.c0000644000201500234410000005335712652366721014572 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * XXX: * Better error messages, throughout. * >It also occurred to me that we could link the errors to the error * >documentation. * > * >Unreferenced function 'request_policy', first mention is * > Line 8 Pos 4 * > sub request_policy { * > ----##############-- * >Read more about this type of error: * >http://varnish/doc/error.html#Unreferenced%20function * > * > * > Unknown variable 'obj.bandwidth' * > At: Line 88 Pos 12 * > if (obj.bandwidth < 1 kb/h) { * > ------------#############------------ * >Read more about this type of error: * >http://varnish/doc/error.html#Unknown%20variable * */ #include "config.h" #include #include #include #include #include #include #include "vcc_compile.h" #include "libvcc.h" #include "vfil.h" struct method method_tab[] = { { "none", 0U, 0}, #define VCL_MET_MAC(l,U,t,b) { "vcl_"#l, b, VCL_MET_##U }, #include "tbl/vcl_returns.h" #undef VCL_MET_MAC { NULL, 0U, 0} }; /*--------------------------------------------------------------------*/ static void TlDoFree(struct vcc *tl, void *p) { struct membit *mb; mb = calloc(sizeof *mb, 1); assert(mb != NULL); mb->ptr = p; VTAILQ_INSERT_TAIL(&tl->membits, mb, list); } void * TlAlloc(struct vcc *tl, unsigned len) { void *p; p = calloc(len, 1); assert(p != NULL); TlDoFree(tl, p); return (p); } char * TlDup(struct vcc *tl, const char *s) { char *p; p = TlAlloc(tl, strlen(s) + 1); AN(p); strcpy(p, s); return (p); } char * TlDupTok(struct vcc *tl, const struct token *tok) { char *p; int i; i = tok->e - tok->b; p = TlAlloc(tl, i + 1); AN(p); memcpy(p, tok->b, i); p[i] = '\0'; return (p); } /*--------------------------------------------------------------------*/ struct inifin * New_IniFin(struct vcc *tl) { struct inifin *p; p = TlAlloc(tl, sizeof *p); AN(p); p->magic = INIFIN_MAGIC; p->ini = VSB_new_auto(); p->fin = VSB_new_auto(); p->event = VSB_new_auto(); p->n = ++tl->ninifin; VTAILQ_INSERT_TAIL(&tl->inifin, p, list); return (p); } /*--------------------------------------------------------------------*/ int IsMethod(const struct token *t) { struct method *m; assert(t->tok == ID); for(m = method_tab; m->name != NULL; m++) { if (vcc_IdIs(t, m->name)) return (m - method_tab); } if ((t->b[0] == 'v'|| t->b[0] == 'V') && (t->b[1] == 'c'|| t->b[1] == 'C') && (t->b[2] == 'l'|| t->b[2] == 'L')) return (-2); return (-1); } /*-------------------------------------------------------------------- * Printf output to the vsbs, possibly indented */ void Fh(const struct vcc *tl, int indent, const char *fmt, ...) { va_list ap; if (indent) VSB_printf(tl->fh, "%*.*s", tl->hindent, tl->hindent, ""); va_start(ap, fmt); VSB_vprintf(tl->fh, fmt, ap); va_end(ap); } void Fb(const struct vcc *tl, int indent, const char *fmt, ...) { va_list ap; assert(tl->fb != NULL); if (indent) VSB_printf(tl->fb, "%*.*s", tl->indent, tl->indent, ""); va_start(ap, fmt); VSB_vprintf(tl->fb, fmt, ap); va_end(ap); } void Fc(const struct vcc *tl, int indent, const char *fmt, ...) { va_list ap; if (indent) VSB_printf(tl->fc, "%*.*s", tl->indent, tl->indent, ""); va_start(ap, fmt); VSB_vprintf(tl->fc, fmt, ap); va_end(ap); } /*--------------------------------------------------------------------*/ void EncString(struct vsb *sb, const char *b, const char *e, int mode) { if (e == NULL) e = strchr(b, '\0'); VSB_cat(sb, "\""); for (; b < e; b++) { switch (*b) { case '?': // Trigraphs case '\\': case '"': VSB_printf(sb, "\\%c", *b); break; case '\n': VSB_printf(sb, "\\n"); if (mode) VSB_printf(sb, "\"\n\t\""); break; case '\t': VSB_printf(sb, "\\t"); break; case '\r': VSB_printf(sb, "\\r"); break; case ' ': VSB_printf(sb, " "); break; default: if (isgraph(*b)) VSB_printf(sb, "%c", *b); else VSB_printf(sb, "\\%03o", (uint8_t)*b); break; } } VSB_cat(sb, "\""); } void EncToken(struct vsb *sb, const struct token *t) { assert(t->tok == CSTR); EncString(sb, t->dec, NULL, 1); } /*-------------------------------------------------------------------- * Output the location/profiling table. For each counted token, we * record source+line+charpos for the first character in the token. */ static void EmitCoordinates(const struct vcc *tl, struct vsb *vsb) { struct token *t; unsigned lin, pos; struct source *sp; const char *p; VSB_printf(vsb, "/* ---===### Source Code ###===---*/\n"); VSB_printf(vsb, "\n#define VGC_NSRCS %u\n", tl->nsources); VSB_printf(vsb, "\nstatic const char *srcname[VGC_NSRCS] = {\n"); VTAILQ_FOREACH(sp, &tl->sources, list) { VSB_printf(vsb, "\t"); EncString(vsb, sp->name, NULL, 0); VSB_printf(vsb, ",\n"); } VSB_printf(vsb, "};\n"); VSB_printf(vsb, "\nstatic const char *srcbody[%u] = {\n", tl->nsources); VTAILQ_FOREACH(sp, &tl->sources, list) { VSB_printf(vsb, " /* "); EncString(vsb, sp->name, NULL, 0); VSB_printf(vsb, "*/\n"); VSB_printf(vsb, "\t"); EncString(vsb, sp->b, sp->e, 1); VSB_printf(vsb, ",\n"); } VSB_printf(vsb, "};\n\n"); VSB_printf(vsb, "/* ---===### Location Counters ###===---*/\n"); VSB_printf(vsb, "\n#define VGC_NREFS %u\n", tl->cnt + 1); VSB_printf(vsb, "\nstatic struct vrt_ref VGC_ref[VGC_NREFS] = {\n"); lin = 1; pos = 0; sp = 0; p = NULL; VTAILQ_FOREACH(t, &tl->tokens, list) { if (t->cnt == 0) continue; assert(t->src != NULL); if (t->src != sp) { lin = 1; pos = 0; sp = t->src; p = sp->b; } assert(sp != NULL); assert(p != NULL); for (;p < t->b; p++) { if (*p == '\n') { lin++; pos = 0; } else if (*p == '\t') { pos &= ~7; pos += 8; } else pos++; } VSB_printf(vsb, " [%3u] = { %u, %8tu, %4u, %3u, ", t->cnt, sp->idx, t->b - sp->b, lin, pos + 1); if (t->tok == CSRC) VSB_printf(vsb, " \"C{\"},\n"); else VSB_printf(vsb, " \"%.*s\" },\n", PF(t)); } VSB_printf(vsb, "};\n\n"); } /*-------------------------------------------------------------------- * Init/Fini/Event * * We call DISCARD and COLD events in the opposite order of LOAD and * WARM. The child will panic if a USE event fails, since a WARM event * leads to a usable state. */ static void EmitInitFini(const struct vcc *tl) { struct inifin *p; unsigned has_event = 0; Fh(tl, 0, "\n"); Fh(tl, 0, "static unsigned vgc_inistep;\n"); Fh(tl, 0, "static unsigned vgc_warmupstep;\n"); /* * LOAD */ Fc(tl, 0, "\nstatic int\nVGC_Load(VRT_CTX)\n{\n\n"); Fc(tl, 0, "\tvgc_inistep = 0;\n\n"); VTAILQ_FOREACH(p, &tl->inifin, list) { AZ(VSB_finish(p->ini)); assert(p->n > 0); if (VSB_len(p->ini)) Fc(tl, 0, "\t/* %u */\n%s\n", p->n, VSB_data(p->ini)); Fc(tl, 0, "\tvgc_inistep = %u;\n\n", p->n); VSB_delete(p->ini); AZ(VSB_finish(p->event)); if (VSB_len(p->event)) has_event = 1; } Fc(tl, 0, "\t(void)VGC_function_vcl_init(ctx);\n"); Fc(tl, 0, "\treturn(*ctx->handling == VCL_RET_OK ? 0: -1);\n"); Fc(tl, 0, "}\n"); /* * DISCARD */ Fc(tl, 0, "\nstatic int\nVGC_Discard(VRT_CTX)\n{\n\n"); Fc(tl, 0, "\t(void)VGC_function_vcl_fini(ctx);\n\n"); VTAILQ_FOREACH_REVERSE(p, &tl->inifin, inifinhead, list) { AZ(VSB_finish(p->fin)); if (VSB_len(p->fin)) { Fc(tl, 0, "\t/* %u */\n", p->n); Fc(tl, 0, "\tif (vgc_inistep >= %u) {\n", p->n); Fc(tl, 0, "%s\n", VSB_data(p->fin)); Fc(tl, 0, "\t}\n\n"); } VSB_delete(p->fin); } Fc(tl, 0, "\treturn(0);\n"); Fc(tl, 0, "}\n"); if (has_event) { /* * WARM */ Fc(tl, 0, "\nstatic int\n"); Fc(tl, 0, "VGC_Warmup(VRT_CTX, enum vcl_event_e ev)\n{\n\n"); Fc(tl, 0, "\tvgc_warmupstep = 0;\n\n"); VTAILQ_FOREACH(p, &tl->inifin, list) { assert(p->n > 0); if (VSB_len(p->event)) { Fc(tl, 0, "\t/* %u */\n", p->n); Fc(tl, 0, "\tif (%s)\n", VSB_data(p->event)); Fc(tl, 0, "\t\treturn (1);\n"); Fc(tl, 0, "\tvgc_warmupstep = %u;\n\n", p->n); } } Fc(tl, 0, "\treturn (0);\n"); Fc(tl, 0, "}\n"); /* * USE (deprecated) */ Fc(tl, 0, "\nstatic int\n"); Fc(tl, 0, "VGC_Use(VRT_CTX, enum vcl_event_e ev)\n{\n\n"); VTAILQ_FOREACH(p, &tl->inifin, list) { assert(p->n > 0); if (VSB_len(p->event)) { Fc(tl, 0, "\t/* %u */\n", p->n); Fc(tl, 0, "\tif (%s)\n", VSB_data(p->event)); Fc(tl, 0, "\t\treturn (1);\n\n"); } } Fc(tl, 0, "\treturn (0);\n"); Fc(tl, 0, "}\n"); /* * COLD */ Fc(tl, 0, "\nstatic int\n"); Fc(tl, 0, "VGC_Cooldown(VRT_CTX, enum vcl_event_e ev)\n{\n"); Fc(tl, 0, "\tint retval = 0;\n\n"); VTAILQ_FOREACH_REVERSE(p, &tl->inifin, inifinhead, list) { if (VSB_len(p->event)) { Fc(tl, 0, "\t/* %u */\n", p->n); Fc(tl, 0, "\tif (vgc_warmupstep >= %u &&\n", p->n); Fc(tl, 0, "\t %s != 0)\n", VSB_data(p->event)); Fc(tl, 0, "\t\tretval = 1;\n\n"); } VSB_delete(p->event); } Fc(tl, 0, "\treturn (retval);\n"); Fc(tl, 0, "}\n"); } /* * EVENTS */ Fc(tl, 0, "\nstatic int\n"); Fc(tl, 0, "VGC_Event(VRT_CTX, enum vcl_event_e ev)\n"); Fc(tl, 0, "{\n"); Fc(tl, 0, "\tif (ev == VCL_EVENT_LOAD)\n"); Fc(tl, 0, "\t\treturn(VGC_Load(ctx));\n"); if (has_event) { Fc(tl, 0, "\tif (ev == VCL_EVENT_WARM)\n"); Fc(tl, 0, "\t\treturn(VGC_Warmup(ctx, ev));\n"); Fc(tl, 0, "\tif (ev == VCL_EVENT_USE)\n"); Fc(tl, 0, "\t\treturn(VGC_Use(ctx, ev));\n"); Fc(tl, 0, "\tif (ev == VCL_EVENT_COLD)\n"); Fc(tl, 0, "\t\treturn(VGC_Cooldown(ctx, ev));\n"); } Fc(tl, 0, "\tif (ev == VCL_EVENT_DISCARD)\n"); Fc(tl, 0, "\t\treturn(VGC_Discard(ctx));\n"); Fc(tl, 0, "\n"); if (!has_event) Fc(tl, 0, "\t(void)vgc_warmupstep;\n"); Fc(tl, 0, "\treturn (%d);\n", has_event ? 1 : 0); Fc(tl, 0, "}\n"); } /*--------------------------------------------------------------------*/ static void EmitStruct(const struct vcc *tl) { Fc(tl, 0, "\nconst struct VCL_conf VCL_conf = {\n"); Fc(tl, 0, "\t.magic = VCL_CONF_MAGIC,\n"); Fc(tl, 0, "\t.event_vcl = VGC_Event,\n"); Fc(tl, 0, "\t.default_director = &%s,\n", tl->default_director); if (tl->default_probe != NULL) Fc(tl, 0, "\t.default_probe = &%s,\n", tl->default_probe); Fc(tl, 0, "\t.ref = VGC_ref,\n"); Fc(tl, 0, "\t.nref = VGC_NREFS,\n"); Fc(tl, 0, "\t.nsrc = VGC_NSRCS,\n"); Fc(tl, 0, "\t.srcname = srcname,\n"); Fc(tl, 0, "\t.srcbody = srcbody,\n"); #define VCL_MET_MAC(l,u,t,b) \ Fc(tl, 0, "\t." #l "_func = VGC_function_vcl_" #l ",\n"); #include "tbl/vcl_returns.h" #undef VCL_MET_MAC Fc(tl, 0, "};\n"); } /*--------------------------------------------------------------------*/ static struct source * vcc_new_source(const char *b, const char *e, const char *name) { struct source *sp; if (e == NULL) e = strchr(b, '\0'); sp = calloc(sizeof *sp, 1); assert(sp != NULL); sp->name = strdup(name); AN(sp->name); sp->b = b; sp->e = e; return (sp); } static void vcc_destroy_source(struct source *sp) { if (sp->freeit != NULL) free(sp->freeit); free(sp->name); free(sp); } /*--------------------------------------------------------------------*/ static struct source * vcc_file_source(const struct vcp * const vcp, struct vsb *sb, const char *fn) { char *f, *fnp; struct source *sp; if (!vcp->unsafe_path && strchr(fn, '/') != NULL) { VSB_printf(sb, "VCL filename '%s' is unsafe.\n", fn); return (NULL); } f = NULL; if (VFIL_searchpath(vcp->vcl_path, NULL, &f, fn, &fnp) || f == NULL) { VSB_printf(sb, "Cannot read file '%s' (%s)\n", fnp != NULL ? fnp : fn, strerror(errno)); return (NULL); } sp = vcc_new_source(f, NULL, fnp); free(fnp); sp->freeit = f; return (sp); } /*--------------------------------------------------------------------*/ static void vcc_resolve_includes(struct vcc *tl) { struct token *t, *t1, *t2; struct source *sp; struct vsb *vsb; const char *p; VTAILQ_FOREACH(t, &tl->tokens, list) { if (t->tok != ID || !vcc_IdIs(t, "include")) continue; t1 = VTAILQ_NEXT(t, list); assert(t1 != NULL); /* There's always an EOI */ if (t1->tok != CSTR) { VSB_printf(tl->sb, "include not followed by string constant.\n"); vcc_ErrWhere(tl, t1); return; } t2 = VTAILQ_NEXT(t1, list); assert(t2 != NULL); /* There's always an EOI */ if (t2->tok != ';') { VSB_printf(tl->sb, "include not followed by semicolon.\n"); vcc_ErrWhere(tl, t1); return; } if (t1->dec[0] == '.' && t1->dec[1] == '/') { /* * Nested include filenames, starting with "./" are * resolved relative to the VCL file which contains * the include directive. */ if (t1->src->name[0] != '/') { VSB_printf(tl->sb, "include \"./xxxxx\"; needs absolute " "filename of including file.\n"); vcc_ErrWhere(tl, t1); return; } vsb = VSB_new_auto(); AN(vsb); p = strrchr(t1->src->name, '/'); AN(p); VSB_bcat(vsb, t1->src->name, p - t1->src->name); VSB_cat(vsb, t1->dec + 1); AZ(VSB_finish(vsb)); sp = vcc_file_source(tl->param, tl->sb, VSB_data(vsb)); VSB_delete(vsb); } else { sp = vcc_file_source(tl->param, tl->sb, t1->dec); } if (sp == NULL) { vcc_ErrWhere(tl, t1); return; } VTAILQ_INSERT_TAIL(&tl->sources, sp, list); sp->idx = tl->nsources++; tl->t = t2; vcc_Lexer(tl, sp); VTAILQ_REMOVE(&tl->tokens, t, list); VTAILQ_REMOVE(&tl->tokens, t1, list); VTAILQ_REMOVE(&tl->tokens, t2, list); if (!tl->err) vcc_resolve_includes(tl); return; } } /*--------------------------------------------------------------------*/ static struct vcc * vcc_NewVcc(const struct vcp *vcp) { struct vcc *tl; int i; CHECK_OBJ_NOTNULL(vcp, VCP_MAGIC); ALLOC_OBJ(tl, VCC_MAGIC); AN(tl); tl->param = vcp; tl->vars = vcc_vars; VTAILQ_INIT(&tl->symbols); VTAILQ_INIT(&tl->inifin); VTAILQ_INIT(&tl->membits); VTAILQ_INIT(&tl->tokens); VTAILQ_INIT(&tl->sources); tl->nsources = 0; /* General C code */ tl->fc = VSB_new_auto(); assert(tl->fc != NULL); /* Forward decls (.h like) */ tl->fh = VSB_new_auto(); assert(tl->fh != NULL); /* body code of methods */ for (i = 0; i < VCL_MET_MAX; i++) { tl->fm[i] = VSB_new_auto(); assert(tl->fm[i] != NULL); } return (tl); } /*--------------------------------------------------------------------*/ static char * vcc_DestroyTokenList(struct vcc *tl, char *ret) { struct membit *mb; struct source *sp; struct symbol *sym; int i; while (!VTAILQ_EMPTY(&tl->membits)) { mb = VTAILQ_FIRST(&tl->membits); VTAILQ_REMOVE(&tl->membits, mb, list); free(mb->ptr); free(mb); } while (!VTAILQ_EMPTY(&tl->sources)) { sp = VTAILQ_FIRST(&tl->sources); VTAILQ_REMOVE(&tl->sources, sp, list); vcc_destroy_source(sp); } while (!VTAILQ_EMPTY(&tl->symbols)) { sym = VTAILQ_FIRST(&tl->symbols); VTAILQ_REMOVE(&tl->symbols, sym, list); FREE_OBJ(sym); } VSB_delete(tl->fh); VSB_delete(tl->fc); for (i = 0; i < VCL_MET_MAX; i++) VSB_delete(tl->fm[i]); free(tl); return (ret); } /*-------------------------------------------------------------------- * Compile the VCL code from the given source and return the C-source */ static char * vcc_CompileSource(const struct vcp * const vcp, struct vsb *sb, struct source *sp) { struct vcc *tl; struct symbol *sym; const struct var *v; struct vsb *vsb; char *of; int i; tl = vcc_NewVcc(vcp); tl->sb = sb; vcc_Expr_Init(tl); for (v = tl->vars; v->name != NULL; v++) { if (v->fmt == HEADER) { sym = VCC_AddSymbolStr(tl, v->name, SYM_WILDCARD); sym->wildcard = vcc_Var_Wildcard; } else { sym = VCC_AddSymbolStr(tl, v->name, SYM_VAR); } sym->var = v; sym->fmt = v->fmt; sym->eval = vcc_Eval_Var; sym->r_methods = v->r_methods; } sym = VCC_AddSymbolStr(tl, "storage.", SYM_WILDCARD); sym->wildcard = vcc_Stv_Wildcard; Fh(tl, 0, "/* ---===### VCC generated .h code ###===---*/\n"); Fc(tl, 0, "\n/* ---===### VCC generated .c code ###===---*/\n"); Fh(tl, 0, "\nextern const struct VCL_conf VCL_conf;\n"); /* Register and lex the main source */ VTAILQ_INSERT_TAIL(&tl->sources, sp, list); sp->idx = tl->nsources++; vcc_Lexer(tl, sp); if (tl->err) return (vcc_DestroyTokenList(tl, NULL)); /* Register and lex the builtin VCL */ sp = vcc_new_source(tl->param->builtin_vcl, NULL, "Builtin"); assert(sp != NULL); VTAILQ_INSERT_TAIL(&tl->sources, sp, list); sp->idx = tl->nsources++; vcc_Lexer(tl, sp); if (tl->err) return (vcc_DestroyTokenList(tl, NULL)); /* Add "END OF INPUT" token */ vcc_AddToken(tl, EOI, sp->e, sp->e); if (tl->err) return (vcc_DestroyTokenList(tl, NULL)); /* Expand and lex any includes in the token string */ vcc_resolve_includes(tl); if (tl->err) return (vcc_DestroyTokenList(tl, NULL)); /* Parse the token string */ tl->t = VTAILQ_FIRST(&tl->tokens); vcc_Parse(tl); if (tl->err) return (vcc_DestroyTokenList(tl, NULL)); /* Check if we have any backends at all */ if (tl->default_director == NULL) { VSB_printf(tl->sb, "No backends or directors found in VCL program, " "at least one is necessary.\n"); tl->err = 1; return (vcc_DestroyTokenList(tl, NULL)); } /* Configure the default director */ vcc_AddRef(tl, tl->t_default_director, SYM_BACKEND); /* Check for orphans */ if (vcc_CheckReferences(tl)) return (vcc_DestroyTokenList(tl, NULL)); /* Check that all action returns are legal */ if (vcc_CheckAction(tl) || tl->err) return (vcc_DestroyTokenList(tl, NULL)); /* Check that all variable uses are legal */ if (vcc_CheckUses(tl) || tl->err) return (vcc_DestroyTokenList(tl, NULL)); /* Emit method functions */ Fh(tl, 1, "\n"); for (i = 1; i < VCL_MET_MAX; i++) { Fh(tl, 1, "int __match_proto__(vcl_func_f) " "VGC_function_%s(VRT_CTX);\n", method_tab[i].name); Fc(tl, 1, "\nint __match_proto__(vcl_func_f)\n"); Fc(tl, 1, "VGC_function_%s(VRT_CTX)\n", method_tab[i].name); AZ(VSB_finish(tl->fm[i])); Fc(tl, 1, "{\n"); /* * We want vmods to be able set a FAIL return value * in members called from vcl_init, so set OK up front * and return with whatever was set last. */ if (method_tab[i].bitval == VCL_MET_INIT) Fc(tl, 1, " VRT_handling(ctx, VCL_RET_OK);\n"); Fc(tl, 1, "%s", VSB_data(tl->fm[i])); if (method_tab[i].bitval == VCL_MET_INIT) Fc(tl, 1, " return(1);\n"); Fc(tl, 1, "}\n"); } EmitInitFini(tl); EmitStruct(tl); /* Combine it all */ vsb = VSB_new_auto(); AN(vsb); vcl_output_lang_h(vsb); EmitCoordinates(tl, vsb); AZ(VSB_finish(tl->fh)); VSB_cat(vsb, VSB_data(tl->fh)); AZ(VSB_finish(tl->fc)); VSB_cat(vsb, VSB_data(tl->fc)); AZ(VSB_finish(vsb)); of = strdup(VSB_data(vsb)); AN(of); VSB_delete(vsb); /* done */ return (vcc_DestroyTokenList(tl, of)); } /*-------------------------------------------------------------------- * Compile the VCL code in the argument. Error messages, if any are * formatted into the vsb. */ char * VCC_Compile(const struct vcp *vcp, struct vsb *sb, const char *vclsrc, const char *vclsrcfile) { struct source *sp; char *r; CHECK_OBJ_NOTNULL(vcp, VCP_MAGIC); AN(sb); AN(vclsrcfile); if (vclsrc != NULL) sp = vcc_new_source(vclsrc, NULL, vclsrcfile); else sp = vcc_file_source(vcp, sb, vclsrcfile); if (sp == NULL) return (NULL); r = vcc_CompileSource(vcp, sb, sp); return (r); } /*-------------------------------------------------------------------- * Allocate a compiler instance */ struct vcp * VCP_New(void) { struct vcp *vcp; ALLOC_OBJ(vcp, VCP_MAGIC); AN(vcp); return (vcp); } /*-------------------------------------------------------------------- * Configure builtin VCL source code */ void VCP_Builtin_VCL(struct vcp *vcp, const char *str) { CHECK_OBJ_NOTNULL(vcp, VCP_MAGIC); REPLACE(vcp->builtin_vcl, str); } /*-------------------------------------------------------------------- * Configure default VCL source directory */ void VCP_VCL_dir(struct vcp *vcp, const char *str) { CHECK_OBJ_NOTNULL(vcp, VCP_MAGIC); REPLACE(vcp->vcl_dir, str); VFIL_setpath(&vcp->vcl_path, str); } /*-------------------------------------------------------------------- * Configure default VMOD directory */ void VCP_VMOD_dir(struct vcp *vcp, const char *str) { CHECK_OBJ_NOTNULL(vcp, VCP_MAGIC); REPLACE(vcp->vmod_dir, str); VFIL_setpath(&vcp->vmod_path, str); } /*-------------------------------------------------------------------- * Configure settings */ void VCP_Err_Unref(struct vcp *vcp, unsigned u) { CHECK_OBJ_NOTNULL(vcp, VCP_MAGIC); vcp->err_unref = u; } void VCP_Allow_InlineC(struct vcp *vcp, unsigned u) { CHECK_OBJ_NOTNULL(vcp, VCP_MAGIC); vcp->allow_inline_c = u; } void VCP_Unsafe_Path(struct vcp *vcp, unsigned u) { CHECK_OBJ_NOTNULL(vcp, VCP_MAGIC); vcp->unsafe_path = u; } varnish-4.1.1/lib/libvcc/vcc_parse.c0000644000201500234410000002207412652366721014244 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include "vcc_compile.h" /*--------------------------------------------------------------------*/ static void vcc_Compound(struct vcc *tl); /*--------------------------------------------------------------------*/ #define L(tl, foo) do { \ tl->indent += INDENT; \ foo; \ tl->indent -= INDENT; \ } while (0) #define C(tl, sep) do { \ Fb(tl, 1, "VRT_count(ctx, %u)%s\n", ++tl->cnt, sep); \ tl->t->cnt = tl->cnt; \ } while (0) /*-------------------------------------------------------------------- * SYNTAX: * Conditional: * '(' Cond_0 ')' */ static void vcc_Conditional(struct vcc *tl) { SkipToken(tl, '('); Fb(tl, 0, "(\n"); L(tl, vcc_Expr(tl, BOOL)); ERRCHK(tl); Fb(tl, 1, ")\n"); SkipToken(tl, ')'); } /*-------------------------------------------------------------------- * SYNTAX: * IfStmt: * 'if' Conditional Compound Branch1* Branch2 * Branch1: * 'elseif' Conditional Compound * Branch2: * 'else' Compound * null */ static void vcc_IfStmt(struct vcc *tl) { SkipToken(tl, ID); Fb(tl, 1, "if "); vcc_Conditional(tl); ERRCHK(tl); L(tl, vcc_Compound(tl)); ERRCHK(tl); while (tl->t->tok == ID) { if (vcc_IdIs(tl->t, "else")) { vcc_NextToken(tl); if (tl->t->tok == '{') { Fb(tl, 1, "else\n"); L(tl, vcc_Compound(tl)); ERRCHK(tl); return; } if (tl->t->tok != ID || !vcc_IdIs(tl->t, "if")) { VSB_printf(tl->sb, "'else' must be followed by 'if' or '{'\n"); vcc_ErrWhere(tl, tl->t); return; } Fb(tl, 1, "else if "); vcc_NextToken(tl); vcc_Conditional(tl); ERRCHK(tl); L(tl, vcc_Compound(tl)); ERRCHK(tl); } else if (vcc_IdIs(tl->t, "elseif") || vcc_IdIs(tl->t, "elsif") || vcc_IdIs(tl->t, "elif")) { Fb(tl, 1, "else if "); vcc_NextToken(tl); vcc_Conditional(tl); ERRCHK(tl); L(tl, vcc_Compound(tl)); ERRCHK(tl); } else { break; } } C(tl, ";"); } /*-------------------------------------------------------------------- * SYNTAX: * Compound: * '{' Stmt* '}' * * Stmt: * Compound * IfStmt * CSRC * Id(Action) (XXX) */ static void vcc_Compound(struct vcc *tl) { int i; SkipToken(tl, '{'); Fb(tl, 1, "{\n"); tl->indent += INDENT; C(tl, ";"); while (1) { ERRCHK(tl); switch (tl->t->tok) { case '{': vcc_Compound(tl); break; case '}': vcc_NextToken(tl); tl->indent -= INDENT; Fb(tl, 1, "}\n"); return; case CSRC: if (tl->param->allow_inline_c) { Fb(tl, 1, "%.*s\n", (int) (tl->t->e - (tl->t->b + 2)), tl->t->b + 1); vcc_NextToken(tl); } else { VSB_printf(tl->sb, "Inline-C not allowed\n"); vcc_ErrWhere(tl, tl->t); } break; case EOI: VSB_printf(tl->sb, "End of input while in compound statement\n"); tl->err = 1; return; case ID: if (vcc_IdIs(tl->t, "if")) { vcc_IfStmt(tl); break; } else { i = vcc_ParseAction(tl); ERRCHK(tl); if (i) { SkipToken(tl, ';'); break; } } /* FALLTHROUGH */ default: /* We deliberately do not mention inline C */ VSB_printf(tl->sb, "Expected an action, 'if', '{' or '}'\n"); vcc_ErrWhere(tl, tl->t); return; } } } /*-------------------------------------------------------------------- * SYNTAX: * Function: * 'sub' ID(name) Compound */ static void vcc_ParseFunction(struct vcc *tl) { int m, i; vcc_NextToken(tl); ExpectErr(tl, ID); if (!vcc_isCid(tl->t)) { VSB_printf(tl->sb, "Names of VCL sub's cannot contain '-'\n"); vcc_ErrWhere(tl, tl->t); return; } m = IsMethod(tl->t); if (m == -2) { VSB_printf(tl->sb, "VCL sub's named 'vcl*' are reserved names.\n"); vcc_ErrWhere(tl, tl->t); VSB_printf(tl->sb, "Valid vcl_* methods are:\n"); for (i = 0; method_tab[i].name != NULL; i++) VSB_printf(tl->sb, "\t%s\n", method_tab[i].name); return; } else if (m != -1) { assert(m < VCL_MET_MAX); tl->fb = tl->fm[m]; if (tl->mprocs[m] == NULL) { (void)vcc_AddDef(tl, tl->t, SYM_SUB); vcc_AddRef(tl, tl->t, SYM_SUB); tl->mprocs[m] = vcc_AddProc(tl, tl->t); } tl->curproc = tl->mprocs[m]; Fb(tl, 1, " /* ... from "); vcc_Coord(tl, tl->fb, NULL); Fb(tl, 0, " */\n"); } else { tl->fb = tl->fc; i = vcc_AddDef(tl, tl->t, SYM_SUB); if (i > 1) { VSB_printf(tl->sb, "Function %.*s redefined\n", PF(tl->t)); vcc_ErrWhere(tl, tl->t); return; } tl->curproc = vcc_AddProc(tl, tl->t); Fh(tl, 0, "int VGC_function_%.*s " "(VRT_CTX);\n", PF(tl->t)); Fc(tl, 1, "\nint __match_proto__(vcl_func_t)\n"); Fc(tl, 1, "VGC_function_%.*s(VRT_CTX)\n", PF(tl->t)); } vcc_NextToken(tl); tl->indent += INDENT; Fb(tl, 1, "{\n"); L(tl, vcc_Compound(tl)); if (m == -1) { /* * non-method subroutines must have an explicit non-action * return in case they just fall through the bottom. */ Fb(tl, 1, " return(0);\n"); } Fb(tl, 1, "}\n"); tl->indent -= INDENT; tl->fb = NULL; tl->curproc = NULL; } /*-------------------------------------------------------------------- */ static void vcc_ParseDirector(struct vcc *tl) { VSB_printf(tl->sb, "\ndirectors are now in directors VMOD.\n"); vcc_ErrWhere(tl, tl->t); } /*-------------------------------------------------------------------- * TODO when bumping the vcl version: * #1603 remove return(fetch) from vcl_hit{} */ static void vcc_ParseVcl(struct vcc *tl) { double ver; struct token *tok; assert(vcc_IdIs(tl->t, "vcl")); vcc_NextToken(tl); tok = tl->t; ver = vcc_DoubleVal(tl); ERRCHK(tl); if (ver != 4.0) { // see TODO above VSB_printf(tl->sb, "VCL version %.1f not supported.\n", ver); vcc_ErrWhere(tl, tok); ERRCHK(tl); } ExpectErr(tl, ';'); vcc_NextToken(tl); } /*-------------------------------------------------------------------- * Top level of parser, recognize: * Inline C-code * ACL definitions * Function definitions * Backend definitions * VMOD import directives * VCL version declarations * End of input */ typedef void parse_f(struct vcc *tl); static struct toplev { const char *name; parse_f *func; } toplev[] = { { "acl", vcc_ParseAcl }, { "sub", vcc_ParseFunction }, { "backend", vcc_ParseBackend }, { "director", vcc_ParseDirector }, { "probe", vcc_ParseProbe }, { "import", vcc_ParseImport }, { "vcl", vcc_ParseVcl }, { NULL, NULL } }; void vcc_Parse(struct vcc *tl) { struct toplev *tp; if (tl->t->tok != ID || !vcc_IdIs(tl->t, "vcl")) { VSB_printf(tl->sb, "VCL version declaration missing\n" "Update your VCL to Version 4 syntax, and add\n" "\tvcl 4.0;\n" "on the first line the VCL files.\n" ); vcc_ErrWhere(tl, tl->t); ERRCHK(tl); } vcc_ParseVcl(tl); ERRCHK(tl); while (tl->t->tok != EOI) { ERRCHK(tl); switch (tl->t->tok) { case CSRC: if (tl->param->allow_inline_c) { Fc(tl, 0, "%.*s\n", (int) (tl->t->e - (tl->t->b + 4)), tl->t->b + 2); vcc_NextToken(tl); } else { VSB_printf(tl->sb, "Inline-C not allowed\n"); vcc_ErrWhere(tl, tl->t); } break; case EOI: break; case ID: for (tp = toplev; tp->name != NULL; tp++) { if (!vcc_IdIs(tl->t, tp->name)) continue; tp->func(tl); break; } if (tp->name != NULL) break; /* FALLTHROUGH */ default: /* We deliberately do not mention inline-C */ VSB_printf(tl->sb, "Expected one of\n\t"); for (tp = toplev; tp->name != NULL; tp++) { if (tp[1].name == NULL) VSB_printf(tl->sb, " or "); VSB_printf(tl->sb, "'%s'", tp->name); if (tp[1].name != NULL) VSB_printf(tl->sb, ", "); } VSB_printf(tl->sb, "\nFound: "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t); return; } } } varnish-4.1.1/lib/libvcc/vcc_token.c0000644000201500234410000002613312652366721014252 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. */ #include "config.h" #include #include #include #include #include "vcc_compile.h" /*--------------------------------------------------------------------*/ void vcc_ErrToken(const struct vcc *tl, const struct token *t) { if (t->tok == EOI) VSB_printf(tl->sb, "end of input"); else if (t->tok == CSRC) VSB_printf(tl->sb, "C{ ... }C"); else VSB_printf(tl->sb, "'%.*s'", PF(t)); } void vcc__ErrInternal(struct vcc *tl, const char *func, unsigned line) { VSB_printf(tl->sb, "VCL compiler internal error at %s():%u\n", func, line); tl->err = 1; } /*-------------------------------------------------------------------- * Find start of source-line of token */ static void vcc_iline(const struct token *t, const char **ll, int tail) { const char *p, *b, *x; b = t->src->b; if (ll != NULL) *ll = b; x = tail ? t->e - 1 : t->b; for (p = b; p < x; p++) { if (*p == '\n') { if (ll != NULL) *ll = p + 1; } } } /*-------------------------------------------------------------------- * Find and print src+line+pos of this token */ static void vcc_icoord(struct vsb *vsb, const struct token *t, int tail) { unsigned lin, pos; const char *p, *b, *x; lin = 1; pos = 0; b = t->src->b; x = tail ? t->e - 1 : t->b; for (p = b; p < x; p++) { if (*p == '\n') { lin++; pos = 0; } else if (*p == '\t') { pos &= ~7; pos += 8; } else pos++; } VSB_printf(vsb, "('%s' Line %u Pos %u)", t->src->name, lin, pos + 1); } /*--------------------------------------------------------------------*/ void vcc_Coord(const struct vcc *tl, struct vsb *vsb, const struct token *t) { if (t == NULL) t = tl->t; vcc_icoord(vsb, t, 0); } /*-------------------------------------------------------------------- * Output one line of source code, starting at 'l' and ending at the * first NL or 'le'. */ static void vcc_quoteline(const struct vcc *tl, const char *l, const char *le) { const char *p; unsigned x, y; x = y = 0; for (p = l; p < le && *p != '\n'; p++) { if (*p == '\t') { y &= ~7; y += 8; while (x < y) { VSB_putc(tl->sb, ' '); x++; } } else { x++; y++; VSB_putc(tl->sb, *p); } } VSB_putc(tl->sb, '\n'); } /*-------------------------------------------------------------------- * Output a marker line for a sourceline starting at 'l' and ending at * the first NL or 'le'. Characters between 'b' and 'e' are marked. */ static void vcc_markline(const struct vcc *tl, const char *l, const char *le, const char *b, const char *e) { const char *p; unsigned x, y; char c; x = y = 0; for (p = l; p < le && *p != '\n'; p++) { if (p >= b && p < e) c = '#'; else c = '-'; if (*p == '\t') { y &= ~7; y += 8; } else y++; while (x < y) { VSB_putc(tl->sb, c); x++; } } VSB_putc(tl->sb, '\n'); } /*--------------------------------------------------------------------*/ /* XXX: should take first+last token */ void vcc_ErrWhere2(struct vcc *tl, const struct token *t, const struct token *t2) { const char *l1, *l2, *l3; if (t == NULL) { vcc_ErrWhere(tl, t2); return; } vcc_iline(t, &l1, 0); t2 = VTAILQ_PREV(t2, tokenhead, list); vcc_iline(t2, &l2, 1); if (l1 == l2) { vcc_icoord(tl->sb, t, 0); VSB_cat(tl->sb, " -- "); vcc_icoord(tl->sb, t2, 1); VSB_putc(tl->sb, '\n'); /* Two tokens on same line */ vcc_quoteline(tl, l1, t->src->e); vcc_markline(tl, l1, t->src->e, t->b, t2->e); } else { /* Two tokens different lines */ l3 = strchr(l1, '\n'); AN(l3); /* XXX: t had better be before t2 */ vcc_icoord(tl->sb, t, 0); if (l3 + 1 == l2) { VSB_cat(tl->sb, " -- "); vcc_icoord(tl->sb, t2, 1); } VSB_putc(tl->sb, '\n'); vcc_quoteline(tl, l1, t->src->e); vcc_markline(tl, l1, t->src->e, t->b, t2->e); if (l3 + 1 != l2) { VSB_cat(tl->sb, "[...]\n"); vcc_icoord(tl->sb, t2, 1); VSB_putc(tl->sb, '\n'); } vcc_quoteline(tl, l2, t->src->e); vcc_markline(tl, l2, t->src->e, t->b, t2->e); } VSB_putc(tl->sb, '\n'); tl->err = 1; } void vcc_ErrWhere(struct vcc *tl, const struct token *t) { const char *l1; vcc_iline(t, &l1, 0); vcc_icoord(tl->sb, t, 0); VSB_putc(tl->sb, '\n'); vcc_quoteline(tl, l1, t->src->e); vcc_markline(tl, l1, t->src->e, t->b, t->e); VSB_putc(tl->sb, '\n'); tl->err = 1; } /*--------------------------------------------------------------------*/ void vcc_NextToken(struct vcc *tl) { tl->t = VTAILQ_NEXT(tl->t, list); if (tl->t == NULL) { VSB_printf(tl->sb, "Ran out of input, something is missing or" " maybe unbalanced (...) or {...}\n"); tl->err = 1; return; } } void vcc__Expect(struct vcc *tl, unsigned tok, unsigned line) { if (tl->t->tok == tok) return; VSB_printf(tl->sb, "Expected %s got ", vcl_tnames[tok]); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, "\n(program line %u), at\n", line); vcc_ErrWhere(tl, tl->t); } /*-------------------------------------------------------------------- * Compare ID token to string, return true of match */ int vcc_IdIs(const struct token *t, const char *p) { const char *q; assert(t->tok == ID); for (q = t->b; q < t->e && *p != '\0'; p++, q++) if (*q != *p) return (0); if (q != t->e || *p != '\0') return (0); return (1); } /*-------------------------------------------------------------------- * Check that we have a C-identifier */ int vcc_isCid(const struct token *t) { const char *q; assert(t->tok == ID); for (q = t->b; q < t->e; q++) { if (!isalnum(*q) && *q != '_') return (0); } return (1); } void vcc_ExpectCid(struct vcc *tl) { ExpectErr(tl, ID); ERRCHK(tl); if (vcc_isCid(tl->t)) return; VSB_printf(tl->sb, "Identifier "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " contains illegal characters, use [0-9a-zA-Z_] only.\n"); vcc_ErrWhere(tl, tl->t); } /*-------------------------------------------------------------------- * Decode a string */ static int vcc_decstr(struct vcc *tl) { char *q; unsigned int l; assert(tl->t->tok == CSTR); l = (tl->t->e - tl->t->b) - 2; tl->t->dec = TlAlloc(tl, l + 1); assert(tl->t->dec != NULL); q = tl->t->dec; memcpy(q, tl->t->b + 1, l); q[l] = '\0'; return (0); } /*-------------------------------------------------------------------- * Add a token to the token list. */ void vcc_AddToken(struct vcc *tl, unsigned tok, const char *b, const char *e) { struct token *t; t = TlAlloc(tl, sizeof *t); assert(t != NULL); t->tok = tok; t->b = b; t->e = e; t->src = tl->src; if (tl->t != NULL) VTAILQ_INSERT_AFTER(&tl->tokens, tl->t, t, list); else VTAILQ_INSERT_TAIL(&tl->tokens, t, list); tl->t = t; } /*-------------------------------------------------------------------- * Lexical analysis and token generation */ void vcc_Lexer(struct vcc *tl, struct source *sp) { const char *p, *q; unsigned u; tl->src = sp; for (p = sp->b; p < sp->e; ) { /* Skip any whitespace */ if (isspace(*p)) { p++; continue; } /* Skip '#.*\n' comments */ if (*p == '#') { while (p < sp->e && *p != '\n') p++; continue; } /* Skip C-style comments */ if (*p == '/' && p[1] == '*') { for (q = p + 2; q < sp->e; q++) { if (*q == '/' && q[1] == '*') { VSB_printf(tl->sb, "/* ... */ comment contains /*\n"); vcc_AddToken(tl, EOI, p, p + 2); vcc_ErrWhere(tl, tl->t); vcc_AddToken(tl, EOI, q, q + 2); vcc_ErrWhere(tl, tl->t); return; } if (*q == '*' && q[1] == '/') { p = q + 2; break; } } if (q < sp->e) continue; vcc_AddToken(tl, EOI, p, p + 2); VSB_printf(tl->sb, "Unterminated /* ... */ comment, starting at\n"); vcc_ErrWhere(tl, tl->t); return; } /* Skip C++-style comments */ if (*p == '/' && p[1] == '/') { while (p < sp->e && *p != '\n') p++; continue; } /* Recognize inline C-code */ if (*p == 'C' && p[1] == '{') { for (q = p + 2; q < sp->e; q++) { if (*q == '}' && q[1] == 'C') { vcc_AddToken(tl, CSRC, p, q + 2); break; } } if (q < sp->e) { p = q + 2; continue; } vcc_AddToken(tl, EOI, p, p + 2); VSB_printf(tl->sb, "Unterminated inline C source, starting at\n"); vcc_ErrWhere(tl, tl->t); return; } /* Recognize long-strings */ if (*p == '{' && p[1] == '"') { for (q = p + 2; q < sp->e; q++) { if (*q == '"' && q[1] == '}') { vcc_AddToken(tl, CSTR, p, q + 2); break; } } if (q < sp->e) { p = q + 2; u = tl->t->e - tl->t->b; u -= 4; /* {" ... "} */ tl->t->dec = TlAlloc(tl, u + 1 ); AN(tl->t->dec); memcpy(tl->t->dec, tl->t->b + 2, u); tl->t->dec[u] = '\0'; continue; } vcc_AddToken(tl, EOI, p, p + 2); VSB_printf(tl->sb, "Unterminated long-string, starting at\n"); vcc_ErrWhere(tl, tl->t); return; } /* Match for the fixed tokens (see token.tcl) */ u = vcl_fixed_token(p, &q); if (u != 0) { vcc_AddToken(tl, u, p, q); p = q; continue; } /* Match strings */ if (*p == '"') { for (q = p + 1; q < sp->e; q++) { if (*q == '"') { q++; break; } if (*q == '\r' || *q == '\n') { vcc_AddToken(tl, EOI, p, q); VSB_printf(tl->sb, "Unterminated string at\n"); vcc_ErrWhere(tl, tl->t); return; } } vcc_AddToken(tl, CSTR, p, q); if (vcc_decstr(tl)) return; p = q; continue; } /* Match Identifiers */ if (isident1(*p)) { for (q = p; q < sp->e; q++) if (!isvar(*q)) break; vcc_AddToken(tl, ID, p, q); p = q; continue; } /* Match numbers { [0-9]+ } */ if (isdigit(*p)) { for (q = p; q < sp->e; q++) if (!isdigit(*q)) break; vcc_AddToken(tl, CNUM, p, q); p = q; continue; } vcc_AddToken(tl, EOI, p, p + 1); VSB_printf(tl->sb, "Syntax error at\n"); vcc_ErrWhere(tl, tl->t); return; } } varnish-4.1.1/lib/libvcc/vcc_backend.c0000644000201500234410000003102612652366721014516 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "config.h" #include #include #include "vcc_compile.h" /*-------------------------------------------------------------------- * Struct sockaddr is not really designed to be a compile time * initialized data structure, so we encode it as a byte-string * and put it in an official sockaddr when we load the VCL. */ static void Emit_Sockaddr(struct vcc *tl, const struct token *t_host, const struct token *t_port) { const char *ipv4, *ipv4a, *ipv6, *ipv6a, *pa; char buf[256]; AN(t_host->dec); if (t_port != NULL) bprintf(buf, "%s %s", t_host->dec, t_port->dec); else bprintf(buf, "%s", t_host->dec); Resolve_Sockaddr(tl, buf, "80", &ipv4, &ipv4a, &ipv6, &ipv6a, &pa, 2, t_host, "Backend host"); ERRCHK(tl); if (ipv4 != NULL) { Fb(tl, 0, "\t.ipv4_suckaddr = (const struct suckaddr *)%s,\n", ipv4); Fb(tl, 0, "\t.ipv4_addr = \"%s\",\n", ipv4a); } if (ipv6 != NULL) { Fb(tl, 0, "\t.ipv6_suckaddr = (const struct suckaddr *)%s,\n", ipv6); Fb(tl, 0, "\t.ipv6_addr = \"%s\",\n", ipv6a); } Fb(tl, 0, "\t.port = \"%s\",\n", pa); } /*-------------------------------------------------------------------- * Parse a backend probe specification */ static void vcc_ProbeRedef(struct vcc *tl, struct token **t_did, struct token *t_field) { /* .url and .request are mutually exclusive */ if (*t_did != NULL) { VSB_printf(tl->sb, "Probe request redefinition at:\n"); vcc_ErrWhere(tl, t_field); VSB_printf(tl->sb, "Previous definition:\n"); vcc_ErrWhere(tl, *t_did); return; } *t_did = t_field; } static void vcc_ParseProbeSpec(struct vcc *tl, const struct token *nm, char **name) { struct fld_spec *fs; struct token *t_field; struct token *t_did = NULL, *t_window = NULL, *t_threshold = NULL; struct token *t_initial = NULL; struct vsb *vsb; char *retval; unsigned window, threshold, initial, status; double t; fs = vcc_FldSpec(tl, "?url", "?request", "?expected_response", "?timeout", "?interval", "?window", "?threshold", "?initial", NULL); SkipToken(tl, '{'); vsb = VSB_new_auto(); AN(vsb); if (nm != NULL) VSB_printf(vsb, "vgc_probe_%.*s", PF(nm)); else VSB_printf(vsb, "vgc_probe__%d", tl->nprobe++); AZ(VSB_finish(vsb)); retval = TlDup(tl, VSB_data(vsb)); VSB_delete(vsb); if (name != NULL) *name = retval; window = 0; threshold = 0; initial = 0; status = 0; Fh(tl, 0, "static const struct vrt_backend_probe %s = {\n", retval); Fh(tl, 0, "\t.magic = VRT_BACKEND_PROBE_MAGIC,\n"); while (tl->t->tok != '}') { vcc_IsField(tl, &t_field, fs); ERRCHK(tl); if (vcc_IdIs(t_field, "url")) { vcc_ProbeRedef(tl, &t_did, t_field); ERRCHK(tl); ExpectErr(tl, CSTR); Fh(tl, 0, "\t.url = "); EncToken(tl->fh, tl->t); Fh(tl, 0, ",\n"); vcc_NextToken(tl); } else if (vcc_IdIs(t_field, "request")) { vcc_ProbeRedef(tl, &t_did, t_field); ERRCHK(tl); ExpectErr(tl, CSTR); Fh(tl, 0, "\t.request =\n"); while (tl->t->tok == CSTR) { Fh(tl, 0, "\t\t"); EncToken(tl->fh, tl->t); Fh(tl, 0, " \"\\r\\n\"\n"); vcc_NextToken(tl); } Fh(tl, 0, "\t\t\"\\r\\n\",\n"); } else if (vcc_IdIs(t_field, "timeout")) { Fh(tl, 0, "\t.timeout = "); vcc_Duration(tl, &t); ERRCHK(tl); Fh(tl, 0, "%g,\n", t); } else if (vcc_IdIs(t_field, "interval")) { Fh(tl, 0, "\t.interval = "); vcc_Duration(tl, &t); ERRCHK(tl); Fh(tl, 0, "%g,\n", t); } else if (vcc_IdIs(t_field, "window")) { t_window = tl->t; window = vcc_UintVal(tl); ERRCHK(tl); } else if (vcc_IdIs(t_field, "initial")) { t_initial = tl->t; initial = vcc_UintVal(tl); ERRCHK(tl); } else if (vcc_IdIs(t_field, "expected_response")) { status = vcc_UintVal(tl); if (status < 100 || status > 999) { VSB_printf(tl->sb, "Must specify .expected_response with " "exactly three digits " "(100 <= x <= 999)\n"); vcc_ErrWhere(tl, tl->t); return; } ERRCHK(tl); } else if (vcc_IdIs(t_field, "threshold")) { t_threshold = tl->t; threshold = vcc_UintVal(tl); ERRCHK(tl); } else { vcc_ErrToken(tl, t_field); vcc_ErrWhere(tl, t_field); ErrInternal(tl); return; } SkipToken(tl, ';'); } if (t_threshold != NULL || t_window != NULL) { if (t_threshold == NULL && t_window != NULL) { VSB_printf(tl->sb, "Must specify .threshold with .window\n"); vcc_ErrWhere(tl, t_window); return; } else if (t_threshold != NULL && t_window == NULL) { if (threshold > 64) { VSB_printf(tl->sb, "Threshold must be 64 or less.\n"); vcc_ErrWhere(tl, t_threshold); return; } window = threshold + 1; } else if (window > 64) { AN(t_window); VSB_printf(tl->sb, "Window must be 64 or less.\n"); vcc_ErrWhere(tl, t_window); return; } if (threshold > window ) { VSB_printf(tl->sb, "Threshold can not be greater than window.\n"); AN(t_threshold); vcc_ErrWhere(tl, t_threshold); AN(t_window); vcc_ErrWhere(tl, t_window); } Fh(tl, 0, "\t.window = %u,\n", window); Fh(tl, 0, "\t.threshold = %u,\n", threshold); } if (t_initial != NULL) Fh(tl, 0, "\t.initial = %u,\n", initial); else Fh(tl, 0, "\t.initial = ~0U,\n"); if (status > 0) Fh(tl, 0, "\t.exp_status = %u,\n", status); Fh(tl, 0, "};\n"); SkipToken(tl, '}'); } /*-------------------------------------------------------------------- * Parse and emit a probe definition */ void vcc_ParseProbe(struct vcc *tl) { struct token *t_probe; struct symbol *sym; char *p; vcc_NextToken(tl); /* ID: probe */ vcc_ExpectCid(tl); /* ID: name */ ERRCHK(tl); t_probe = tl->t; vcc_NextToken(tl); sym = VCC_GetSymbolTok(tl, t_probe, SYM_PROBE); AN(sym); if (sym->ndef > 0) { VSB_printf(tl->sb, "Probe %.*s redefined\n", PF(t_probe)); vcc_ErrWhere(tl, t_probe); return; } sym->fmt = PROBE; sym->eval = vcc_Eval_Probe; sym->ndef++; ERRCHK(tl); vcc_ParseProbeSpec(tl, t_probe, &p); if (vcc_IdIs(t_probe, "default")) { vcc_AddRef(tl, t_probe, SYM_PROBE); tl->default_probe = p; } } /*-------------------------------------------------------------------- * Parse and emit a backend host definition * * The struct vrt_backend is emitted to Fh(). */ static void vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname) { struct token *t_field; struct token *t_host = NULL; struct token *t_port = NULL; struct token *t_hosthdr = NULL; struct fld_spec *fs; struct inifin *ifp; struct vsb *vsb; char *p; unsigned u; double t; fs = vcc_FldSpec(tl, "!host", "?port", "?host_header", "?connect_timeout", "?first_byte_timeout", "?between_bytes_timeout", "?probe", "?max_connections", NULL); SkipToken(tl, '{'); vsb = VSB_new_auto(); AN(vsb); tl->fb = vsb; Fb(tl, 0, "\nstatic const struct vrt_backend vgc_dir_priv_%s = {\n", vgcname); Fb(tl, 0, "\t.magic = VRT_BACKEND_MAGIC,\n"); Fb(tl, 0, "\t.vcl_name = \"%.*s", PF(t_be)); Fb(tl, 0, "\",\n"); /* Check for old syntax */ if (tl->t->tok == ID && vcc_IdIs(tl->t, "set")) { VSB_printf(tl->sb, "NB: Backend Syntax has changed:\n" "Remove \"set\" and \"backend\" in front" " of backend fields.\n" ); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " at "); vcc_ErrWhere(tl, tl->t); return; } while (tl->t->tok != '}') { vcc_IsField(tl, &t_field, fs); ERRCHK(tl); if (vcc_IdIs(t_field, "host")) { ExpectErr(tl, CSTR); assert(tl->t->dec != NULL); t_host = tl->t; vcc_NextToken(tl); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "port")) { ExpectErr(tl, CSTR); assert(tl->t->dec != NULL); t_port = tl->t; vcc_NextToken(tl); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "host_header")) { ExpectErr(tl, CSTR); assert(tl->t->dec != NULL); t_hosthdr = tl->t; vcc_NextToken(tl); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "connect_timeout")) { Fb(tl, 0, "\t.connect_timeout = "); vcc_Duration(tl, &t); ERRCHK(tl); Fb(tl, 0, "%g,\n", t); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "first_byte_timeout")) { Fb(tl, 0, "\t.first_byte_timeout = "); vcc_Duration(tl, &t); ERRCHK(tl); Fb(tl, 0, "%g,\n", t); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "between_bytes_timeout")) { Fb(tl, 0, "\t.between_bytes_timeout = "); vcc_Duration(tl, &t); ERRCHK(tl); Fb(tl, 0, "%g,\n", t); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "max_connections")) { u = vcc_UintVal(tl); ERRCHK(tl); SkipToken(tl, ';'); Fb(tl, 0, "\t.max_connections = %u,\n", u); } else if (vcc_IdIs(t_field, "probe") && tl->t->tok == '{') { vcc_ParseProbeSpec(tl, NULL, &p); Fb(tl, 0, "\t.probe = &%s,\n", p); ERRCHK(tl); } else if (vcc_IdIs(t_field, "probe") && tl->t->tok == ID) { Fb(tl, 0, "\t.probe = &vgc_probe_%.*s,\n", PF(tl->t)); vcc_AddRef(tl, tl->t, SYM_PROBE); vcc_NextToken(tl); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "probe")) { VSB_printf(tl->sb, "Expected '{' or name of probe, got "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t); return; } else { ErrInternal(tl); return; } } vcc_FieldsOk(tl, fs); ERRCHK(tl); /* Check that the hostname makes sense */ assert(t_host != NULL); Emit_Sockaddr(tl, t_host, t_port); ERRCHK(tl); ExpectErr(tl, '}'); /* We have parsed it all, emit the ident string */ /* Emit the hosthdr field, fall back to .host if not specified */ Fb(tl, 0, "\t.hosthdr = "); if (t_hosthdr != NULL) EncToken(tl->fb, t_hosthdr); else EncToken(tl->fb, t_host); Fb(tl, 0, ",\n"); /* Close the struct */ Fb(tl, 0, "};\n"); vcc_NextToken(tl); tl->fb = NULL; AZ(VSB_finish(vsb)); Fh(tl, 0, "%s", VSB_data(vsb)); VSB_delete(vsb); ifp = New_IniFin(tl); VSB_printf(ifp->ini, "\t%s =\n\t VRT_new_backend(ctx, &vgc_dir_priv_%s);", vgcname, vgcname); } /*-------------------------------------------------------------------- * Parse directors and backends */ void vcc_ParseBackend(struct vcc *tl) { struct token *t_first, *t_be; struct symbol *sym; char vgcname[MAX_BACKEND_NAME + 20]; t_first = tl->t; vcc_NextToken(tl); /* ID: backend */ vcc_ExpectCid(tl); /* ID: name */ ERRCHK(tl); if (tl->t->e - tl->t->b > MAX_BACKEND_NAME) { VSB_printf(tl->sb, "Name of %.*s too long (max %d, is %zu):\n", PF(t_first), MAX_BACKEND_NAME, (size_t)(tl->t->e - tl->t->b)); vcc_ErrWhere(tl, tl->t); return; } t_be = tl->t; vcc_NextToken(tl); sprintf(vgcname, "vgc_backend_%.*s", PF(t_be)); Fh(tl, 0, "\nstatic struct director *%s;\n", vgcname); sym = VCC_GetSymbolTok(tl, t_be, SYM_BACKEND); AN(sym); if (sym->ndef > 0) { VSB_printf(tl->sb, "Backend %.*s redefined\n", PF(t_be)); vcc_ErrWhere(tl, t_be); return; } sym->fmt = BACKEND; sym->eval = vcc_Eval_Backend; sym->eval_priv = TlDup(tl, vgcname); sym->ndef++; ERRCHK(tl); vcc_ParseHostDef(tl, t_be, vgcname); ERRCHK(tl); if (tl->err) { VSB_printf(tl->sb, "\nIn %.*s specification starting at:\n", PF(t_first)); vcc_ErrWhere(tl, t_first); return; } if (tl->default_director == NULL || vcc_IdIs(t_be, "default")) { tl->default_director = sym->eval_priv; tl->t_default_director = t_be; } } varnish-4.1.1/lib/libvcc/vcc_action.c0000644000201500234410000002470612652366721014413 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This file parses the real action of the VCL code, the procedure * statements which do the actual work. */ #include "config.h" #include #include "vcc_compile.h" /*--------------------------------------------------------------------*/ static void parse_call(struct vcc *tl) { vcc_NextToken(tl); ExpectErr(tl, ID); vcc_AddCall(tl, tl->t); vcc_AddRef(tl, tl->t, SYM_SUB); Fb(tl, 1, "if (VGC_function_%.*s(ctx))\n", PF(tl->t)); Fb(tl, 1, "\treturn (1);\n"); vcc_NextToken(tl); } /*--------------------------------------------------------------------*/ static const struct arith { enum var_type type; unsigned oper; enum var_type want; } arith[] = { { INT, T_INCR, INT }, { INT, T_DECR, INT }, { INT, T_MUL, INT }, { INT, T_DIV, INT }, { INT, '=', INT }, { INT, 0, INT }, { TIME, T_INCR, DURATION }, { TIME, T_DECR, DURATION }, { TIME, T_MUL, REAL }, { TIME, T_DIV, REAL }, { TIME, '=', TIME }, { TIME, 0, TIME }, { DURATION, T_INCR, DURATION }, { DURATION, T_DECR, DURATION }, { DURATION, T_MUL, REAL }, { DURATION, T_DIV, REAL }, { DURATION, '=', DURATION }, { DURATION, 0, DURATION }, { VOID, '=', VOID } }; static void parse_set(struct vcc *tl) { const struct var *vp; const struct arith *ap; enum var_type fmt; vcc_NextToken(tl); ExpectErr(tl, ID); vp = vcc_FindVar(tl, tl->t, 1, "cannot be set"); ERRCHK(tl); assert(vp != NULL); Fb(tl, 1, "%s\n", vp->lname); tl->indent += INDENT; vcc_NextToken(tl); fmt = vp->fmt; for (ap = arith; ap->type != VOID; ap++) { if (ap->type != fmt) continue; if (ap->oper != tl->t->tok) continue; if (ap->oper != '=') Fb(tl, 1, "%s %c ", vp->rname, *tl->t->b); vcc_NextToken(tl); fmt = ap->want; break; } if (ap->type == VOID) SkipToken(tl, ap->oper); if (fmt == HEADER) { vcc_Expr(tl, STRING_LIST); } else if (fmt == STRING) { vcc_Expr(tl, STRING_LIST); } else { vcc_Expr(tl, fmt); } tl->indent -= INDENT; Fb(tl, 1, ");\n"); } /*--------------------------------------------------------------------*/ static void parse_unset(struct vcc *tl) { const struct var *vp; /* XXX: Wrong, should use VCC_Expr(HEADER) */ vcc_NextToken(tl); ExpectErr(tl, ID); vp = vcc_FindVar(tl, tl->t, 1, "cannot be unset"); ERRCHK(tl); assert(vp != NULL); if (vp->fmt != HEADER) { VSB_printf(tl->sb, "Only HTTP header variables can be unset.\n"); vcc_ErrWhere(tl, tl->t); return; } ERRCHK(tl); Fb(tl, 1, "%svrt_magic_string_unset);\n", vp->lname); vcc_NextToken(tl); } /*--------------------------------------------------------------------*/ static void parse_new(struct vcc *tl) { struct symbol *sy1, *sy2, *sy3; struct inifin *ifp; const char *p, *s_obj, *s_init, *s_struct, *s_fini; char buf1[128]; char buf2[128]; vcc_NextToken(tl); ExpectErr(tl, ID); if (!vcc_isCid(tl->t)) { VSB_printf(tl->sb, "Names of VCL objects cannot contain '-'\n"); vcc_ErrWhere(tl, tl->t); return; } sy1 = VCC_FindSymbol(tl, tl->t, SYM_NONE); if (sy1 != NULL) { VSB_printf(tl->sb, "Object name '%.*s' already used.\n", PF(tl->t)); VSB_printf(tl->sb, "First usage:\n"); AN(sy1->def_b); if (sy1->def_e != NULL) vcc_ErrWhere2(tl, sy1->def_b, sy1->def_e); else vcc_ErrWhere(tl, sy1->def_b); VSB_printf(tl->sb, "Redefinition:\n"); vcc_ErrWhere(tl, tl->t); return; } sy1 = VCC_AddSymbolTok(tl, tl->t, SYM_NONE); // XXX: NONE ? XXXAN(sy1); sy1->def_b = tl->t; vcc_NextToken(tl); ExpectErr(tl, '='); vcc_NextToken(tl); ExpectErr(tl, ID); sy2 = VCC_FindSymbol(tl, tl->t, SYM_OBJECT); if (sy2 == NULL) { VSB_printf(tl->sb, "Symbol not found: "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " at "); vcc_ErrWhere(tl, tl->t); return; } XXXAN(sy2); /*lint -save -e448 */ /* Split the first three args */ p = sy2->args; s_obj = p; p += strlen(p) + 1; s_init = p; while (p[0] != '\0' || p[1] != '\0') p++; p += 2; s_struct = p; p += strlen(p) + 1; s_fini = p + strlen(p) + 1; while (p[0] != '\0' || p[1] != '\0') p++; p += 2; Fh(tl, 0, "static %s *vo_%s;\n\n", s_struct, sy1->name); vcc_NextToken(tl); bprintf(buf1, ", &vo_%s, \"%s\"", sy1->name, sy1->name); vcc_Eval_Func(tl, s_init, buf1, sy2->name, s_init + strlen(s_init) + 1); ifp = New_IniFin(tl); VSB_printf(ifp->fin, "\t\t%s(&vo_%s);", s_fini, sy1->name); ExpectErr(tl, ';'); bprintf(buf1, ", vo_%s", sy1->name); /* Split the methods from the args */ while (*p != '\0') { p += strlen(s_obj); bprintf(buf2, "%s%s", sy1->name, p); sy3 = VCC_AddSymbolStr(tl, buf2, SYM_FUNC); AN(sy3); sy3->eval = vcc_Eval_SymFunc; p += strlen(p) + 1; sy3->cfunc = p; p += strlen(p) + 1; /* Functions which return VOID are procedures */ if (!memcmp(p, "VOID\0", 5)) sy3->kind = SYM_PROC; sy3->args = p; sy3->extra = TlDup(tl, buf1); while (p[0] != '\0' || p[1] != '\0') { if (!memcmp(p, "ENUM\0", 5)) { /* XXX: Special case for ENUM that has it's own \0\0 end marker. Not exactly elegant, we should consider alternatives here. Maybe runlength encode the entire block? */ p += strlen(p) + 1; while (p[0] != '\0' || p[1] != '\0') p++; } p++; } p += 2; } sy1->def_e = tl->t; /*lint -restore */ } /*--------------------------------------------------------------------*/ static void parse_ban(struct vcc *tl) { vcc_NextToken(tl); ExpectErr(tl, '('); vcc_NextToken(tl); Fb(tl, 1, "VRT_ban_string(ctx, \n"); tl->indent += INDENT; vcc_Expr(tl, STRING); tl->indent -= INDENT; ERRCHK(tl); Fb(tl, 1, ");\n"); ExpectErr(tl, ')'); vcc_NextToken(tl); } /*--------------------------------------------------------------------*/ static void parse_hash_data(struct vcc *tl) { vcc_NextToken(tl); SkipToken(tl, '('); Fb(tl, 1, "VRT_hashdata(ctx,\n "); vcc_Expr(tl, STRING_LIST); ERRCHK(tl); Fb(tl, 1, ");\n"); SkipToken(tl, ')'); } /*--------------------------------------------------------------------*/ static void parse_return(struct vcc *tl) { int retval = 0; vcc_NextToken(tl); ExpectErr(tl, '('); vcc_NextToken(tl); ExpectErr(tl, ID); /* 'error' gets special handling, to allow optional status/response */ if (vcc_IdIs(tl->t, "synth")) { vcc_NextToken(tl); if (tl->t->tok == ')') { VSB_printf(tl->sb, "Syntax has changed, use:\n" "\treturn(synth(999));\n" "or\n" "\treturn(synth(999, \"Response text\"));\n"); vcc_ErrWhere(tl, tl->t); return; } ExpectErr(tl, '('); vcc_NextToken(tl); Fb(tl, 1, "VRT_synth(ctx,\n"); tl->indent += INDENT; vcc_Expr(tl, INT); ERRCHK(tl); Fb(tl, 1, ",\n"); if (tl->t->tok == ',') { vcc_NextToken(tl); vcc_Expr(tl, STRING); ERRCHK(tl); } else { Fb(tl, 1, "(const char*)0\n"); } tl->indent -= INDENT; ExpectErr(tl, ')'); vcc_NextToken(tl); Fb(tl, 1, ");\n"); Fb(tl, 1, "VRT_handling(ctx, VCL_RET_SYNTH);\n"); Fb(tl, 1, "return (1);\n"); vcc_ProcAction(tl->curproc, VCL_RET_SYNTH, tl->t); ExpectErr(tl, ')'); vcc_NextToken(tl); return; } #define VCL_RET_MAC(l, U, B) \ do { \ if (vcc_IdIs(tl->t, #l)) { \ Fb(tl, 1, "VRT_handling(ctx, VCL_RET_" #U ");\n"); \ Fb(tl, 1, "return (1);\n"); \ vcc_ProcAction(tl->curproc, VCL_RET_##U, tl->t);\ retval = 1; \ } \ } while (0); #include "tbl/vcl_returns.h" #undef VCL_RET_MAC if (!retval) { VSB_printf(tl->sb, "Expected return action name.\n"); vcc_ErrWhere(tl, tl->t); ERRCHK(tl); } vcc_NextToken(tl); ExpectErr(tl, ')'); vcc_NextToken(tl); } /*--------------------------------------------------------------------*/ static void parse_rollback(struct vcc *tl) { vcc_NextToken(tl); Fb(tl, 1, "VRT_Rollback(ctx, VRT_r_req(ctx));\n"); } /*--------------------------------------------------------------------*/ static void parse_synthetic(struct vcc *tl) { vcc_NextToken(tl); ExpectErr(tl, '('); ERRCHK(tl); vcc_NextToken(tl); Fb(tl, 1, "VRT_synth_page(ctx, "); vcc_Expr(tl, STRING_LIST); ERRCHK(tl); Fb(tl, 0, ");\n"); ExpectErr(tl, ')'); vcc_NextToken(tl); ERRCHK(tl); } /*--------------------------------------------------------------------*/ typedef void action_f(struct vcc *tl); static struct action_table { const char *name; action_f *func; unsigned bitmask; } action_table[] = { /* Keep list sorted from here */ { "ban", parse_ban }, { "call", parse_call }, { "hash_data", parse_hash_data, VCL_MET_HASH }, { "new", parse_new, VCL_MET_INIT}, { "return", parse_return }, { "rollback", parse_rollback }, { "set", parse_set }, { "synthetic", parse_synthetic, VCL_MET_SYNTH | VCL_MET_BACKEND_ERROR }, { "unset", parse_unset }, { NULL, NULL } }; int vcc_ParseAction(struct vcc *tl) { struct token *at; struct action_table *atp; const struct symbol *sym; at = tl->t; assert(at->tok == ID); for(atp = action_table; atp->name != NULL; atp++) { if (vcc_IdIs(at, atp->name)) { if (atp->bitmask != 0) vcc_AddUses(tl, at, atp->bitmask, "not a valid action"); atp->func(tl); return (1); } } sym = VCC_FindSymbol(tl, tl->t, SYM_NONE); if (sym != NULL && sym->kind == SYM_PROC) { vcc_Expr_Call(tl, sym); return (1); } return (0); } varnish-4.1.1/lib/libvcc/vcc_backend_util.c0000644000201500234410000000675412652366721015565 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ #include "config.h" #include #include #include #include "vcc_compile.h" /*-------------------------------------------------------------------- * Helper functions to complain about duplicate and missing fields * * XXX: idea: add groups to check for exclusivity, such that * XXX: ("!foo", "?bar", "!{", "this", "that", "}", NULL) * XXX: means exactly one of "this" or "that", and * XXX: ("!foo", "?bar", "?{", "this", "that", "}", NULL) * XXX: means at most one of "this" or "that". */ struct fld_spec { const char *name; struct token *found; }; static void vcc_ResetFldSpec(struct fld_spec *f) { for (; f->name != NULL; f++) f->found = NULL; } struct fld_spec * vcc_FldSpec(struct vcc *tl, const char *first, ...) { struct fld_spec f[100], *r; int n = 0; va_list ap; const char *p; f[n++].name = first; va_start(ap, first); while (1) { p = va_arg(ap, const char *); if (p == NULL) break; f[n++].name = p; assert(n < 100); } va_end(ap); f[n++].name = NULL; vcc_ResetFldSpec(f); r = TlAlloc(tl, sizeof *r * n); memcpy(r, f, n * sizeof *r); return (r); } void vcc_IsField(struct vcc *tl, struct token **t, struct fld_spec *fs) { struct token *t_field; SkipToken(tl, '.'); ExpectErr(tl, ID); t_field = tl->t; *t = t_field; vcc_NextToken(tl); SkipToken(tl, '='); for (; fs->name != NULL; fs++) { if (!vcc_IdIs(t_field, fs->name + 1)) continue; if (fs->found == NULL) { fs->found = t_field; return; } VSB_printf(tl->sb, "Field "); vcc_ErrToken(tl, t_field); VSB_printf(tl->sb, " redefined at:\n"); vcc_ErrWhere(tl, t_field); VSB_printf(tl->sb, "\nFirst defined at:\n"); vcc_ErrWhere(tl, fs->found); return; } VSB_printf(tl->sb, "Unknown field: "); vcc_ErrToken(tl, t_field); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, t_field); } void vcc_FieldsOk(struct vcc *tl, const struct fld_spec *fs) { for (; fs->name != NULL; fs++) { if (*fs->name == '!' && fs->found == NULL) { VSB_printf(tl->sb, "Mandatory field '%s' missing.\n", fs->name + 1); tl->err = 1; } } } varnish-4.1.1/lib/libvmod_debug/0000755000201500234410000000000012652366756013556 500000000000000varnish-4.1.1/lib/libvmod_debug/vmod.vcc0000644000201500234410000000756212652366721015142 00000000000000# # Copyright (c) 2010-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. $Module debug 3 Development, test and debug DESCRIPTION =========== This vmod is used to develop, test and debug the various aspects of VMOD handling in Varnish. $Event event_function $Function VOID panic(STRING_LIST) Don't. $Function STRING author(ENUM { phk, des, kristian, mithrandir } person="phk") Test function for ENUM arguments $Function VOID test_priv_call(PRIV_CALL) Test function for call private pointers $Function VOID test_priv_vcl(PRIV_VCL) Test function for VCL private pointers $Function STRING test_priv_task(PRIV_TASK, STRING) Test function for TASK private pointers $Function STRING test_priv_top(PRIV_TOP, STRING) Test function for TOP private pointers $Function BLOB str2blob(STRING src="foo") Turn a string into a blob $Function STRING blob2hex(BLOB src) Hexdump a blob $Function BACKEND no_backend() Fails at backend selection $Object obj(STRING) Test object .. NOTE: .enum before .foo as part of test r01332.vtc $Method VOID .enum(ENUM { phk, des, kristian, mithrandir, martin }) Testing that enums work as part of object and that the parser isn't (too) buggy. $Method STRING .foo(STRING why) Foo indeed. $Method TIME .date() You never know when you need a date. $Function VOID rot52(HTTP hdr) Encrypt the HTTP header with quad-ROT13 encryption, (this is approx 33% better than triple-DES). $Function STRING argtest(STRING one, REAL two=2, STRING three="3", STRING comma=",") $Function INT vre_limit() $Function VOID register_exp_callback(PRIV_VCL) Register the vmod to receive expiry callbacks $Function VOID init_fail() Function to fail vcl_init{} $Function VOID sleep(DURATION) Sleep the current worker thread. $Object dyn(STRING addr, STRING port) Dynamically create a single-backend director $Method BACKEND .backend() Return the dynamic backend. $Method VOID .refresh(STRING addr, STRING port) Dynamically refresh & (always!) replace the backend by a new one. $Function VOID workspace_allocate(ENUM { client, backend, session, thread }, INT SIZE) Allocate and zero out SIZE bytes from a workspace. $Function BOOL workspace_overflowed(ENUM { client, backend, session, thread }) Return if the workspace overflow mark is set or not. $Function VOID workspace_overflow(ENUM { client, backend, session, thread }) Mark a workspace as overflowed. $Function INT workspace_free(ENUM { client, backend, session, thread }) Find how much unallocated space there is left in a workspace. $Function VOID vcl_release_delay(DURATION) Hold a reference to the VCL when it goes cold for the given delay. varnish-4.1.1/lib/libvmod_debug/Makefile.am0000644000201500234410000000177012652366721015527 00000000000000# AM_LDFLAGS = $(AM_LT_LDFLAGS) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/bin/varnishd \ -I$(top_builddir)/include vmoddir = $(pkglibdir)/vmods vmod_srcdir = $(top_srcdir)/lib/libvmod_debug vmodtool = $(top_srcdir)/lib/libvcc/vmodtool.py vmodtoolargs = --strict noinst_LTLIBRARIES = libvmod_debug.la libvmod_debug_la_LDFLAGS = $(AM_LDFLAGS) -module -export-dynamic -avoid-version -shared -rpath /nowhere libvmod_debug_la_SOURCES = \ vmod_debug.c \ vmod_debug_obj.c \ vmod_debug_dyn.c nodist_libvmod_debug_la_SOURCES = \ vcc_if.c \ vcc_if.h # BUILT_SOURCES is only a hack and dependency tracking does not help for the first build vmod_debug.lo vmod_debug_obj.lo vmod_debug_dyn.lo: vcc_if.h vcc_if.c vcc_if.h vmod_debug.rst vmod_debug.man.rst: $(vmodtool) $(vmod_srcdir)/vmod.vcc @PYTHON@ $(vmodtool) $(vmodtoolargs) $(vmod_srcdir)/vmod.vcc EXTRA_DIST = vmod.vcc CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \ $(builddir)/vmod_debug.rst \ $(builddir)/vmod_debug.man.rst varnish-4.1.1/lib/libvmod_debug/Makefile.in0000644000201500234410000004305112652366727015544 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = lib/libvmod_debug DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libvmod_debug_la_LIBADD = am_libvmod_debug_la_OBJECTS = vmod_debug.lo vmod_debug_obj.lo \ vmod_debug_dyn.lo nodist_libvmod_debug_la_OBJECTS = vcc_if.lo libvmod_debug_la_OBJECTS = $(am_libvmod_debug_la_OBJECTS) \ $(nodist_libvmod_debug_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent libvmod_debug_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libvmod_debug_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libvmod_debug_la_SOURCES) \ $(nodist_libvmod_debug_la_SOURCES) DIST_SOURCES = $(libvmod_debug_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ # AM_LDFLAGS = $(AM_LT_LDFLAGS) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/bin/varnishd \ -I$(top_builddir)/include vmoddir = $(pkglibdir)/vmods vmod_srcdir = $(top_srcdir)/lib/libvmod_debug vmodtool = $(top_srcdir)/lib/libvcc/vmodtool.py vmodtoolargs = --strict noinst_LTLIBRARIES = libvmod_debug.la libvmod_debug_la_LDFLAGS = $(AM_LDFLAGS) -module -export-dynamic -avoid-version -shared -rpath /nowhere libvmod_debug_la_SOURCES = \ vmod_debug.c \ vmod_debug_obj.c \ vmod_debug_dyn.c nodist_libvmod_debug_la_SOURCES = \ vcc_if.c \ vcc_if.h EXTRA_DIST = vmod.vcc CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \ $(builddir)/vmod_debug.rst \ $(builddir)/vmod_debug.man.rst all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/libvmod_debug/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/libvmod_debug/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libvmod_debug.la: $(libvmod_debug_la_OBJECTS) $(libvmod_debug_la_DEPENDENCIES) $(EXTRA_libvmod_debug_la_DEPENDENCIES) $(AM_V_CCLD)$(libvmod_debug_la_LINK) $(libvmod_debug_la_OBJECTS) $(libvmod_debug_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_if.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vmod_debug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vmod_debug_dyn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vmod_debug_obj.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am # BUILT_SOURCES is only a hack and dependency tracking does not help for the first build vmod_debug.lo vmod_debug_obj.lo vmod_debug_dyn.lo: vcc_if.h vcc_if.c vcc_if.h vmod_debug.rst vmod_debug.man.rst: $(vmodtool) $(vmod_srcdir)/vmod.vcc @PYTHON@ $(vmodtool) $(vmodtoolargs) $(vmod_srcdir)/vmod.vcc # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/lib/libvmod_debug/vmod_debug_obj.c0000644000201500234410000000516712652366721016610 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include "cache/cache.h" #include "vrt.h" #include "vcc_if.h" struct vmod_debug_obj { unsigned magic; #define VMOD_DEBUG_OBJ_MAGIC 0xccbd9b77 int foobar; }; VCL_VOID vmod_obj__init(VRT_CTX, struct vmod_debug_obj **op, const char *vcl_name, VCL_STRING s) { struct vmod_debug_obj *o; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); (void)vcl_name; (void)s; AN(op); AZ(*op); ALLOC_OBJ(o, VMOD_DEBUG_OBJ_MAGIC); AN(o); *op = o; o->foobar = 42; AN(*op); } VCL_VOID vmod_obj__fini(struct vmod_debug_obj **op) { AN(op); AN(*op); FREE_OBJ(*op); *op = NULL; } VCL_VOID __match_proto__() vmod_obj_enum(VRT_CTX, struct vmod_debug_obj *o, VCL_ENUM e) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(o, VMOD_DEBUG_OBJ_MAGIC); assert(!strcmp(e, "martin")); } VCL_STRING __match_proto__() vmod_obj_foo(VRT_CTX, struct vmod_debug_obj *o, VCL_STRING s) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); (void)s; CHECK_OBJ_NOTNULL(o, VMOD_DEBUG_OBJ_MAGIC); assert(o->foobar == 42); return ("BOO"); } VCL_TIME __match_proto__() vmod_obj_date(VRT_CTX, struct vmod_debug_obj *o) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(o, VMOD_DEBUG_OBJ_MAGIC); assert(o->foobar == 42); return (21.4); } varnish-4.1.1/lib/libvmod_debug/vmod_debug_dyn.c0000644000201500234410000001037712652366721016627 00000000000000/*- * Copyright (c) 2015 Varnish Software AS * All rights reserved. * * Author: Dridi Boukelmoune * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include #include #include "vcl.h" #include "vrt.h" #include "cache/cache.h" #include "cache/cache_director.h" #include "cache/cache_backend.h" #include "vsa.h" #include "vcc_if.h" struct vmod_debug_dyn { unsigned magic; #define VMOD_DEBUG_DYN_MAGIC 0x9b77ccbd pthread_mutex_t mtx; char *vcl_name; struct director *dir; }; static void dyn_dir_init(VRT_CTX, struct vmod_debug_dyn *dyn, VCL_STRING addr, VCL_STRING port) { struct addrinfo hints, *res = NULL; struct suckaddr *sa; struct director *dir, *dir2; struct vrt_backend vrt; CHECK_OBJ_NOTNULL(dyn, VMOD_DEBUG_DYN_MAGIC); XXXAN(addr); XXXAN(port); INIT_OBJ(&vrt, VRT_BACKEND_MAGIC); vrt.port = port; vrt.vcl_name = dyn->vcl_name; vrt.hosthdr = vrt.ipv4_addr; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; AZ(getaddrinfo(vrt.ipv4_addr, vrt.port, &hints, &res)); XXXAZ(res->ai_next); sa = VSA_Malloc(res->ai_addr, res->ai_addrlen); AN(sa); if (VSA_Get_Proto(sa) == AF_INET) { vrt.ipv4_addr = addr; vrt.ipv4_suckaddr = sa; } else if (VSA_Get_Proto(sa) == AF_INET6) { vrt.ipv6_addr = addr; vrt.ipv6_suckaddr = sa; } else WRONG("Wrong proto family"); freeaddrinfo(res); dir = VRT_new_backend(ctx, &vrt); AN(dir); /* * NB: A real dynamic backend should not replace the previous * instance if the new one is identical. We do it here because * the d* tests requires a replacement. */ AZ(pthread_mutex_lock(&dyn->mtx)); dir2 = dyn->dir; dyn->dir = dir; AZ(pthread_mutex_unlock(&dyn->mtx)); if (dir2 != NULL) VRT_delete_backend(ctx, &dir2); free(sa); } VCL_VOID vmod_dyn__init(VRT_CTX, struct vmod_debug_dyn **dynp, const char *vcl_name, VCL_STRING addr, VCL_STRING port) { struct vmod_debug_dyn *dyn; ASSERT_CLI(); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(dynp); AZ(*dynp); AN(vcl_name); ALLOC_OBJ(dyn, VMOD_DEBUG_DYN_MAGIC); AN(dyn); REPLACE(dyn->vcl_name, vcl_name); AZ(pthread_mutex_init(&dyn->mtx, NULL)); dyn_dir_init(ctx, dyn, addr, port); XXXAN(dyn->dir); *dynp = dyn; } VCL_VOID vmod_dyn__fini(struct vmod_debug_dyn **dynp) { struct vmod_debug_dyn *dyn; AN(dynp); CAST_OBJ_NOTNULL(dyn, *dynp, VMOD_DEBUG_DYN_MAGIC); /* at this point all backends will be deleted by the vcl */ free(dyn->vcl_name); AZ(pthread_mutex_destroy(&dyn->mtx)); FREE_OBJ(dyn); *dynp = NULL; } VCL_BACKEND __match_proto__() vmod_dyn_backend(VRT_CTX, struct vmod_debug_dyn *dyn) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(dyn, VMOD_DEBUG_DYN_MAGIC); AN(dyn->dir); return (dyn->dir); } VCL_VOID vmod_dyn_refresh(VRT_CTX, struct vmod_debug_dyn *dyn, VCL_STRING addr, VCL_STRING port) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(dyn, VMOD_DEBUG_DYN_MAGIC); dyn_dir_init(ctx, dyn, addr, port); } varnish-4.1.1/lib/libvmod_debug/vmod_debug.c0000644000201500234410000002302212652366721015744 00000000000000/*- * Copyright (c) 2012-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include "cache/cache.h" #include "vcl.h" #include "vrt.h" #include "vsb.h" #include "vtim.h" #include "vcc_if.h" struct priv_vcl { unsigned magic; #define PRIV_VCL_MAGIC 0x8E62FA9D char *foo; uintptr_t exp_cb; struct vcl *vcl; struct vclref *vclref; }; static VCL_DURATION vcl_release_delay = 0.0; VCL_VOID __match_proto__(td_debug_panic) vmod_panic(VRT_CTX, const char *str, ...) { va_list ap; const char *b; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); va_start(ap, str); b = VRT_String(ctx->ws, "PANIC: ", str, ap); va_end(ap); VAS_Fail("VCL", "", 0, b, VAS_VCL); } VCL_STRING __match_proto__(td_debug_author) vmod_author(VRT_CTX, VCL_ENUM id) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (!strcmp(id, "phk")) return ("Poul-Henning"); if (!strcmp(id, "des")) return ("Dag-Erling"); if (!strcmp(id, "kristian")) return ("Kristian"); if (!strcmp(id, "mithrandir")) return ("Tollef"); WRONG("Illegal VMOD enum"); } VCL_VOID __match_proto__(td_debug_test_priv_call) vmod_test_priv_call(VRT_CTX, struct vmod_priv *priv) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (priv->priv == NULL) { priv->priv = strdup("BAR"); priv->free = free; } else { assert(!strcmp(priv->priv, "BAR")); } } VCL_STRING __match_proto__(td_debug_test_priv_task) vmod_test_priv_task(VRT_CTX, struct vmod_priv *priv, VCL_STRING s) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (priv->priv == NULL) { priv->priv = strdup(s); priv->free = free; } return (priv->priv); } VCL_STRING __match_proto__(td_debug_test_priv_top) vmod_test_priv_top(VRT_CTX, struct vmod_priv *priv, VCL_STRING s) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (priv->priv == NULL) { priv->priv = strdup(s); priv->free = free; } return (priv->priv); } VCL_VOID __match_proto__(td_debug_test_priv_vcl) vmod_test_priv_vcl(VRT_CTX, struct vmod_priv *priv) { struct priv_vcl *priv_vcl; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(priv); CAST_OBJ_NOTNULL(priv_vcl, priv->priv, PRIV_VCL_MAGIC); AN(priv_vcl->foo); assert(!strcmp(priv_vcl->foo, "FOO")); } VCL_BLOB vmod_str2blob(VRT_CTX, VCL_STRING s) { struct vmod_priv *p; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); p = (void*)WS_Alloc(ctx->ws, sizeof *p); AN(p); memset(p, 0, sizeof *p); p->len = strlen(s); p->priv = WS_Copy(ctx->ws, s, -1); return (p); } VCL_STRING vmod_blob2hex(VRT_CTX, VCL_BLOB b) { char *s, *p; uint8_t *q; int i; s = WS_Alloc(ctx->ws, b->len * 2 + 2); AN(s); p = s; q = b->priv; for (i = 0; i < b->len; i++) { sprintf(p, "%02x", *q); p += 2; q += 1; } VRT_priv_fini(b); return (s); } VCL_BACKEND vmod_no_backend(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); return (NULL); } VCL_VOID __match_proto__(td_debug_rot52) vmod_rot52(VRT_CTX, VCL_HTTP hp) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); http_PrintfHeader(hp, "Encrypted: ROT52"); } VCL_STRING vmod_argtest(VRT_CTX, VCL_STRING one, VCL_REAL two, VCL_STRING three, VCL_STRING comma) { char buf[100]; bprintf(buf, "%s %g %s %s", one, two, three, comma); return WS_Copy(ctx->ws, buf, -1); } VCL_INT vmod_vre_limit(VRT_CTX) { (void)ctx; return (cache_param->vre_limits.match); } static void __match_proto__(exp_callback_f) exp_cb(struct worker *wrk, struct objcore *oc, enum exp_event_e ev, void *priv) { const struct priv_vcl *priv_vcl; const char *what; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CAST_OBJ_NOTNULL(priv_vcl, priv, PRIV_VCL_MAGIC); switch (ev) { case EXP_INSERT: what = "insert"; break; case EXP_INJECT: what = "inject"; break; case EXP_REMOVE: what = "remove"; break; default: WRONG("Wrong exp_event"); } VSL(SLT_Debug, 0, "exp_cb: event %s 0x%jx", what, (intmax_t)(uintptr_t)oc); } VCL_VOID __match_proto__() vmod_register_exp_callback(VRT_CTX, struct vmod_priv *priv) { struct priv_vcl *priv_vcl; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CAST_OBJ_NOTNULL(priv_vcl, priv->priv, PRIV_VCL_MAGIC); AZ(priv_vcl->exp_cb); priv_vcl->exp_cb = EXP_Register_Callback(exp_cb, priv_vcl); VSL(SLT_Debug, 0, "exp_cb: registered"); } VCL_VOID __match_proto__() vmod_init_fail(VRT_CTX) { AN(ctx->msg); VSB_printf(ctx->msg, "Planned failure in vcl_init{}"); VRT_handling(ctx, VCL_RET_FAIL); } static void __match_proto__(vmod_priv_free_f) priv_vcl_free(void *priv) { struct priv_vcl *priv_vcl; CAST_OBJ_NOTNULL(priv_vcl, priv, PRIV_VCL_MAGIC); AN(priv_vcl->foo); free(priv_vcl->foo); if (priv_vcl->exp_cb != 0) { EXP_Deregister_Callback(&priv_vcl->exp_cb); VSL(SLT_Debug, 0, "exp_cb: deregistered"); } AZ(priv_vcl->vcl); AZ(priv_vcl->vclref); FREE_OBJ(priv_vcl); AZ(priv_vcl); } static int event_load(VRT_CTX, struct vmod_priv *priv) { struct priv_vcl *priv_vcl; AN(ctx->msg); if (cache_param->nuke_limit == 42) { VSB_printf(ctx->msg, "nuke_limit is not the answer."); return (-1); } ALLOC_OBJ(priv_vcl, PRIV_VCL_MAGIC); AN(priv_vcl); priv_vcl->foo = strdup("FOO"); AN(priv_vcl->foo); priv->priv = priv_vcl; priv->free = priv_vcl_free; return (0); } static int event_warm(VRT_CTX, const struct vmod_priv *priv) { struct priv_vcl *priv_vcl; char buf[32]; VSL(SLT_Debug, 0, "%s: VCL_EVENT_WARM", VCL_Name(ctx->vcl)); AN(ctx->msg); if (cache_param->max_esi_depth == 42) { VSB_printf(ctx->msg, "max_esi_depth is not the answer."); return (-1); } CAST_OBJ_NOTNULL(priv_vcl, priv->priv, PRIV_VCL_MAGIC); AZ(priv_vcl->vcl); AZ(priv_vcl->vclref); bprintf(buf, "vmod-debug ref on %s", VCL_Name(ctx->vcl)); priv_vcl->vcl = ctx->vcl; priv_vcl->vclref = VRT_ref_vcl(ctx, buf); return (0); } static void* cooldown_thread(void *priv) { struct vrt_ctx ctx; struct priv_vcl *priv_vcl; CAST_OBJ_NOTNULL(priv_vcl, priv, PRIV_VCL_MAGIC); AN(priv_vcl->vcl); AN(priv_vcl->vclref); INIT_OBJ(&ctx, VRT_CTX_MAGIC); ctx.vcl = priv_vcl->vcl; VTIM_sleep(vcl_release_delay); VRT_rel_vcl(&ctx, &priv_vcl->vclref); priv_vcl->vcl = NULL; return (NULL); } static int event_cold(VRT_CTX, const struct vmod_priv *priv) { pthread_t thread; struct priv_vcl *priv_vcl; CAST_OBJ_NOTNULL(priv_vcl, priv->priv, PRIV_VCL_MAGIC); AN(priv_vcl->vcl); AN(priv_vcl->vclref); VSL(SLT_Debug, 0, "%s: VCL_EVENT_COLD", VCL_Name(ctx->vcl)); if (vcl_release_delay == 0.0) { VRT_rel_vcl(ctx, &priv_vcl->vclref); priv_vcl->vcl = NULL; return (0); } AZ(pthread_create(&thread, NULL, cooldown_thread, priv_vcl)); AZ(pthread_detach(thread)); return (0); } int __match_proto__(vmod_event_f) event_function(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e) { switch (e) { case VCL_EVENT_LOAD: return event_load(ctx, priv); case VCL_EVENT_WARM: return event_warm(ctx, priv); case VCL_EVENT_COLD: return event_cold(ctx, priv); default: return (0); } } VCL_VOID __match_proto__(td_debug_sleep) vmod_sleep(VRT_CTX, VCL_DURATION t) { CHECK_OBJ_ORNULL(ctx, VRT_CTX_MAGIC); VTIM_sleep(t); } static struct ws *wsfind(VRT_CTX, VCL_ENUM which) { if (!strcmp(which, "client")) { return ctx->ws; } else if (!strcmp(which, "backend")) { return ctx->bo->ws; } else if (!strcmp(which, "session")) { return ctx->req->sp->ws; } else if (!strcmp(which, "thread")) { return ctx->req->wrk->aws; } else WRONG("No such workspace."); } void vmod_workspace_allocate(VRT_CTX, VCL_ENUM which, VCL_INT size) { struct ws *ws; char *s; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); ws = wsfind(ctx, which); WS_Assert(ws); AZ(ws->r); s = WS_Alloc(ws, size); if (!s) return; memset(s, '\0', size); } VCL_INT vmod_workspace_free(VRT_CTX, VCL_ENUM which) { struct ws *ws; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); ws = wsfind(ctx, which); WS_Assert(ws); AZ(ws->r); return pdiff(ws->f, ws->e); } VCL_BOOL vmod_workspace_overflowed(VRT_CTX, VCL_ENUM which) { struct ws *ws; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); ws = wsfind(ctx, which); WS_Assert(ws); return (WS_Overflowed(ws)); } void vmod_workspace_overflow(VRT_CTX, VCL_ENUM which) { struct ws *ws; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); ws = wsfind(ctx, which); WS_Assert(ws); WS_MarkOverflow(ws); } void vmod_vcl_release_delay(VRT_CTX, VCL_DURATION delay) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); assert(delay > 0.0); vcl_release_delay = delay; } varnish-4.1.1/lib/Makefile.in0000644000201500234410000004436412652366727012752 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = lib DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ SUBDIRS = \ libvarnishcompat \ libvarnish \ libvarnishapi \ libvarnishtools \ libvcc \ libvgz \ libvmod_debug \ libvmod_std \ libvmod_directors DIST_SUBDIRS = \ libvarnishcompat \ libvarnish \ libvarnishapi \ libvarnishtools \ libvcc \ libvgz \ libvmod_debug \ libvmod_std \ libvmod_directors all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/lib/libvgz/0000755000201500234410000000000012652366756012251 500000000000000varnish-4.1.1/lib/libvgz/zconf.h0000644000201500234410000003650712652366721013464 00000000000000/* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-2013 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $FreeBSD: head/lib/libz/zconf.h 250261 2013-05-05 06:20:49Z delphij $ */ #ifndef ZCONF_H #define ZCONF_H /* * If you *really* need a unique prefix for all types and library functions, * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. * Even better than compiling with -DZ_PREFIX would be to use configure to set * this permanently in zconf.h using "./configure --zprefix". */ #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ # define Z_PREFIX_SET /* all linked symbols */ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align # define _tr_flush_bits z__tr_flush_bits # define _tr_flush_block z__tr_flush_block # define _tr_init z__tr_init # define _tr_stored_block z__tr_stored_block # define _tr_tally z__tr_tally # define adler32 z_adler32 # define adler32_combine z_adler32_combine # define adler32_combine64 z_adler32_combine64 # ifndef Z_SOLO # define compress z_compress # define compress2 z_compress2 # define compressBound z_compressBound # endif # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 # define deflate z_deflate # define deflateBound z_deflateBound # define deflateCopy z_deflateCopy # define deflateEnd z_deflateEnd # define deflateInit2_ z_deflateInit2_ # define deflateInit_ z_deflateInit_ # define deflateParams z_deflateParams # define deflatePending z_deflatePending # define deflatePrime z_deflatePrime # define deflateReset z_deflateReset # define deflateResetKeep z_deflateResetKeep # define deflateSetDictionary z_deflateSetDictionary # define deflateSetHeader z_deflateSetHeader # define deflateTune z_deflateTune # define deflate_copyright z_deflate_copyright # define get_crc_table z_get_crc_table # ifndef Z_SOLO # define gz_error z_gz_error # define gz_intmax z_gz_intmax # define gz_strwinerror z_gz_strwinerror # define gzbuffer z_gzbuffer # define gzclearerr z_gzclearerr # define gzclose z_gzclose # define gzclose_r z_gzclose_r # define gzclose_w z_gzclose_w # define gzdirect z_gzdirect # define gzdopen z_gzdopen # define gzeof z_gzeof # define gzerror z_gzerror # define gzflush z_gzflush # define gzgetc z_gzgetc # define gzgetc_ z_gzgetc_ # define gzgets z_gzgets # define gzoffset z_gzoffset # define gzoffset64 z_gzoffset64 # define gzopen z_gzopen # define gzopen64 z_gzopen64 # ifdef _WIN32 # define gzopen_w z_gzopen_w # endif # define gzprintf z_gzprintf # define gzvprintf z_gzvprintf # define gzputc z_gzputc # define gzputs z_gzputs # define gzread z_gzread # define gzrewind z_gzrewind # define gzseek z_gzseek # define gzseek64 z_gzseek64 # define gzsetparams z_gzsetparams # define gztell z_gztell # define gztell64 z_gztell64 # define gzungetc z_gzungetc # define gzwrite z_gzwrite # endif # define inflate z_inflate # define inflateBack z_inflateBack # define inflateBackEnd z_inflateBackEnd # define inflateBackInit_ z_inflateBackInit_ # define inflateCopy z_inflateCopy # define inflateEnd z_inflateEnd # define inflateGetHeader z_inflateGetHeader # define inflateInit2_ z_inflateInit2_ # define inflateInit_ z_inflateInit_ # define inflateMark z_inflateMark # define inflatePrime z_inflatePrime # define inflateReset z_inflateReset # define inflateReset2 z_inflateReset2 # define inflateSetDictionary z_inflateSetDictionary # define inflateGetDictionary z_inflateGetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine # define inflateResetKeep z_inflateResetKeep # define inflate_copyright z_inflate_copyright # define inflate_fast z_inflate_fast # define inflate_table z_inflate_table # ifndef Z_SOLO # define uncompress z_uncompress # endif # define zError z_zError # ifndef Z_SOLO # define zcalloc z_zcalloc # define zcfree z_zcfree # endif # define zlibCompileFlags z_zlibCompileFlags # define zlibVersion z_zlibVersion /* all zlib typedefs in zlib.h and zconf.h */ # define Byte z_Byte # define Bytef z_Bytef # define alloc_func z_alloc_func # define charf z_charf # define free_func z_free_func # ifndef Z_SOLO # define gzFile z_gzFile # endif # define gz_header z_gz_header # define gz_headerp z_gz_headerp # define in_func z_in_func # define intf z_intf # define out_func z_out_func # define uInt z_uInt # define uIntf z_uIntf # define uLong z_uLong # define uLongf z_uLongf # define voidp z_voidp # define voidpc z_voidpc # define voidpf z_voidpf /* all zlib structs in zlib.h and zconf.h */ # define gz_header_s z_gz_header_s # define internal_state z_internal_state #endif #if defined(__MSDOS__) && !defined(MSDOS) # define MSDOS #endif #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) # define OS2 #endif #if defined(_WINDOWS) && !defined(WINDOWS) # define WINDOWS #endif #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) # ifndef WIN32 # define WIN32 # endif #endif #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) # ifndef SYS16BIT # define SYS16BIT # endif # endif #endif /* * Compile with -DMAXSEG_64K if the alloc function cannot allocate more * than 64k bytes at a time (needed on systems with 16-bit int). */ #ifdef SYS16BIT # define MAXSEG_64K #endif #ifdef MSDOS # define UNALIGNED_OK #endif #ifdef __STDC_VERSION__ # ifndef STDC # define STDC # endif # if __STDC_VERSION__ >= 199901L # ifndef STDC99 # define STDC99 # endif # endif #endif #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) # define STDC #endif #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) # define STDC #endif #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) # define STDC #endif #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) # define STDC #endif #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ # define STDC #endif #ifndef STDC # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ # define const /* note: need a more gentle solution here */ # endif #endif #if defined(ZLIB_CONST) && !defined(z_const) # define z_const const #else # define z_const #endif /* Some Mac compilers merge all .h files incorrectly: */ #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) # define NO_DUMMY_DECL #endif /* Maximum value for memLevel in deflateInit2 */ #ifndef MAX_MEM_LEVEL # ifdef MAXSEG_64K # define MAX_MEM_LEVEL 8 # else # define MAX_MEM_LEVEL 9 # endif #endif /* Maximum value for windowBits in deflateInit2 and inflateInit2. * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files * created by gzip. (Files created by minigzip can still be extracted by * gzip.) */ #ifndef MAX_WBITS # define MAX_WBITS 15 /* 32K LZ77 window */ #endif /* The memory requirements for deflate are (in bytes): (1 << (windowBits+2)) + (1 << (memLevel+9)) that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) plus a few kilobytes for small objects. For example, if you want to reduce the default memory requirements from 256K to 128K, compile with make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" Of course this will generally degrade compression (there's no free lunch). The memory requirements for inflate are (in bytes) 1 << windowBits that is, 32K for windowBits=15 (default value) plus a few kilobytes for small objects. */ /* Type declarations */ #ifndef OF /* function prototypes */ # ifdef STDC # define OF(args) args # else # define OF(args) () # endif #endif #ifndef Z_ARG /* function prototypes for stdarg */ # if defined(STDC) || defined(Z_HAVE_STDARG_H) # define Z_ARG(args) args # else # define Z_ARG(args) () # endif #endif /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, * just define FAR to be empty. */ #ifdef SYS16BIT # if defined(M_I86SM) || defined(M_I86MM) /* MSC small or medium model */ # define SMALL_MEDIUM # ifdef _MSC_VER # define FAR _far # else # define FAR far # endif # endif # if (defined(__SMALL__) || defined(__MEDIUM__)) /* Turbo C small or medium model */ # define SMALL_MEDIUM # ifdef __BORLANDC__ # define FAR _far # else # define FAR far # endif # endif #endif #if defined(WINDOWS) || defined(WIN32) /* If building or using zlib as a DLL, define ZLIB_DLL. * This is not mandatory, but it offers a little performance increase. */ # ifdef ZLIB_DLL # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) # ifdef ZLIB_INTERNAL # define ZEXTERN extern __declspec(dllexport) # else # define ZEXTERN extern __declspec(dllimport) # endif # endif # endif /* ZLIB_DLL */ /* If building or using zlib with the WINAPI/WINAPIV calling convention, * define ZLIB_WINAPI. * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. */ # ifdef ZLIB_WINAPI # ifdef FAR # undef FAR # endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ # define ZEXPORT WINAPI # ifdef WIN32 # define ZEXPORTVA WINAPIV # else # define ZEXPORTVA FAR CDECL # endif # endif #endif #if defined (__BEOS__) # ifdef ZLIB_DLL # ifdef ZLIB_INTERNAL # define ZEXPORT __declspec(dllexport) # define ZEXPORTVA __declspec(dllexport) # else # define ZEXPORT __declspec(dllimport) # define ZEXPORTVA __declspec(dllimport) # endif # endif #endif #ifndef ZEXTERN # define ZEXTERN extern #endif #ifndef ZEXPORT # define ZEXPORT #endif #ifndef ZEXPORTVA # define ZEXPORTVA #endif #ifndef FAR # define FAR #endif #if !defined(__MACTYPES__) typedef unsigned char Byte; /* 8 bits */ #endif typedef unsigned int uInt; /* 16 bits or more */ typedef unsigned long uLong; /* 32 bits or more */ #ifdef SMALL_MEDIUM /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ # define Bytef Byte FAR #else typedef Byte FAR Bytef; #endif typedef char FAR charf; typedef int FAR intf; typedef uInt FAR uIntf; typedef uLong FAR uLongf; #ifdef STDC typedef void const *voidpc; typedef void FAR *voidpf; typedef void *voidp; #else typedef Byte const *voidpc; typedef Byte FAR *voidpf; typedef Byte *voidp; #endif #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) # include # if (UINT_MAX == 0xffffffffUL) # define Z_U4 unsigned # elif (ULONG_MAX == 0xffffffffUL) # define Z_U4 unsigned long # elif (USHRT_MAX == 0xffffffffUL) # define Z_U4 unsigned short # endif #endif #ifdef Z_U4 typedef Z_U4 z_crc_t; #else typedef unsigned long z_crc_t; #endif #if 0 /* was set to #if 0 by ./configure */ # define Z_HAVE_UNISTD_H #endif #ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ # define Z_HAVE_STDARG_H #endif #ifdef STDC # ifndef Z_SOLO # include /* for off_t */ # endif #endif #if defined(STDC) || defined(Z_HAVE_STDARG_H) # ifndef Z_SOLO # include /* for va_list */ # endif #endif #ifdef _WIN32 # ifndef Z_SOLO # include /* for wchar_t */ # endif #endif /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even * though the former does not conform to the LFS document), but considering * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as * equivalently requesting no 64-bit operations */ #if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 # undef _LARGEFILE64_SOURCE #endif #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) # define Z_HAVE_UNISTD_H #endif #ifndef Z_SOLO # if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ # endif # ifndef z_off_t # define z_off_t off_t # endif # endif #endif #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 # define Z_LFS64 #endif #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) # define Z_LARGE64 #endif #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) # define Z_WANT64 #endif #if !defined(SEEK_SET) && !defined(Z_SOLO) # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ #endif /* * This is hard-configured for FreeBSD. */ #define z_off_t off_t #ifndef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 #endif #ifndef z_off_t # define z_off_t long #endif #if !defined(_WIN32) && defined(Z_LARGE64) # define z_off64_t off64_t #else # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) # define z_off64_t __int64 # else # define z_off64_t z_off_t # endif #endif /* MVS linker does not support external names larger than 8 bytes */ #if defined(__MVS__) #pragma map(deflateInit_,"DEIN") #pragma map(deflateInit2_,"DEIN2") #pragma map(deflateEnd,"DEEND") #pragma map(deflateBound,"DEBND") #pragma map(inflateInit_,"ININ") #pragma map(inflateInit2_,"ININ2") #pragma map(inflateEnd,"INEND") #pragma map(inflateSync,"INSY") #pragma map(inflateSetDictionary,"INSEDI") #pragma map(compressBound,"CMBND") #pragma map(inflate_table,"INTABL") #pragma map(inflate_fast,"INFA") #pragma map(inflate_copyright,"INCOPY") #endif #endif /* ZCONF_H */ varnish-4.1.1/lib/libvgz/crc32.h0000644000201500234410000007354212652366721013261 00000000000000/* crc32.h -- tables for rapid CRC calculation * Generated automatically by crc32.c */ local const z_crc_t FAR crc_table[TBLS][256] = { { 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, 0x2d02ef8dUL #ifdef BYFOUR }, { 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, 0x9324fd72UL }, { 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, 0xbe9834edUL }, { 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, 0xde0506f1UL }, { 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, 0x8def022dUL }, { 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, 0x72fd2493UL }, { 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, 0xed3498beUL }, { 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, 0xf10605deUL #endif } }; varnish-4.1.1/lib/libvgz/inflate.h0000644000201500234410000001437712652366721013770 00000000000000/* inflate.h -- internal inflate state definition * Copyright (C) 1995-2009 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* define NO_GZIP when compiling if you want to disable gzip header and trailer decoding by inflate(). NO_GZIP would be used to avoid linking in the crc code when it is not needed. For shared libraries, gzip decoding should be left enabled. */ #ifndef NO_GZIP # define GUNZIP #endif /* Possible inflate modes between inflate() calls */ typedef enum { HEAD, /* i: waiting for magic header */ FLAGS, /* i: waiting for method and flags (gzip) */ TIME, /* i: waiting for modification time (gzip) */ OS, /* i: waiting for extra flags and operating system (gzip) */ EXLEN, /* i: waiting for extra length (gzip) */ EXTRA, /* i: waiting for extra bytes (gzip) */ NAME, /* i: waiting for end of file name (gzip) */ COMMENT, /* i: waiting for end of comment (gzip) */ HCRC, /* i: waiting for header crc (gzip) */ DICTID, /* i: waiting for dictionary check value */ DICT, /* waiting for inflateSetDictionary() call */ TYPE, /* i: waiting for type bits, including last-flag bit */ TYPEDO, /* i: same, but skip check to exit inflate on new block */ STORED, /* i: waiting for stored size (length and complement) */ COPY_, /* i/o: same as COPY below, but only first time in */ COPY, /* i/o: waiting for input or output to copy stored block */ TABLE, /* i: waiting for dynamic block table lengths */ LENLENS, /* i: waiting for code length code lengths */ CODELENS, /* i: waiting for length/lit and distance code lengths */ LEN_, /* i: same as LEN below, but only first time in */ LEN, /* i: waiting for length/lit/eob code */ LENEXT, /* i: waiting for length extra bits */ DIST, /* i: waiting for distance code */ DISTEXT, /* i: waiting for distance extra bits */ MATCH, /* o: waiting for output space to copy string */ LIT, /* o: waiting for output space to write literal */ CHECK, /* i: waiting for 32-bit check value */ LENGTH, /* i: waiting for 32-bit length (gzip) */ DONE, /* finished check, done -- remain here until reset */ BAD, /* got a data error -- remain here until reset */ MEM, /* got an inflate() memory error -- remain here until reset */ SYNC /* looking for synchronization bytes to restart inflate() */ } inflate_mode; /* State transitions between above modes - (most modes can go to BAD or MEM on error -- not shown for clarity) Process header: HEAD -> (gzip) or (zlib) or (raw) (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> HCRC -> TYPE (zlib) -> DICTID or TYPE DICTID -> DICT -> TYPE (raw) -> TYPEDO Read deflate blocks: TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK STORED -> COPY_ -> COPY -> TYPE TABLE -> LENLENS -> CODELENS -> LEN_ LEN_ -> LEN Read deflate codes in fixed or dynamic block: LEN -> LENEXT or LIT or TYPE LENEXT -> DIST -> DISTEXT -> MATCH -> LEN LIT -> LEN Process trailer: CHECK -> LENGTH -> DONE */ /* state maintained between inflate() calls. Approximately 10K bytes. */ struct inflate_state { inflate_mode mode; /* current inflate mode */ int last; /* true if processing last block */ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ int havedict; /* true if dictionary provided */ int flags; /* gzip header method and flags (0 if zlib) */ unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ unsigned long check; /* protected copy of check value */ unsigned long total; /* protected copy of output count */ gz_headerp head; /* where to save gzip header information */ /* sliding window */ unsigned wbits; /* log base 2 of requested window size */ unsigned wsize; /* window size or zero if not using window */ unsigned whave; /* valid bytes in the window */ unsigned wnext; /* window write index */ unsigned char FAR *window; /* allocated sliding window, if needed */ /* bit accumulator */ unsigned long hold; /* input bit accumulator */ unsigned bits; /* number of bits in "in" */ /* for string and stored block copying */ unsigned length; /* literal or length of data to copy */ unsigned offset; /* distance back to copy string from */ /* for table and code decoding */ unsigned extra; /* extra bits needed */ /* fixed and dynamic code tables */ code const FAR *lencode; /* starting table for length/literal codes */ code const FAR *distcode; /* starting table for distance codes */ unsigned lenbits; /* index bits for lencode */ unsigned distbits; /* index bits for distcode */ /* dynamic table building */ unsigned ncode; /* number of code length code lengths */ unsigned nlen; /* number of length code lengths */ unsigned ndist; /* number of distance code lengths */ unsigned have; /* number of code lengths in lens[] */ code FAR *next; /* next available space in codes[] */ unsigned short lens[320]; /* temporary storage for code lengths */ unsigned short work[288]; /* work area for code table building */ code codes[ENOUGH]; /* space for code tables */ int sane; /* if false, allow invalid distance too far */ int back; /* bits back of last unprocessed length/lit */ unsigned was; /* initial length of match */ }; varnish-4.1.1/lib/libvgz/vgz.h0000644000201500234410000025376712652366721013164 00000000000000/* zlib.h -- interface of the 'zlib' general purpose compression library version 1.2.8, April 28th, 2013 Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jean-loup Gailly Mark Adler jloup@gzip.org madler@alumni.caltech.edu The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ #ifndef ZLIB_H #define ZLIB_H #include "zconf.h" #ifdef __cplusplus extern "C" { #endif #define ZLIB_VERSION "1.2.8" #define ZLIB_VERNUM 0x1280 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 #define ZLIB_VER_REVISION 8 #define ZLIB_VER_SUBREVISION 0 /* The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation) but other algorithms will be added later and will have the same stream interface. Compression can be done in a single step if the buffers are large enough, or can be done by repeated calls of the compression function. In the latter case, the application must provide more input and/or consume the output (providing more output space) before each call. The compressed data format used by default by the in-memory functions is the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped around a deflate stream, which is itself documented in RFC 1951. The library also supports reading and writing files in gzip (.gz) format with an interface similar to that of stdio using the functions that start with "gz". The gzip format is different from the zlib format. gzip is a gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. This library can optionally read and write gzip streams in memory as well. The zlib format was designed to be compact and fast for use in memory and on communications channels. The gzip format was designed for single- file compression on file systems, has a larger header than zlib to maintain directory information, and uses a different, slower check method than zlib. The library does not install any signal handler. The decoder checks the consistency of the compressed data, so the library should never crash even in case of corrupted input. */ typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); typedef void (*free_func) OF((voidpf opaque, voidpf address)); struct internal_state; typedef struct z_stream_s { z_const Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ uLong total_in; /* total number of input bytes read so far */ Bytef *next_out; /* next output byte should be put there */ uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total number of bytes output so far */ z_const char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ free_func zfree; /* used to free the internal state */ voidpf opaque; /* private data object passed to zalloc and zfree */ int data_type; /* best guess about the data type: binary or text */ uLong adler; /* adler32 value of the uncompressed data */ uLong reserved; /* reserved for future use */ uLong start_bit; /* Bit pos of first deflate block */ uLong stop_bit; /* Bit pos after last deflate block */ uLong last_bit; /* Bit pos of 'last' bit */ } z_stream; typedef z_stream FAR *z_streamp; /* gzip header information passed to and from zlib routines. See RFC 1952 for more details on the meanings of these fields. */ typedef struct gz_header_s { int text; /* true if compressed data believed to be text */ uLong time; /* modification time */ int xflags; /* extra flags (not used when writing a gzip file) */ int os; /* operating system */ Bytef *extra; /* pointer to extra field or Z_NULL if none */ uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ uInt extra_max; /* space at extra (only when reading header) */ Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ uInt name_max; /* space at name (only when reading header) */ Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ uInt comm_max; /* space at comment (only when reading header) */ int hcrc; /* true if there was or will be a header crc */ int done; /* true when done reading gzip header (not used when writing a gzip file) */ } gz_header; typedef gz_header FAR *gz_headerp; /* The application must update next_in and avail_in when avail_in has dropped to zero. It must update next_out and avail_out when avail_out has dropped to zero. The application must initialize zalloc, zfree and opaque before calling the init function. All other fields are set by the compression library and must not be updated by the application. The opaque value provided by the application will be passed as the first parameter for calls of zalloc and zfree. This can be useful for custom memory management. The compression library attaches no meaning to the opaque value. zalloc must return Z_NULL if there is not enough memory for the object. If zlib is used in a multi-threaded application, zalloc and zfree must be thread safe. On 16-bit systems, the functions zalloc and zfree must be able to allocate exactly 65536 bytes, but will not be required to allocate more than this if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers returned by zalloc for objects of exactly 65536 bytes *must* have their offset normalized to zero. The default allocation function provided by this library ensures this (see zutil.c). To reduce memory requirements and avoid any allocation of 64K objects, at the expense of compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). The fields total_in and total_out can be used for statistics or progress reports. After compression, total_in holds the total size of the uncompressed data and may be saved for use in the decompressor (particularly if the decompressor wants to decompress everything in a single step). */ /* constants */ #define Z_NO_FLUSH 0 #define Z_PARTIAL_FLUSH 1 #define Z_SYNC_FLUSH 2 #define Z_FULL_FLUSH 3 #define Z_FINISH 4 #define Z_BLOCK 5 #define Z_TREES 6 /* Allowed flush values; see deflate() and inflate() below for details */ #define Z_OK 0 #define Z_STREAM_END 1 #define Z_NEED_DICT 2 #define Z_ERRNO (-1) #define Z_STREAM_ERROR (-2) #define Z_DATA_ERROR (-3) #define Z_MEM_ERROR (-4) #define Z_BUF_ERROR (-5) #define Z_VERSION_ERROR (-6) /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ #define Z_NO_COMPRESSION 0 #define Z_BEST_SPEED 1 #define Z_BEST_COMPRESSION 9 #define Z_DEFAULT_COMPRESSION (-1) /* compression levels */ #define Z_FILTERED 1 #define Z_HUFFMAN_ONLY 2 #define Z_RLE 3 #define Z_FIXED 4 #define Z_DEFAULT_STRATEGY 0 /* compression strategy; see deflateInit2() below for details */ #define Z_BINARY 0 #define Z_TEXT 1 #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ #define Z_UNKNOWN 2 /* Possible values of the data_type field (though see inflate()) */ #define Z_DEFLATED 8 /* The deflate compression method (the only one supported in this version) */ #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ /* basic functions */ ZEXTERN const char * ZEXPORT zlibVersion OF((void)); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. If the first character differs, the library code actually used is not compatible with the zlib.h header file used by the application. This check is automatically made by deflateInit and inflateInit. */ /* ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); Initializes the internal stream state for compression. The fields zalloc, zfree and opaque must be initialized before by the caller. If zalloc and zfree are set to Z_NULL, deflateInit updates them to use default allocation functions. The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION requests a default compromise between speed and compression (currently equivalent to level 6). deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if level is not a valid compression level, or Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). msg is set to null if there is no error message. deflateInit does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); /* deflate compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. deflate performs one or both of the following actions: - Compress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in and avail_in are updated and processing will resume at this point for the next call of deflate(). - Provide more output starting at next_out and update next_out and avail_out accordingly. This action is forced if the parameter flush is non zero. Forcing flush frequently degrades the compression ratio, so this parameter should be set only when necessary (in interactive applications). Some output may be provided even if flush is not set. Before the call of deflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating avail_in or avail_out accordingly; avail_out should never be zero before the call. The application can consume the compressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to decide how much data to accumulate before producing output, in order to maximize compression. If the parameter flush is set to Z_SYNC_FLUSH, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far. (In particular avail_in is zero after the call if enough output space has been provided before the call.) Flushing may degrade compression for some compression algorithms and so it should be used only when necessary. This completes the current deflate block and follows it with an empty stored block that is three bits plus filler bits to the next byte, followed by four bytes (00 00 ff ff). If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the output buffer, but the output is not aligned to a byte boundary. All of the input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. This completes the current deflate block and follows it with an empty fixed codes block that is 10 bits long. This assures that enough bytes are output in order for the decompressor to finish the block before the empty fixed code block. If flush is set to Z_BLOCK, a deflate block is completed and emitted, as for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to seven bits of the current block are held to be written as the next byte after the next deflate block is completed. In this case, the decompressor may not be provided enough bits at this point in order to complete decompression of the data provided so far to the compressor. It may need to wait for the next block to be emitted. This is for advanced applications that need to control the emission of deflate blocks. If flush is set to Z_FULL_FLUSH, all output is flushed as with Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using Z_FULL_FLUSH too often can seriously degrade compression. If deflate returns with avail_out == 0, this function must be called again with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that avail_out is greater than six to avoid repeated flush markers due to avail_out == 0 on return. If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was enough output space; if deflate returns with Z_OK, this function must be called again with Z_FINISH and more output space (updated avail_out) but no more input data, until it returns with Z_STREAM_END or an error. After deflate has returned Z_STREAM_END, the only possible operations on the stream are deflateReset or deflateEnd. Z_FINISH can be used immediately after deflateInit if all the compression is to be done in a single step. In this case, avail_out must be at least the value returned by deflateBound (see below). Then deflate is guaranteed to return Z_STREAM_END. If not enough output space is provided, deflate will not return Z_STREAM_END, and it must be called again as described above. deflate() sets strm->adler to the adler32 checksum of all input read so far (that is, total_in bytes). deflate() may update strm->data_type if it can make a good guess about the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered binary. This field is only for information purposes and does not affect the compression algorithm in any manner. deflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and deflate() can be called again with more input and more output space to continue compressing. */ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent, Z_DATA_ERROR if the stream was freed prematurely (some input or output was discarded). In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. If next_in is not Z_NULL and avail_in is large enough (the exact value depends on the compression method), inflateInit determines the compression method from the zlib header and allocates all data structures accordingly; otherwise the allocation will be deferred to the first call of inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to use default allocation functions. inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller, or Z_STREAM_ERROR if the parameters are invalid, such as a null pointer to the structure. msg is set to null if there is no error message. inflateInit does not perform any decompression apart from possibly reading the zlib header if present: actual decompression will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unused and unchanged.) The current implementation of inflateInit() does not process any header information -- that is deferred until inflate() is called. */ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); /* inflate decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. inflate performs one or both of the following actions: - Decompress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in is updated and processing will resume at this point for the next call of inflate(). - Provide more output starting at next_out and update next_out and avail_out accordingly. inflate() provides as much output as possible, until there is no more input data or no more space in the output buffer (see below about the flush parameter). Before the call of inflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating the next_* and avail_* values accordingly. The application can consume the uncompressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of inflate(). If inflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much output as possible to the output buffer. Z_BLOCK requests that inflate() stop if and when it gets to the next deflate block boundary. When decoding the zlib or gzip format, this will cause inflate() to return immediately after the header and before the first block. When doing a raw inflate, inflate() will go ahead and process the first block, and will return when it gets to the end of that block, or when it runs out of data. The Z_BLOCK option assists in appending to or combining deflate streams. Also to assist in this, on return inflate() will set strm->data_type to the number of unused bits in the last byte taken from strm->next_in, plus 64 if inflate() is currently decoding the last block in the deflate stream, plus 128 if inflate() returned immediately after decoding an end-of-block code or decoding the complete header up to just before the first byte of the deflate stream. The end-of-block will not be indicated until all of the uncompressed data from that block has been written to strm->next_out. The number of unused bits may in general be greater than seven, except when bit 7 of data_type is set, in which case the number of unused bits will be less than eight. data_type is set as noted here every time inflate() returns for all flush options, and so can be used to determine the amount of currently consumed input in bits. The Z_TREES option behaves as Z_BLOCK does, but it also returns when the end of each deflate block header is reached, before any actual data in that block is decoded. This allows the caller to determine the length of the deflate block header for later use in random access within a deflate block. 256 is added to the value of strm->data_type when inflate() returns immediately after reaching the end of the deflate block header. inflate() should normally be called until it returns Z_STREAM_END or an error. However if all decompression is to be performed in a single step (a single call of inflate), the parameter flush should be set to Z_FINISH. In this case all pending input is processed and all pending output is flushed; avail_out must be large enough to hold all of the uncompressed data for the operation to complete. (The size of the uncompressed data may have been saved by the compressor for this purpose.) The use of Z_FINISH is not required to perform an inflation in one step. However it may be used to inform inflate that a faster approach can be used for the single inflate() call. Z_FINISH also informs inflate to not maintain a sliding window if the stream completes, which reduces inflate's memory footprint. If the stream does not complete, either because not all of the stream is provided or not enough output space is provided, then a sliding window will be allocated and inflate() can be called again to continue the operation as if Z_NO_FLUSH had been used. In this implementation, inflate() always flushes as much output as possible to the output buffer, and always uses the faster approach on the first call. So the effects of the flush parameter in this implementation are on the return value of inflate() as noted below, when inflate() returns early when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of memory for a sliding window when Z_FINISH is used. If a preset dictionary is needed after this call (see inflateSetDictionary below), inflate sets strm->adler to the Adler-32 checksum of the dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise it sets strm->adler to the Adler-32 checksum of all output produced so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described below. At the end of the stream, inflate() checks that its computed adler32 checksum is equal to that saved by the compressor and returns Z_STREAM_END only if the checksum is correct. inflate() can decompress and check either zlib-wrapped or gzip-wrapped deflate data. The header type is detected automatically, if requested when initializing with inflateInit2(). Any information contained in the gzip header is not retained, so applications that need that information should instead use raw inflate, see inflateInit2() below, or inflateBack() and perform their own processing of the gzip header and trailer. When processing gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output producted so far. The CRC-32 is checked against the gzip trailer. inflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if the end of the compressed data has been reached and all uncompressed output has been produced, Z_NEED_DICT if a preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming to the zlib format or incorrect check value), Z_STREAM_ERROR if the stream structure was inconsistent (for example next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no progress is possible or if there was not enough room in the output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and inflate() can be called again with more input and more output space to continue decompressing. If Z_DATA_ERROR is returned, the application may then call inflateSync() to look for a good compression block if a partial recovery of the data is desired. */ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent. In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* Advanced functions */ /* The following functions are needed only in some special applications. */ /* ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy)); This is another version of deflateInit with more compression options. The fields next_in, zalloc, zfree and opaque must be initialized before by the caller. The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. The windowBits parameter is the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage. The default value is 15 if deflateInit is used instead. windowBits can also be -8..-15 for raw deflate. In this case, -windowBits determines the window size. deflate() will then generate raw deflate data with no zlib header or trailer, and will not compute an adler32 check value. windowBits can also be greater than 15 for optional gzip encoding. Add 16 to windowBits to write a simple gzip header and trailer around the compressed data instead of a zlib wrapper. The gzip header will have no file name, no extra data, no comment, no modification time (set to zero), no header crc, and the operating system will be set to 255 (unknown). If a gzip stream is being written, strm->adler is a crc32 instead of an adler32. The memLevel parameter specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed. The default value is 8. See zconf.h for total memory usage as a function of windowBits and memLevel. The strategy parameter is used to tune the compression algorithm. Use the value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no string match), or Z_RLE to limit match distances to one (run-length encoding). Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better. The effect of Z_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately. Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications. deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). msg is set to null if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the compression dictionary from the given byte sequence without producing any compressed output. When using the zlib format, this function must be called immediately after deflateInit, deflateInit2 or deflateReset, and before any call of deflate. When doing raw deflate, this function must be called either before any call of deflate, or immediately after the completion of a deflate block, i.e. after all input has been consumed and all output has been delivered when using any of the flush options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The compressor and decompressor must use exactly the same dictionary (see inflateSetDictionary). The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, with the most commonly used strings preferably put towards the end of the dictionary. Using a dictionary is most useful when the data to be compressed is short and can be predicted with good accuracy; the data can then be compressed better than with the default empty dictionary. Depending on the size of the compression data structures selected by deflateInit or deflateInit2, a part of the dictionary may in effect be discarded, for example if the dictionary is larger than the window size provided in deflateInit or deflateInit2. Thus the strings most likely to be useful should be put at the end of the dictionary, not at the front. In addition, the current implementation of deflate will use at most the window size minus 262 bytes of the provided dictionary. Upon return of this function, strm->adler is set to the adler32 value of the dictionary; the decompressor may later use this value to determine which dictionary has been used by the compressor. (The adler32 value applies to the whole dictionary even if only a subset of the dictionary is actually used by the compressor.) If a raw deflate was requested, then the adler32 value is not computed and strm->adler is not set. deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is inconsistent (for example if deflate has already been called for this stream or if not at a block boundary for raw deflate). deflateSetDictionary does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when several compression strategies will be tried, for example when there are several ways of pre-processing the input data with a filter. The streams that will be discarded should then be freed by calling deflateEnd. Note that deflateCopy duplicates the internal compression state which can be quite large, so this strategy is slow and can consume lots of memory. deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being Z_NULL). msg is left unchanged in both source and destination. */ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); /* This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate all the internal compression state. The stream will keep the same compression level and any other attributes that may have been set by deflateInit2. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). */ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy)); /* Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in deflateInit2. This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression level is changed, the input available so far is compressed with the old level (and may be flushed); the new level will take effect only at the next call of deflate(). Before the call of deflateParams, the stream state must be set as for a call of deflate(), since the currently available input may have to be compressed and flushed. In particular, strm->avail_out must be non-zero. deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if strm->avail_out was zero. */ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)); /* Fine tune deflate's internal compression parameters. This should only be used by someone who understands the algorithm used by zlib's deflate for searching for the best matching string, and even then only by the most fanatic optimizer trying to squeeze out the last compressed bit for their specific input data. Read the deflate.c source code for the meaning of the max_lazy, good_length, nice_length, and max_chain parameters. deflateTune() can be called after deflateInit() or deflateInit2(), and returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. */ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, uLong sourceLen)); /* deflateBound() returns an upper bound on the compressed size after deflation of sourceLen bytes. It must be called after deflateInit() or deflateInit2(), and after deflateSetHeader(), if used. This would be used to allocate an output buffer for deflation in a single pass, and so would be called before deflate(). If that first deflate() call is provided the sourceLen input bytes, an output buffer allocated to the size returned by deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed to return Z_STREAM_END. Note that it is possible for the compressed size to be larger than the value returned by deflateBound() if flush options other than Z_FINISH or Z_NO_FLUSH are used. */ ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, unsigned *pending, int *bits)); /* deflatePending() returns the number of bytes and bits of output that have been generated, but not yet provided in the available output. The bytes not provided would be due to the available output space having being consumed. The number of bits of output not provided are between 0 and 7, where they await more bits to join them in order to fill out a full byte. If pending or bits are Z_NULL, then those values are not set. deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, int bits, int value)); /* deflatePrime() inserts bits in the deflate output stream. The intent is that this function is used to start off the deflate output with the bits leftover from a previous deflate stream when appending to it. As such, this function can only be used for raw deflate, and must be used before the first deflate() call after a deflateInit2() or deflateReset(). bits must be less than or equal to 16, and that many of the least significant bits of value will be inserted in the output. deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, gz_headerp head)); /* deflateSetHeader() provides gzip header information for when a gzip stream is requested by deflateInit2(). deflateSetHeader() may be called after deflateInit2() or deflateReset() and before the first call of deflate(). The text, time, os, extra field, name, and comment information in the provided gz_header structure are written to the gzip header (xflag is ignored -- the extra flags are set according to the compression level). The caller must assure that, if not Z_NULL, name and comment are terminated with a zero byte, and that if extra is not Z_NULL, that extra_len bytes are available there. If hcrc is true, a gzip header crc is included. Note that the current versions of the command-line version of gzip (up through version 1.3.x) do not support header crc's, and will report that it is a "multi-part gzip file" and give up. If deflateSetHeader is not used, the default gzip header has text false, the time set to zero, and os set to 255, with no extra, name, or comment fields. The gzip header is returned to the default state by deflateReset(). deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, int windowBits)); This is another version of inflateInit with an extra parameter. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. The windowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. The default value is 15 if inflateInit is used instead. windowBits must be greater than or equal to the windowBits value provided to deflateInit2() while compressing, or it must be equal to 15 if deflateInit2() was not used. If a compressed stream with a larger window size is given as input, inflate() will return with the error code Z_DATA_ERROR instead of trying to allocate a larger window. windowBits can also be zero to request that inflate use the window size in the zlib header of the compressed stream. windowBits can also be -8..-15 for raw inflate. In this case, -windowBits determines the window size. inflate() will then process raw deflate data, not looking for a zlib or gzip header, not generating a check value, and not looking for any check values for comparison at the end of the stream. This is for use with other formats that use the deflate compressed data format such as zip. Those formats provide their own check values. If a custom format is developed using the raw deflate format for compressed data, it is recommended that a check value such as an adler32 or a crc32 be applied to the uncompressed data as is done in the zlib, gzip, and zip formats. For most applications, the zlib format should be used as is. Note that comments above on the use in deflateInit2() applies to the magnitude of windowBits. windowBits can also be greater than 15 for optional gzip decoding. Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a crc32 instead of an adler32. inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller, or Z_STREAM_ERROR if the parameters are invalid, such as a null pointer to the structure. msg is set to null if there is no error message. inflateInit2 does not perform any decompression apart from possibly reading the zlib header if present: actual decompression will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unused and unchanged.) The current implementation of inflateInit2() does not process any header information -- that is deferred until inflate() is called. */ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of inflate, if that call returned Z_NEED_DICT. The dictionary chosen by the compressor can be determined from the adler32 value returned by that call of inflate. The compressor and decompressor must use exactly the same dictionary (see deflateSetDictionary). For raw inflate, this function can be called at any time to set the dictionary. If the provided dictionary is smaller than the window and there is already data in the window, then the provided dictionary will amend what's there. The application must insure that the dictionary that was used for compression is provided. inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of inflate(). */ ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, Bytef *dictionary, uInt *dictLength)); /* Returns the sliding dictionary being maintained by inflate. dictLength is set to the number of bytes in the dictionary, and that many bytes are copied to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If inflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. Similary, if dictLength is Z_NULL, then it is not set. inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the stream state is inconsistent. */ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); /* Skips invalid compressed data until a possible full flush point (see above for the description of deflate with Z_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided. inflateSync searches for a 00 00 FF FF pattern in the compressed data. All full flush points have this pattern, but not all occurrences of this pattern are full flush points. inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the success case, the application may save the current current value of total_in which indicates where valid compressed data was found. In the error case, the application may repeatedly call inflateSync, providing more input each time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when randomly accessing a large stream. The first pass through the stream can periodically record the inflate state, allowing restarting inflate at those points when randomly accessing the stream. inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being Z_NULL). msg is left unchanged in both source and destination. */ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); /* This function is equivalent to inflateEnd followed by inflateInit, but does not free and reallocate all the internal decompression state. The stream will keep attributes that may have been set by inflateInit2. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). */ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, int windowBits)); /* This function is the same as inflateReset, but it also permits changing the wrap and window size requests. The windowBits parameter is interpreted the same as it is for inflateInit2. inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL), or if the windowBits parameter is invalid. */ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, int bits, int value)); /* This function inserts bits in the inflate input stream. The intent is that this function is used to start inflating at a bit position in the middle of a byte. The provided bits will be used before any bytes are used from next_in. This function should only be used with raw inflate, and should be used before the first inflate() call after inflateInit2() or inflateReset(). bits must be less than or equal to 16, and that many of the least significant bits of value will be inserted in the input. If bits is negative, then the input stream bit buffer is emptied. Then inflatePrime() can be called again to put bits in the buffer. This is used to clear out bits leftover after feeding inflate a block description prior to feeding inflate codes. inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); /* This function returns two values, one in the lower 16 bits of the return value, and the other in the remaining upper bits, obtained by shifting the return value down 16 bits. If the upper value is -1 and the lower value is zero, then inflate() is currently decoding information outside of a block. If the upper value is -1 and the lower value is non-zero, then inflate is in the middle of a stored block, with the lower value equaling the number of bytes from the input remaining to copy. If the upper value is not -1, then it is the number of bits back from the current bit position in the input of the code (literal or length/distance pair) currently being processed. In that case the lower value is the number of bytes already emitted for that code. A code is being processed if inflate is waiting for more input to complete decoding of the code, or if it has completed decoding but is waiting for more output space to write the literal or match data. inflateMark() is used to mark locations in the input data for random access, which may be at bit positions, and to note those cases where the output of a code may span boundaries of random access blocks. The current location in the input stream can be determined from avail_in and data_type as noted in the description for the Z_BLOCK flush parameter for inflate. inflateMark returns the value noted above or -1 << 16 if the provided source stream state was inconsistent. */ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, gz_headerp head)); /* inflateGetHeader() requests that gzip header information be stored in the provided gz_header structure. inflateGetHeader() may be called after inflateInit2() or inflateReset(), and before the first call of inflate(). As inflate() processes the gzip stream, head->done is zero until the header is completed, at which time head->done is set to one. If a zlib stream is being decoded, then head->done is set to -1 to indicate that there will be no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be used to force inflate() to return immediately after header processing is complete and before any actual data is decompressed. The text, time, xflags, and os fields are filled in with the gzip header contents. hcrc is set to true if there is a header CRC. (The header CRC was valid if done is set to one.) If extra is not Z_NULL, then extra_max contains the maximum number of bytes to write to extra. Once done is true, extra_len contains the actual extra field length, and extra contains the extra field, or that field truncated if extra_max is less than extra_len. If name is not Z_NULL, then up to name_max characters are written there, terminated with a zero unless the length is greater than name_max. If comment is not Z_NULL, then up to comm_max characters are written there, terminated with a zero unless the length is greater than comm_max. When any of extra, name, or comment are not Z_NULL and the respective field is not present in the header, then that field is set to Z_NULL to signal its absence. This allows the use of deflateSetHeader() with the returned structure to duplicate the header. However if those fields are set to allocated memory, then the application will need to save those pointers elsewhere so that they can be eventually freed. If inflateGetHeader is not used, then the header information is simply discarded. The header is always checked for validity, including the header CRC if present. inflateReset() will reset the process to discard the header information. The application would need to call inflateGetHeader() again to retrieve the header from the next gzip stream. inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, unsigned char FAR *window)); Initialize the internal stream state for decompression using inflateBack() calls. The fields zalloc, zfree and opaque in strm must be initialized before the call. If zalloc and zfree are Z_NULL, then the default library- derived memory allocation routines are used. windowBits is the base two logarithm of the window size, in the range 8..15. window is a caller supplied buffer of that size. Except for special applications where it is assured that deflate was used with small window sizes, windowBits must be 15 and a 32K byte window must be supplied to be able to decompress general deflate streams. See inflateBack() for the usage of these routines. inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of the parameters are invalid, Z_MEM_ERROR if the internal state could not be allocated, or Z_VERSION_ERROR if the version of the library does not match the version of the header file. */ typedef unsigned (*in_func) OF((void FAR *, z_const unsigned char FAR * FAR *)); typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, in_func in, void FAR *in_desc, out_func out, void FAR *out_desc)); /* inflateBack() does a raw inflate with a single call using a call-back interface for input and output. This is potentially more efficient than inflate() for file i/o applications, in that it avoids copying between the output and the sliding window by simply making the window itself the output buffer. inflate() can be faster on modern CPUs when used with large buffers. inflateBack() trusts the application to not change the output buffer passed by the output function, at least until inflateBack() returns. inflateBackInit() must be called first to allocate the internal state and to initialize the state with the user-provided window buffer. inflateBack() may then be used multiple times to inflate a complete, raw deflate stream with each call. inflateBackEnd() is then called to free the allocated state. A raw deflate stream is one with no zlib or gzip header or trailer. This routine would normally be used in a utility that reads zip or gzip files and writes out uncompressed files. The utility would decode the header and process the trailer on its own, hence this routine expects only the raw deflate stream to decompress. This is different from the normal behavior of inflate(), which expects either a zlib or gzip header and trailer around the deflate stream. inflateBack() uses two subroutines supplied by the caller that are then called by inflateBack() for input and output. inflateBack() calls those routines until it reads a complete deflate stream and writes out all of the uncompressed data, or until it encounters an error. The function's parameters and return types are defined above in the in_func and out_func typedefs. inflateBack() will call in(in_desc, &buf) which should return the number of bytes of provided input, and a pointer to that input in buf. If there is no input available, in() must return zero--buf is ignored in that case--and inflateBack() will return a buffer error. inflateBack() will call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() should return zero on success, or non-zero on failure. If out() returns non-zero, inflateBack() will return with an error. Neither in() nor out() are permitted to change the contents of the window provided to inflateBackInit(), which is also the buffer that out() uses to write from. The length written by out() will be at most the window size. Any non-zero amount of input may be provided by in(). For convenience, inflateBack() can be provided input on the first call by setting strm->next_in and strm->avail_in. If that input is exhausted, then in() will be called. Therefore strm->next_in must be initialized before calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in must also be initialized, and then if strm->avail_in is not zero, input will initially be taken from strm->next_in[0 .. strm->avail_in - 1]. The in_desc and out_desc parameters of inflateBack() is passed as the first parameter of in() and out() respectively when they are called. These descriptors can be optionally used to pass any information that the caller- supplied in() and out() functions need to do their job. On return, inflateBack() will set strm->next_in and strm->avail_in to pass back any unused input that was provided by the last in() call. The return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR if in() or out() returned an error, Z_DATA_ERROR if there was a format error in the deflate stream (in which case strm->msg is set to indicate the nature of the error), or Z_STREAM_ERROR if the stream was not properly initialized. In the case of Z_BUF_ERROR, an input or output error can be distinguished using strm->next_in which will be Z_NULL only if in() returned an error. If strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning non-zero. (in() will always be called before out(), so strm->next_in is assured to be defined if out() returns non-zero.) Note that inflateBack() cannot return Z_OK. */ ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); /* All memory allocated by inflateBackInit() is freed. inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream state was inconsistent. */ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); /* Return flags indicating compile-time options. Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: 1.0: size of uInt 3.2: size of uLong 5.4: size of voidpf (pointer) 7.6: size of z_off_t Compiler, assembler, and debug options: 8: DEBUG 9: ASMV or ASMINF -- use ASM code 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention 11: 0 (reserved) One-time table building (smaller code, but not thread-safe if true): 12: BUILDFIXED -- build static block decoding tables when needed 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed 14,15: 0 (reserved) Library content (indicates missing functionality): 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking deflate code when not needed) 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect and decode gzip streams (to avoid linking crc code) 18-19: 0 (reserved) Operation variations (changes in library functionality): 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate 21: FASTEST -- deflate algorithm with only one, lowest compression level 22,23: 0 (reserved) The sprintf variant used by gzprintf (zero is best): 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! 26: 0 = returns value, 1 = void -- 1 means inferred string length returned Remainder: 27-31: 0 (reserved) */ #ifndef Z_SOLO /* utility functions */ /* The following utility functions are implemented on top of the basic stream-oriented functions. To simplify the interface, some default options are assumed (compression level and memory usage, standard memory allocation functions). The source code of these utility functions can be modified if you need special options. */ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Compresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed buffer. compress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer. */ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)); /* Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed buffer. compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); /* compressBound() returns an upper bound on the compressed size after compress() or compress2() on sourceLen bytes. It would be used before a compress() or compress2() call to allocate the destination buffer. */ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, destLen is the actual size of the uncompressed buffer. uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In the case where there is not enough room, uncompress() will fill the output buffer with the uncompressed data up to that point. */ /* gzip file access functions */ /* This library supports reading and writing files in gzip (.gz) format with an interface similar to that of stdio, using the functions that start with "gz". The gzip format is different from the zlib format. gzip is a gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. */ typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ /* ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); Opens a gzip (.gz) file for reading or writing. The mode parameter is as in fopen ("rb" or "wb") but can also include a compression level ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression as in "wb9F". (See the description of deflateInit2 for more information about the strategy parameter.) 'T' will request transparent writing or appending with no compression and not using the gzip format. "a" can be used instead of "w" to request that the gzip stream that will be written be appended to the file. "+" will result in an error, since reading and writing to the same gzip file is not supported. The addition of "x" when writing will create the file exclusively, which fails if the file already exists. On systems that support it, the addition of "e" when reading or writing will set the flag to close the file on an execve() call. These functions, as well as gzip, will read and decode a sequence of gzip streams in a file. The append function of gzopen() can be used to create such a file. (Also see gzflush() for another way to do this.) When appending, gzopen does not test whether the file begins with a gzip stream, nor does it look for the end of the gzip streams to begin appending. gzopen will simply append a gzip stream to the existing file. gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. When reading, this will be detected automatically by looking for the magic two- byte gzip header. gzopen returns NULL if the file could not be opened, if there was insufficient memory to allocate the gzFile state, or if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). errno can be checked to determine if the reason gzopen failed was that the file could not be opened. */ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); /* gzdopen associates a gzFile with the file descriptor fd. File descriptors are obtained from calls like open, dup, creat, pipe or fileno (if the file has been previously opened with fopen). The mode parameter is as in gzopen. The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, mode);. The duplicated descriptor should be saved to avoid a leak, since gzdopen does not close fd if it fails. If you are using fileno() to get the file descriptor from a FILE *, then you will have to use dup() to avoid double-close()ing the file descriptor. Both gzclose() and fclose() will close the associated file descriptor, so they need to have different file descriptors. gzdopen returns NULL if there was insufficient memory to allocate the gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided), or if fd is -1. The file descriptor is not used until the next gz* read, write, seek, or close operation, so gzdopen will not detect if fd is invalid (unless fd is -1). */ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); /* Set the internal buffer size used by this library's functions. The default buffer size is 8192 bytes. This function must be called after gzopen() or gzdopen(), and before any other calls that read or write the file. The buffer memory allocation is always deferred to the first read or write. Two buffers are allocated, either both of the specified size when writing, or one of the specified size and the other twice that size when reading. A larger buffer size of, for example, 64K or 128K bytes will noticeably increase the speed of decompression (reading). The new buffer size also affects the maximum length for gzprintf(). gzbuffer() returns 0 on success, or -1 on failure, such as being called too late. */ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); /* Dynamically update the compression level or strategy. See the description of deflateInit2 for the meaning of these parameters. gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not opened for writing. */ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); /* Reads the given number of uncompressed bytes from the compressed file. If the input file is not in gzip format, gzread copies the given number of bytes into the buffer directly from the file. After reaching the end of a gzip stream in the input, gzread will continue to read, looking for another gzip stream. Any number of gzip streams may be concatenated in the input file, and will all be decompressed by gzread(). If something other than a gzip stream is encountered after a gzip stream, that remaining trailing garbage is ignored (and no error is returned). gzread can be used to read a gzip file that is being concurrently written. Upon reaching the end of the input, gzread will return with the available data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then gzclearerr can be used to clear the end of file indicator in order to permit gzread to be tried again. Z_OK indicates that a gzip stream was completed on the last gzread. Z_BUF_ERROR indicates that the input file ended in the middle of a gzip stream. Note that gzread does not return -1 in the event of an incomplete gzip stream. This error is deferred until gzclose(), which will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip stream. Alternatively, gzerror can be used before gzclose to detect this case. gzread returns the number of uncompressed bytes actually read, less than len for end of file, or -1 for error. */ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len)); /* Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of uncompressed bytes written or 0 in case of error. */ ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); /* Converts, formats, and writes the arguments to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of uncompressed bytes actually written, or 0 in case of error. The number of uncompressed bytes written is limited to 8191, or one less than the buffer size given to gzbuffer(). The caller should assure that this limit is not exceeded. If it is exceeded, then gzprintf() will return an error (0) with nothing written. In this case, there may also be a buffer overflow with unpredictable consequences, which is possible only if zlib was compiled with the insecure functions sprintf() or vsprintf() because the secure snprintf() or vsnprintf() functions were not available. This can be determined using zlibCompileFlags(). */ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* Writes the given null-terminated string to the compressed file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file condition is encountered. If any characters are read or if len == 1, the string is terminated with a null character. If no characters are read due to an end-of-file or len < 1, then the buffer is left untouched. gzgets returns buf which is a null-terminated string, or it returns NULL for end-of-file or in case of error. If there was an error, the contents at buf are indeterminate. */ ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); /* Writes c, converted to an unsigned char, into the compressed file. gzputc returns the value that was written, or -1 in case of error. */ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); /* Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. This is implemented as a macro for speed. As such, it does not do all of the checking the other functions do. I.e. it does not check to see if file is NULL, nor whether the structure file points to has been clobbered or not. */ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); /* Push one character back onto the stream to be read as the first character on the next read. At least one character of push-back is allowed. gzungetc() returns the character pushed, or -1 on failure. gzungetc() will fail if c is -1, and may fail if a character has been pushed but not read yet. If gzungetc is used immediately after gzopen or gzdopen, at least the output buffer size of pushed characters is allowed. (See gzbuffer above.) The pushed character will be discarded if the stream is repositioned with gzseek() or gzrewind(). */ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); /* Flushes all pending output into the compressed file. The parameter flush is as in the deflate() function. The return value is the zlib error number (see function gzerror below). gzflush is only permitted when writing. If the flush parameter is Z_FINISH, the remaining data is written and the gzip stream is completed in the output. If gzwrite() is called again, a new gzip stream will be started in the output. gzread() is able to read such concatented gzip streams. gzflush should be called only when strictly necessary because it will degrade compression if called too often. */ /* ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); Sets the starting position for the next gzread or gzwrite on the given compressed file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. If the file is opened for reading, this function is emulated but can be extremely slow. If the file is opened for writing, only forward seeks are supported; gzseek then compresses a sequence of zeroes up to the new starting position. gzseek returns the resulting offset location as measured in bytes from the beginning of the uncompressed stream, or -1 in case of error, in particular if the file is opened for writing and the new starting position would be before the current position. */ ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); /* Rewinds the given file. This function is supported only for reading. gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) */ /* ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); Returns the starting position for the next gzread or gzwrite on the given compressed file. This position represents a number of bytes in the uncompressed data stream, and is zero when starting, even if appending or reading a gzip stream from the middle of a file using gzdopen(). gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ /* ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); Returns the current offset in the file being read or written. This offset includes the count of bytes that precede the gzip stream, for example when appending or when using gzdopen() for reading. When reading, the offset does not include as yet unused buffered input. This information can be used for a progress indicator. On error, gzoffset() returns -1. */ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); /* Returns true (1) if the end-of-file indicator has been set while reading, false (0) otherwise. Note that the end-of-file indicator is set only if the read tried to go past the end of the input, but came up short. Therefore, just like feof(), gzeof() may return false even if there is no more data to read, in the event that the last read request was for the exact number of bytes remaining in the input file. This will happen if the input file size is an exact multiple of the buffer size. If gzeof() returns true, then the read functions will return no more data, unless the end-of-file indicator is reset by gzclearerr() and the input file has grown since the previous end of file was detected. */ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); /* Returns true (1) if file is being copied directly while reading, or false (0) if file is a gzip stream being decompressed. If the input file is empty, gzdirect() will return true, since the input does not contain a gzip stream. If gzdirect() is used immediately after gzopen() or gzdopen() it will cause buffers to be allocated to allow reading the file to determine if it is a gzip file. Therefore if gzbuffer() is used, it should be called before gzdirect(). When writing, gzdirect() returns true (1) if transparent writing was requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: gzdirect() is not needed when writing. Transparent writing must be explicitly requested, so the application already knows the answer. When linking statically, using gzdirect() will include all of the zlib code for gzip file reading and decompression, which may not be desired.) */ ZEXTERN int ZEXPORT gzclose OF((gzFile file)); /* Flushes all pending output if necessary, closes the compressed file and deallocates the (de)compression state. Note that once file is closed, you cannot call gzerror with file, since its structures have been deallocated. gzclose must not be called more than once on the same file, just as free must not be called more than once on the same allocation. gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the last read ended in the middle of a gzip stream, or Z_OK on success. */ ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); /* Same as gzclose(), but gzclose_r() is only for use when reading, and gzclose_w() is only for use when writing or appending. The advantage to using these instead of gzclose() is that they avoid linking in zlib compression or decompression code that is not used when only reading or only writing respectively. If gzclose() is used, then both compression and decompression code will be included the application when linking to a static zlib library. */ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); /* Returns the error message for the last error which occurred on the given compressed file. errnum is set to zlib error number. If an error occurred in the file system and not in the compression library, errnum is set to Z_ERRNO and the application may consult errno to get the exact error code. The application must not modify the returned string. Future calls to this function may invalidate the previously returned string. If file is closed, then the string previously returned by gzerror will no longer be available. gzerror() should be used to distinguish errors from end-of-file for those functions above that do not distinguish those cases in their return values. */ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); /* Clears the error and end-of-file flags for file. This is analogous to the clearerr() function in stdio. This is useful for continuing to read a gzip file that is being written concurrently. */ #endif /* !Z_SOLO */ /* checksum functions */ /* These functions are not related to compression but are exported anyway because they might be useful in applications using the compression library. */ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and return the updated checksum. If buf is Z_NULL, this function returns the required initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example: uLong adler = adler32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { adler = adler32(adler, buffer, length); } if (adler != original_adler) error(); */ /* ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, z_off_t len2)); Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note that the z_off_t type (like off_t) is a signed integer. If len2 is negative, the result has no meaning or utility. */ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the updated CRC-32. If buf is Z_NULL, this function returns the required initial value for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application. Usage example: uLong crc = crc32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { crc = crc32(crc, buffer, length); } if (crc != original_crc) error(); */ /* ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); Combine two CRC-32 check values into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and len2. */ /* various hacks, don't look :) */ /* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */ ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, const char *version, int stream_size)); ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, unsigned char FAR *window, const char *version, int stream_size)); #define deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) #define inflateInit(strm) \ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) #define inflateInit2(strm, windowBits) \ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ (int)sizeof(z_stream)) #define inflateBackInit(strm, windowBits, window) \ inflateBackInit_((strm), (windowBits), (window), \ ZLIB_VERSION, (int)sizeof(z_stream)) #ifndef Z_SOLO /* gzgetc() macro and its supporting function and exposed data structure. Note * that the real internal state is much larger than the exposed structure. * This abbreviated structure exposes just enough for the gzgetc() macro. The * user should not mess with these exposed elements, since their names or * behavior could change in the future, perhaps even capriciously. They can * only be used by the gzgetc() macro. You have been warned. */ struct gzFile_s { unsigned have; unsigned char *next; z_off64_t pos; }; ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ #ifdef Z_PREFIX_SET # undef z_gzgetc # define z_gzgetc(g) \ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) #else # define gzgetc(g) \ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) #endif /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if * both are true, the application gets the *64 functions, and the regular * functions are changed to 64 bits) -- in case these are set on systems * without large file support, _LFS64_LARGEFILE must also be true */ #ifdef Z_LARGE64 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); #endif #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) # ifdef Z_PREFIX_SET # define z_gzopen z_gzopen64 # define z_gzseek z_gzseek64 # define z_gztell z_gztell64 # define z_gzoffset z_gzoffset64 # define z_adler32_combine z_adler32_combine64 # define z_crc32_combine z_crc32_combine64 # else # define gzopen gzopen64 # define gzseek gzseek64 # define gztell gztell64 # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 # endif # ifndef Z_LARGE64 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); # endif #else ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); #endif #else /* Z_SOLO */ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); #endif /* !Z_SOLO */ /* hack for buggy compilers */ #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) struct internal_state {int dummy;}; #endif /* undocumented functions */ ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); #if defined(_WIN32) && !defined(Z_SOLO) ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, const char *mode)); #endif #if defined(STDC) || defined(Z_HAVE_STDARG_H) # ifndef Z_SOLO ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, const char *format, va_list va)); # endif #endif #ifdef __cplusplus } #endif #endif /* ZLIB_H */ varnish-4.1.1/lib/libvgz/inflate.c0000644000201500234410000015067012652366721013760 00000000000000/* inflate.c -- zlib decompression * Copyright (C) 1995-2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* * Change history: * * 1.2.beta0 24 Nov 2002 * - First version -- complete rewrite of inflate to simplify code, avoid * creation of window when not needed, minimize use of window when it is * needed, make inffast.c even faster, implement gzip decoding, and to * improve code readability and style over the previous zlib inflate code * * 1.2.beta1 25 Nov 2002 * - Use pointers for available input and output checking in inffast.c * - Remove input and output counters in inffast.c * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 * - Remove unnecessary second byte pull from length extra in inffast.c * - Unroll direct copy to three copies per loop in inffast.c * * 1.2.beta2 4 Dec 2002 * - Change external routine names to reduce potential conflicts * - Correct filename to inffixed.h for fixed tables in inflate.c * - Make hbuf[] unsigned char to match parameter type in inflate.c * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) * to avoid negation problem on Alphas (64 bit) in inflate.c * * 1.2.beta3 22 Dec 2002 * - Add comments on state->bits assertion in inffast.c * - Add comments on op field in inftrees.h * - Fix bug in reuse of allocated window after inflateReset() * - Remove bit fields--back to byte structure for speed * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths * - Change post-increments to pre-increments in inflate_fast(), PPC biased? * - Add compile time option, POSTINC, to use post-increments instead (Intel?) * - Make MATCH copy in inflate() much faster for when inflate_fast() not used * - Use local copies of stream next and avail values, as well as local bit * buffer and bit count in inflate()--for speed when inflate_fast() not used * * 1.2.beta4 1 Jan 2003 * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings * - Move a comment on output buffer sizes from inffast.c to inflate.c * - Add comments in inffast.c to introduce the inflate_fast() routine * - Rearrange window copies in inflate_fast() for speed and simplification * - Unroll last copy for window match in inflate_fast() * - Use local copies of window variables in inflate_fast() for speed * - Pull out common wnext == 0 case for speed in inflate_fast() * - Make op and len in inflate_fast() unsigned for consistency * - Add FAR to lcode and dcode declarations in inflate_fast() * - Simplified bad distance check in inflate_fast() * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new * source file infback.c to provide a call-back interface to inflate for * programs like gzip and unzip -- uses window as output buffer to avoid * window copying * * 1.2.beta5 1 Jan 2003 * - Improved inflateBack() interface to allow the caller to provide initial * input in strm. * - Fixed stored blocks bug in inflateBack() * * 1.2.beta6 4 Jan 2003 * - Added comments in inffast.c on effectiveness of POSTINC * - Typecasting all around to reduce compiler warnings * - Changed loops from while (1) or do {} while (1) to for (;;), again to * make compilers happy * - Changed type of window in inflateBackInit() to unsigned char * * * 1.2.beta7 27 Jan 2003 * - Changed many types to unsigned or unsigned short to avoid warnings * - Added inflateCopy() function * * 1.2.0 9 Mar 2003 * - Changed inflateBack() interface to provide separate opaque descriptors * for the in() and out() functions * - Changed inflateBack() argument and in_func typedef to swap the length * and buffer address return values for the input function * - Check next_in and next_out for Z_NULL on entry to inflate() * * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. */ #include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h" #ifdef MAKEFIXED # ifndef BUILDFIXED # define BUILDFIXED # endif #endif /* function prototypes */ local void fixedtables OF((struct inflate_state FAR *state)); local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, unsigned copy)); #ifdef BUILDFIXED void makefixed OF((void)); #endif local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf, unsigned len)); int ZEXPORT inflateResetKeep(strm) z_streamp strm; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; strm->total_in = strm->total_out = state->total = 0; strm->start_bit = strm->stop_bit = strm->last_bit = 0; strm->msg = Z_NULL; if (state->wrap) /* to support ill-conceived Java test suite */ strm->adler = state->wrap & 1; state->mode = HEAD; state->last = 0; state->havedict = 0; state->dmax = 32768U; state->head = Z_NULL; state->hold = 0; state->bits = 0; state->lencode = state->distcode = state->next = state->codes; state->sane = 1; state->back = -1; Tracev((stderr, "inflate: reset\n")); return Z_OK; } int ZEXPORT inflateReset(strm) z_streamp strm; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; state->wsize = 0; state->whave = 0; state->wnext = 0; return inflateResetKeep(strm); } int ZEXPORT inflateReset2(strm, windowBits) z_streamp strm; int windowBits; { int wrap; struct inflate_state FAR *state; /* get the state */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; /* extract wrap request from windowBits parameter */ if (windowBits < 0) { wrap = 0; windowBits = -windowBits; } else { wrap = (windowBits >> 4) + 1; #ifdef GUNZIP if (windowBits < 48) windowBits &= 15; #endif } /* set number of window bits, free window if different */ if (windowBits && (windowBits < 8 || windowBits > 15)) return Z_STREAM_ERROR; if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { ZFREE(strm, state->window); state->window = Z_NULL; } /* update state and reset the rest of it */ state->wrap = wrap; state->wbits = (unsigned)windowBits; return inflateReset(strm); } int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) z_streamp strm; int windowBits; const char *version; int stream_size; { int ret; struct inflate_state FAR *state; if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream))) return Z_VERSION_ERROR; if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; /* in case we return an error */ if (strm->zalloc == (alloc_func)0) { #ifdef Z_SOLO return Z_STREAM_ERROR; #else strm->zalloc = zcalloc; strm->opaque = (voidpf)0; #endif } if (strm->zfree == (free_func)0) #ifdef Z_SOLO return Z_STREAM_ERROR; #else strm->zfree = zcfree; #endif state = (struct inflate_state FAR *) ZALLOC(strm, 1, sizeof(struct inflate_state)); if (state == Z_NULL) return Z_MEM_ERROR; Tracev((stderr, "inflate: allocated\n")); strm->state = (struct internal_state FAR *)state; state->window = Z_NULL; ret = inflateReset2(strm, windowBits); if (ret != Z_OK) { ZFREE(strm, state); strm->state = Z_NULL; } return ret; } int ZEXPORT inflateInit_(strm, version, stream_size) z_streamp strm; const char *version; int stream_size; { return inflateInit2_(strm, DEF_WBITS, version, stream_size); } int ZEXPORT inflatePrime(strm, bits, value) z_streamp strm; int bits; int value; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (bits < 0) { state->hold = 0; state->bits = 0; return Z_OK; } if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; value &= (1L << bits) - 1; state->hold += value << state->bits; state->bits += bits; return Z_OK; } /* Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. If BUILDFIXED is defined, then instead this routine builds the tables the first time it's called, and returns those tables the first time and thereafter. This reduces the size of the code by about 2K bytes, in exchange for a little execution time. However, BUILDFIXED should not be used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ local void fixedtables(state) struct inflate_state FAR *state; { #ifdef BUILDFIXED static int virgin = 1; static code *lenfix, *distfix; static code fixed[544]; /* build fixed huffman tables if first call (may not be thread safe) */ if (virgin) { unsigned sym, bits; static code *next; /* literal/length table */ sym = 0; while (sym < 144) state->lens[sym++] = 8; while (sym < 256) state->lens[sym++] = 9; while (sym < 280) state->lens[sym++] = 7; while (sym < 288) state->lens[sym++] = 8; next = fixed; lenfix = next; bits = 9; inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); /* distance table */ sym = 0; while (sym < 32) state->lens[sym++] = 5; distfix = next; bits = 5; inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); /* do this just once */ virgin = 0; } #else /* !BUILDFIXED */ # include "inffixed.h" #endif /* BUILDFIXED */ state->lencode = lenfix; state->lenbits = 9; state->distcode = distfix; state->distbits = 5; } #ifdef MAKEFIXED #include /* Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also defines BUILDFIXED, so the tables are built on the fly. makefixed() writes those tables to stdout, which would be piped to inffixed.h. A small program can simply call makefixed to do this: void makefixed(void); int main(void) { makefixed(); return 0; } Then that can be linked with zlib built with MAKEFIXED defined and run: a.out > inffixed.h */ void makefixed() { unsigned low, size; struct inflate_state state; fixedtables(&state); puts(" /* inffixed.h -- table for decoding fixed codes"); puts(" * Generated automatically by makefixed()."); puts(" */"); puts(""); puts(" /* WARNING: this file should *not* be used by applications."); puts(" It is part of the implementation of this library and is"); puts(" subject to change. Applications should only use zlib.h."); puts(" */"); puts(""); size = 1U << 9; printf(" static const code lenfix[%u] = {", size); low = 0; for (;;) { if ((low % 7) == 0) printf("\n "); printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op, state.lencode[low].bits, state.lencode[low].val); if (++low == size) break; putchar(','); } puts("\n };"); size = 1U << 5; printf("\n static const code distfix[%u] = {", size); low = 0; for (;;) { if ((low % 6) == 0) printf("\n "); printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, state.distcode[low].val); if (++low == size) break; putchar(','); } puts("\n };"); } #endif /* MAKEFIXED */ /* Update the window with the last wsize (normally 32K) bytes written before returning. If window does not exist yet, create it. This is only called when a window is already in use, or when output has been written during this inflate call, but the end of the deflate stream has not been reached yet. It is also called to create a window for dictionary data when a dictionary is loaded. Providing output buffers larger than 32K to inflate() should provide a speed advantage, since only the last 32K of output is copied to the sliding window upon return from inflate(), and since all distances after the first 32K of output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches. */ local int updatewindow(strm, end, copy) z_streamp strm; const Bytef *end; unsigned copy; { struct inflate_state FAR *state; unsigned dist; state = (struct inflate_state FAR *)strm->state; /* if it hasn't been done already, allocate space for the window */ if (state->window == Z_NULL) { state->window = (unsigned char FAR *) ZALLOC(strm, 1U << state->wbits, sizeof(unsigned char)); if (state->window == Z_NULL) return 1; } /* if window not in use yet, initialize */ if (state->wsize == 0) { state->wsize = 1U << state->wbits; state->wnext = 0; state->whave = 0; } /* copy state->wsize or less output bytes into the circular window */ if (copy >= state->wsize) { zmemcpy(state->window, end - state->wsize, state->wsize); state->wnext = 0; state->whave = state->wsize; } else { dist = state->wsize - state->wnext; if (dist > copy) dist = copy; zmemcpy(state->window + state->wnext, end - copy, dist); copy -= dist; if (copy) { zmemcpy(state->window, end - copy, copy); state->wnext = copy; state->whave = state->wsize; } else { state->wnext += dist; if (state->wnext == state->wsize) state->wnext = 0; if (state->whave < state->wsize) state->whave += dist; } } return 0; } /* Macros for inflate(): */ /* check function to use adler32() for zlib or crc32() for gzip */ #ifdef GUNZIP # define UPDATE(check, buf, len) \ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) #else # define UPDATE(check, buf, len) adler32(check, buf, len) #endif /* check macros for header crc */ #ifdef GUNZIP # define CRC2(check, word) \ do { \ hbuf[0] = (unsigned char)(word); \ hbuf[1] = (unsigned char)((word) >> 8); \ check = crc32(check, hbuf, 2); \ } while (0) # define CRC4(check, word) \ do { \ hbuf[0] = (unsigned char)(word); \ hbuf[1] = (unsigned char)((word) >> 8); \ hbuf[2] = (unsigned char)((word) >> 16); \ hbuf[3] = (unsigned char)((word) >> 24); \ check = crc32(check, hbuf, 4); \ } while (0) #endif /* Load registers with state in inflate() for speed */ #define LOAD() \ do { \ put = strm->next_out; \ left = strm->avail_out; \ next = strm->next_in; \ have = strm->avail_in; \ hold = state->hold; \ bits = state->bits; \ } while (0) /* Restore state from registers in inflate() */ #define RESTORE() \ do { \ strm->next_out = put; \ strm->avail_out = left; \ strm->next_in = next; \ strm->avail_in = have; \ state->hold = hold; \ state->bits = bits; \ } while (0) /* Clear the input bit accumulator */ #define INITBITS() \ do { \ hold = 0; \ bits = 0; \ } while (0) /* Get a byte of input into the bit accumulator, or return from inflate() if there is no input available. */ #define PULLBYTE() \ do { \ if (have == 0) goto inf_leave; \ have--; \ hold += (unsigned long)(*next++) << bits; \ bits += 8; \ } while (0) /* Assure that there are at least n bits in the bit accumulator. If there is not enough available input to do that, then return from inflate(). */ #define NEEDBITS(n) \ do { \ while (bits < (unsigned)(n)) \ PULLBYTE(); \ } while (0) /* Return the low n bits of the bit accumulator (n < 16) */ #define BITS(n) \ ((unsigned)hold & ((1U << (n)) - 1)) /* Remove n bits from the bit accumulator */ #define DROPBITS(n) \ do { \ hold >>= (n); \ bits -= (unsigned)(n); \ } while (0) /* Remove zero to seven bits as needed to go to a byte boundary */ #define BYTEBITS() \ do { \ hold >>= bits & 7; \ bits -= bits & 7; \ } while (0) /* inflate() uses a state machine to process as much input data and generate as much output data as possible before returning. The state machine is structured roughly as follows: for (;;) switch (state) { ... case STATEn: if (not enough input data or output space to make progress) return; ... make progress ... state = STATEm; break; ... } so when inflate() is called again, the same case is attempted again, and if the appropriate resources are provided, the machine proceeds to the next state. The NEEDBITS() macro is usually the way the state evaluates whether it can proceed or should return. NEEDBITS() does the return if the requested bits are not available. The typical use of the BITS macros is: NEEDBITS(n); ... do something with BITS(n) ... DROPBITS(n); where NEEDBITS(n) either returns from inflate() if there isn't enough input left to load n bits into the accumulator, or it continues. BITS(n) gives the low n bits in the accumulator. When done, DROPBITS(n) drops the low n bits off the accumulator. INITBITS() clears the accumulator and sets the number of available bits to zero. BYTEBITS() discards just enough bits to put the accumulator on a byte boundary. After BYTEBITS() and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return if there is no input available. The decoding of variable length codes uses PULLBYTE() directly in order to pull just enough bytes to decode the next code, and no more. Some states loop until they get enough input, making sure that enough state information is maintained to continue the loop where it left off if NEEDBITS() returns in the loop. For example, want, need, and keep would all have to actually be part of the saved state in case NEEDBITS() returns: case STATEw: while (want < need) { NEEDBITS(n); keep[want++] = BITS(n); DROPBITS(n); } state = STATEx; case STATEx: As shown above, if the next state is also the next case, then the break is omitted. A state may also return if there is not enough output space available to complete that state. Those states are copying stored data, writing a literal byte, and copying a matching string. When returning, a "goto inf_leave" is used to update the total counters, update the check value, and determine whether any progress has been made during that inflate() call in order to return the proper return code. Progress is defined as a change in either strm->avail_in or strm->avail_out. When there is a window, goto inf_leave will update the window with the last output written. If a goto inf_leave occurs in the middle of decompression and there is no window currently, goto inf_leave will create one and copy output to the window for the next call of inflate(). In this implementation, the flush parameter of inflate() only affects the return code (per zlib.h). inflate() always writes as much as possible to strm->next_out, given the space available and the provided input--the effect documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers the allocation of and copying into a sliding window until necessary, which provides the effect documented in zlib.h for Z_FINISH when the entire input stream available. So the only thing the flush parameter actually does is: when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it will return Z_BUF_ERROR if it has not reached the end of the stream. */ int ZEXPORT inflate(strm, flush) z_streamp strm; int flush; { struct inflate_state FAR *state; z_const unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsigned long hold; /* bit buffer */ unsigned bits; /* bits in bit buffer */ unsigned in, out; /* save starting available input and output */ unsigned copy; /* number of stored or match bytes to copy */ unsigned char FAR *from; /* where to copy match bytes from */ code here; /* current decoding table entry */ code last; /* parent table entry */ unsigned len; /* length to copy for repeats, bits to drop */ int ret; /* return code */ #ifdef GUNZIP unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ #endif static const unsigned short order[19] = /* permutation of code lengths */ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || (strm->next_in == Z_NULL && strm->avail_in != 0)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ LOAD(); in = have; out = left; ret = Z_OK; for (;;) switch (state->mode) { case HEAD: if (state->wrap == 0) { state->mode = TYPEDO; break; } NEEDBITS(16); #ifdef GUNZIP if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ state->check = crc32(0L, Z_NULL, 0); CRC2(state->check, hold); INITBITS(); state->mode = FLAGS; break; } state->flags = 0; /* expect zlib header */ if (state->head != Z_NULL) state->head->done = -1; if (!(state->wrap & 1) || /* check if zlib header allowed */ #else if ( #endif ((BITS(8) << 8) + (hold >> 8)) % 31) { strm->msg = "incorrect header check"; state->mode = BAD; break; } if (BITS(4) != Z_DEFLATED) { strm->msg = "unknown compression method"; state->mode = BAD; break; } DROPBITS(4); len = BITS(4) + 8; if (state->wbits == 0) state->wbits = len; else if (len > state->wbits) { strm->msg = "invalid window size"; state->mode = BAD; break; } state->dmax = 1U << len; Tracev((stderr, "inflate: zlib header ok\n")); strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = hold & 0x200 ? DICTID : TYPE; INITBITS(); break; #ifdef GUNZIP case FLAGS: NEEDBITS(16); state->flags = (int)(hold); if ((state->flags & 0xff) != Z_DEFLATED) { strm->msg = "unknown compression method"; state->mode = BAD; break; } if (state->flags & 0xe000) { strm->msg = "unknown header flags set"; state->mode = BAD; break; } if (state->head != Z_NULL) state->head->text = (int)((hold >> 8) & 1); if (state->flags & 0x0200) CRC2(state->check, hold); INITBITS(); state->mode = TIME; case TIME: NEEDBITS(32); if (state->head != Z_NULL) state->head->time = hold; if (state->flags & 0x0200) CRC4(state->check, hold); INITBITS(); state->mode = OS; case OS: NEEDBITS(16); if (state->head != Z_NULL) { state->head->xflags = (int)(hold & 0xff); state->head->os = (int)(hold >> 8); } if (state->flags & 0x0200) CRC2(state->check, hold); INITBITS(); state->mode = EXLEN; case EXLEN: if (state->flags & 0x0400) { NEEDBITS(16); state->length = (unsigned)(hold); if (state->head != Z_NULL) state->head->extra_len = (unsigned)hold; if (state->flags & 0x0200) CRC2(state->check, hold); INITBITS(); } else if (state->head != Z_NULL) state->head->extra = Z_NULL; state->mode = EXTRA; case EXTRA: if (state->flags & 0x0400) { copy = state->length; if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && state->head->extra != Z_NULL) { len = state->head->extra_len - state->length; zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy); } if (state->flags & 0x0200) state->check = crc32(state->check, next, copy); have -= copy; next += copy; state->length -= copy; } if (state->length) goto inf_leave; } state->length = 0; state->mode = NAME; case NAME: if (state->flags & 0x0800) { if (have == 0) goto inf_leave; copy = 0; do { len = (unsigned)(next[copy++]); if (state->head != Z_NULL && state->head->name != Z_NULL && state->length < state->head->name_max) state->head->name[state->length++] = len; } while (len && copy < have); if (state->flags & 0x0200) state->check = crc32(state->check, next, copy); have -= copy; next += copy; if (len) goto inf_leave; } else if (state->head != Z_NULL) state->head->name = Z_NULL; state->length = 0; state->mode = COMMENT; case COMMENT: if (state->flags & 0x1000) { if (have == 0) goto inf_leave; copy = 0; do { len = (unsigned)(next[copy++]); if (state->head != Z_NULL && state->head->comment != Z_NULL && state->length < state->head->comm_max) state->head->comment[state->length++] = len; } while (len && copy < have); if (state->flags & 0x0200) state->check = crc32(state->check, next, copy); have -= copy; next += copy; if (len) goto inf_leave; } else if (state->head != Z_NULL) state->head->comment = Z_NULL; state->mode = HCRC; case HCRC: if (state->flags & 0x0200) { NEEDBITS(16); if (hold != (state->check & 0xffff)) { strm->msg = "header crc mismatch"; state->mode = BAD; break; } INITBITS(); } if (state->head != Z_NULL) { state->head->hcrc = (int)((state->flags >> 9) & 1); state->head->done = 1; } strm->adler = state->check = crc32(0L, Z_NULL, 0); state->mode = TYPE; break; #endif case DICTID: NEEDBITS(32); strm->adler = state->check = ZSWAP32(hold); INITBITS(); state->mode = DICT; case DICT: if (state->havedict == 0) { RESTORE(); return Z_NEED_DICT; } strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = TYPE; case TYPE: if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; case TYPEDO: if (strm->start_bit == 0) strm->start_bit = 8 * (strm->total_in + in - have) - bits; if (state->last) { strm->stop_bit = 8 * (strm->total_in + in - have) - bits; BYTEBITS(); state->mode = CHECK; break; } NEEDBITS(3); state->last = BITS(1); if (state->last) strm->last_bit = 8 * (strm->total_in + in - have) - bits; DROPBITS(1); switch (BITS(2)) { case 0: /* stored block */ Tracev((stderr, "inflate: stored block%s\n", state->last ? " (last)" : "")); state->mode = STORED; break; case 1: /* fixed block */ fixedtables(state); Tracev((stderr, "inflate: fixed codes block%s\n", state->last ? " (last)" : "")); state->mode = LEN_; /* decode codes */ if (flush == Z_TREES) { DROPBITS(2); goto inf_leave; } break; case 2: /* dynamic block */ Tracev((stderr, "inflate: dynamic codes block%s\n", state->last ? " (last)" : "")); state->mode = TABLE; break; case 3: strm->msg = "invalid block type"; state->mode = BAD; } DROPBITS(2); break; case STORED: BYTEBITS(); /* go to byte boundary */ NEEDBITS(32); if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { strm->msg = "invalid stored block lengths"; state->mode = BAD; break; } state->length = (unsigned)hold & 0xffff; Tracev((stderr, "inflate: stored length %u\n", state->length)); INITBITS(); state->mode = COPY_; if (flush == Z_TREES) goto inf_leave; case COPY_: state->mode = COPY; case COPY: copy = state->length; if (copy) { if (copy > have) copy = have; if (copy > left) copy = left; if (copy == 0) goto inf_leave; zmemcpy(put, next, copy); have -= copy; next += copy; left -= copy; put += copy; state->length -= copy; break; } Tracev((stderr, "inflate: stored end\n")); state->mode = TYPE; break; case TABLE: NEEDBITS(14); state->nlen = BITS(5) + 257; DROPBITS(5); state->ndist = BITS(5) + 1; DROPBITS(5); state->ncode = BITS(4) + 4; DROPBITS(4); #ifndef PKZIP_BUG_WORKAROUND if (state->nlen > 286 || state->ndist > 30) { strm->msg = "too many length or distance symbols"; state->mode = BAD; break; } #endif Tracev((stderr, "inflate: table sizes ok\n")); state->have = 0; state->mode = LENLENS; case LENLENS: while (state->have < state->ncode) { NEEDBITS(3); state->lens[order[state->have++]] = (unsigned short)BITS(3); DROPBITS(3); } while (state->have < 19) state->lens[order[state->have++]] = 0; state->next = state->codes; state->lencode = (const code FAR *)(state->next); state->lenbits = 7; ret = inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = "invalid code lengths set"; state->mode = BAD; break; } Tracev((stderr, "inflate: code lengths ok\n")); state->have = 0; state->mode = CODELENS; case CODELENS: while (state->have < state->nlen + state->ndist) { for (;;) { here = state->lencode[BITS(state->lenbits)]; if ((unsigned)(here.bits) <= bits) break; PULLBYTE(); } if (here.val < 16) { DROPBITS(here.bits); state->lens[state->have++] = here.val; } else { if (here.val == 16) { NEEDBITS(here.bits + 2); DROPBITS(here.bits); if (state->have == 0) { strm->msg = "invalid bit length repeat"; state->mode = BAD; break; } len = state->lens[state->have - 1]; copy = 3 + BITS(2); DROPBITS(2); } else if (here.val == 17) { NEEDBITS(here.bits + 3); DROPBITS(here.bits); len = 0; copy = 3 + BITS(3); DROPBITS(3); } else { NEEDBITS(here.bits + 7); DROPBITS(here.bits); len = 0; copy = 11 + BITS(7); DROPBITS(7); } if (state->have + copy > state->nlen + state->ndist) { strm->msg = "invalid bit length repeat"; state->mode = BAD; break; } while (copy--) state->lens[state->have++] = (unsigned short)len; } } /* handle error breaks in while */ if (state->mode == BAD) break; /* check for end-of-block code (better have one) */ if (state->lens[256] == 0) { strm->msg = "invalid code -- missing end-of-block"; state->mode = BAD; break; } /* build code tables -- note: do not change the lenbits or distbits values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ state->next = state->codes; state->lencode = (const code FAR *)(state->next); state->lenbits = 9; ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = "invalid literal/lengths set"; state->mode = BAD; break; } state->distcode = (const code FAR *)(state->next); state->distbits = 6; ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, &(state->next), &(state->distbits), state->work); if (ret) { strm->msg = "invalid distances set"; state->mode = BAD; break; } Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN_; if (flush == Z_TREES) goto inf_leave; case LEN_: state->mode = LEN; case LEN: if (have >= 6 && left >= 258) { RESTORE(); inflate_fast(strm, out); LOAD(); if (state->mode == TYPE) state->back = -1; break; } state->back = 0; for (;;) { here = state->lencode[BITS(state->lenbits)]; if ((unsigned)(here.bits) <= bits) break; PULLBYTE(); } if (here.op && (here.op & 0xf0) == 0) { last = here; for (;;) { here = state->lencode[last.val + (BITS(last.bits + last.op) >> last.bits)]; if ((unsigned)(last.bits + here.bits) <= bits) break; PULLBYTE(); } DROPBITS(last.bits); state->back += last.bits; } DROPBITS(here.bits); state->back += here.bits; state->length = (unsigned)here.val; if ((int)(here.op) == 0) { Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? "inflate: literal '%c'\n" : "inflate: literal 0x%02x\n", here.val)); state->mode = LIT; break; } if (here.op & 32) { Tracevv((stderr, "inflate: end of block\n")); state->back = -1; state->mode = TYPE; break; } if (here.op & 64) { strm->msg = "invalid literal/length code"; state->mode = BAD; break; } state->extra = (unsigned)(here.op) & 15; state->mode = LENEXT; case LENEXT: if (state->extra) { NEEDBITS(state->extra); state->length += BITS(state->extra); DROPBITS(state->extra); state->back += state->extra; } Tracevv((stderr, "inflate: length %u\n", state->length)); state->was = state->length; state->mode = DIST; case DIST: for (;;) { here = state->distcode[BITS(state->distbits)]; if ((unsigned)(here.bits) <= bits) break; PULLBYTE(); } if ((here.op & 0xf0) == 0) { last = here; for (;;) { here = state->distcode[last.val + (BITS(last.bits + last.op) >> last.bits)]; if ((unsigned)(last.bits + here.bits) <= bits) break; PULLBYTE(); } DROPBITS(last.bits); state->back += last.bits; } DROPBITS(here.bits); state->back += here.bits; if (here.op & 64) { strm->msg = "invalid distance code"; state->mode = BAD; break; } state->offset = (unsigned)here.val; state->extra = (unsigned)(here.op) & 15; state->mode = DISTEXT; case DISTEXT: if (state->extra) { NEEDBITS(state->extra); state->offset += BITS(state->extra); DROPBITS(state->extra); state->back += state->extra; } #ifdef INFLATE_STRICT if (state->offset > state->dmax) { strm->msg = "invalid distance too far back"; state->mode = BAD; break; } #endif Tracevv((stderr, "inflate: distance %u\n", state->offset)); state->mode = MATCH; case MATCH: if (left == 0) goto inf_leave; copy = out - left; if (state->offset > copy) { /* copy from window */ copy = state->offset - copy; if (copy > state->whave) { if (state->sane) { strm->msg = "invalid distance too far back"; state->mode = BAD; break; } #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR Trace((stderr, "inflate.c too far\n")); copy -= state->whave; if (copy > state->length) copy = state->length; if (copy > left) copy = left; left -= copy; state->length -= copy; do { *put++ = 0; } while (--copy); if (state->length == 0) state->mode = LEN; break; #endif } if (copy > state->wnext) { copy -= state->wnext; from = state->window + (state->wsize - copy); } else from = state->window + (state->wnext - copy); if (copy > state->length) copy = state->length; } else { /* copy from output */ from = put - state->offset; copy = state->length; } if (copy > left) copy = left; left -= copy; state->length -= copy; do { *put++ = *from++; } while (--copy); if (state->length == 0) state->mode = LEN; break; case LIT: if (left == 0) goto inf_leave; *put++ = (unsigned char)(state->length); left--; state->mode = LEN; break; case CHECK: if (state->wrap) { NEEDBITS(32); out -= left; strm->total_out += out; state->total += out; if (out) strm->adler = state->check = UPDATE(state->check, put - out, out); out = left; if (( #ifdef GUNZIP state->flags ? hold : #endif ZSWAP32(hold)) != state->check) { strm->msg = "incorrect data check"; state->mode = BAD; break; } INITBITS(); Tracev((stderr, "inflate: check matches trailer\n")); } #ifdef GUNZIP state->mode = LENGTH; case LENGTH: if (state->wrap && state->flags) { NEEDBITS(32); if (hold != (state->total & 0xffffffffUL)) { strm->msg = "incorrect length check"; state->mode = BAD; break; } INITBITS(); Tracev((stderr, "inflate: length matches trailer\n")); } #endif state->mode = DONE; case DONE: ret = Z_STREAM_END; goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; case MEM: return Z_MEM_ERROR; case SYNC: default: return Z_STREAM_ERROR; } /* Return from inflate(), updating the total counts and the check value. If there was no progress during the inflate() call, return a buffer error. Call updatewindow() to create and/or update the window state. Note: a memory error from inflate() is non-recoverable. */ inf_leave: RESTORE(); if (state->wsize || (out != strm->avail_out && state->mode < BAD && (state->mode < CHECK || flush != Z_FINISH))) if (updatewindow(strm, strm->next_out, out - strm->avail_out)) { state->mode = MEM; return Z_MEM_ERROR; } in -= strm->avail_in; out -= strm->avail_out; strm->total_in += in; strm->total_out += out; state->total += out; if (state->wrap && out) strm->adler = state->check = UPDATE(state->check, strm->next_out - out, out); strm->data_type = state->bits + (state->last ? 64 : 0) + (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) ret = Z_BUF_ERROR; return ret; } int ZEXPORT inflateEnd(strm) z_streamp strm; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->window != Z_NULL) ZFREE(strm, state->window); ZFREE(strm, strm->state); strm->state = Z_NULL; Tracev((stderr, "inflate: end\n")); return Z_OK; } int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength) z_streamp strm; Bytef *dictionary; uInt *dictLength; { struct inflate_state FAR *state; /* check state */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; /* copy dictionary */ if (state->whave && dictionary != Z_NULL) { zmemcpy(dictionary, state->window + state->wnext, state->whave - state->wnext); zmemcpy(dictionary + state->whave - state->wnext, state->window, state->wnext); } if (dictLength != Z_NULL) *dictLength = state->whave; return Z_OK; } int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; { struct inflate_state FAR *state; unsigned long dictid; int ret; /* check state */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->wrap != 0 && state->mode != DICT) return Z_STREAM_ERROR; /* check for correct dictionary identifier */ if (state->mode == DICT) { dictid = adler32(0L, Z_NULL, 0); dictid = adler32(dictid, dictionary, dictLength); if (dictid != state->check) return Z_DATA_ERROR; } /* copy dictionary to window using updatewindow(), which will amend the existing dictionary if appropriate */ ret = updatewindow(strm, dictionary + dictLength, dictLength); if (ret) { state->mode = MEM; return Z_MEM_ERROR; } state->havedict = 1; Tracev((stderr, "inflate: dictionary set\n")); return Z_OK; } int ZEXPORT inflateGetHeader(strm, head) z_streamp strm; gz_headerp head; { struct inflate_state FAR *state; /* check state */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; /* save header structure */ state->head = head; head->done = 0; return Z_OK; } /* Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found or when out of input. When called, *have is the number of pattern bytes found in order so far, in 0..3. On return *have is updated to the new state. If on return *have equals four, then the pattern was found and the return value is how many bytes were read including the last byte of the pattern. If *have is less than four, then the pattern has not been found yet and the return value is len. In the latter case, syncsearch() can be called again with more data and the *have state. *have is initialized to zero for the first call. */ local unsigned syncsearch(have, buf, len) unsigned FAR *have; const unsigned char FAR *buf; unsigned len; { unsigned got; unsigned next; got = *have; next = 0; while (next < len && got < 4) { if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) got++; else if (buf[next]) got = 0; else got = 4 - got; next++; } *have = got; return next; } int ZEXPORT inflateSync(strm) z_streamp strm; { unsigned len; /* number of bytes to look at or looked at */ unsigned long in, out; /* temporary to save total_in and total_out */ unsigned char buf[4]; /* to restore bit buffer to byte string */ struct inflate_state FAR *state; /* check parameters */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; state->hold <<= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { buf[len++] = (unsigned char)(state->hold); state->hold >>= 8; state->bits -= 8; } state->have = 0; syncsearch(&(state->have), buf, len); } /* search available input */ len = syncsearch(&(state->have), strm->next_in, strm->avail_in); strm->avail_in -= len; strm->next_in += len; strm->total_in += len; /* return no joy or set up to restart inflate() on a new block */ if (state->have != 4) return Z_DATA_ERROR; in = strm->total_in; out = strm->total_out; inflateReset(strm); strm->total_in = in; strm->total_out = out; state->mode = TYPE; return Z_OK; } /* Returns true if inflate is currently at the end of a block generated by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored block. When decompressing, PPP checks that at the end of input packet, inflate is waiting for these length bytes. */ int ZEXPORT inflateSyncPoint(strm) z_streamp strm; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; return state->mode == STORED && state->bits == 0; } int ZEXPORT inflateCopy(dest, source) z_streamp dest; z_streamp source; { struct inflate_state FAR *state; struct inflate_state FAR *copy; unsigned char FAR *window; unsigned wsize; /* check input */ if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)source->state; /* allocate space */ copy = (struct inflate_state FAR *) ZALLOC(source, 1, sizeof(struct inflate_state)); if (copy == Z_NULL) return Z_MEM_ERROR; window = Z_NULL; if (state->window != Z_NULL) { window = (unsigned char FAR *) ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); if (window == Z_NULL) { ZFREE(source, copy); return Z_MEM_ERROR; } } /* copy state */ zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state)); if (state->lencode >= state->codes && state->lencode <= state->codes + ENOUGH - 1) { copy->lencode = copy->codes + (state->lencode - state->codes); copy->distcode = copy->codes + (state->distcode - state->codes); } copy->next = copy->codes + (state->next - state->codes); if (window != Z_NULL) { wsize = 1U << state->wbits; zmemcpy(window, state->window, wsize); } copy->window = window; dest->state = (struct internal_state FAR *)copy; return Z_OK; } int ZEXPORT inflateUndermine(strm, subvert) z_streamp strm; int subvert; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; state->sane = !subvert; #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR return Z_OK; #else state->sane = 1; return Z_DATA_ERROR; #endif } long ZEXPORT inflateMark(strm) z_streamp strm; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return -(1L << 16); state = (struct inflate_state FAR *)strm->state; return ((long)(state->back) << 16) + (state->mode == COPY ? state->length : (state->mode == MATCH ? state->was - state->length : 0)); } varnish-4.1.1/lib/libvgz/inftrees.c0000644000201500234410000003141312652366721014146 00000000000000/* inftrees.c -- generate Huffman trees for efficient decoding * Copyright (C) 1995-2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" #define MAXBITS 15 extern const char inflate_copyright[]; const char inflate_copyright[] = " inflate 1.2.8 Copyright 1995-2013 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot include such an acknowledgment, I would appreciate that you keep this copyright string in the executable of your product. */ /* Build a set of tables to decode the provided canonical Huffman code. The code lengths are lens[0..codes-1]. The result starts at *table, whose indices are 0..2^bits-1. work is a writable array of at least lens shorts, which is used as a work area. type is the type of code to be generated, CODES, LENS, or DISTS. On return, zero is success, -1 is an invalid code, and +1 means that ENOUGH isn't enough. table on return points to the next available entry's address. bits is the requested root table index bits, and on return it is the actual root table index bits. It will differ if the request is greater than the longest code or if it is less than the shortest code. */ int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) codetype type; unsigned short FAR *lens; unsigned codes; code FAR * FAR *table; unsigned FAR *bits; unsigned short FAR *work; { unsigned len; /* a code's length in bits */ unsigned sym; /* index of code symbols */ unsigned min, max; /* minimum and maximum code lengths */ unsigned root; /* number of index bits for root table */ unsigned curr; /* number of index bits for current table */ unsigned drop; /* code bits to drop for sub-table */ int left; /* number of prefix codes available */ unsigned used; /* code entries in table used */ unsigned huff; /* Huffman code */ unsigned incr; /* for incrementing code, index */ unsigned fill; /* index for replicating entries */ unsigned low; /* low bits for current root entry */ unsigned mask; /* mask for low root bits */ code here; /* table entry for duplication */ code FAR *next; /* next available space in table */ const unsigned short FAR *base; /* base value table to use */ const unsigned short FAR *extra; /* extra bits table to use */ int end; /* use base and extra for symbol > end */ unsigned short count[MAXBITS+1]; /* number of codes of each length */ unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ static const unsigned short lbase[31] = { /* Length codes 257..285 base */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0}; static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64}; /* Process a set of code lengths to create a canonical Huffman code. The code lengths are lens[0..codes-1]. Each length corresponds to the symbols 0..codes-1. The Huffman code is generated by first sorting the symbols by length from short to long, and retaining the symbol order for codes with equal lengths. Then the code starts with all zero bits for the first code of the shortest length, and the codes are integer increments for the same length, and zeros are appended as the length increases. For the deflate format, these bits are stored backwards from their more natural integer increment ordering, and so when the decoding tables are built in the large loop below, the integer codes are incremented backwards. This routine assumes, but does not check, that all of the entries in lens[] are in the range 0..MAXBITS. The caller must assure this. 1..MAXBITS is interpreted as that code length. zero means that that symbol does not occur in this code. The codes are sorted by computing a count of codes for each length, creating from that a table of starting indices for each length in the sorted table, and then entering the symbols in order in the sorted table. The sorted table is work[], with that space being provided by the caller. The length counts are used for other purposes as well, i.e. finding the minimum and maximum length codes, determining if there are any codes at all, checking for a valid set of lengths, and looking ahead at length counts to determine sub-table sizes when building the decoding tables. */ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ for (len = 0; len <= MAXBITS; len++) count[len] = 0; for (sym = 0; sym < codes; sym++) count[lens[sym]]++; /* bound code lengths, force root to be within code lengths */ root = *bits; for (max = MAXBITS; max >= 1; max--) if (count[max] != 0) break; if (root > max) root = max; if (max == 0) { /* no symbols to code at all */ here.op = (unsigned char)64; /* invalid code marker */ here.bits = (unsigned char)1; here.val = (unsigned short)0; *(*table)++ = here; /* make a table to force an error */ *(*table)++ = here; *bits = 1; return 0; /* no symbols, but wait for decoding to report error */ } for (min = 1; min < max; min++) if (count[min] != 0) break; if (root < min) root = min; /* check for an over-subscribed or incomplete set of lengths */ left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= count[len]; if (left < 0) return -1; /* over-subscribed */ } if (left > 0 && (type == CODES || max != 1)) return -1; /* incomplete set */ /* generate offsets into symbol table for each length for sorting */ offs[1] = 0; for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + count[len]; /* sort symbols by length, by symbol order within each length */ for (sym = 0; sym < codes; sym++) if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; /* Create and fill in decoding tables. In this loop, the table being filled is at next and has curr index bits. The code being used is huff with length len. That code is converted to an index by dropping drop bits off of the bottom. For codes where len is less than drop + curr, those top drop + curr - len bits are incremented through all values to fill the table with replicated entries. root is the number of index bits for the root table. When len exceeds root, sub-tables are created pointed to by the root entry with an index of the low root bits of huff. This is saved in low to check for when a new sub-table should be started. drop is zero when the root table is being filled, and drop is root when sub-tables are being filled. When a new sub-table is needed, it is necessary to look ahead in the code lengths to determine what size sub-table is needed. The length counts are used for this, and so count[] is decremented as codes are entered in the tables. used keeps track of how many table entries have been allocated from the provided *table space. It is checked for LENS and DIST tables against the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in the initial root table size constants. See the comments in inftrees.h for more information. sym increments through all symbols, and the loop terminates when all codes of length max, i.e. all codes, have been processed. This routine permits incomplete codes, so another loop after this one fills in the rest of the decoding tables with invalid code markers. */ /* set up for code type */ switch (type) { case CODES: base = extra = work; /* dummy value--not used */ end = 19; break; case LENS: base = lbase; base -= 257; extra = lext; extra -= 257; end = 256; break; default: /* DISTS */ base = dbase; extra = dext; end = -1; } /* initialize state for loop */ huff = 0; /* starting code */ sym = 0; /* starting code symbol */ len = min; /* starting code length */ next = *table; /* current table to fill in */ curr = root; /* current table index bits */ drop = 0; /* current bits to drop from code for index */ low = (unsigned)(-1); /* trigger new sub-table when len > root */ used = 1U << root; /* use root table entries */ mask = used - 1; /* mask for comparing low */ /* check available table space */ if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS)) return 1; /* process all codes and make table entries */ for (;;) { /* create table entry */ here.bits = (unsigned char)(len - drop); if ((int)(work[sym]) < end) { here.op = (unsigned char)0; here.val = work[sym]; } else if ((int)(work[sym]) > end) { here.op = (unsigned char)(extra[work[sym]]); here.val = base[work[sym]]; } else { here.op = (unsigned char)(32 + 64); /* end of block */ here.val = 0; } /* replicate for those indices with low len bits equal to huff */ incr = 1U << (len - drop); fill = 1U << curr; min = fill; /* save offset to next table */ do { fill -= incr; next[(huff >> drop) + fill] = here; } while (fill != 0); /* backwards increment the len-bit code huff */ incr = 1U << (len - 1); while (huff & incr) incr >>= 1; if (incr != 0) { huff &= incr - 1; huff += incr; } else huff = 0; /* go to next symbol, update count, len */ sym++; if (--(count[len]) == 0) { if (len == max) break; len = lens[work[sym]]; } /* create new sub-table if needed */ if (len > root && (huff & mask) != low) { /* if first time, transition to sub-tables */ if (drop == 0) drop = root; /* increment past last table */ next += min; /* here min is 1 << curr */ /* determine length of next table */ curr = len - drop; left = (int)(1 << curr); while (curr + drop < max) { left -= count[curr + drop]; if (left <= 0) break; curr++; left <<= 1; } /* check for enough space */ used += 1U << curr; if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS)) return 1; /* point entry in root table to sub-table */ low = huff & mask; (*table)[low].op = (unsigned char)curr; (*table)[low].bits = (unsigned char)root; (*table)[low].val = (unsigned short)(next - *table); } } /* fill in remaining table entry if code is incomplete (guaranteed to have at most one remaining entry, since if the code is incomplete, the maximum code length that was allowed to get this far is one bit) */ if (huff != 0) { here.op = (unsigned char)64; /* invalid code marker */ here.bits = (unsigned char)(len - drop); here.val = (unsigned short)0; next[huff] = here; } /* set return parameters */ *table += used; *bits = root; return 0; } varnish-4.1.1/lib/libvgz/crc32.c0000644000201500234410000003156612652366721013254 00000000000000/* crc32.c -- compute the CRC-32 of a data stream * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h * * Thanks to Rodney Brown for his contribution of faster * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing * tables for updating the shift register in one step with three exclusive-ors * instead of four steps with four exclusive-ors. This results in about a * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. */ /* @(#) $Id$ */ /* Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore protection on the static variables used to control the first-use generation of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should first call get_crc_table() to initialize the tables before allowing more than one thread to use crc32(). DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h. */ #ifdef MAKECRCH # include # ifndef DYNAMIC_CRC_TABLE # define DYNAMIC_CRC_TABLE # endif /* !DYNAMIC_CRC_TABLE */ #endif /* MAKECRCH */ #include "zutil.h" /* for STDC and FAR definitions */ #define local static /* Definitions for doing the crc four data bytes at a time. */ #if !defined(NOBYFOUR) && defined(Z_U4) # define BYFOUR #endif #ifdef BYFOUR local unsigned long crc32_little OF((unsigned long, const unsigned char FAR *, unsigned)); local unsigned long crc32_big OF((unsigned long, const unsigned char FAR *, unsigned)); # define TBLS 8 #else # define TBLS 1 #endif /* BYFOUR */ /* Local functions for crc concatenation */ local unsigned long gf2_matrix_times OF((unsigned long *mat, unsigned long vec)); local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2)); #ifdef DYNAMIC_CRC_TABLE local volatile int crc_table_empty = 1; local z_crc_t FAR crc_table[TBLS][256]; local void make_crc_table OF((void)); #ifdef MAKECRCH local void write_table OF((FILE *, const z_crc_t FAR *)); #endif /* MAKECRCH */ /* Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. Polynomials over GF(2) are represented in binary, one bit per coefficient, with the lowest powers in the most significant bit. Then adding polynomials is just exclusive-or, and multiplying a polynomial by x is a right shift by one. If we call the above polynomial p, and represent a byte as the polynomial q, also with the lowest power in the most significant bit (so the byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, where a mod b means the remainder after dividing a by b. This calculation is done using the shift-register method of multiplying and taking the remainder. The register is initialized to zero, and for each incoming bit, x^32 is added mod p to the register if the bit is a one (where x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by x (which is shifting right by one and adding x^32 mod p if the bit shifted out is a one). We start with the highest power (least significant bit) of q and repeat for all eight bits of q. The first table is simply the CRC of all possible eight bit values. This is all the information needed to generate CRCs on data a byte at a time for all combinations of CRC register values and incoming bytes. The remaining tables allow for word-at-a-time CRC calculation for both big-endian and little- endian machines, where a word is four bytes. */ local void make_crc_table() { z_crc_t c; int n, k; z_crc_t poly; /* polynomial exclusive-or pattern */ /* terms of polynomial defining this crc (except x^32): */ static volatile int first = 1; /* flag to limit concurrent making */ static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; /* See if another task is already doing this (not thread-safe, but better than nothing -- significantly reduces duration of vulnerability in case the advice about DYNAMIC_CRC_TABLE is ignored) */ if (first) { first = 0; /* make exclusive-or pattern from polynomial (0xedb88320UL) */ poly = 0; for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) poly |= (z_crc_t)1 << (31 - p[n]); /* generate a crc for every 8-bit value */ for (n = 0; n < 256; n++) { c = (z_crc_t)n; for (k = 0; k < 8; k++) c = c & 1 ? poly ^ (c >> 1) : c >> 1; crc_table[0][n] = c; } #ifdef BYFOUR /* generate crc for each value followed by one, two, and three zeros, and then the byte reversal of those as well as the first table */ for (n = 0; n < 256; n++) { c = crc_table[0][n]; crc_table[4][n] = ZSWAP32(c); for (k = 1; k < 4; k++) { c = crc_table[0][c & 0xff] ^ (c >> 8); crc_table[k][n] = c; crc_table[k + 4][n] = ZSWAP32(c); } } #endif /* BYFOUR */ crc_table_empty = 0; } else { /* not first */ /* wait for the other guy to finish (not efficient, but rare) */ while (crc_table_empty) ; } #ifdef MAKECRCH /* write out CRC tables to crc32.h */ { FILE *out; out = fopen("crc32.h", "w"); if (out == NULL) return; fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); fprintf(out, "local const z_crc_t FAR "); fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); write_table(out, crc_table[0]); # ifdef BYFOUR fprintf(out, "#ifdef BYFOUR\n"); for (k = 1; k < 8; k++) { fprintf(out, " },\n {\n"); write_table(out, crc_table[k]); } fprintf(out, "#endif\n"); # endif /* BYFOUR */ fprintf(out, " }\n};\n"); fclose(out); } #endif /* MAKECRCH */ } #ifdef MAKECRCH local void write_table(out, table) FILE *out; const z_crc_t FAR *table; { int n; for (n = 0; n < 256; n++) fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", (unsigned long)(table[n]), n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); } #endif /* MAKECRCH */ #else /* !DYNAMIC_CRC_TABLE */ /* ======================================================================== * Tables of CRC-32s of all single-byte values, made by make_crc_table(). */ #include "crc32.h" #endif /* DYNAMIC_CRC_TABLE */ /* ========================================================================= * This function can be used by asm versions of crc32() */ const z_crc_t FAR * ZEXPORT get_crc_table() { #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif /* DYNAMIC_CRC_TABLE */ return (const z_crc_t FAR *)crc_table; } /* ========================================================================= */ #define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 /* ========================================================================= */ unsigned long ZEXPORT crc32(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; uInt len; { if (buf == Z_NULL) return 0UL; #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif /* DYNAMIC_CRC_TABLE */ #ifdef BYFOUR if (sizeof(void *) == sizeof(ptrdiff_t)) { z_crc_t endian; endian = 1; if (*((unsigned char *)(&endian))) return crc32_little(crc, buf, len); else return crc32_big(crc, buf, len); } #endif /* BYFOUR */ crc = crc ^ 0xffffffffUL; while (len >= 8) { DO8; len -= 8; } if (len) do { DO1; } while (--len); return crc ^ 0xffffffffUL; } #ifdef BYFOUR /* ========================================================================= */ #define DOLIT4 c ^= *buf4++; \ c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] #define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 /* ========================================================================= */ local unsigned long crc32_little(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; unsigned len; { register z_crc_t c; register const z_crc_t FAR *buf4; c = (z_crc_t)crc; c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); len--; } buf4 = (const z_crc_t FAR *)(const void FAR *)buf; while (len >= 32) { DOLIT32; len -= 32; } while (len >= 4) { DOLIT4; len -= 4; } buf = (const unsigned char FAR *)buf4; if (len) do { c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); } while (--len); c = ~c; return (unsigned long)c; } /* ========================================================================= */ #define DOBIG4 c ^= *++buf4; \ c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 /* ========================================================================= */ local unsigned long crc32_big(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; unsigned len; { register z_crc_t c; register const z_crc_t FAR *buf4; c = ZSWAP32((z_crc_t)crc); c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); len--; } buf4 = (const z_crc_t FAR *)(const void FAR *)buf; buf4--; while (len >= 32) { DOBIG32; len -= 32; } while (len >= 4) { DOBIG4; len -= 4; } buf4++; buf = (const unsigned char FAR *)buf4; if (len) do { c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); } while (--len); c = ~c; return (unsigned long)(ZSWAP32(c)); } #endif /* BYFOUR */ #define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ /* ========================================================================= */ local unsigned long gf2_matrix_times(mat, vec) unsigned long *mat; unsigned long vec; { unsigned long sum; sum = 0; while (vec) { if (vec & 1) sum ^= *mat; vec >>= 1; mat++; } return sum; } /* ========================================================================= */ local void gf2_matrix_square(square, mat) unsigned long *square; unsigned long *mat; { int n; for (n = 0; n < GF2_DIM; n++) square[n] = gf2_matrix_times(mat, mat[n]); } /* ========================================================================= */ local uLong crc32_combine_(crc1, crc2, len2) uLong crc1; uLong crc2; z_off64_t len2; { int n; unsigned long row; unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ /* degenerate case (also disallow negative lengths) */ if (len2 <= 0) return crc1; /* put operator for one zero bit in odd */ odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ row = 1; for (n = 1; n < GF2_DIM; n++) { odd[n] = row; row <<= 1; } /* put operator for two zero bits in even */ gf2_matrix_square(even, odd); /* put operator for four zero bits in odd */ gf2_matrix_square(odd, even); /* apply len2 zeros to crc1 (first square will put the operator for one zero byte, eight zero bits, in even) */ do { /* apply zeros operator for this bit of len2 */ gf2_matrix_square(even, odd); if (len2 & 1) crc1 = gf2_matrix_times(even, crc1); len2 >>= 1; /* if no more bits set, then done */ if (len2 == 0) break; /* another iteration of the loop with odd and even swapped */ gf2_matrix_square(odd, even); if (len2 & 1) crc1 = gf2_matrix_times(odd, crc1); len2 >>= 1; /* if no more bits set, then done */ } while (len2 != 0); /* return combined crc */ crc1 ^= crc2; return crc1; } /* ========================================================================= */ uLong ZEXPORT crc32_combine(crc1, crc2, len2) uLong crc1; uLong crc2; z_off_t len2; { return crc32_combine_(crc1, crc2, len2); } uLong ZEXPORT crc32_combine64(crc1, crc2, len2) uLong crc1; uLong crc2; z_off64_t len2; { return crc32_combine_(crc1, crc2, len2); } varnish-4.1.1/lib/libvgz/deflate.h0000644000201500234410000003074612652366721013750 00000000000000/* deflate.h -- internal compression state * Copyright (C) 1995-2012 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* @(#) $Id$ */ #ifndef DEFLATE_H #define DEFLATE_H #include "zutil.h" /* define NO_GZIP when compiling if you want to disable gzip header and trailer creation by deflate(). NO_GZIP would be used to avoid linking in the crc code when it is not needed. For shared libraries, gzip encoding should be left enabled. */ #ifndef NO_GZIP # define GZIP #endif /* =========================================================================== * Internal compression state. */ #define LENGTH_CODES 29 /* number of length codes, not counting the special END_BLOCK code */ #define LITERALS 256 /* number of literal bytes 0..255 */ #define L_CODES (LITERALS+1+LENGTH_CODES) /* number of Literal or Length codes, including the END_BLOCK code */ #define D_CODES 30 /* number of distance codes */ #define BL_CODES 19 /* number of codes used to transfer the bit lengths */ #define HEAP_SIZE (2*L_CODES+1) /* maximum heap size */ #define MAX_BITS 15 /* All codes must not exceed MAX_BITS bits */ #define Buf_size 16 /* size of bit buffer in bi_buf */ #define INIT_STATE 42 #define EXTRA_STATE 69 #define NAME_STATE 73 #define COMMENT_STATE 91 #define HCRC_STATE 103 #define BUSY_STATE 113 #define FINISH_STATE 666 /* Stream status */ /* Data structure describing a single value and its code string. */ typedef struct ct_data_s { union { ush freq; /* frequency count */ ush code; /* bit string */ } fc; union { ush dad; /* father node in Huffman tree */ ush len; /* length of bit string */ } dl; } FAR ct_data; #define Freq fc.freq #define Code fc.code #define Dad dl.dad #define Len dl.len typedef struct static_tree_desc_s static_tree_desc; typedef struct tree_desc_s { ct_data *dyn_tree; /* the dynamic tree */ int max_code; /* largest code with non zero frequency */ static_tree_desc *stat_desc; /* the corresponding static tree */ } FAR tree_desc; typedef ush Pos; typedef Pos FAR Posf; typedef unsigned IPos; /* A Pos is an index in the character window. We use short instead of int to * save space in the various tables. IPos is used only for parameter passing. */ typedef struct internal_state { z_streamp strm; /* pointer back to this zlib stream */ int status; /* as the name implies */ Bytef *pending_buf; /* output still pending */ ulg pending_buf_size; /* size of pending_buf */ Bytef *pending_out; /* next pending byte to output to the stream */ uInt pending; /* nb of bytes in the pending buffer */ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ gz_headerp gzhead; /* gzip header information to write */ uInt gzindex; /* where in extra, name, or comment */ Byte method; /* can only be DEFLATED */ int last_flush; /* value of flush param for previous deflate call */ /* used by deflate.c: */ uInt w_size; /* LZ77 window size (32K by default) */ uInt w_bits; /* log2(w_size) (8..16) */ uInt w_mask; /* w_size - 1 */ Bytef *window; /* Sliding window. Input bytes are read into the second half of the window, * and move to the first half later to keep a dictionary of at least wSize * bytes. With this organization, matches are limited to a distance of * wSize-MAX_MATCH bytes, but this ensures that IO is always * performed with a length multiple of the block size. Also, it limits * the window size to 64K, which is quite useful on MSDOS. * To do: use the user input buffer as sliding window. */ ulg window_size; /* Actual size of window: 2*wSize, except when the user input buffer * is directly used as sliding window. */ Posf *prev; /* Link to older string with same hash index. To limit the size of this * array to 64K, this link is maintained only for the last 32K strings. * An index in this array is thus a window index modulo 32K. */ Posf *head; /* Heads of the hash chains or NIL. */ uInt ins_h; /* hash index of string to be inserted */ uInt hash_size; /* number of elements in hash table */ uInt hash_bits; /* log2(hash_size) */ uInt hash_mask; /* hash_size-1 */ uInt hash_shift; /* Number of bits by which ins_h must be shifted at each input * step. It must be such that after MIN_MATCH steps, the oldest * byte no longer takes part in the hash key, that is: * hash_shift * MIN_MATCH >= hash_bits */ long block_start; /* Window position at the beginning of the current output block. Gets * negative when the window is moved backwards. */ uInt match_length; /* length of best match */ IPos prev_match; /* previous match */ int match_available; /* set if previous match exists */ uInt strstart; /* start of string to insert */ uInt match_start; /* start of matching string */ uInt lookahead; /* number of valid bytes ahead in window */ uInt prev_length; /* Length of the best match at previous step. Matches not greater than this * are discarded. This is used in the lazy match evaluation. */ uInt max_chain_length; /* To speed up deflation, hash chains are never searched beyond this * length. A higher limit improves compression ratio but degrades the * speed. */ uInt max_lazy_match; /* Attempt to find a better match only when the current match is strictly * smaller than this value. This mechanism is used only for compression * levels >= 4. */ # define max_insert_length max_lazy_match /* Insert new strings in the hash table only if the match length is not * greater than this length. This saves time but degrades compression. * max_insert_length is used only for compression levels <= 3. */ int level; /* compression level (1..9) */ int strategy; /* favor or force Huffman coding*/ uInt good_match; /* Use a faster search when the previous match is longer than this */ int nice_match; /* Stop searching when current match exceeds this */ /* used by trees.c: */ /* Didn't use ct_data typedef below to suppress compiler warning */ struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ struct tree_desc_s l_desc; /* desc. for literal tree */ struct tree_desc_s d_desc; /* desc. for distance tree */ struct tree_desc_s bl_desc; /* desc. for bit length tree */ ush bl_count[MAX_BITS+1]; /* number of codes at each bit length for an optimal tree */ int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ int heap_len; /* number of elements in the heap */ int heap_max; /* element of largest frequency */ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. * The same heap array is used to build all trees. */ uch depth[2*L_CODES+1]; /* Depth of each subtree used as tie breaker for trees of equal frequency */ uchf *l_buf; /* buffer for literals or lengths */ uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for * limiting lit_bufsize to 64K: * - frequencies can be kept in 16 bit counters * - if compression is not successful for the first block, all input * data is still in the window so we can still emit a stored block even * when input comes from standard input. (This can also be done for * all blocks if lit_bufsize is not greater than 32K.) * - if compression is not successful for a file smaller than 64K, we can * even emit a stored file instead of a stored block (saving 5 bytes). * This is applicable only for zip (not gzip or zlib). * - creating new Huffman trees less frequently may not provide fast * adaptation to changes in the input data statistics. (Take for * example a binary file with poorly compressible code followed by * a highly compressible string table.) Smaller buffer sizes give * fast adaptation but have of course the overhead of transmitting * trees more frequently. * - I can't count above 4 */ uInt last_lit; /* running index in l_buf */ ushf *d_buf; /* Buffer for distances. To simplify the code, d_buf and l_buf have * the same number of elements. To use different lengths, an extra flag * array would be necessary. */ ulg opt_len; /* bit length of current block with optimal trees */ ulg static_len; /* bit length of current block with static trees */ uInt matches; /* number of string matches in current block */ uInt insert; /* bytes at end of window left to insert */ #ifdef DEBUG ulg compressed_len; /* total bit length of compressed file mod 2^32 */ ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ #endif ush bi_buf; /* Output buffer. bits are inserted starting at the bottom (least * significant bits). */ int bi_valid; /* Number of valid bits in bi_buf. All bits above the last valid bit * are always zero. */ ulg high_water; /* High water mark offset in window for initialized bytes -- bytes above * this are set to zero in order to avoid memory check warnings when * longest match routines access bytes past the input. This is then * updated to the new high water mark. */ } FAR deflate_state; /* Output a byte on the stream. * IN assertion: there is enough room in pending_buf. */ #define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) /* Minimum amount of lookahead, except at the end of the input file. * See deflate.c for comments about the MIN_MATCH+1. */ #define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) /* In order to simplify the code, particularly on 16 bit machines, match * distances are limited to MAX_DIST instead of WSIZE. */ #define WIN_INIT MAX_MATCH /* Number of bytes after end of data in window to initialize in order to avoid memory checker errors from longest match routines */ /* in trees.c */ void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, int last)); void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s)); void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, int last)); #define d_code(dist) \ ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) /* Mapping from a distance to a distance code. dist is the distance - 1 and * must not have side effects. _dist_code[256] and _dist_code[257] are never * used. */ #ifndef DEBUG /* Inline versions of _tr_tally for speed: */ #if defined(GEN_TREES_H) || !defined(STDC) extern uch ZLIB_INTERNAL _length_code[]; extern uch ZLIB_INTERNAL _dist_code[]; #else extern const uch ZLIB_INTERNAL _length_code[]; extern const uch ZLIB_INTERNAL _dist_code[]; #endif # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ s->d_buf[s->last_lit] = 0; \ s->l_buf[s->last_lit++] = cc; \ s->dyn_ltree[cc].Freq++; \ flush = (s->last_lit == s->lit_bufsize-1); \ } # define _tr_tally_dist(s, distance, length, flush) \ { uch len = (length); \ ush dist = (distance); \ s->d_buf[s->last_lit] = dist; \ s->l_buf[s->last_lit++] = len; \ dist--; \ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ s->dyn_dtree[d_code(dist)].Freq++; \ flush = (s->last_lit == s->lit_bufsize-1); \ } #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ flush = _tr_tally(s, distance, length) #endif #endif /* DEFLATE_H */ varnish-4.1.1/lib/libvgz/README0000644000201500234410000001221112652366721013036 00000000000000This is a modified version of the ZLIB 1.2.8 data compression library. ZLIB DATA COMPRESSION LIBRARY zlib 1.2.8 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). All functions of the compression library are documented in the file zlib.h (volunteer to write man pages welcome, contact zlib@gzip.org). A usage example of the library is given in the file test/example.c which also tests that the library is working correctly. Another example is given in the file test/minigzip.c. The compression library itself is composed of all source files in the root directory. To compile all files and run the test program, follow the instructions given at the top of Makefile.in. In short "./configure; make test", and if that goes well, "make install" should work for most flavors of Unix. For Windows, use one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use make_vms.com. Questions about zlib should be sent to , or to Gilles Vollant for the Windows DLL version. The zlib home page is http://zlib.net/ . Before reporting a problem, please check this site to verify that you have the latest version of zlib; otherwise get the latest version and check whether the problem still exists or not. PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help. Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at http://marknelson.us/1997/01/01/zlib-engine/ . The changes made in version 1.2.8 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . zlib is available in Java using the java.util.zip package, documented at http://java.sun.com/developer/technicalArticles/Programming/compression/ . A Perl interface to zlib written by Paul Marquess is available at CPAN (Comprehensive Perl Archive Network) sites, including http://search.cpan.org/~pmqs/IO-Compress-Zlib/ . A Python interface to zlib written by A.M. Kuchling is available in Python 1.5 and later versions, see http://docs.python.org/library/zlib.html . zlib is built into tcl: http://wiki.tcl.tk/4610 . An experimental package to read and write files in .zip format, written on top of zlib by Gilles Vollant , is available in the contrib/minizip directory of zlib. Notes for some targets: - For Windows DLL versions, please see win32/DLL_FAQ.txt - For 64-bit Irix, deflate.c must be compiled without any optimization. With -O, one libpng test fails. The test works in 32 bit mode (with the -n32 compiler flag). The compiler bug has been reported to SGI. - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works when compiled with cc. - On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is necessary to get gzprintf working correctly. This is done by configure. - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with other compilers. Use "make test" to check your compiler. - gzdopen is not supported on RISCOS or BEOS. - For PalmOs, see http://palmzlib.sourceforge.net/ Acknowledgments: The deflate format used by zlib was defined by Phil Katz. The deflate and zlib specifications were written by L. Peter Deutsch. Thanks to all the people who reported problems and suggested various improvements in zlib; they are too numerous to cite here. Copyright notice: (C) 1995-2013 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jean-loup Gailly Mark Adler jloup@gzip.org madler@alumni.caltech.edu If you use the zlib library in a product, we would appreciate *not* receiving lengthy legal documents to sign. The sources are provided for free but without warranty of any kind. The library has been entirely written by Jean-loup Gailly and Mark Adler; it does not include third-party code. If you redistribute modified sources, we would appreciate that you include in the file ChangeLog history information documenting your changes. Please read the FAQ for more information on the distribution of modified source versions. varnish-4.1.1/lib/libvgz/Makefile.am0000644000201500234410000000074612652366721014224 00000000000000# AM_LDFLAGS = $(AM_LT_LDFLAGS) pkglib_LTLIBRARIES = libvgz.la libvgz_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version libvgz_la_CFLAGS = -D_LARGEFILE64_SOURCE=1 -DZLIB_CONST $(libvgz_extra_cflags) libvgz_la_SOURCES = \ adler32.c \ compress.c \ crc32.c \ crc32.h \ deflate.c \ deflate.h \ gzguts.h \ infback.c \ inffast.c \ inffast.h \ inffixed.h \ inflate.c \ inflate.h \ inftrees.c \ inftrees.h \ trees.c \ trees.h \ uncompr.c \ zconf.h \ vgz.h \ zutil.c \ zutil.h varnish-4.1.1/lib/libvgz/uncompr.c0000644000201500234410000000372212652366721014014 00000000000000/* uncompr.c -- decompress a memory buffer * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #define ZLIB_INTERNAL #include "vgz.h" /* =========================================================================== Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, destLen is the actual size of the compressed buffer. uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted. */ int ZEXPORT uncompress (dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; { z_stream stream; int err; stream.next_in = (z_const Bytef *)source; stream.avail_in = (uInt)sourceLen; /* Check for source > 64K on 16-bit machine: */ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; stream.next_out = dest; stream.avail_out = (uInt)*destLen; if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; stream.zalloc = (alloc_func)0; stream.zfree = (free_func)0; err = inflateInit(&stream); if (err != Z_OK) return err; err = inflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { inflateEnd(&stream); if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) return Z_DATA_ERROR; return err; } *destLen = stream.total_out; err = inflateEnd(&stream); return err; } varnish-4.1.1/lib/libvgz/inffast.c0000644000201500234410000003215712652366721013767 00000000000000/* inffast.c -- fast decoding * Copyright (C) 1995-2008, 2010, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h" #ifndef ASMINF /* Allow machine dependent optimization for post-increment or pre-increment. Based on testing to date, Pre-increment preferred for: - PowerPC G3 (Adler) - MIPS R5000 (Randers-Pehrson) Post-increment preferred for: - none No measurable difference: - Pentium III (Anderson) - M68060 (Nikl) */ #ifdef POSTINC # define OFF 0 # define PUP(a) *(a)++ #else # define OFF 1 # define PUP(a) *++(a) #endif /* Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is available, an end-of-block is encountered, or a data error is encountered. When large enough input and output buffers are supplied to inflate(), for example, a 16K input buffer and a 64K output buffer, more than 95% of the inflate execution time is spent in this routine. Entry assumptions: state->mode == LEN strm->avail_in >= 6 strm->avail_out >= 258 start >= strm->avail_out state->bits < 8 On return, state->mode is one of: LEN -- ran out of enough output space or enough available input TYPE -- reached end of block code, inflate() to interpret next block BAD -- error in block data Notes: - The maximum input bits used by a length/distance pair is 15 bits for the length code, 5 bits for the length extra, 15 bits for the distance code, and 13 bits for the distance extra. This totals 48 bits, or six bytes. Therefore if strm->avail_in >= 6, then there is enough input to avoid checking for available input while decoding. - The maximum bytes that a single length/distance pair can output is 258 bytes, which is the maximum length that can be coded. inflate_fast() requires strm->avail_out >= 258 for each loop to avoid checking for output space. */ void ZLIB_INTERNAL inflate_fast(strm, start) z_streamp strm; unsigned start; /* inflate()'s starting value for strm->avail_out */ { struct inflate_state FAR *state; z_const unsigned char FAR *in; /* local strm->next_in */ z_const unsigned char FAR *last; /* have enough input while in < last */ unsigned char FAR *out; /* local strm->next_out */ unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ unsigned char FAR *end; /* while out < end, enough space available */ #ifdef INFLATE_STRICT unsigned dmax; /* maximum distance from zlib header */ #endif unsigned wsize; /* window size or zero if not using window */ unsigned whave; /* valid bytes in the window */ unsigned wnext; /* window write index */ unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ unsigned long hold; /* local strm->hold */ unsigned bits; /* local strm->bits */ code const FAR *lcode; /* local strm->lencode */ code const FAR *dcode; /* local strm->distcode */ unsigned lmask; /* mask for first level of length codes */ unsigned dmask; /* mask for first level of distance codes */ code here; /* retrieved table entry */ unsigned op; /* code bits, operation, extra bits, or */ /* window position, window bytes to copy */ unsigned len; /* match length, unused bytes */ unsigned dist; /* match distance */ unsigned char FAR *from; /* where to copy match from */ /* copy state to local variables */ state = (struct inflate_state FAR *)strm->state; in = strm->next_in - OFF; last = in + (strm->avail_in - 5); out = strm->next_out - OFF; beg = out - (start - strm->avail_out); end = out + (strm->avail_out - 257); #ifdef INFLATE_STRICT dmax = state->dmax; #endif wsize = state->wsize; whave = state->whave; wnext = state->wnext; window = state->window; hold = state->hold; bits = state->bits; lcode = state->lencode; dcode = state->distcode; lmask = (1U << state->lenbits) - 1; dmask = (1U << state->distbits) - 1; /* decode literals and length/distances until end-of-block or not enough input data or output space */ do { if (bits < 15) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; hold += (unsigned long)(PUP(in)) << bits; bits += 8; } here = lcode[hold & lmask]; dolen: op = (unsigned)(here.bits); hold >>= op; bits -= op; op = (unsigned)(here.op); if (op == 0) { /* literal */ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? "inflate: literal '%c'\n" : "inflate: literal 0x%02x\n", here.val)); PUP(out) = (unsigned char)(here.val); } else if (op & 16) { /* length base */ len = (unsigned)(here.val); op &= 15; /* number of extra bits */ if (op) { if (bits < op) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; } len += (unsigned)hold & ((1U << op) - 1); hold >>= op; bits -= op; } Tracevv((stderr, "inflate: length %u\n", len)); if (bits < 15) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; hold += (unsigned long)(PUP(in)) << bits; bits += 8; } here = dcode[hold & dmask]; dodist: op = (unsigned)(here.bits); hold >>= op; bits -= op; op = (unsigned)(here.op); if (op & 16) { /* distance base */ dist = (unsigned)(here.val); op &= 15; /* number of extra bits */ if (bits < op) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; if (bits < op) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; } } dist += (unsigned)hold & ((1U << op) - 1); #ifdef INFLATE_STRICT if (dist > dmax) { strm->msg = "invalid distance too far back"; state->mode = BAD; break; } #endif hold >>= op; bits -= op; Tracevv((stderr, "inflate: distance %u\n", dist)); op = (unsigned)(out - beg); /* max distance in output */ if (dist > op) { /* see if copy from window */ op = dist - op; /* distance back in window */ if (op > whave) { if (state->sane) { strm->msg = "invalid distance too far back"; state->mode = BAD; break; } #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR if (len <= op - whave) { do { PUP(out) = 0; } while (--len); continue; } len -= op - whave; do { PUP(out) = 0; } while (--op > whave); if (op == 0) { from = out - dist; do { PUP(out) = PUP(from); } while (--len); continue; } #endif } from = window - OFF; if (wnext == 0) { /* very common case */ from += wsize - op; if (op < len) { /* some from window */ len -= op; do { PUP(out) = PUP(from); } while (--op); from = out - dist; /* rest from output */ } } else if (wnext < op) { /* wrap around window */ from += wsize + wnext - op; op -= wnext; if (op < len) { /* some from end of window */ len -= op; do { PUP(out) = PUP(from); } while (--op); from = window - OFF; if (wnext < len) { /* some from start of window */ op = wnext; len -= op; do { PUP(out) = PUP(from); } while (--op); from = out - dist; /* rest from output */ } } } else { /* contiguous in window */ from += wnext - op; if (op < len) { /* some from window */ len -= op; do { PUP(out) = PUP(from); } while (--op); from = out - dist; /* rest from output */ } } while (len > 2) { PUP(out) = PUP(from); PUP(out) = PUP(from); PUP(out) = PUP(from); len -= 3; } if (len) { PUP(out) = PUP(from); if (len > 1) PUP(out) = PUP(from); } } else { from = out - dist; /* copy direct from output */ do { /* minimum length is three */ PUP(out) = PUP(from); PUP(out) = PUP(from); PUP(out) = PUP(from); len -= 3; } while (len > 2); if (len) { PUP(out) = PUP(from); if (len > 1) PUP(out) = PUP(from); } } } else if ((op & 64) == 0) { /* 2nd level distance code */ here = dcode[here.val + (hold & ((1U << op) - 1))]; goto dodist; } else { strm->msg = "invalid distance code"; state->mode = BAD; break; } } else if ((op & 64) == 0) { /* 2nd level length code */ here = lcode[here.val + (hold & ((1U << op) - 1))]; goto dolen; } else if (op & 32) { /* end-of-block */ Tracevv((stderr, "inflate: end of block\n")); state->mode = TYPE; break; } else { strm->msg = "invalid literal/length code"; state->mode = BAD; break; } } while (in < last && out < end); /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ len = bits >> 3; in -= len; bits -= len << 3; hold &= (1U << bits) - 1; /* update state and return */ strm->next_in = in + OFF; strm->next_out = out + OFF; strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); strm->avail_out = (unsigned)(out < end ? 257 + (end - out) : 257 - (out - end)); state->hold = hold; state->bits = bits; return; } /* inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): - Using bit fields for code structure - Different op definition to avoid & for extra bits (do & for table bits) - Three separate decoding do-loops for direct, window, and wnext == 0 - Special case for distance > 1 copies to do overlapped load and store copy - Explicit branch predictions (based on measured branch probabilities) - Deferring match copy and interspersed it with decoding subsequent codes - Swapping literal/length else - Swapping window/direct else - Larger unrolled copy loops (three is about right) - Moving len -= 3 statement into middle of loop */ #endif /* !ASMINF */ varnish-4.1.1/lib/libvgz/zutil.h0000644000201500234410000001515512652366721013510 00000000000000/* zutil.h -- internal interface and configuration of the compression library * Copyright (C) 1995-2013 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* @(#) $Id$ */ #ifndef ZUTIL_H #define ZUTIL_H #ifdef HAVE_HIDDEN # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL #endif #include "vgz.h" #if defined(STDC) && !defined(Z_SOLO) # if !(defined(_WIN32_WCE) && defined(_MSC_VER)) # include # endif # include # include #endif #ifdef Z_SOLO typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ #endif #ifndef local # define local static #endif /* compile with -Dlocal if your debugger can't find static symbols */ typedef unsigned char uch; typedef uch FAR uchf; typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] #define ERR_RETURN(strm,err) \ return (strm->msg = ERR_MSG(err), (err)) /* To be used only when the state is known to be valid */ /* common constants */ #ifndef DEF_WBITS # define DEF_WBITS MAX_WBITS #endif /* default windowBits for decompression. MAX_WBITS is for compression only */ #if MAX_MEM_LEVEL >= 8 # define DEF_MEM_LEVEL 8 #else # define DEF_MEM_LEVEL MAX_MEM_LEVEL #endif /* default memLevel */ #define STORED_BLOCK 0 #define STATIC_TREES 1 #define DYN_TREES 2 /* The three kinds of block type */ #define MIN_MATCH 3 #define MAX_MATCH 258 /* The minimum and maximum match lengths */ #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ /* target dependencies */ #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) # define OS_CODE 0x00 # ifndef Z_SOLO # if defined(__TURBOC__) || defined(__BORLANDC__) # if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) /* Allow compilation with ANSI keywords only enabled */ void _Cdecl farfree( void *block ); void *_Cdecl farmalloc( unsigned long nbytes ); # else # include # endif # else /* MSC or DJGPP */ # include # endif # endif #endif #ifdef AMIGA # define OS_CODE 0x01 #endif #if defined(VAXC) || defined(VMS) # define OS_CODE 0x02 # define F_OPEN(name, mode) \ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") #endif #if defined(ATARI) || defined(atarist) # define OS_CODE 0x05 #endif #ifdef OS2 # define OS_CODE 0x06 # if defined(M_I86) && !defined(Z_SOLO) # include # endif #endif #if defined(MACOS) || defined(TARGET_OS_MAC) # define OS_CODE 0x07 # ifndef Z_SOLO # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os # include /* for fdopen */ # else # ifndef fdopen # define fdopen(fd,mode) NULL /* No fdopen() */ # endif # endif # endif #endif #ifdef TOPS20 # define OS_CODE 0x0a #endif #ifdef WIN32 # ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ # define OS_CODE 0x0b # endif #endif #ifdef __50SERIES /* Prime/PRIMOS */ # define OS_CODE 0x0f #endif #if defined(_BEOS_) || defined(RISCOS) # define fdopen(fd,mode) NULL /* No fdopen() */ #endif #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX # if defined(_WIN32_WCE) # define fdopen(fd,mode) NULL /* No fdopen() */ # ifndef _PTRDIFF_T_DEFINED typedef int ptrdiff_t; # define _PTRDIFF_T_DEFINED # endif # else # define fdopen(fd,type) _fdopen(fd,type) # endif #endif #if defined(__BORLANDC__) && !defined(MSDOS) #pragma warn -8004 #pragma warn -8008 #pragma warn -8066 #endif /* provide prototypes for these when building zlib without LFS */ #if !defined(_WIN32) && \ (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); #endif /* common defaults */ #ifndef OS_CODE # define OS_CODE 0x03 /* assume Unix */ #endif #ifndef F_OPEN # define F_OPEN(name, mode) fopen((name), (mode)) #endif /* functions */ #if defined(pyr) || defined(Z_SOLO) # define NO_MEMCPY #endif #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) /* Use our own functions for small and medium model with MSC <= 5.0. * You may have to use the same strategy for Borland C (untested). * The __SC__ check is for Symantec. */ # define NO_MEMCPY #endif #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) # define HAVE_MEMCPY #endif #ifdef HAVE_MEMCPY # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ # define zmemcpy _fmemcpy # define zmemcmp _fmemcmp # define zmemzero(dest, len) _fmemset(dest, 0, len) # else # define zmemcpy memcpy # define zmemcmp memcmp # define zmemzero(dest, len) memset(dest, 0, len) # endif #else void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); #endif /* Diagnostic functions */ #ifdef DEBUG # include extern int ZLIB_INTERNAL z_verbose; extern void ZLIB_INTERNAL z_error OF((char *m)); # define Assert(cond,msg) {if(!(cond)) z_error(msg);} # define Trace(x) {if (z_verbose>=0) fprintf x ;} # define Tracev(x) {if (z_verbose>0) fprintf x ;} # define Tracevv(x) {if (z_verbose>1) fprintf x ;} # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} #else # define Assert(cond,msg) # define Trace(x) # define Tracev(x) # define Tracevv(x) # define Tracec(c,x) # define Tracecv(c,x) #endif #ifndef Z_SOLO voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, unsigned size)); void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); #endif #define ZALLOC(strm, items, size) \ (*((strm)->zalloc))((strm)->opaque, (items), (size)) #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} /* Reverse the bytes in a 32-bit value */ #define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) #endif /* ZUTIL_H */ varnish-4.1.1/lib/libvgz/inftrees.h0000644000201500234410000000556012652366721014157 00000000000000/* inftrees.h -- header to use inftrees.c * Copyright (C) 1995-2005, 2010 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* Structure for decoding tables. Each entry provides either the information needed to do the operation requested by the code that indexed that table entry, or it provides a pointer to another table that indexes more bits of the code. op indicates whether the entry is a pointer to another table, a literal, a length or distance, an end-of-block, or an invalid code. For a table pointer, the low four bits of op is the number of index bits of that table. For a length or distance, the low four bits of op is the number of extra bits to get after the code. bits is the number of bits in this code or part of the code to drop off of the bit buffer. val is the actual byte to output in the case of a literal, the base length or distance, or the offset from the current table to the next table. Each entry is four bytes. */ typedef struct { unsigned char op; /* operation, extra bits, table bits */ unsigned char bits; /* bits in this part of the code */ unsigned short val; /* offset in table or code value */ } code; /* op values as set by inflate_table(): 00000000 - literal 0000tttt - table link, tttt != 0 is the number of table index bits 0001eeee - length or distance, eeee is the number of extra bits 01100000 - end of block 01000000 - invalid code */ /* Maximum size of the dynamic table. The maximum number of code structures is 1444, which is the sum of 852 for literal/length codes and 592 for distance codes. These values were found by exhaustive searches using the program examples/enough.c found in the zlib distribtution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes returns returns 852, and "enough 30 6 15" for distance codes returns 592. The initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ #define ENOUGH_LENS 852 #define ENOUGH_DISTS 592 #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) /* Type of code to build for inflate_table() */ typedef enum { CODES, LENS, DISTS } codetype; int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, unsigned codes, code FAR * FAR *table, unsigned FAR *bits, unsigned short FAR *work)); varnish-4.1.1/lib/libvgz/gzguts.h0000644000201500234410000001462712652366721013667 00000000000000/* gzguts.h -- zlib internal header definitions for gz* operations * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #ifdef _LARGEFILE64_SOURCE # ifndef _LARGEFILE_SOURCE # define _LARGEFILE_SOURCE 1 # endif # ifdef _FILE_OFFSET_BITS # undef _FILE_OFFSET_BITS # endif #endif #ifdef HAVE_HIDDEN # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL #endif #include #include "vgz.h" #ifdef STDC # include # include # include #endif #include #ifdef _WIN32 # include #endif #if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32) # include #endif #ifdef WINAPI_FAMILY # define open _open # define read _read # define write _write # define close _close #endif #ifdef NO_DEFLATE /* for compatibility with old definition */ # define NO_GZCOMPRESS #endif #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) # ifndef HAVE_VSNPRINTF # define HAVE_VSNPRINTF # endif #endif #if defined(__CYGWIN__) # ifndef HAVE_VSNPRINTF # define HAVE_VSNPRINTF # endif #endif #if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410) # ifndef HAVE_VSNPRINTF # define HAVE_VSNPRINTF # endif #endif #ifndef HAVE_VSNPRINTF # ifdef MSDOS /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), but for now we just assume it doesn't. */ # define NO_vsnprintf # endif # ifdef __TURBOC__ # define NO_vsnprintf # endif # ifdef WIN32 /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ # if !defined(vsnprintf) && !defined(NO_vsnprintf) # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) # define vsnprintf _vsnprintf # endif # endif # endif # ifdef __SASC # define NO_vsnprintf # endif # ifdef VMS # define NO_vsnprintf # endif # ifdef __OS400__ # define NO_vsnprintf # endif # ifdef __MVS__ # define NO_vsnprintf # endif #endif /* unlike snprintf (which is required in C99, yet still not supported by Microsoft more than a decade later!), _snprintf does not guarantee null termination of the result -- however this is only used in gzlib.c where the result is assured to fit in the space provided */ #ifdef _MSC_VER # define snprintf _snprintf #endif #ifndef local # define local static #endif /* compile with -Dlocal if your debugger can't find static symbols */ /* gz* functions always use library allocation functions */ #ifndef STDC extern voidp malloc OF((uInt size)); extern void free OF((voidpf ptr)); #endif /* get errno and strerror definition */ #if defined UNDER_CE # include # define zstrerror() gz_strwinerror((DWORD)GetLastError()) #else # ifndef NO_STRERROR # include # define zstrerror() strerror(errno) # else # define zstrerror() "stdio error (consult errno)" # endif #endif /* provide prototypes for these when building zlib without LFS */ #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); #endif /* default memLevel */ #if MAX_MEM_LEVEL >= 8 # define DEF_MEM_LEVEL 8 #else # define DEF_MEM_LEVEL MAX_MEM_LEVEL #endif /* default i/o buffer size -- double this for output when reading (this and twice this must be able to fit in an unsigned type) */ #define GZBUFSIZE 8192 /* gzip modes, also provide a little integrity check on the passed structure */ #define GZ_NONE 0 #define GZ_READ 7247 #define GZ_WRITE 31153 #define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ /* values for gz_state how */ #define LOOK 0 /* look for a gzip header */ #define COPY 1 /* copy input directly */ #define GZIP 2 /* decompress a gzip stream */ /* internal gzip file state data structure */ typedef struct { /* exposed contents for gzgetc() macro */ struct gzFile_s x; /* "x" for exposed */ /* x.have: number of bytes available at x.next */ /* x.next: next output data to deliver or write */ /* x.pos: current position in uncompressed data */ /* used for both reading and writing */ int mode; /* see gzip modes above */ int fd; /* file descriptor */ char *path; /* path or fd for error messages */ unsigned size; /* buffer size, zero if not allocated yet */ unsigned want; /* requested buffer size, default is GZBUFSIZE */ unsigned char *in; /* input buffer */ unsigned char *out; /* output buffer (double-sized when reading) */ int direct; /* 0 if processing gzip, 1 if transparent */ /* just for reading */ int how; /* 0: get header, 1: copy, 2: decompress */ z_off64_t start; /* where the gzip data started, for rewinding */ int eof; /* true if end of input file reached */ int past; /* true if read requested past end */ /* just for writing */ int level; /* compression level */ int strategy; /* compression strategy */ /* seek request */ z_off64_t skip; /* amount to skip (already rewound if backwards) */ int seek; /* true if seek request pending */ /* error information */ int err; /* error code */ char *msg; /* error message */ /* zlib inflate or deflate stream */ z_stream strm; /* stream structure in-place (not a pointer) */ } gz_state; typedef gz_state FAR *gz_statep; /* shared functions */ void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); #if defined UNDER_CE char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); #endif /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed (possible z_off64_t types off_t, off64_t, and long are all signed) */ #ifdef INT_MAX # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) #else unsigned ZLIB_INTERNAL gz_intmax OF((void)); # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) #endif varnish-4.1.1/lib/libvgz/Makefile.in0000644000201500234410000007551512652366727014251 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = lib/libvgz DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) libvgz_la_LIBADD = am_libvgz_la_OBJECTS = libvgz_la-adler32.lo libvgz_la-compress.lo \ libvgz_la-crc32.lo libvgz_la-deflate.lo libvgz_la-infback.lo \ libvgz_la-inffast.lo libvgz_la-inflate.lo \ libvgz_la-inftrees.lo libvgz_la-trees.lo libvgz_la-uncompr.lo \ libvgz_la-zutil.lo libvgz_la_OBJECTS = $(am_libvgz_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent libvgz_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libvgz_la_CFLAGS) \ $(CFLAGS) $(libvgz_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libvgz_la_SOURCES) DIST_SOURCES = $(libvgz_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ # AM_LDFLAGS = $(AM_LT_LDFLAGS) pkglib_LTLIBRARIES = libvgz.la libvgz_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version libvgz_la_CFLAGS = -D_LARGEFILE64_SOURCE=1 -DZLIB_CONST $(libvgz_extra_cflags) libvgz_la_SOURCES = \ adler32.c \ compress.c \ crc32.c \ crc32.h \ deflate.c \ deflate.h \ gzguts.h \ infback.c \ inffast.c \ inffast.h \ inffixed.h \ inflate.c \ inflate.h \ inftrees.c \ inftrees.h \ trees.c \ trees.h \ uncompr.c \ zconf.h \ vgz.h \ zutil.c \ zutil.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/libvgz/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/libvgz/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libvgz.la: $(libvgz_la_OBJECTS) $(libvgz_la_DEPENDENCIES) $(EXTRA_libvgz_la_DEPENDENCIES) $(AM_V_CCLD)$(libvgz_la_LINK) -rpath $(pkglibdir) $(libvgz_la_OBJECTS) $(libvgz_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvgz_la-adler32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvgz_la-compress.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvgz_la-crc32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvgz_la-deflate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvgz_la-infback.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvgz_la-inffast.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvgz_la-inflate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvgz_la-inftrees.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvgz_la-trees.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvgz_la-uncompr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvgz_la-zutil.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< libvgz_la-adler32.lo: adler32.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -MT libvgz_la-adler32.lo -MD -MP -MF $(DEPDIR)/libvgz_la-adler32.Tpo -c -o libvgz_la-adler32.lo `test -f 'adler32.c' || echo '$(srcdir)/'`adler32.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvgz_la-adler32.Tpo $(DEPDIR)/libvgz_la-adler32.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='adler32.c' object='libvgz_la-adler32.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -c -o libvgz_la-adler32.lo `test -f 'adler32.c' || echo '$(srcdir)/'`adler32.c libvgz_la-compress.lo: compress.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -MT libvgz_la-compress.lo -MD -MP -MF $(DEPDIR)/libvgz_la-compress.Tpo -c -o libvgz_la-compress.lo `test -f 'compress.c' || echo '$(srcdir)/'`compress.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvgz_la-compress.Tpo $(DEPDIR)/libvgz_la-compress.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='compress.c' object='libvgz_la-compress.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -c -o libvgz_la-compress.lo `test -f 'compress.c' || echo '$(srcdir)/'`compress.c libvgz_la-crc32.lo: crc32.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -MT libvgz_la-crc32.lo -MD -MP -MF $(DEPDIR)/libvgz_la-crc32.Tpo -c -o libvgz_la-crc32.lo `test -f 'crc32.c' || echo '$(srcdir)/'`crc32.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvgz_la-crc32.Tpo $(DEPDIR)/libvgz_la-crc32.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crc32.c' object='libvgz_la-crc32.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -c -o libvgz_la-crc32.lo `test -f 'crc32.c' || echo '$(srcdir)/'`crc32.c libvgz_la-deflate.lo: deflate.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -MT libvgz_la-deflate.lo -MD -MP -MF $(DEPDIR)/libvgz_la-deflate.Tpo -c -o libvgz_la-deflate.lo `test -f 'deflate.c' || echo '$(srcdir)/'`deflate.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvgz_la-deflate.Tpo $(DEPDIR)/libvgz_la-deflate.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='deflate.c' object='libvgz_la-deflate.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -c -o libvgz_la-deflate.lo `test -f 'deflate.c' || echo '$(srcdir)/'`deflate.c libvgz_la-infback.lo: infback.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -MT libvgz_la-infback.lo -MD -MP -MF $(DEPDIR)/libvgz_la-infback.Tpo -c -o libvgz_la-infback.lo `test -f 'infback.c' || echo '$(srcdir)/'`infback.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvgz_la-infback.Tpo $(DEPDIR)/libvgz_la-infback.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='infback.c' object='libvgz_la-infback.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -c -o libvgz_la-infback.lo `test -f 'infback.c' || echo '$(srcdir)/'`infback.c libvgz_la-inffast.lo: inffast.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -MT libvgz_la-inffast.lo -MD -MP -MF $(DEPDIR)/libvgz_la-inffast.Tpo -c -o libvgz_la-inffast.lo `test -f 'inffast.c' || echo '$(srcdir)/'`inffast.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvgz_la-inffast.Tpo $(DEPDIR)/libvgz_la-inffast.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='inffast.c' object='libvgz_la-inffast.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -c -o libvgz_la-inffast.lo `test -f 'inffast.c' || echo '$(srcdir)/'`inffast.c libvgz_la-inflate.lo: inflate.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -MT libvgz_la-inflate.lo -MD -MP -MF $(DEPDIR)/libvgz_la-inflate.Tpo -c -o libvgz_la-inflate.lo `test -f 'inflate.c' || echo '$(srcdir)/'`inflate.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvgz_la-inflate.Tpo $(DEPDIR)/libvgz_la-inflate.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='inflate.c' object='libvgz_la-inflate.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -c -o libvgz_la-inflate.lo `test -f 'inflate.c' || echo '$(srcdir)/'`inflate.c libvgz_la-inftrees.lo: inftrees.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -MT libvgz_la-inftrees.lo -MD -MP -MF $(DEPDIR)/libvgz_la-inftrees.Tpo -c -o libvgz_la-inftrees.lo `test -f 'inftrees.c' || echo '$(srcdir)/'`inftrees.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvgz_la-inftrees.Tpo $(DEPDIR)/libvgz_la-inftrees.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='inftrees.c' object='libvgz_la-inftrees.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -c -o libvgz_la-inftrees.lo `test -f 'inftrees.c' || echo '$(srcdir)/'`inftrees.c libvgz_la-trees.lo: trees.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -MT libvgz_la-trees.lo -MD -MP -MF $(DEPDIR)/libvgz_la-trees.Tpo -c -o libvgz_la-trees.lo `test -f 'trees.c' || echo '$(srcdir)/'`trees.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvgz_la-trees.Tpo $(DEPDIR)/libvgz_la-trees.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='trees.c' object='libvgz_la-trees.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -c -o libvgz_la-trees.lo `test -f 'trees.c' || echo '$(srcdir)/'`trees.c libvgz_la-uncompr.lo: uncompr.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -MT libvgz_la-uncompr.lo -MD -MP -MF $(DEPDIR)/libvgz_la-uncompr.Tpo -c -o libvgz_la-uncompr.lo `test -f 'uncompr.c' || echo '$(srcdir)/'`uncompr.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvgz_la-uncompr.Tpo $(DEPDIR)/libvgz_la-uncompr.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='uncompr.c' object='libvgz_la-uncompr.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -c -o libvgz_la-uncompr.lo `test -f 'uncompr.c' || echo '$(srcdir)/'`uncompr.c libvgz_la-zutil.lo: zutil.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -MT libvgz_la-zutil.lo -MD -MP -MF $(DEPDIR)/libvgz_la-zutil.Tpo -c -o libvgz_la-zutil.lo `test -f 'zutil.c' || echo '$(srcdir)/'`zutil.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvgz_la-zutil.Tpo $(DEPDIR)/libvgz_la-zutil.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='zutil.c' object='libvgz_la-zutil.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvgz_la_CFLAGS) $(CFLAGS) -c -o libvgz_la-zutil.lo `test -f 'zutil.c' || echo '$(srcdir)/'`zutil.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/lib/libvgz/inffast.h0000644000201500234410000000065312652366721013770 00000000000000/* inffast.h -- header to use inffast.c * Copyright (C) 1995-2003, 2010 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); varnish-4.1.1/lib/libvgz/inffixed.h0000644000201500234410000001427412652366721014136 00000000000000 /* inffixed.h -- table for decoding fixed codes * Generated automatically by makefixed(). */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of this library and is subject to change. Applications should only use zlib.h. */ static const code lenfix[512] = { {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, {0,9,255} }; static const code distfix[32] = { {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, {22,5,193},{64,5,0} }; varnish-4.1.1/lib/libvgz/deflate.c0000644000201500234410000021400112652366721013727 00000000000000/* deflate.c -- compress data using the deflation algorithm * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* * ALGORITHM * * The "deflation" process depends on being able to identify portions * of the input text which are identical to earlier input (within a * sliding window trailing behind the input currently being processed). * * The most straightforward technique turns out to be the fastest for * most input files: try all possible matches and select the longest. * The key feature of this algorithm is that insertions into the string * dictionary are very simple and thus fast, and deletions are avoided * completely. Insertions are performed at each input character, whereas * string matches are performed only when the previous match ends. So it * is preferable to spend more time in matches to allow very fast string * insertions and avoid deletions. The matching algorithm for small * strings is inspired from that of Rabin & Karp. A brute force approach * is used to find longer strings when a small match has been found. * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze * (by Leonid Broukhis). * A previous version of this file used a more sophisticated algorithm * (by Fiala and Greene) which is guaranteed to run in linear amortized * time, but has a larger average cost, uses more memory and is patented. * However the F&G algorithm may be faster for some highly redundant * files if the parameter max_chain_length (described below) is too large. * * ACKNOWLEDGEMENTS * * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and * I found it in 'freeze' written by Leonid Broukhis. * Thanks to many people for bug reports and testing. * * REFERENCES * * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". * Available in http://tools.ietf.org/html/rfc1951 * * A description of the Rabin and Karp algorithm is given in the book * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. * * Fiala,E.R., and Greene,D.H. * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 * */ /* @(#) $Id$ */ #include "deflate.h" extern const char deflate_copyright[]; const char deflate_copyright[] = " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot include such an acknowledgment, I would appreciate that you keep this copyright string in the executable of your product. */ /* =========================================================================== * Function prototypes. */ typedef enum { need_more, /* block not completed, need more input or more output */ block_done, /* block flush performed */ finish_started, /* finish started, need only more output at next deflate */ finish_done /* finish done, accept no more input or output */ } block_state; typedef block_state (*compress_func) OF((deflate_state *s, int flush)); /* Compression function. Returns the block state after the call. */ local void fill_window OF((deflate_state *s)); local block_state deflate_stored OF((deflate_state *s, int flush)); local block_state deflate_fast OF((deflate_state *s, int flush)); #ifndef FASTEST local block_state deflate_slow OF((deflate_state *s, int flush)); #endif local block_state deflate_rle OF((deflate_state *s, int flush)); local block_state deflate_huff OF((deflate_state *s, int flush)); local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local void flush_pending OF((z_streamp strm)); local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); #ifdef ASMV void match_init OF((void)); /* asm code initialization */ uInt longest_match OF((deflate_state *s, IPos cur_match)); #else local uInt longest_match OF((deflate_state *s, IPos cur_match)); #endif #ifdef DEBUG local void check_match OF((deflate_state *s, IPos start, IPos match, int length)); #endif /* =========================================================================== * Local data */ #define NIL 0 /* Tail of hash chains */ #ifndef TOO_FAR # define TOO_FAR 4096 #endif /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ /* Values for max_lazy_match, good_match and max_chain_length, depending on * the desired pack level (0..9). The values given below have been tuned to * exclude worst case performance for pathological files. Better values may be * found for specific files. */ typedef struct config_s { ush good_length; /* reduce lazy search above this match length */ ush max_lazy; /* do not perform lazy search above this match length */ ush nice_length; /* quit search above this match length */ ush max_chain; compress_func func; } config; #ifdef FASTEST local const config configuration_table[2] = { /* good lazy nice chain */ /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ /* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ #else local const config configuration_table[10] = { /* good lazy nice chain */ /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ /* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ /* 2 */ {4, 5, 16, 8, deflate_fast}, /* 3 */ {4, 6, 32, 32, deflate_fast}, /* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ /* 5 */ {8, 16, 32, 32, deflate_slow}, /* 6 */ {8, 16, 128, 128, deflate_slow}, /* 7 */ {8, 32, 128, 256, deflate_slow}, /* 8 */ {32, 128, 258, 1024, deflate_slow}, /* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ #endif /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 * For deflate_fast() (levels <= 3) good is ignored and lazy has a different * meaning. */ #define EQUAL 0 /* result of memcmp for equal strings */ #ifndef NO_DUMMY_DECL struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ #endif /* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ #define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0)) /* =========================================================================== * Update a hash value with the given input byte * IN assertion: all calls to to UPDATE_HASH are made with consecutive * input characters, so that a running hash key can be computed from the * previous key instead of complete recalculation each time. */ #define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) /* =========================================================================== * Insert string str in the dictionary and set match_head to the previous head * of the hash chain (the most recent string with same hash key). Return * the previous length of the hash chain. * If this file is compiled with -DFASTEST, the compression level is forced * to 1, and no hash chains are maintained. * IN assertion: all calls to to INSERT_STRING are made with consecutive * input characters and the first MIN_MATCH bytes of str are valid * (except for the last MIN_MATCH-1 bytes of the input file). */ #ifdef FASTEST #define INSERT_STRING(s, str, match_head) \ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ match_head = s->head[s->ins_h], \ s->head[s->ins_h] = (Pos)(str)) #else #define INSERT_STRING(s, str, match_head) \ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ s->head[s->ins_h] = (Pos)(str)) #endif /* =========================================================================== * Initialize the hash table (avoiding 64K overflow for 16 bit systems). * prev[] will be initialized on the fly. */ #define CLEAR_HASH(s) \ s->head[s->hash_size-1] = NIL; \ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); /* ========================================================================= */ int ZEXPORT deflateInit_(strm, level, version, stream_size) z_streamp strm; int level; const char *version; int stream_size; { return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, version, stream_size); /* To do: ignore strm->next_in if we use it as window */ } /* ========================================================================= */ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, version, stream_size) z_streamp strm; int level; int method; int windowBits; int memLevel; int strategy; const char *version; int stream_size; { deflate_state *s; int wrap = 1; static const char my_version[] = ZLIB_VERSION; ushf *overlay; /* We overlay pending_buf and d_buf+l_buf. This works since the average * output size for (length,distance) codes is <= 24 bits. */ if (version == Z_NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) { return Z_VERSION_ERROR; } if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; if (strm->zalloc == (alloc_func)0) { #ifdef Z_SOLO return Z_STREAM_ERROR; #else strm->zalloc = zcalloc; strm->opaque = (voidpf)0; #endif } if (strm->zfree == (free_func)0) #ifdef Z_SOLO return Z_STREAM_ERROR; #else strm->zfree = zcfree; #endif #ifdef FASTEST if (level != 0) level = 1; #else if (level == Z_DEFAULT_COMPRESSION) level = 6; #endif if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; windowBits = -windowBits; } #ifdef GZIP else if (windowBits > 15) { wrap = 2; /* write gzip wrapper instead */ windowBits -= 16; } #endif if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { return Z_STREAM_ERROR; } if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); if (s == Z_NULL) return Z_MEM_ERROR; strm->state = (struct internal_state FAR *)s; s->strm = strm; s->wrap = wrap; s->gzhead = Z_NULL; s->w_bits = windowBits; s->w_size = 1 << s->w_bits; s->w_mask = s->w_size - 1; s->hash_bits = memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); s->high_water = 0; /* nothing written to s->window yet */ s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); s->pending_buf = (uchf *) overlay; s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || s->pending_buf == Z_NULL) { s->status = FINISH_STATE; strm->msg = ERR_MSG(Z_MEM_ERROR); deflateEnd (strm); return Z_MEM_ERROR; } s->d_buf = overlay + s->lit_bufsize/sizeof(ush); s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; s->level = level; s->strategy = strategy; s->method = (Byte)method; return deflateReset(strm); } /* ========================================================================= */ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; { deflate_state *s; uInt str, n; int wrap; unsigned avail; z_const unsigned char *next; if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL) return Z_STREAM_ERROR; s = strm->state; wrap = s->wrap; if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead) return Z_STREAM_ERROR; /* when using zlib wrappers, compute Adler-32 for provided dictionary */ if (wrap == 1) strm->adler = adler32(strm->adler, dictionary, dictLength); s->wrap = 0; /* avoid computing Adler-32 in read_buf */ /* if dictionary would fill window, just replace the history */ if (dictLength >= s->w_size) { if (wrap == 0) { /* already empty otherwise */ CLEAR_HASH(s); s->strstart = 0; s->block_start = 0L; s->insert = 0; } dictionary += dictLength - s->w_size; /* use the tail */ dictLength = s->w_size; } /* insert dictionary into window and hash */ avail = strm->avail_in; next = strm->next_in; strm->avail_in = dictLength; strm->next_in = (z_const Bytef *)dictionary; fill_window(s); while (s->lookahead >= MIN_MATCH) { str = s->strstart; n = s->lookahead - (MIN_MATCH-1); do { UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); #ifndef FASTEST s->prev[str & s->w_mask] = s->head[s->ins_h]; #endif s->head[s->ins_h] = (Pos)str; str++; } while (--n); s->strstart = str; s->lookahead = MIN_MATCH-1; fill_window(s); } s->strstart += s->lookahead; s->block_start = (long)s->strstart; s->insert = s->lookahead; s->lookahead = 0; s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; strm->next_in = next; strm->avail_in = avail; s->wrap = wrap; return Z_OK; } /* ========================================================================= */ int ZEXPORT deflateResetKeep (strm) z_streamp strm; { deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { return Z_STREAM_ERROR; } strm->total_in = strm->total_out = 0; strm->start_bit = strm->stop_bit = strm->last_bit = 0; strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ strm->data_type = Z_UNKNOWN; s = (deflate_state *)strm->state; s->pending = 0; s->pending_out = s->pending_buf; if (s->wrap < 0) { s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ } s->status = s->wrap ? INIT_STATE : BUSY_STATE; strm->adler = #ifdef GZIP s->wrap == 2 ? crc32(0L, Z_NULL, 0) : #endif adler32(0L, Z_NULL, 0); s->last_flush = Z_NO_FLUSH; _tr_init(s); return Z_OK; } /* ========================================================================= */ int ZEXPORT deflateReset (strm) z_streamp strm; { int ret; ret = deflateResetKeep(strm); if (ret == Z_OK) lm_init(strm->state); return ret; } /* ========================================================================= */ int ZEXPORT deflateSetHeader (strm, head) z_streamp strm; gz_headerp head; { if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; if (strm->state->wrap != 2) return Z_STREAM_ERROR; strm->state->gzhead = head; return Z_OK; } /* ========================================================================= */ int ZEXPORT deflatePending (strm, pending, bits) unsigned *pending; int *bits; z_streamp strm; { if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; if (pending != Z_NULL) *pending = strm->state->pending; if (bits != Z_NULL) *bits = strm->state->bi_valid; return Z_OK; } /* ========================================================================= */ int ZEXPORT deflatePrime (strm, bits, value) z_streamp strm; int bits; int value; { deflate_state *s; int put; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; s = strm->state; if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; do { put = Buf_size - s->bi_valid; if (put > bits) put = bits; s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid); s->bi_valid += put; _tr_flush_bits(s); value >>= put; bits -= put; } while (bits); return Z_OK; } /* ========================================================================= */ int ZEXPORT deflateParams(strm, level, strategy) z_streamp strm; int level; int strategy; { deflate_state *s; compress_func func; int err = Z_OK; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; s = strm->state; #ifdef FASTEST if (level != 0) level = 1; #else if (level == Z_DEFAULT_COMPRESSION) level = 6; #endif if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { return Z_STREAM_ERROR; } func = configuration_table[s->level].func; if ((strategy != s->strategy || func != configuration_table[level].func) && strm->total_in != 0) { /* Flush the last buffer: */ err = deflate(strm, Z_BLOCK); if (err == Z_BUF_ERROR && s->pending == 0) err = Z_OK; } if (s->level != level) { s->level = level; s->max_lazy_match = configuration_table[level].max_lazy; s->good_match = configuration_table[level].good_length; s->nice_match = configuration_table[level].nice_length; s->max_chain_length = configuration_table[level].max_chain; } s->strategy = strategy; return err; } /* ========================================================================= */ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) z_streamp strm; int good_length; int max_lazy; int nice_length; int max_chain; { deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; s = strm->state; s->good_match = good_length; s->max_lazy_match = max_lazy; s->nice_match = nice_length; s->max_chain_length = max_chain; return Z_OK; } /* ========================================================================= * For the default windowBits of 15 and memLevel of 8, this function returns * a close to exact, as well as small, upper bound on the compressed size. * They are coded as constants here for a reason--if the #define's are * changed, then this function needs to be changed as well. The return * value for 15 and 8 only works for those exact settings. * * For any setting other than those defaults for windowBits and memLevel, * the value returned is a conservative worst case for the maximum expansion * resulting from using fixed blocks instead of stored blocks, which deflate * can emit on compressed data for some combinations of the parameters. * * This function could be more sophisticated to provide closer upper bounds for * every combination of windowBits and memLevel. But even the conservative * upper bound of about 14% expansion does not seem onerous for output buffer * allocation. */ uLong ZEXPORT deflateBound(strm, sourceLen) z_streamp strm; uLong sourceLen; { deflate_state *s; uLong complen, wraplen; Bytef *str; /* conservative upper bound for compressed data */ complen = sourceLen + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; /* if can't get parameters, return conservative bound plus zlib wrapper */ if (strm == Z_NULL || strm->state == Z_NULL) return complen + 6; /* compute wrapper length */ s = strm->state; switch (s->wrap) { case 0: /* raw deflate */ wraplen = 0; break; case 1: /* zlib wrapper */ wraplen = 6 + (s->strstart ? 4 : 0); break; case 2: /* gzip wrapper */ wraplen = 18; if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ if (s->gzhead->extra != Z_NULL) wraplen += 2 + s->gzhead->extra_len; str = s->gzhead->name; if (str != Z_NULL) do { wraplen++; } while (*str++); str = s->gzhead->comment; if (str != Z_NULL) do { wraplen++; } while (*str++); if (s->gzhead->hcrc) wraplen += 2; } break; default: /* for compiler happiness */ wraplen = 6; } /* if not default parameters, return conservative bound */ if (s->w_bits != 15 || s->hash_bits != 8 + 7) return complen + wraplen; /* default settings: return tight bound for that case */ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13 - 6 + wraplen; } /* ========================================================================= * Put a short in the pending buffer. The 16-bit value is put in MSB order. * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ local void putShortMSB (s, b) deflate_state *s; uInt b; { put_byte(s, (Byte)(b >> 8)); put_byte(s, (Byte)(b & 0xff)); } /* ========================================================================= * Flush as much pending output as possible. All deflate() output goes * through this function so some applications may wish to modify it * to avoid allocating a large strm->next_out buffer and copying into it. * (See also read_buf()). */ local void flush_pending(strm) z_streamp strm; { unsigned len; deflate_state *s = strm->state; _tr_flush_bits(s); len = s->pending; if (len > strm->avail_out) len = strm->avail_out; if (len == 0) return; zmemcpy(strm->next_out, s->pending_out, len); strm->next_out += len; s->pending_out += len; strm->total_out += len; strm->avail_out -= len; s->pending -= len; if (s->pending == 0) { s->pending_out = s->pending_buf; } } /* ========================================================================= */ int ZEXPORT deflate (strm, flush) z_streamp strm; int flush; { int old_flush; /* value of flush param for previous deflate call */ deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL || flush > Z_BLOCK || flush < 0) { return Z_STREAM_ERROR; } s = strm->state; if (strm->next_out == Z_NULL || (strm->next_in == Z_NULL && strm->avail_in != 0) || (s->status == FINISH_STATE && flush != Z_FINISH)) { ERR_RETURN(strm, Z_STREAM_ERROR); } if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); s->strm = strm; /* just in case */ old_flush = s->last_flush; s->last_flush = flush; /* Write the header */ if (s->status == INIT_STATE) { #ifdef GZIP if (s->wrap == 2) { strm->adler = crc32(0L, Z_NULL, 0); put_byte(s, 31); put_byte(s, 139); put_byte(s, 8); if (s->gzhead == Z_NULL) { put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, s->level == 9 ? 2 : (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0)); put_byte(s, OS_CODE); s->status = BUSY_STATE; } else { put_byte(s, (s->gzhead->text ? 1 : 0) + (s->gzhead->hcrc ? 2 : 0) + (s->gzhead->extra == Z_NULL ? 0 : 4) + (s->gzhead->name == Z_NULL ? 0 : 8) + (s->gzhead->comment == Z_NULL ? 0 : 16) ); put_byte(s, (Byte)(s->gzhead->time & 0xff)); put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); put_byte(s, s->level == 9 ? 2 : (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0)); put_byte(s, s->gzhead->os & 0xff); if (s->gzhead->extra != Z_NULL) { put_byte(s, s->gzhead->extra_len & 0xff); put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); } if (s->gzhead->hcrc) strm->adler = crc32(strm->adler, s->pending_buf, s->pending); s->gzindex = 0; s->status = EXTRA_STATE; } } else #endif { uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; uInt level_flags; if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) level_flags = 0; else if (s->level < 6) level_flags = 1; else if (s->level == 6) level_flags = 2; else level_flags = 3; header |= (level_flags << 6); if (s->strstart != 0) header |= PRESET_DICT; header += 31 - (header % 31); s->status = BUSY_STATE; putShortMSB(s, header); /* Save the adler32 of the preset dictionary: */ if (s->strstart != 0) { putShortMSB(s, (uInt)(strm->adler >> 16)); putShortMSB(s, (uInt)(strm->adler & 0xffff)); } strm->adler = adler32(0L, Z_NULL, 0); } } #ifdef GZIP if (s->status == EXTRA_STATE) { if (s->gzhead->extra != Z_NULL) { uInt beg = s->pending; /* start of bytes to update crc */ while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { if (s->pending == s->pending_buf_size) { if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); flush_pending(strm); beg = s->pending; if (s->pending == s->pending_buf_size) break; } put_byte(s, s->gzhead->extra[s->gzindex]); s->gzindex++; } if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); if (s->gzindex == s->gzhead->extra_len) { s->gzindex = 0; s->status = NAME_STATE; } } else s->status = NAME_STATE; } if (s->status == NAME_STATE) { if (s->gzhead->name != Z_NULL) { uInt beg = s->pending; /* start of bytes to update crc */ int val; do { if (s->pending == s->pending_buf_size) { if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); flush_pending(strm); beg = s->pending; if (s->pending == s->pending_buf_size) { val = 1; break; } } val = s->gzhead->name[s->gzindex++]; put_byte(s, val); } while (val != 0); if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); if (val == 0) { s->gzindex = 0; s->status = COMMENT_STATE; } } else s->status = COMMENT_STATE; } if (s->status == COMMENT_STATE) { if (s->gzhead->comment != Z_NULL) { uInt beg = s->pending; /* start of bytes to update crc */ int val; do { if (s->pending == s->pending_buf_size) { if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); flush_pending(strm); beg = s->pending; if (s->pending == s->pending_buf_size) { val = 1; break; } } val = s->gzhead->comment[s->gzindex++]; put_byte(s, val); } while (val != 0); if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); if (val == 0) s->status = HCRC_STATE; } else s->status = HCRC_STATE; } if (s->status == HCRC_STATE) { if (s->gzhead->hcrc) { if (s->pending + 2 > s->pending_buf_size) flush_pending(strm); if (s->pending + 2 <= s->pending_buf_size) { put_byte(s, (Byte)(strm->adler & 0xff)); put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); strm->adler = crc32(0L, Z_NULL, 0); s->status = BUSY_STATE; } } else s->status = BUSY_STATE; } #endif /* Flush as much pending output as possible */ if (s->pending != 0) { flush_pending(strm); if (strm->avail_out == 0) { /* Since avail_out is 0, deflate will be called again with * more output space, but possibly with both pending and * avail_in equal to zero. There won't be anything to do, * but this is not an error situation so make sure we * return OK instead of BUF_ERROR at next call of deflate: */ s->last_flush = -1; return Z_OK; } /* Make sure there is something to do and avoid duplicate consecutive * flushes. For repeated and useless calls with Z_FINISH, we keep * returning Z_STREAM_END instead of Z_BUF_ERROR. */ } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && flush != Z_FINISH) { ERR_RETURN(strm, Z_BUF_ERROR); } /* User must not provide more input after the first FINISH: */ if (s->status == FINISH_STATE && strm->avail_in != 0) { ERR_RETURN(strm, Z_BUF_ERROR); } if (strm->start_bit == 0) strm->start_bit = (strm->total_out + s->pending) * 8 + s->bi_valid; /* Start a new block or continue the current one. */ if (strm->avail_in != 0 || s->lookahead != 0 || (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { block_state bstate; bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : (s->strategy == Z_RLE ? deflate_rle(s, flush) : (*(configuration_table[s->level].func))(s, flush)); if (bstate == finish_started || bstate == finish_done) { s->status = FINISH_STATE; } if (bstate == need_more || bstate == finish_started) { if (strm->avail_out == 0) { s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ } return Z_OK; /* If flush != Z_NO_FLUSH && avail_out == 0, the next call * of deflate should use the same flush parameter to make sure * that the flush is complete. So we don't have to output an * empty block here, this will be done at next call. This also * ensures that for a very small output buffer, we emit at most * one empty block. */ } if (bstate == block_done) { if (flush == Z_PARTIAL_FLUSH) { _tr_align(s); } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ _tr_stored_block(s, (char*)0, 0L, 0); /* For a full flush, this empty block will be recognized * as a special marker by inflate_sync(). */ if (flush == Z_FULL_FLUSH) { CLEAR_HASH(s); /* forget history */ if (s->lookahead == 0) { s->strstart = 0; s->block_start = 0L; s->insert = 0; } } } flush_pending(strm); if (strm->avail_out == 0) { s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ return Z_OK; } } } Assert(strm->avail_out > 0, "bug2"); if (flush != Z_FINISH) return Z_OK; if (s->wrap <= 0) return Z_STREAM_END; /* Write the trailer */ #ifdef GZIP if (s->wrap == 2) { put_byte(s, (Byte)(strm->adler & 0xff)); put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); put_byte(s, (Byte)(strm->total_in & 0xff)); put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); } else #endif { putShortMSB(s, (uInt)(strm->adler >> 16)); putShortMSB(s, (uInt)(strm->adler & 0xffff)); } flush_pending(strm); /* If avail_out is zero, the application will call deflate again * to flush the rest. */ if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ return s->pending != 0 ? Z_OK : Z_STREAM_END; } /* ========================================================================= */ int ZEXPORT deflateEnd (strm) z_streamp strm; { int status; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; status = strm->state->status; if (status != INIT_STATE && status != EXTRA_STATE && status != NAME_STATE && status != COMMENT_STATE && status != HCRC_STATE && status != BUSY_STATE && status != FINISH_STATE) { return Z_STREAM_ERROR; } /* Deallocate in reverse order of allocations: */ TRY_FREE(strm, strm->state->pending_buf); TRY_FREE(strm, strm->state->head); TRY_FREE(strm, strm->state->prev); TRY_FREE(strm, strm->state->window); ZFREE(strm, strm->state); strm->state = Z_NULL; return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; } /* ========================================================================= * Copy the source state to the destination state. * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ int ZEXPORT deflateCopy (dest, source) z_streamp dest; z_streamp source; { #ifdef MAXSEG_64K return Z_STREAM_ERROR; #else deflate_state *ds; deflate_state *ss; ushf *overlay; if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { return Z_STREAM_ERROR; } ss = source->state; zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); if (ds == Z_NULL) return Z_MEM_ERROR; dest->state = (struct internal_state FAR *) ds; zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state)); ds->strm = dest; ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); ds->pending_buf = (uchf *) overlay; if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { deflateEnd (dest); return Z_MEM_ERROR; } /* following zmemcpy do not work for 16-bit MSDOS */ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; ds->bl_desc.dyn_tree = ds->bl_tree; return Z_OK; #endif /* MAXSEG_64K */ } /* =========================================================================== * Read a new buffer from the current input stream, update the adler32 * and total number of bytes read. All deflate() input goes through * this function so some applications may wish to modify it to avoid * allocating a large strm->next_in buffer and copying from it. * (See also flush_pending()). */ local int read_buf(strm, buf, size) z_streamp strm; Bytef *buf; unsigned size; { unsigned len = strm->avail_in; if (len > size) len = size; if (len == 0) return 0; strm->avail_in -= len; zmemcpy(buf, strm->next_in, len); if (strm->state->wrap == 1) { strm->adler = adler32(strm->adler, buf, len); } #ifdef GZIP else if (strm->state->wrap == 2) { strm->adler = crc32(strm->adler, buf, len); } #endif strm->next_in += len; strm->total_in += len; return (int)len; } /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ local void lm_init (s) deflate_state *s; { s->window_size = (ulg)2L*s->w_size; CLEAR_HASH(s); /* Set the default configuration parameters: */ s->max_lazy_match = configuration_table[s->level].max_lazy; s->good_match = configuration_table[s->level].good_length; s->nice_match = configuration_table[s->level].nice_length; s->max_chain_length = configuration_table[s->level].max_chain; s->strstart = 0; s->block_start = 0L; s->lookahead = 0; s->insert = 0; s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; #ifndef FASTEST #ifdef ASMV match_init(); /* initialize the asm code */ #endif #endif } #ifndef FASTEST /* =========================================================================== * Set match_start to the longest match starting at the given string and * return its length. Matches shorter or equal to prev_length are discarded, * in which case the result is equal to prev_length and match_start is * garbage. * IN assertions: cur_match is the head of the hash chain for the current * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ #ifndef ASMV /* For 80x86 and 680x0, an optimized version will be provided in match.asm or * match.S. The code will be functionally equivalent. */ local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ { unsigned chain_length = s->max_chain_length;/* max hash chain length */ register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *match; /* matched string */ register int len; /* length of current match */ int best_len = s->prev_length; /* best match length so far */ int nice_match = s->nice_match; /* stop if match long enough */ IPos limit = s->strstart > (IPos)MAX_DIST(s) ? s->strstart - (IPos)MAX_DIST(s) : NIL; /* Stop when cur_match becomes <= limit. To simplify the code, * we prevent matches with the string of window index 0. */ Posf *prev = s->prev; uInt wmask = s->w_mask; #ifdef UNALIGNED_OK /* Compare two bytes at a time. Note: this is not always beneficial. * Try with and without -DUNALIGNED_OK to check. */ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; register ush scan_start = *(ushf*)scan; register ush scan_end = *(ushf*)(scan+best_len-1); #else register Bytef *strend = s->window + s->strstart + MAX_MATCH; register Byte scan_end1 = scan[best_len-1]; register Byte scan_end = scan[best_len]; #endif /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); /* Do not waste too much time if we already have a good match: */ if (s->prev_length >= s->good_match) { chain_length >>= 2; } /* Do not look for matches beyond the end of the input. This is necessary * to make deflate deterministic. */ if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); do { Assert(cur_match < s->strstart, "no future"); match = s->window + cur_match; /* Skip to next match if the match length cannot increase * or if the match length is less than 2. Note that the checks below * for insufficient lookahead only occur occasionally for performance * reasons. Therefore uninitialized memory will be accessed, and * conditional jumps will be made that depend on those values. * However the length of the match is limited to the lookahead, so * the output of deflate is not affected by the uninitialized values. */ #if (defined(UNALIGNED_OK) && MAX_MATCH == 258) /* This code assumes sizeof(unsigned short) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ if (*(ushf*)(match+best_len-1) != scan_end || *(ushf*)match != scan_start) continue; /* It is not necessary to compare scan[2] and match[2] since they are * always equal when the other bytes match, given that the hash keys * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at * strstart+3, +5, ... up to strstart+257. We check for insufficient * lookahead only every 4th comparison; the 128th check will be made * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is * necessary to put more guard bytes at the end of the window, or * to check more often for insufficient lookahead. */ Assert(scan[2] == match[2], "scan[2]?"); scan++, match++; do { } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && *(ushf*)(scan+=2) == *(ushf*)(match+=2) && *(ushf*)(scan+=2) == *(ushf*)(match+=2) && *(ushf*)(scan+=2) == *(ushf*)(match+=2) && scan < strend); /* The funny "do {}" generates better code on most compilers */ /* Here, scan <= window+strstart+257 */ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); if (*scan == *match) scan++; len = (MAX_MATCH - 1) - (int)(strend-scan); scan = strend - (MAX_MATCH-1); #else /* UNALIGNED_OK */ if (match[best_len] != scan_end || match[best_len-1] != scan_end1 || *match != *scan || *++match != scan[1]) continue; /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2, match++; Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { } while (*++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && scan < strend); Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); scan = strend - MAX_MATCH; #endif /* UNALIGNED_OK */ if (len > best_len) { s->match_start = cur_match; best_len = len; if (len >= nice_match) break; #ifdef UNALIGNED_OK scan_end = *(ushf*)(scan+best_len-1); #else scan_end1 = scan[best_len-1]; scan_end = scan[best_len]; #endif } } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length != 0); if ((uInt)best_len <= s->lookahead) return (uInt)best_len; return s->lookahead; } #endif /* ASMV */ #else /* FASTEST */ /* --------------------------------------------------------------------------- * Optimized version for FASTEST only */ local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ { register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *match; /* matched string */ register int len; /* length of current match */ register Bytef *strend = s->window + s->strstart + MAX_MATCH; /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); Assert(cur_match < s->strstart, "no future"); match = s->window + cur_match; /* Return failure if the match length is less than 2: */ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2, match += 2; Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { } while (*++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && scan < strend); Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); if (len < MIN_MATCH) return MIN_MATCH - 1; s->match_start = cur_match; return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; } #endif /* FASTEST */ #ifdef DEBUG /* =========================================================================== * Check that the match at match_start is indeed a match. */ local void check_match(s, start, match, length) deflate_state *s; IPos start, match; int length; { /* check that the match is indeed a match */ if (zmemcmp(s->window + match, s->window + start, length) != EQUAL) { fprintf(stderr, " start %u, match %u, length %d\n", start, match, length); do { fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); } while (--length != 0); z_error("invalid match"); } if (z_verbose > 1) { fprintf(stderr,"\\[%d,%d]", start-match, length); do { putc(s->window[start++], stderr); } while (--length != 0); } } #else # define check_match(s, start, match, length) #endif /* DEBUG */ /* =========================================================================== * Fill the window when the lookahead becomes insufficient. * Updates strstart and lookahead. * * IN assertion: lookahead < MIN_LOOKAHEAD * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD * At least one byte has been read, or avail_in == 0; reads are * performed for at least two bytes (required for the zip translate_eol * option -- not supported here). */ local void fill_window(s) deflate_state *s; { register unsigned n, m; register Posf *p; unsigned more; /* Amount of free space at the end of the window. */ uInt wsize = s->w_size; Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); do { more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); /* Deal with !@#$% 64K limit: */ if (sizeof(int) <= 2) { if (more == 0 && s->strstart == 0 && s->lookahead == 0) { more = wsize; } else if (more == (unsigned)(-1)) { /* Very unlikely, but possible on 16 bit machine if * strstart == 0 && lookahead == 1 (input done a byte at time) */ more--; } } /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ if (s->strstart >= wsize+MAX_DIST(s)) { zmemcpy(s->window, s->window+wsize, (unsigned)wsize); s->match_start -= wsize; s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ s->block_start -= (long) wsize; /* Slide the hash table (could be avoided with 32 bit values at the expense of memory usage). We slide even when level == 0 to keep the hash table consistent if we switch back to level > 0 later. (Using level 0 permanently is not an optimal usage of zlib, so we don't care about this pathological case.) */ n = s->hash_size; p = &s->head[n]; do { m = *--p; *p = (Pos)(m >= wsize ? m-wsize : NIL); } while (--n); n = wsize; #ifndef FASTEST p = &s->prev[n]; do { m = *--p; *p = (Pos)(m >= wsize ? m-wsize : NIL); /* If n is not on any hash chain, prev[n] is garbage but * its value will never be used. */ } while (--n); #endif more += wsize; } if (s->strm->avail_in == 0) break; /* If there was no sliding: * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && * more == window_size - lookahead - strstart * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) * => more >= window_size - 2*WSIZE + 2 * In the BIG_MEM or MMAP case (not yet supported), * window_size == input_size + MIN_LOOKAHEAD && * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. * Otherwise, window_size == 2*WSIZE so more >= 2. * If there was sliding, more >= WSIZE. So in all cases, more >= 2. */ Assert(more >= 2, "more < 2"); n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); s->lookahead += n; /* Initialize the hash value now that we have some input: */ if (s->lookahead + s->insert >= MIN_MATCH) { uInt str = s->strstart - s->insert; s->ins_h = s->window[str]; UPDATE_HASH(s, s->ins_h, s->window[str + 1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif while (s->insert) { UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); #ifndef FASTEST s->prev[str & s->w_mask] = s->head[s->ins_h]; #endif s->head[s->ins_h] = (Pos)str; str++; s->insert--; if (s->lookahead + s->insert < MIN_MATCH) break; } } /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, * but this is not important since only literal bytes will be emitted. */ } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); /* If the WIN_INIT bytes after the end of the current data have never been * written, then zero those bytes in order to avoid memory check reports of * the use of uninitialized (or uninitialised as Julian writes) bytes by * the longest match routines. Update the high water mark for the next * time through here. WIN_INIT is set to MAX_MATCH since the longest match * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. */ if (s->high_water < s->window_size) { ulg curr = s->strstart + (ulg)(s->lookahead); ulg init; if (s->high_water < curr) { /* Previous high water mark below current data -- zero WIN_INIT * bytes or up to end of window, whichever is less. */ init = s->window_size - curr; if (init > WIN_INIT) init = WIN_INIT; zmemzero(s->window + curr, (unsigned)init); s->high_water = curr + init; } else if (s->high_water < (ulg)curr + WIN_INIT) { /* High water mark at or above current data, but below current data * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up * to end of window, whichever is less. */ init = (ulg)curr + WIN_INIT - s->high_water; if (init > s->window_size - s->high_water) init = s->window_size - s->high_water; zmemzero(s->window + s->high_water, (unsigned)init); s->high_water += init; } } Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, "not enough room for search"); } /* =========================================================================== * Flush the current block, with given end-of-file flag. * IN assertion: strstart is set to the end of the current match. */ #define FLUSH_BLOCK_ONLY(s, last) { \ _tr_flush_block(s, (s->block_start >= 0L ? \ (charf *)&s->window[(unsigned)s->block_start] : \ (charf *)Z_NULL), \ (ulg)((long)s->strstart - s->block_start), \ (last)); \ s->block_start = s->strstart; \ flush_pending(s->strm); \ Tracev((stderr,"[FLUSH]")); \ } /* Same but force premature exit if necessary. */ #define FLUSH_BLOCK(s, last) { \ FLUSH_BLOCK_ONLY(s, last); \ if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ } /* =========================================================================== * Copy without compression as much as possible from the input stream, return * the current block state. * This function does not insert new strings in the dictionary since * uncompressible data is probably not useful. This function is used * only for the level=0 compression option. * NOTE: this function should be optimized to avoid extra copying from * window to pending_buf. */ local block_state deflate_stored(s, flush) deflate_state *s; int flush; { /* Stored blocks are limited to 0xffff bytes, pending_buf is limited * to pending_buf_size, and each stored block has a 5 byte header: */ ulg max_block_size = 0xffff; ulg max_start; if (max_block_size > s->pending_buf_size - 5) { max_block_size = s->pending_buf_size - 5; } /* Copy as much as possible from input to output: */ for (;;) { /* Fill the window as much as possible: */ if (s->lookahead <= 1) { Assert(s->strstart < s->w_size+MAX_DIST(s) || s->block_start >= (long)s->w_size, "slide too late"); fill_window(s); if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; if (s->lookahead == 0) break; /* flush the current block */ } Assert(s->block_start >= 0L, "block gone"); s->strstart += s->lookahead; s->lookahead = 0; /* Emit a stored block if pending_buf will be full: */ max_start = s->block_start + max_block_size; if (s->strstart == 0 || (ulg)s->strstart >= max_start) { /* strstart == 0 is possible when wraparound on 16-bit machine */ s->lookahead = (uInt)(s->strstart - max_start); s->strstart = (uInt)max_start; FLUSH_BLOCK(s, 0); } /* Flush if we may have to slide, otherwise block_start may become * negative and the data will be gone: */ if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { FLUSH_BLOCK(s, 0); } } s->insert = 0; if (flush == Z_FINISH) { FLUSH_BLOCK(s, 1); return finish_done; } if ((long)s->strstart > s->block_start) FLUSH_BLOCK(s, 0); return block_done; } /* =========================================================================== * Compress as much as possible from the input stream, return the current * block state. * This function does not perform lazy evaluation of matches and inserts * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ local block_state deflate_fast(s, flush) deflate_state *s; int flush; { IPos hash_head; /* head of the hash chain */ int bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s->lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { return need_more; } if (s->lookahead == 0) break; /* flush the current block */ } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; if (s->lookahead >= MIN_MATCH) { INSERT_STRING(s, s->strstart, hash_head); } /* Find the longest match, discarding those <= prev_length. * At this point we have always match_length < MIN_MATCH */ if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ s->match_length = longest_match (s, hash_head); /* longest_match() sets match_start */ } if (s->match_length >= MIN_MATCH) { check_match(s, s->strstart, s->match_start, s->match_length); _tr_tally_dist(s, s->strstart - s->match_start, s->match_length - MIN_MATCH, bflush); s->lookahead -= s->match_length; /* Insert new strings in the hash table only if the match length * is not too large. This saves time but degrades compression. */ #ifndef FASTEST if (s->match_length <= s->max_insert_length && s->lookahead >= MIN_MATCH) { s->match_length--; /* string at strstart already in table */ do { s->strstart++; INSERT_STRING(s, s->strstart, hash_head); /* strstart never exceeds WSIZE-MAX_MATCH, so there are * always MIN_MATCH bytes ahead. */ } while (--s->match_length != 0); s->strstart++; } else #endif { s->strstart += s->match_length; s->match_length = 0; s->ins_h = s->window[s->strstart]; UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not * matter since it will be recomputed at next deflate call. */ } } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); _tr_tally_lit (s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } if (bflush) FLUSH_BLOCK(s, 0); } s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; if (flush == Z_FINISH) { FLUSH_BLOCK(s, 1); return finish_done; } if (s->last_lit) FLUSH_BLOCK(s, 0); return block_done; } #ifndef FASTEST /* =========================================================================== * Same as above, but achieves better compression. We use a lazy * evaluation for matches: a match is finally adopted only if there is * no better match at the next window position. */ local block_state deflate_slow(s, flush) deflate_state *s; int flush; { IPos hash_head; /* head of hash chain */ int bflush; /* set if current block must be flushed */ /* Process the input block. */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s->lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { return need_more; } if (s->lookahead == 0) break; /* flush the current block */ } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; if (s->lookahead >= MIN_MATCH) { INSERT_STRING(s, s->strstart, hash_head); } /* Find the longest match, discarding those <= prev_length. */ s->prev_length = s->match_length, s->prev_match = s->match_start; s->match_length = MIN_MATCH-1; if (hash_head != NIL && s->prev_length < s->max_lazy_match && s->strstart - hash_head <= MAX_DIST(s)) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ s->match_length = longest_match (s, hash_head); /* longest_match() sets match_start */ if (s->match_length <= 5 && (s->strategy == Z_FILTERED #if TOO_FAR <= 32767 || (s->match_length == MIN_MATCH && s->strstart - s->match_start > TOO_FAR) #endif )) { /* If prev_match is also MIN_MATCH, match_start is garbage * but we will ignore the current match anyway. */ s->match_length = MIN_MATCH-1; } } /* If there was a match at the previous step and the current * match is not better, output the previous match: */ if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ check_match(s, s->strstart-1, s->prev_match, s->prev_length); _tr_tally_dist(s, s->strstart -1 - s->prev_match, s->prev_length - MIN_MATCH, bflush); /* Insert in hash table all strings up to the end of the match. * strstart-1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ s->lookahead -= s->prev_length-1; s->prev_length -= 2; do { if (++s->strstart <= max_insert) { INSERT_STRING(s, s->strstart, hash_head); } } while (--s->prev_length != 0); s->match_available = 0; s->match_length = MIN_MATCH-1; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); } else if (s->match_available) { /* If there was no match at the previous position, output a * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ Tracevv((stderr,"%c", s->window[s->strstart-1])); _tr_tally_lit(s, s->window[s->strstart-1], bflush); if (bflush) { FLUSH_BLOCK_ONLY(s, 0); } s->strstart++; s->lookahead--; if (s->strm->avail_out == 0) return need_more; } else { /* There is no previous match to compare with, wait for * the next step to decide. */ s->match_available = 1; s->strstart++; s->lookahead--; } } Assert (flush != Z_NO_FLUSH, "no flush?"); if (s->match_available) { Tracevv((stderr,"%c", s->window[s->strstart-1])); _tr_tally_lit(s, s->window[s->strstart-1], bflush); s->match_available = 0; } s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; if (flush == Z_FINISH) { FLUSH_BLOCK(s, 1); return finish_done; } if (s->last_lit) FLUSH_BLOCK(s, 0); return block_done; } #endif /* FASTEST */ /* =========================================================================== * For Z_RLE, simply look for runs of bytes, generate matches only of distance * one. Do not maintain a hash table. (It will be regenerated if this run of * deflate switches away from Z_RLE.) */ local block_state deflate_rle(s, flush) deflate_state *s; int flush; { int bflush; /* set if current block must be flushed */ uInt prev; /* byte at distance one to match */ Bytef *scan, *strend; /* scan goes up to strend for length of run */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the longest run, plus one for the unrolled loop. */ if (s->lookahead <= MAX_MATCH) { fill_window(s); if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) { return need_more; } if (s->lookahead == 0) break; /* flush the current block */ } /* See how many times the previous byte repeats */ s->match_length = 0; if (s->lookahead >= MIN_MATCH && s->strstart > 0) { scan = s->window + s->strstart - 1; prev = *scan; if (prev == *++scan && prev == *++scan && prev == *++scan) { strend = s->window + s->strstart + MAX_MATCH; do { } while (prev == *++scan && prev == *++scan && prev == *++scan && prev == *++scan && prev == *++scan && prev == *++scan && prev == *++scan && prev == *++scan && scan < strend); s->match_length = MAX_MATCH - (int)(strend - scan); if (s->match_length > s->lookahead) s->match_length = s->lookahead; } Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ if (s->match_length >= MIN_MATCH) { check_match(s, s->strstart, s->strstart - 1, s->match_length); _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush); s->lookahead -= s->match_length; s->strstart += s->match_length; s->match_length = 0; } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); _tr_tally_lit (s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } if (bflush) FLUSH_BLOCK(s, 0); } s->insert = 0; if (flush == Z_FINISH) { FLUSH_BLOCK(s, 1); return finish_done; } if (s->last_lit) FLUSH_BLOCK(s, 0); return block_done; } /* =========================================================================== * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. * (It will be regenerated if this run of deflate switches away from Huffman.) */ local block_state deflate_huff(s, flush) deflate_state *s; int flush; { int bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we have a literal to write. */ if (s->lookahead == 0) { fill_window(s); if (s->lookahead == 0) { if (flush == Z_NO_FLUSH) return need_more; break; /* flush the current block */ } } /* Output a literal byte */ s->match_length = 0; Tracevv((stderr,"%c", s->window[s->strstart])); _tr_tally_lit (s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); } s->insert = 0; if (flush == Z_FINISH) { FLUSH_BLOCK(s, 1); return finish_done; } if (s->last_lit) FLUSH_BLOCK(s, 0); return block_done; } varnish-4.1.1/lib/libvgz/infback.c0000644000201500234410000005412512652366721013731 00000000000000/* infback.c -- inflate using a call-back interface * Copyright (C) 1995-2011 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* This code is largely copied from inflate.c. Normally either infback.o or inflate.o would be linked into an application--not both. The interface with inffast.c is retained so that optimized assembler-coded versions of inflate_fast() can be used with either inflate.c or infback.c. */ #include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h" /* function prototypes */ local void fixedtables OF((struct inflate_state FAR *state)); /* strm provides memory allocation functions in zalloc and zfree, or Z_NULL to use the library memory allocation functions. windowBits is in the range 8..15, and window is a user-supplied window and output buffer that is 2**windowBits bytes. */ int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) z_streamp strm; int windowBits; unsigned char FAR *window; const char *version; int stream_size; { struct inflate_state FAR *state; if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream))) return Z_VERSION_ERROR; if (strm == Z_NULL || window == Z_NULL || windowBits < 8 || windowBits > 15) return Z_STREAM_ERROR; strm->msg = Z_NULL; /* in case we return an error */ if (strm->zalloc == (alloc_func)0) { #ifdef Z_SOLO return Z_STREAM_ERROR; #else strm->zalloc = zcalloc; strm->opaque = (voidpf)0; #endif } if (strm->zfree == (free_func)0) #ifdef Z_SOLO return Z_STREAM_ERROR; #else strm->zfree = zcfree; #endif state = (struct inflate_state FAR *)ZALLOC(strm, 1, sizeof(struct inflate_state)); if (state == Z_NULL) return Z_MEM_ERROR; Tracev((stderr, "inflate: allocated\n")); strm->state = (struct internal_state FAR *)state; state->dmax = 32768U; state->wbits = windowBits; state->wsize = 1U << windowBits; state->window = window; state->wnext = 0; state->whave = 0; return Z_OK; } /* Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. If BUILDFIXED is defined, then instead this routine builds the tables the first time it's called, and returns those tables the first time and thereafter. This reduces the size of the code by about 2K bytes, in exchange for a little execution time. However, BUILDFIXED should not be used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ local void fixedtables(state) struct inflate_state FAR *state; { #ifdef BUILDFIXED static int virgin = 1; static code *lenfix, *distfix; static code fixed[544]; /* build fixed huffman tables if first call (may not be thread safe) */ if (virgin) { unsigned sym, bits; static code *next; /* literal/length table */ sym = 0; while (sym < 144) state->lens[sym++] = 8; while (sym < 256) state->lens[sym++] = 9; while (sym < 280) state->lens[sym++] = 7; while (sym < 288) state->lens[sym++] = 8; next = fixed; lenfix = next; bits = 9; inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); /* distance table */ sym = 0; while (sym < 32) state->lens[sym++] = 5; distfix = next; bits = 5; inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); /* do this just once */ virgin = 0; } #else /* !BUILDFIXED */ # include "inffixed.h" #endif /* BUILDFIXED */ state->lencode = lenfix; state->lenbits = 9; state->distcode = distfix; state->distbits = 5; } /* Macros for inflateBack(): */ /* Load returned state from inflate_fast() */ #define LOAD() \ do { \ put = strm->next_out; \ left = strm->avail_out; \ next = strm->next_in; \ have = strm->avail_in; \ hold = state->hold; \ bits = state->bits; \ } while (0) /* Set state from registers for inflate_fast() */ #define RESTORE() \ do { \ strm->next_out = put; \ strm->avail_out = left; \ strm->next_in = next; \ strm->avail_in = have; \ state->hold = hold; \ state->bits = bits; \ } while (0) /* Clear the input bit accumulator */ #define INITBITS() \ do { \ hold = 0; \ bits = 0; \ } while (0) /* Assure that some input is available. If input is requested, but denied, then return a Z_BUF_ERROR from inflateBack(). */ #define PULL() \ do { \ if (have == 0) { \ have = in(in_desc, &next); \ if (have == 0) { \ next = Z_NULL; \ ret = Z_BUF_ERROR; \ goto inf_leave; \ } \ } \ } while (0) /* Get a byte of input into the bit accumulator, or return from inflateBack() with an error if there is no input available. */ #define PULLBYTE() \ do { \ PULL(); \ have--; \ hold += (unsigned long)(*next++) << bits; \ bits += 8; \ } while (0) /* Assure that there are at least n bits in the bit accumulator. If there is not enough available input to do that, then return from inflateBack() with an error. */ #define NEEDBITS(n) \ do { \ while (bits < (unsigned)(n)) \ PULLBYTE(); \ } while (0) /* Return the low n bits of the bit accumulator (n < 16) */ #define BITS(n) \ ((unsigned)hold & ((1U << (n)) - 1)) /* Remove n bits from the bit accumulator */ #define DROPBITS(n) \ do { \ hold >>= (n); \ bits -= (unsigned)(n); \ } while (0) /* Remove zero to seven bits as needed to go to a byte boundary */ #define BYTEBITS() \ do { \ hold >>= bits & 7; \ bits -= bits & 7; \ } while (0) /* Assure that some output space is available, by writing out the window if it's full. If the write fails, return from inflateBack() with a Z_BUF_ERROR. */ #define ROOM() \ do { \ if (left == 0) { \ put = state->window; \ left = state->wsize; \ state->whave = left; \ if (out(out_desc, put, left)) { \ ret = Z_BUF_ERROR; \ goto inf_leave; \ } \ } \ } while (0) /* strm provides the memory allocation functions and window buffer on input, and provides information on the unused input on return. For Z_DATA_ERROR returns, strm will also provide an error message. in() and out() are the call-back input and output functions. When inflateBack() needs more input, it calls in(). When inflateBack() has filled the window with output, or when it completes with data in the window, it calls out() to write out the data. The application must not change the provided input until in() is called again or inflateBack() returns. The application must not change the window/output buffer until inflateBack() returns. in() and out() are called with a descriptor parameter provided in the inflateBack() call. This parameter can be a structure that provides the information required to do the read or write, as well as accumulated information on the input and output such as totals and check values. in() should return zero on failure. out() should return non-zero on failure. If either in() or out() fails, than inflateBack() returns a Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it was in() or out() that caused in the error. Otherwise, inflateBack() returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format error, or Z_MEM_ERROR if it could not allocate memory for the state. inflateBack() can also return Z_STREAM_ERROR if the input parameters are not correct, i.e. strm is Z_NULL or the state was not initialized. */ int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) z_streamp strm; in_func in; void FAR *in_desc; out_func out; void FAR *out_desc; { struct inflate_state FAR *state; z_const unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsigned long hold; /* bit buffer */ unsigned bits; /* bits in bit buffer */ unsigned copy; /* number of stored or match bytes to copy */ unsigned char FAR *from; /* where to copy match bytes from */ code here; /* current decoding table entry */ code last; /* parent table entry */ unsigned len; /* length to copy for repeats, bits to drop */ int ret; /* return code */ static const unsigned short order[19] = /* permutation of code lengths */ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; /* Check that the strm exists and that the state was initialized */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; /* Reset the state */ strm->msg = Z_NULL; state->mode = TYPE; state->last = 0; state->whave = 0; next = strm->next_in; have = next != Z_NULL ? strm->avail_in : 0; hold = 0; bits = 0; put = state->window; left = state->wsize; /* Inflate until end of block marked as last */ for (;;) switch (state->mode) { case TYPE: /* determine and dispatch block type */ if (state->last) { BYTEBITS(); state->mode = DONE; break; } NEEDBITS(3); state->last = BITS(1); DROPBITS(1); switch (BITS(2)) { case 0: /* stored block */ Tracev((stderr, "inflate: stored block%s\n", state->last ? " (last)" : "")); state->mode = STORED; break; case 1: /* fixed block */ fixedtables(state); Tracev((stderr, "inflate: fixed codes block%s\n", state->last ? " (last)" : "")); state->mode = LEN; /* decode codes */ break; case 2: /* dynamic block */ Tracev((stderr, "inflate: dynamic codes block%s\n", state->last ? " (last)" : "")); state->mode = TABLE; break; case 3: strm->msg = "invalid block type"; state->mode = BAD; } DROPBITS(2); break; case STORED: /* get and verify stored block length */ BYTEBITS(); /* go to byte boundary */ NEEDBITS(32); if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { strm->msg = "invalid stored block lengths"; state->mode = BAD; break; } state->length = (unsigned)hold & 0xffff; Tracev((stderr, "inflate: stored length %u\n", state->length)); INITBITS(); /* copy stored block from input to output */ while (state->length != 0) { copy = state->length; PULL(); ROOM(); if (copy > have) copy = have; if (copy > left) copy = left; zmemcpy(put, next, copy); have -= copy; next += copy; left -= copy; put += copy; state->length -= copy; } Tracev((stderr, "inflate: stored end\n")); state->mode = TYPE; break; case TABLE: /* get dynamic table entries descriptor */ NEEDBITS(14); state->nlen = BITS(5) + 257; DROPBITS(5); state->ndist = BITS(5) + 1; DROPBITS(5); state->ncode = BITS(4) + 4; DROPBITS(4); #ifndef PKZIP_BUG_WORKAROUND if (state->nlen > 286 || state->ndist > 30) { strm->msg = "too many length or distance symbols"; state->mode = BAD; break; } #endif Tracev((stderr, "inflate: table sizes ok\n")); /* get code length code lengths (not a typo) */ state->have = 0; while (state->have < state->ncode) { NEEDBITS(3); state->lens[order[state->have++]] = (unsigned short)BITS(3); DROPBITS(3); } while (state->have < 19) state->lens[order[state->have++]] = 0; state->next = state->codes; state->lencode = (code const FAR *)(state->next); state->lenbits = 7; ret = inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = "invalid code lengths set"; state->mode = BAD; break; } Tracev((stderr, "inflate: code lengths ok\n")); /* get length and distance code code lengths */ state->have = 0; while (state->have < state->nlen + state->ndist) { for (;;) { here = state->lencode[BITS(state->lenbits)]; if ((unsigned)(here.bits) <= bits) break; PULLBYTE(); } if (here.val < 16) { DROPBITS(here.bits); state->lens[state->have++] = here.val; } else { if (here.val == 16) { NEEDBITS(here.bits + 2); DROPBITS(here.bits); if (state->have == 0) { strm->msg = "invalid bit length repeat"; state->mode = BAD; break; } len = (unsigned)(state->lens[state->have - 1]); copy = 3 + BITS(2); DROPBITS(2); } else if (here.val == 17) { NEEDBITS(here.bits + 3); DROPBITS(here.bits); len = 0; copy = 3 + BITS(3); DROPBITS(3); } else { NEEDBITS(here.bits + 7); DROPBITS(here.bits); len = 0; copy = 11 + BITS(7); DROPBITS(7); } if (state->have + copy > state->nlen + state->ndist) { strm->msg = "invalid bit length repeat"; state->mode = BAD; break; } while (copy--) state->lens[state->have++] = (unsigned short)len; } } /* handle error breaks in while */ if (state->mode == BAD) break; /* check for end-of-block code (better have one) */ if (state->lens[256] == 0) { strm->msg = "invalid code -- missing end-of-block"; state->mode = BAD; break; } /* build code tables -- note: do not change the lenbits or distbits values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ state->next = state->codes; state->lencode = (code const FAR *)(state->next); state->lenbits = 9; ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = "invalid literal/lengths set"; state->mode = BAD; break; } state->distcode = (code const FAR *)(state->next); state->distbits = 6; ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, &(state->next), &(state->distbits), state->work); if (ret) { strm->msg = "invalid distances set"; state->mode = BAD; break; } Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN; case LEN: /* use inflate_fast() if we have enough input and output */ if (have >= 6 && left >= 258) { RESTORE(); if (state->whave < state->wsize) state->whave = state->wsize - left; inflate_fast(strm, state->wsize); LOAD(); break; } /* get a literal, length, or end-of-block code */ for (;;) { here = state->lencode[BITS(state->lenbits)]; if ((unsigned)(here.bits) <= bits) break; PULLBYTE(); } if (here.op && (here.op & 0xf0) == 0) { last = here; for (;;) { here = state->lencode[last.val + (BITS(last.bits + last.op) >> last.bits)]; if ((unsigned)(last.bits + here.bits) <= bits) break; PULLBYTE(); } DROPBITS(last.bits); } DROPBITS(here.bits); state->length = (unsigned)here.val; /* process literal */ if (here.op == 0) { Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? "inflate: literal '%c'\n" : "inflate: literal 0x%02x\n", here.val)); ROOM(); *put++ = (unsigned char)(state->length); left--; state->mode = LEN; break; } /* process end of block */ if (here.op & 32) { Tracevv((stderr, "inflate: end of block\n")); state->mode = TYPE; break; } /* invalid code */ if (here.op & 64) { strm->msg = "invalid literal/length code"; state->mode = BAD; break; } /* length code -- get extra bits, if any */ state->extra = (unsigned)(here.op) & 15; if (state->extra != 0) { NEEDBITS(state->extra); state->length += BITS(state->extra); DROPBITS(state->extra); } Tracevv((stderr, "inflate: length %u\n", state->length)); /* get distance code */ for (;;) { here = state->distcode[BITS(state->distbits)]; if ((unsigned)(here.bits) <= bits) break; PULLBYTE(); } if ((here.op & 0xf0) == 0) { last = here; for (;;) { here = state->distcode[last.val + (BITS(last.bits + last.op) >> last.bits)]; if ((unsigned)(last.bits + here.bits) <= bits) break; PULLBYTE(); } DROPBITS(last.bits); } DROPBITS(here.bits); if (here.op & 64) { strm->msg = "invalid distance code"; state->mode = BAD; break; } state->offset = (unsigned)here.val; /* get distance extra bits, if any */ state->extra = (unsigned)(here.op) & 15; if (state->extra != 0) { NEEDBITS(state->extra); state->offset += BITS(state->extra); DROPBITS(state->extra); } if (state->offset > state->wsize - (state->whave < state->wsize ? left : 0)) { strm->msg = "invalid distance too far back"; state->mode = BAD; break; } Tracevv((stderr, "inflate: distance %u\n", state->offset)); /* copy match from window to output */ do { ROOM(); copy = state->wsize - state->offset; if (copy < left) { from = put + copy; copy = left - copy; } else { from = put - state->offset; copy = left; } if (copy > state->length) copy = state->length; state->length -= copy; left -= copy; do { *put++ = *from++; } while (--copy); } while (state->length != 0); break; case DONE: /* inflate stream terminated properly -- write leftover output */ ret = Z_STREAM_END; if (left < state->wsize) { if (out(out_desc, state->window, state->wsize - left)) ret = Z_BUF_ERROR; } goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; default: /* can't happen, but makes compilers happy */ ret = Z_STREAM_ERROR; goto inf_leave; } /* Return unused input */ inf_leave: strm->next_in = next; strm->avail_in = have; return ret; } int ZEXPORT inflateBackEnd(strm) z_streamp strm; { if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) return Z_STREAM_ERROR; ZFREE(strm, strm->state); strm->state = Z_NULL; Tracev((stderr, "inflate: end\n")); return Z_OK; } varnish-4.1.1/lib/libvgz/trees.h0000644000201500234410000002043012652366721013453 00000000000000/* header created automatically with -DGEN_TREES_H */ local const ct_data static_ltree[L_CODES+2] = { {{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, {{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, {{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, {{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, {{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, {{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, {{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, {{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, {{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, {{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, {{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, {{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, {{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, {{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, {{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, {{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, {{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, {{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, {{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, {{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, {{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, {{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, {{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, {{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, {{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, {{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, {{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, {{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, {{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, {{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, {{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, {{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, {{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, {{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, {{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, {{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, {{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, {{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, {{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, {{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, {{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, {{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, {{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, {{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, {{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, {{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, {{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, {{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, {{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, {{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, {{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, {{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, {{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, {{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, {{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, {{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, {{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, {{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} }; local const ct_data static_dtree[D_CODES] = { {{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, {{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, {{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, {{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, {{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, {{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} }; const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = { 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, 18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 }; const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 }; local const int base_length[LENGTH_CODES] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0 }; local const int base_dist[D_CODES] = { 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 }; varnish-4.1.1/lib/libvgz/zutil.c0000644000201500234410000001636612652366721013510 00000000000000/* zutil.c -- target dependent utility functions for the compression library * Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #include "zutil.h" #ifndef Z_SOLO # include "gzguts.h" #endif #ifndef NO_DUMMY_DECL struct internal_state {int dummy;}; /* for buggy compilers */ #endif z_const char * const z_errmsg[10] = { "need dictionary", /* Z_NEED_DICT 2 */ "stream end", /* Z_STREAM_END 1 */ "", /* Z_OK 0 */ "file error", /* Z_ERRNO (-1) */ "stream error", /* Z_STREAM_ERROR (-2) */ "data error", /* Z_DATA_ERROR (-3) */ "insufficient memory", /* Z_MEM_ERROR (-4) */ "buffer error", /* Z_BUF_ERROR (-5) */ "incompatible version",/* Z_VERSION_ERROR (-6) */ ""}; const char * ZEXPORT zlibVersion() { return ZLIB_VERSION; } uLong ZEXPORT zlibCompileFlags() { uLong flags; flags = 0; switch ((int)(sizeof(uInt))) { case 2: break; case 4: flags += 1; break; case 8: flags += 2; break; default: flags += 3; } switch ((int)(sizeof(uLong))) { case 2: break; case 4: flags += 1 << 2; break; case 8: flags += 2 << 2; break; default: flags += 3 << 2; } switch ((int)(sizeof(voidpf))) { case 2: break; case 4: flags += 1 << 4; break; case 8: flags += 2 << 4; break; default: flags += 3 << 4; } switch ((int)(sizeof(z_off_t))) { case 2: break; case 4: flags += 1 << 6; break; case 8: flags += 2 << 6; break; default: flags += 3 << 6; } #ifdef DEBUG flags += 1 << 8; #endif #if defined(ASMV) || defined(ASMINF) flags += 1 << 9; #endif #ifdef ZLIB_WINAPI flags += 1 << 10; #endif #ifdef BUILDFIXED flags += 1 << 12; #endif #ifdef DYNAMIC_CRC_TABLE flags += 1 << 13; #endif #ifdef NO_GZCOMPRESS flags += 1L << 16; #endif #ifdef NO_GZIP flags += 1L << 17; #endif #ifdef PKZIP_BUG_WORKAROUND flags += 1L << 20; #endif #ifdef FASTEST flags += 1L << 21; #endif #if defined(STDC) || defined(Z_HAVE_STDARG_H) # ifdef NO_vsnprintf flags += 1L << 25; # ifdef HAS_vsprintf_void flags += 1L << 26; # endif # else # ifdef HAS_vsnprintf_void flags += 1L << 26; # endif # endif #else flags += 1L << 24; # ifdef NO_snprintf flags += 1L << 25; # ifdef HAS_sprintf_void flags += 1L << 26; # endif # else # ifdef HAS_snprintf_void flags += 1L << 26; # endif # endif #endif return flags; } #ifdef DEBUG # ifndef verbose # define verbose 0 # endif int ZLIB_INTERNAL z_verbose = verbose; void ZLIB_INTERNAL z_error (m) char *m; { fprintf(stderr, "%s\n", m); exit(1); } #endif /* exported to allow conversion of error code to string for compress() and * uncompress() */ const char * ZEXPORT zError(err) int err; { return ERR_MSG(err); } #if defined(_WIN32_WCE) /* The Microsoft C Run-Time Library for Windows CE doesn't have * errno. We define it as a global variable to simplify porting. * Its value is always 0 and should not be used. */ int errno = 0; #endif #ifndef HAVE_MEMCPY void ZLIB_INTERNAL zmemcpy(dest, source, len) Bytef* dest; const Bytef* source; uInt len; { if (len == 0) return; do { *dest++ = *source++; /* ??? to be unrolled */ } while (--len != 0); } int ZLIB_INTERNAL zmemcmp(s1, s2, len) const Bytef* s1; const Bytef* s2; uInt len; { uInt j; for (j = 0; j < len; j++) { if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; } return 0; } void ZLIB_INTERNAL zmemzero(dest, len) Bytef* dest; uInt len; { if (len == 0) return; do { *dest++ = 0; /* ??? to be unrolled */ } while (--len != 0); } #endif #ifndef Z_SOLO #ifdef SYS16BIT #ifdef __TURBOC__ /* Turbo C in 16-bit mode */ # define MY_ZCALLOC /* Turbo C malloc() does not allow dynamic allocation of 64K bytes * and farmalloc(64K) returns a pointer with an offset of 8, so we * must fix the pointer. Warning: the pointer must be put back to its * original form in order to free it, use zcfree(). */ #define MAX_PTR 10 /* 10*64K = 640K */ local int next_ptr = 0; typedef struct ptr_table_s { voidpf org_ptr; voidpf new_ptr; } ptr_table; local ptr_table table[MAX_PTR]; /* This table is used to remember the original form of pointers * to large buffers (64K). Such pointers are normalized with a zero offset. * Since MSDOS is not a preemptive multitasking OS, this table is not * protected from concurrent access. This hack doesn't work anyway on * a protected system like OS/2. Use Microsoft C instead. */ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) { voidpf buf = opaque; /* just to make some compilers happy */ ulg bsize = (ulg)items*size; /* If we allocate less than 65520 bytes, we assume that farmalloc * will return a usable pointer which doesn't have to be normalized. */ if (bsize < 65520L) { buf = farmalloc(bsize); if (*(ush*)&buf != 0) return buf; } else { buf = farmalloc(bsize + 16L); } if (buf == NULL || next_ptr >= MAX_PTR) return NULL; table[next_ptr].org_ptr = buf; /* Normalize the pointer to seg:0 */ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; *(ush*)&buf = 0; table[next_ptr++].new_ptr = buf; return buf; } void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) { int n; if (*(ush*)&ptr != 0) { /* object < 64K */ farfree(ptr); return; } /* Find the original pointer */ for (n = 0; n < next_ptr; n++) { if (ptr != table[n].new_ptr) continue; farfree(table[n].org_ptr); while (++n < next_ptr) { table[n-1] = table[n]; } next_ptr--; return; } ptr = opaque; /* just to make some compilers happy */ Assert(0, "zcfree: ptr not found"); } #endif /* __TURBOC__ */ #ifdef M_I86 /* Microsoft C in 16-bit mode */ # define MY_ZCALLOC #if (!defined(_MSC_VER) || (_MSC_VER <= 600)) # define _halloc halloc # define _hfree hfree #endif voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) { if (opaque) opaque = 0; /* to make compiler happy */ return _halloc((long)items, size); } void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) { if (opaque) opaque = 0; /* to make compiler happy */ _hfree(ptr); } #endif /* M_I86 */ #endif /* SYS16BIT */ #ifndef MY_ZCALLOC /* Any system without a special alloc function */ #ifndef STDC extern voidp malloc OF((uInt size)); extern voidp calloc OF((uInt items, uInt size)); extern void free OF((voidpf ptr)); #endif voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) voidpf opaque; unsigned items; unsigned size; { if (opaque) items += size - size; /* make compiler happy */ return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : (voidpf)calloc(items, size); } void ZLIB_INTERNAL zcfree (opaque, ptr) voidpf opaque; voidpf ptr; { free(ptr); if (opaque) return; /* make compiler happy */ } #endif /* MY_ZCALLOC */ #endif /* !Z_SOLO */ varnish-4.1.1/lib/libvgz/compress.c0000644000201500234410000000474012652366721014165 00000000000000/* compress.c -- compress a memory buffer * Copyright (C) 1995-2005 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #define ZLIB_INTERNAL #include "vgz.h" /* =========================================================================== Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least 0.1% larger than sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; int level; { z_stream stream; int err; stream.next_in = (z_const Bytef *)source; stream.avail_in = (uInt)sourceLen; #ifdef MAXSEG_64K /* Check for source > 64K on 16-bit machine: */ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; #endif stream.next_out = dest; stream.avail_out = (uInt)*destLen; if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; stream.zalloc = (alloc_func)0; stream.zfree = (free_func)0; stream.opaque = (voidpf)0; err = deflateInit(&stream, level); if (err != Z_OK) return err; err = deflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { deflateEnd(&stream); return err == Z_OK ? Z_BUF_ERROR : err; } *destLen = stream.total_out; err = deflateEnd(&stream); return err; } /* =========================================================================== */ int ZEXPORT compress (dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; { return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); } /* =========================================================================== If the default memLevel or windowBits for deflateInit() is changed, then this function needs to be updated. */ uLong ZEXPORT compressBound (sourceLen) uLong sourceLen; { return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13; } varnish-4.1.1/lib/libvgz/trees.c0000644000201500234410000012664612652366721013466 00000000000000/* trees.c -- output deflated data using Huffman coding * Copyright (C) 1995-2012 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ /* * ALGORITHM * * The "deflation" process uses several Huffman trees. The more * common source values are represented by shorter bit sequences. * * Each code tree is stored in a compressed form which is itself * a Huffman encoding of the lengths of all the code strings (in * ascending order by source values). The actual code strings are * reconstructed from the lengths in the inflate process, as described * in the deflate specification. * * REFERENCES * * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc * * Storer, James A. * Data Compression: Methods and Theory, pp. 49-50. * Computer Science Press, 1988. ISBN 0-7167-8156-5. * * Sedgewick, R. * Algorithms, p290. * Addison-Wesley, 1983. ISBN 0-201-06672-6. */ /* @(#) $Id$ */ /* #define GEN_TREES_H */ #include "deflate.h" #ifdef DEBUG # include #endif /* =========================================================================== * Constants */ #define MAX_BL_BITS 7 /* Bit length codes must not exceed MAX_BL_BITS bits */ #define END_BLOCK 256 /* end of block literal code */ #define REP_3_6 16 /* repeat previous bit length 3-6 times (2 bits of repeat count) */ #define REPZ_3_10 17 /* repeat a zero length 3-10 times (3 bits of repeat count) */ #define REPZ_11_138 18 /* repeat a zero length 11-138 times (7 bits of repeat count) */ local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; local const int extra_dbits[D_CODES] /* extra bits for each distance code */ = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; local const uch bl_order[BL_CODES] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; /* The lengths of the bit length codes are sent in order of decreasing * probability, to avoid transmitting the lengths for unused bit length codes. */ /* =========================================================================== * Local data. These are initialized only once. */ #define DIST_CODE_LEN 512 /* see definition of array dist_code below */ #if defined(GEN_TREES_H) || !defined(STDC) /* non ANSI compilers may not accept trees.h */ local ct_data static_ltree[L_CODES+2]; /* The static literal tree. Since the bit lengths are imposed, there is no * need for the L_CODES extra codes used during heap construction. However * The codes 286 and 287 are needed to build a canonical tree (see _tr_init * below). */ local ct_data static_dtree[D_CODES]; /* The static distance tree. (Actually a trivial tree since all codes use * 5 bits.) */ uch _dist_code[DIST_CODE_LEN]; /* Distance codes. The first 256 values correspond to the distances * 3 .. 258, the last 256 values correspond to the top 8 bits of * the 15 bit distances. */ uch _length_code[MAX_MATCH-MIN_MATCH+1]; /* length code for each normalized match length (0 == MIN_MATCH) */ local int base_length[LENGTH_CODES]; /* First normalized length for each code (0 = MIN_MATCH) */ local int base_dist[D_CODES]; /* First normalized distance for each code (0 = distance of 1) */ #else # include "trees.h" #endif /* GEN_TREES_H */ struct static_tree_desc_s { const ct_data *static_tree; /* static tree or NULL */ const intf *extra_bits; /* extra bits for each code or NULL */ int extra_base; /* base index for extra_bits */ int elems; /* max number of elements in the tree */ int max_length; /* max bit length for the codes */ }; local static_tree_desc static_l_desc = {static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; local static_tree_desc static_d_desc = {static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; local static_tree_desc static_bl_desc = {(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; /* =========================================================================== * Local (static) routines in this file. */ local void tr_static_init OF((void)); local void init_block OF((deflate_state *s)); local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); local void build_tree OF((deflate_state *s, tree_desc *desc)); local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); local int build_bl_tree OF((deflate_state *s)); local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, int blcodes)); local void compress_block OF((deflate_state *s, const ct_data *ltree, const ct_data *dtree)); local int detect_data_type OF((deflate_state *s)); local unsigned bi_reverse OF((unsigned value, int length)); local void bi_windup OF((deflate_state *s)); local void bi_flush OF((deflate_state *s)); local void copy_block OF((deflate_state *s, charf *buf, unsigned len, int header)); #ifdef GEN_TREES_H local void gen_trees_header OF((void)); #endif #ifndef DEBUG # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) /* Send a code of the given tree. c and tree must not have side effects */ #else /* DEBUG */ # define send_code(s, c, tree) \ { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ send_bits(s, tree[c].Code, tree[c].Len); } #endif /* =========================================================================== * Output a short LSB first on the stream. * IN assertion: there is enough room in pendingBuf. */ #define put_short(s, w) { \ put_byte(s, (uch)((w) & 0xff)); \ put_byte(s, (uch)((ush)(w) >> 8)); \ } /* =========================================================================== * Send a value on a given number of bits. * IN assertion: length <= 16 and value fits in length bits. */ #ifdef DEBUG local void send_bits OF((deflate_state *s, int value, int length)); local void send_bits(s, value, length) deflate_state *s; int value; /* value to send */ int length; /* number of bits */ { Tracevv((stderr," l %2d v %4x ", length, value)); Assert(length > 0 && length <= 15, "invalid length"); s->bits_sent += (ulg)length; /* If not enough room in bi_buf, use (valid) bits from bi_buf and * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) * unused bits in value. */ if (s->bi_valid > (int)Buf_size - length) { s->bi_buf |= (ush)value << s->bi_valid; put_short(s, s->bi_buf); s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); s->bi_valid += length - Buf_size; } else { s->bi_buf |= (ush)value << s->bi_valid; s->bi_valid += length; } } #else /* !DEBUG */ #define send_bits(s, value, length) \ { int len = length;\ if (s->bi_valid > (int)Buf_size - len) {\ int val = value;\ s->bi_buf |= (ush)val << s->bi_valid;\ put_short(s, s->bi_buf);\ s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ s->bi_valid += len - Buf_size;\ } else {\ s->bi_buf |= (ush)(value) << s->bi_valid;\ s->bi_valid += len;\ }\ } #endif /* DEBUG */ /* the arguments must not have side effects */ /* =========================================================================== * Initialize the various 'constant' tables. */ local void tr_static_init() { #if defined(GEN_TREES_H) || !defined(STDC) static int static_init_done = 0; int n; /* iterates over tree elements */ int bits; /* bit counter */ int length; /* length value */ int code; /* code value */ int dist; /* distance index */ ush bl_count[MAX_BITS+1]; /* number of codes at each bit length for an optimal tree */ if (static_init_done) return; /* For some embedded targets, global variables are not initialized: */ #ifdef NO_INIT_GLOBAL_POINTERS static_l_desc.static_tree = static_ltree; static_l_desc.extra_bits = extra_lbits; static_d_desc.static_tree = static_dtree; static_d_desc.extra_bits = extra_dbits; static_bl_desc.extra_bits = extra_blbits; #endif /* Initialize the mapping length (0..255) -> length code (0..28) */ length = 0; for (code = 0; code < LENGTH_CODES-1; code++) { base_length[code] = length; for (n = 0; n < (1< dist code (0..29) */ dist = 0; for (code = 0 ; code < 16; code++) { base_dist[code] = dist; for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ for ( ; code < D_CODES; code++) { base_dist[code] = dist << 7; for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { _dist_code[256 + dist++] = (uch)code; } } Assert (dist == 256, "tr_static_init: 256+dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; n = 0; while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; /* Codes 286 and 287 do not exist, but we must include them in the * tree construction to get a canonical Huffman tree (longest code * all ones) */ gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); /* The static distance tree is trivial: */ for (n = 0; n < D_CODES; n++) { static_dtree[n].Len = 5; static_dtree[n].Code = bi_reverse((unsigned)n, 5); } static_init_done = 1; # ifdef GEN_TREES_H gen_trees_header(); # endif #endif /* defined(GEN_TREES_H) || !defined(STDC) */ } /* =========================================================================== * Genererate the file trees.h describing the static trees. */ #ifdef GEN_TREES_H # ifndef DEBUG # include # endif # define SEPARATOR(i, last, width) \ ((i) == (last)? "\n};\n\n" : \ ((i) % (width) == (width)-1 ? ",\n" : ", ")) void gen_trees_header() { FILE *header = fopen("trees.h", "w"); int i; Assert (header != NULL, "Can't open trees.h"); fprintf(header, "/* header created automatically with -DGEN_TREES_H */\n\n"); fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); for (i = 0; i < L_CODES+2; i++) { fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); } fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); for (i = 0; i < D_CODES; i++) { fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); } fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); for (i = 0; i < DIST_CODE_LEN; i++) { fprintf(header, "%2u%s", _dist_code[i], SEPARATOR(i, DIST_CODE_LEN-1, 20)); } fprintf(header, "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { fprintf(header, "%2u%s", _length_code[i], SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); } fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); for (i = 0; i < LENGTH_CODES; i++) { fprintf(header, "%1u%s", base_length[i], SEPARATOR(i, LENGTH_CODES-1, 20)); } fprintf(header, "local const int base_dist[D_CODES] = {\n"); for (i = 0; i < D_CODES; i++) { fprintf(header, "%5u%s", base_dist[i], SEPARATOR(i, D_CODES-1, 10)); } fclose(header); } #endif /* GEN_TREES_H */ /* =========================================================================== * Initialize the tree data structures for a new zlib stream. */ void ZLIB_INTERNAL _tr_init(s) deflate_state *s; { tr_static_init(); s->l_desc.dyn_tree = s->dyn_ltree; s->l_desc.stat_desc = &static_l_desc; s->d_desc.dyn_tree = s->dyn_dtree; s->d_desc.stat_desc = &static_d_desc; s->bl_desc.dyn_tree = s->bl_tree; s->bl_desc.stat_desc = &static_bl_desc; s->bi_buf = 0; s->bi_valid = 0; #ifdef DEBUG s->compressed_len = 0L; s->bits_sent = 0L; #endif /* Initialize the first block of the first file: */ init_block(s); } /* =========================================================================== * Initialize a new block. */ local void init_block(s) deflate_state *s; { int n; /* iterates over tree elements */ /* Initialize the trees. */ for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; s->dyn_ltree[END_BLOCK].Freq = 1; s->opt_len = s->static_len = 0L; s->last_lit = s->matches = 0; } #define SMALLEST 1 /* Index within the heap array of least frequent node in the Huffman tree */ /* =========================================================================== * Remove the smallest element from the heap and recreate the heap with * one less element. Updates heap and heap_len. */ #define pqremove(s, tree, top) \ {\ top = s->heap[SMALLEST]; \ s->heap[SMALLEST] = s->heap[s->heap_len--]; \ pqdownheap(s, tree, SMALLEST); \ } /* =========================================================================== * Compares to subtrees, using the tree depth as tie breaker when * the subtrees have equal frequency. This minimizes the worst case length. */ #define smaller(tree, n, m, depth) \ (tree[n].Freq < tree[m].Freq || \ (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) /* =========================================================================== * Restore the heap property by moving down the tree starting at node k, * exchanging a node with the smallest of its two sons if necessary, stopping * when the heap property is re-established (each father smaller than its * two sons). */ local void pqdownheap(s, tree, k) deflate_state *s; ct_data *tree; /* the tree to restore */ int k; /* node to move down */ { int v = s->heap[k]; int j = k << 1; /* left son of k */ while (j <= s->heap_len) { /* Set j to the smallest of the two sons: */ if (j < s->heap_len && smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { j++; } /* Exit if v is smaller than both sons */ if (smaller(tree, v, s->heap[j], s->depth)) break; /* Exchange v with the smallest son */ s->heap[k] = s->heap[j]; k = j; /* And continue down the tree, setting j to the left son of k */ j <<= 1; } s->heap[k] = v; } /* =========================================================================== * Compute the optimal bit lengths for a tree and update the total bit length * for the current block. * IN assertion: the fields freq and dad are set, heap[heap_max] and * above are the tree nodes sorted by increasing frequency. * OUT assertions: the field len is set to the optimal bit length, the * array bl_count contains the frequencies for each bit length. * The length opt_len is updated; static_len is also updated if stree is * not null. */ local void gen_bitlen(s, desc) deflate_state *s; tree_desc *desc; /* the tree descriptor */ { ct_data *tree = desc->dyn_tree; int max_code = desc->max_code; const ct_data *stree = desc->stat_desc->static_tree; const intf *extra = desc->stat_desc->extra_bits; int base = desc->stat_desc->extra_base; int max_length = desc->stat_desc->max_length; int h; /* heap index */ int n, m; /* iterate over the tree elements */ int bits; /* bit length */ int xbits; /* extra bits */ ush f; /* frequency */ int overflow = 0; /* number of elements with bit length too large */ for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; /* In a first pass, compute the optimal bit lengths (which may * overflow in the case of the bit length tree). */ tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ for (h = s->heap_max+1; h < HEAP_SIZE; h++) { n = s->heap[h]; bits = tree[tree[n].Dad].Len + 1; if (bits > max_length) bits = max_length, overflow++; tree[n].Len = (ush)bits; /* We overwrite tree[n].Dad which is no longer needed */ if (n > max_code) continue; /* not a leaf node */ s->bl_count[bits]++; xbits = 0; if (n >= base) xbits = extra[n-base]; f = tree[n].Freq; s->opt_len += (ulg)f * (bits + xbits); if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); } if (overflow == 0) return; Trace((stderr,"\nbit length overflow\n")); /* This happens for example on obj2 and pic of the Calgary corpus */ /* Find the first bit length which could increase: */ do { bits = max_length-1; while (s->bl_count[bits] == 0) bits--; s->bl_count[bits]--; /* move one leaf down the tree */ s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ s->bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] */ overflow -= 2; } while (overflow > 0); /* Now recompute all bit lengths, scanning in increasing frequency. * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all * lengths instead of fixing only the wrong ones. This idea is taken * from 'ar' written by Haruhiko Okumura.) */ for (bits = max_length; bits != 0; bits--) { n = s->bl_count[bits]; while (n != 0) { m = s->heap[--h]; if (m > max_code) continue; if ((unsigned) tree[m].Len != (unsigned) bits) { Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); s->opt_len += ((long)bits - (long)tree[m].Len) *(long)tree[m].Freq; tree[m].Len = (ush)bits; } n--; } } } /* =========================================================================== * Generate the codes for a given tree and bit counts (which need not be * optimal). * IN assertion: the array bl_count contains the bit length statistics for * the given tree and the field len is set for all tree elements. * OUT assertion: the field code is set for all tree elements of non * zero code length. */ local void gen_codes (tree, max_code, bl_count) ct_data *tree; /* the tree to decorate */ int max_code; /* largest code with non zero frequency */ ushf *bl_count; /* number of codes at each bit length */ { ush next_code[MAX_BITS+1]; /* next code value for each bit length */ ush code = 0; /* running code value */ int bits; /* bit index */ int n; /* code index */ /* The distribution counts are first used to generate the code values * without bit reversal. */ for (bits = 1; bits <= MAX_BITS; bits++) { next_code[bits] = code = (code + bl_count[bits-1]) << 1; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; const ct_data *stree = desc->stat_desc->static_tree; int elems = desc->stat_desc->elems; int n, m; /* iterate over heap elements */ int max_code = -1; /* largest code with non zero frequency */ int node; /* new node being created */ /* Construct the initial heap, with least frequent element in * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. * heap[0] is not used. */ s->heap_len = 0, s->heap_max = HEAP_SIZE; for (n = 0; n < elems; n++) { if (tree[n].Freq != 0) { s->heap[++(s->heap_len)] = max_code = n; s->depth[n] = 0; } else { tree[n].Len = 0; } } /* The pkzip format requires that at least one distance code exists, * and that at least one bit should be sent even if there is only one * possible code. So to avoid special checks later on we force at least * two codes of non zero frequency. */ while (s->heap_len < 2) { node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); tree[node].Freq = 1; s->depth[node] = 0; s->opt_len--; if (stree) s->static_len -= stree[node].Len; /* node is 0 or 1 so it does not have extra bits */ } desc->max_code = max_code; /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); /* Construct the Huffman tree by repeatedly combining the least two * frequent nodes. */ node = elems; /* next internal node of the tree */ do { pqremove(s, tree, n); /* n = node of least frequency */ m = s->heap[SMALLEST]; /* m = node of next least frequency */ s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ s->heap[--(s->heap_max)] = m; /* Create a new node father of n and m */ tree[node].Freq = tree[n].Freq + tree[m].Freq; s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? s->depth[n] : s->depth[m]) + 1); tree[n].Dad = tree[m].Dad = (ush)node; #ifdef DUMP_BL_TREE if (tree == s->bl_tree) { fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); } #endif /* and insert the new node in the heap */ s->heap[SMALLEST] = node++; pqdownheap(s, tree, SMALLEST); } while (s->heap_len >= 2); s->heap[--(s->heap_max)] = s->heap[SMALLEST]; /* At this point, the fields freq and dad are set. We can now * generate the bit lengths. */ gen_bitlen(s, (tree_desc *)desc); /* The field len is now set, we can generate the bit codes */ gen_codes ((ct_data *)tree, max_code, s->bl_count); } /* =========================================================================== * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ local void scan_tree (s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ int curlen; /* length of current code */ int nextlen = tree[0].Len; /* length of next code */ int count = 0; /* repeat count of the current code */ int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ if (nextlen == 0) max_count = 138, min_count = 3; tree[max_code+1].Len = (ush)0xffff; /* guard */ for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[n+1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { s->bl_tree[curlen].Freq += count; } else if (curlen != 0) { if (curlen != prevlen) s->bl_tree[curlen].Freq++; s->bl_tree[REP_3_6].Freq++; } else if (count <= 10) { s->bl_tree[REPZ_3_10].Freq++; } else { s->bl_tree[REPZ_11_138].Freq++; } count = 0; prevlen = curlen; if (nextlen == 0) { max_count = 138, min_count = 3; } else if (curlen == nextlen) { max_count = 6, min_count = 3; } else { max_count = 7, min_count = 4; } } } /* =========================================================================== * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ local void send_tree (s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ int curlen; /* length of current code */ int nextlen = tree[0].Len; /* length of next code */ int count = 0; /* repeat count of the current code */ int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ /* tree[max_code+1].Len = -1; */ /* guard already set */ if (nextlen == 0) max_count = 138, min_count = 3; for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[n+1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { do { send_code(s, curlen, s->bl_tree); } while (--count != 0); } else if (curlen != 0) { if (curlen != prevlen) { send_code(s, curlen, s->bl_tree); count--; } Assert(count >= 3 && count <= 6, " 3_6?"); send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); } else if (count <= 10) { send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); } else { send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); } count = 0; prevlen = curlen; if (nextlen == 0) { max_count = 138, min_count = 3; } else if (curlen == nextlen) { max_count = 6, min_count = 3; } else { max_count = 7, min_count = 4; } } } /* =========================================================================== * Construct the Huffman tree for the bit lengths and return the index in * bl_order of the last bit length code to send. */ local int build_bl_tree(s) deflate_state *s; { int max_blindex; /* index of last bit length code of non zero freq */ /* Determine the bit length frequencies for literal and distance trees */ scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); /* Build the bit length tree: */ build_tree(s, (tree_desc *)(&(s->bl_desc))); /* opt_len now includes the length of the tree representations, except * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format * requires that at least 4 bit length codes be sent. (appnote.txt says * 3 but the actual value used is 4.) */ for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; } /* Update opt_len to include the bit length tree and counts */ s->opt_len += 3*(max_blindex+1) + 5+5+4; Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", s->opt_len, s->static_len)); return max_blindex; } /* =========================================================================== * Send the header for a block using dynamic Huffman trees: the counts, the * lengths of the bit length codes, the literal tree and the distance tree. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. */ local void send_all_trees(s, lcodes, dcodes, blcodes) deflate_state *s; int lcodes, dcodes, blcodes; /* number of codes for each tree */ { int rank; /* index in bl_order */ Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes"); Tracev((stderr, "\nbl counts: ")); send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ send_bits(s, dcodes-1, 5); send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ for (rank = 0; rank < blcodes; rank++) { Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); } Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); } /* =========================================================================== * Send a stored block */ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) deflate_state *s; charf *buf; /* input block */ ulg stored_len; /* length of input block */ int last; /* one if this is the last block for a file */ { send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ #ifdef DEBUG s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; s->compressed_len += (stored_len + 4) << 3; #endif copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ } /* =========================================================================== * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) */ void ZLIB_INTERNAL _tr_flush_bits(s) deflate_state *s; { bi_flush(s); } /* =========================================================================== * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. */ void ZLIB_INTERNAL _tr_align(s) deflate_state *s; { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); #ifdef DEBUG s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ #endif bi_flush(s); } /* =========================================================================== * Determine the best encoding for the current block: dynamic trees, static * trees or store, and output the encoded block to the zip file. */ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) deflate_state *s; charf *buf; /* input block, or NULL if too old */ ulg stored_len; /* length of input block */ int last; /* one if this is the last block for a file */ { ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ int max_blindex = 0; /* index of last bit length code of non zero freq */ if (last) s->strm->last_bit = (s->strm->total_out + s->pending) * 8 + s->bi_valid; /* Build the Huffman trees unless a stored block is forced */ if (s->level > 0) { /* Check if the file is binary or text */ if (s->strm->data_type == Z_UNKNOWN) s->strm->data_type = detect_data_type(s); /* Construct the literal and distance trees */ build_tree(s, (tree_desc *)(&(s->l_desc))); Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, s->static_len)); build_tree(s, (tree_desc *)(&(s->d_desc))); Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, s->static_len)); /* At this point, opt_len and static_len are the total bit lengths of * the compressed block data, excluding the tree representations. */ /* Build the bit length tree for the above two trees, and get the index * in bl_order of the last bit length code to send. */ max_blindex = build_bl_tree(s); /* Determine the best encoding. Compute the block lengths in bytes. */ opt_lenb = (s->opt_len+3+7)>>3; static_lenb = (s->static_len+3+7)>>3; Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, s->last_lit)); if (static_lenb <= opt_lenb) opt_lenb = static_lenb; } else { Assert(buf != (char*)0, "lost buf"); opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ } #ifdef FORCE_STORED if (buf != (char*)0) { /* force stored block */ #else if (stored_len+4 <= opt_lenb && buf != (char*)0) { /* 4: two words for the lengths */ #endif /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. * Otherwise we can't have processed more than WSIZE input bytes since * the last block flush, because compression would have been * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to * transform a block into a stored block. */ _tr_stored_block(s, buf, stored_len, last); #ifdef FORCE_STATIC } else if (static_lenb >= 0) { /* force static trees */ #else } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { #endif send_bits(s, (STATIC_TREES<<1)+last, 3); compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree); #ifdef DEBUG s->compressed_len += 3 + s->static_len; #endif } else { send_bits(s, (DYN_TREES<<1)+last, 3); send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1); compress_block(s, (const ct_data *)s->dyn_ltree, (const ct_data *)s->dyn_dtree); #ifdef DEBUG s->compressed_len += 3 + s->opt_len; #endif } Assert (s->compressed_len == s->bits_sent, "bad compressed size"); /* The above check is made mod 2^32, for files larger than 512 MB * and uLong implemented on 32 bits. */ init_block(s); if (last) { s->strm->stop_bit = (s->strm->total_out + s->pending) * 8 + s->bi_valid; bi_windup(s); #ifdef DEBUG s->compressed_len += 7; /* align on byte boundary */ #endif } Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, s->compressed_len-7*last)); } /* =========================================================================== * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ int ZLIB_INTERNAL _tr_tally (s, dist, lc) deflate_state *s; unsigned dist; /* distance of matched string */ unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ { s->d_buf[s->last_lit] = (ush)dist; s->l_buf[s->last_lit++] = (uch)lc; if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; } else { s->matches++; /* Here, lc is the match length - MIN_MATCH */ dist--; /* dist = match distance - 1 */ Assert((ush)dist < (ush)MAX_DIST(s) && (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; s->dyn_dtree[d_code(dist)].Freq++; } #ifdef TRUNCATE_BLOCK /* Try to guess if it is profitable to stop the current block here */ if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { /* Compute an upper bound for the compressed length */ ulg out_length = (ulg)s->last_lit*8L; ulg in_length = (ulg)((long)s->strstart - s->block_start); int dcode; for (dcode = 0; dcode < D_CODES; dcode++) { out_length += (ulg)s->dyn_dtree[dcode].Freq * (5L+extra_dbits[dcode]); } out_length >>= 3; Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", s->last_lit, in_length, out_length, 100L - out_length*100L/in_length)); if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; } #endif return (s->last_lit == s->lit_bufsize-1); /* We avoid equality with lit_bufsize because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. */ } /* =========================================================================== * Send the block data compressed using the given Huffman trees */ local void compress_block(s, ltree, dtree) deflate_state *s; const ct_data *ltree; /* literal tree */ const ct_data *dtree; /* distance tree */ { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ unsigned lx = 0; /* running index in l_buf */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if (s->last_lit != 0) do { dist = s->d_buf[lx]; lc = s->l_buf[lx++]; if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); } else { /* Here, lc is the match length - MIN_MATCH */ code = _length_code[lc]; send_code(s, code+LITERALS+1, ltree); /* send the length code */ extra = extra_lbits[code]; if (extra != 0) { lc -= base_length[code]; send_bits(s, lc, extra); /* send the extra length bits */ } dist--; /* dist is now the match distance - 1 */ code = d_code(dist); Assert (code < D_CODES, "bad d_code"); send_code(s, code, dtree); /* send the distance code */ extra = extra_dbits[code]; if (extra != 0) { dist -= base_dist[code]; send_bits(s, dist, extra); /* send the extra distance bits */ } } /* literal or match pair ? */ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, "pendingBuf overflow"); } while (lx < s->last_lit); send_code(s, END_BLOCK, ltree); } /* =========================================================================== * Check if the data type is TEXT or BINARY, using the following algorithm: * - TEXT if the two conditions below are satisfied: * a) There are no non-portable control characters belonging to the * "black list" (0..6, 14..25, 28..31). * b) There is at least one printable character belonging to the * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). * - BINARY otherwise. * - The following partially-portable control characters form a * "gray list" that is ignored in this detection algorithm: * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). * IN assertion: the fields Freq of dyn_ltree are set. */ local int detect_data_type(s) deflate_state *s; { /* black_mask is the bit mask of black-listed bytes * set bits 0..6, 14..25, and 28..31 * 0xf3ffc07f = binary 11110011111111111100000001111111 */ unsigned long black_mask = 0xf3ffc07fUL; int n; /* Check for non-textual ("black-listed") bytes. */ for (n = 0; n <= 31; n++, black_mask >>= 1) if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) return Z_BINARY; /* Check for textual ("white-listed") bytes. */ if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0) return Z_TEXT; for (n = 32; n < LITERALS; n++) if (s->dyn_ltree[n].Freq != 0) return Z_TEXT; /* There are no "black-listed" or "white-listed" bytes: * this stream either is empty or has tolerated ("gray-listed") bytes only. */ return Z_BINARY; } /* =========================================================================== * Reverse the first len bits of a code, using straightforward code (a faster * method would use a table) * IN assertion: 1 <= len <= 15 */ local unsigned bi_reverse(code, len) unsigned code; /* the value to invert */ int len; /* its bit length */ { register unsigned res = 0; do { res |= code & 1; code >>= 1, res <<= 1; } while (--len > 0); return res >> 1; } /* =========================================================================== * Flush the bit buffer, keeping at most 7 bits in it. */ local void bi_flush(s) deflate_state *s; { if (s->bi_valid == 16) { put_short(s, s->bi_buf); s->bi_buf = 0; s->bi_valid = 0; } else if (s->bi_valid >= 8) { put_byte(s, (Byte)s->bi_buf); s->bi_buf >>= 8; s->bi_valid -= 8; } } /* =========================================================================== * Flush the bit buffer and align the output on a byte boundary */ local void bi_windup(s) deflate_state *s; { if (s->bi_valid > 8) { put_short(s, s->bi_buf); } else if (s->bi_valid > 0) { put_byte(s, (Byte)s->bi_buf); } s->bi_buf = 0; s->bi_valid = 0; #ifdef DEBUG s->bits_sent = (s->bits_sent+7) & ~7; #endif } /* =========================================================================== * Copy a stored block, storing first the length and its * one's complement if requested. */ local void copy_block(s, buf, len, header) deflate_state *s; charf *buf; /* the input data */ unsigned len; /* its length */ int header; /* true if block header must be written */ { bi_windup(s); /* align on byte boundary */ if (header) { put_short(s, (ush)len); put_short(s, (ush)~len); #ifdef DEBUG s->bits_sent += 2*16; #endif } #ifdef DEBUG s->bits_sent += (ulg)len<<3; #endif while (len--) { put_byte(s, *buf++); } } varnish-4.1.1/lib/libvgz/adler32.c0000644000201500234410000001155012652366721013563 00000000000000/* adler32.c -- compute the Adler-32 checksum of a data stream * Copyright (C) 1995-2011 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #include "zutil.h" #define local static local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); #define BASE 65521 /* largest prime smaller than 65536 */ #define NMAX 5552 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); #define DO16(buf) DO8(buf,0); DO8(buf,8); /* use NO_DIVIDE if your processor does not do division in hardware -- try it both ways to see which is faster */ #ifdef NO_DIVIDE /* note that this assumes BASE is 65521, where 65536 % 65521 == 15 (thank you to John Reiser for pointing this out) */ # define CHOP(a) \ do { \ unsigned long tmp = a >> 16; \ a &= 0xffffUL; \ a += (tmp << 4) - tmp; \ } while (0) # define MOD28(a) \ do { \ CHOP(a); \ if (a >= BASE) a -= BASE; \ } while (0) # define MOD(a) \ do { \ CHOP(a); \ MOD28(a); \ } while (0) # define MOD63(a) \ do { /* this assumes a is not negative */ \ z_off64_t tmp = a >> 32; \ a &= 0xffffffffL; \ a += (tmp << 8) - (tmp << 5) + tmp; \ tmp = a >> 16; \ a &= 0xffffL; \ a += (tmp << 4) - tmp; \ tmp = a >> 16; \ a &= 0xffffL; \ a += (tmp << 4) - tmp; \ if (a >= BASE) a -= BASE; \ } while (0) #else # define MOD(a) a %= BASE # define MOD28(a) a %= BASE # define MOD63(a) a %= BASE #endif /* ========================================================================= */ uLong ZEXPORT adler32(adler, buf, len) uLong adler; const Bytef *buf; uInt len; { unsigned long sum2; unsigned n; /* split Adler-32 into component sums */ sum2 = (adler >> 16) & 0xffff; adler &= 0xffff; /* in case user likes doing a byte at a time, keep it fast */ if (len == 1) { adler += buf[0]; if (adler >= BASE) adler -= BASE; sum2 += adler; if (sum2 >= BASE) sum2 -= BASE; return adler | (sum2 << 16); } /* initial Adler-32 value (deferred check for len == 1 speed) */ if (buf == Z_NULL) return 1L; /* in case short lengths are provided, keep it somewhat fast */ if (len < 16) { while (len--) { adler += *buf++; sum2 += adler; } if (adler >= BASE) adler -= BASE; MOD28(sum2); /* only added so many BASE's */ return adler | (sum2 << 16); } /* do length NMAX blocks -- requires just one modulo operation */ while (len >= NMAX) { len -= NMAX; n = NMAX / 16; /* NMAX is divisible by 16 */ do { DO16(buf); /* 16 sums unrolled */ buf += 16; } while (--n); MOD(adler); MOD(sum2); } /* do remaining bytes (less than NMAX, still just one modulo) */ if (len) { /* avoid modulos if none remaining */ while (len >= 16) { len -= 16; DO16(buf); buf += 16; } while (len--) { adler += *buf++; sum2 += adler; } MOD(adler); MOD(sum2); } /* return recombined sums */ return adler | (sum2 << 16); } /* ========================================================================= */ local uLong adler32_combine_(adler1, adler2, len2) uLong adler1; uLong adler2; z_off64_t len2; { unsigned long sum1; unsigned long sum2; unsigned rem; /* for negative len, return invalid adler32 as a clue for debugging */ if (len2 < 0) return 0xffffffffUL; /* the derivation of this formula is left as an exercise for the reader */ MOD63(len2); /* assumes len2 >= 0 */ rem = (unsigned)len2; sum1 = adler1 & 0xffff; sum2 = rem * sum1; MOD(sum2); sum1 += (adler2 & 0xffff) + BASE - 1; sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; if (sum1 >= BASE) sum1 -= BASE; if (sum1 >= BASE) sum1 -= BASE; if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); if (sum2 >= BASE) sum2 -= BASE; return sum1 | (sum2 << 16); } /* ========================================================================= */ uLong ZEXPORT adler32_combine(adler1, adler2, len2) uLong adler1; uLong adler2; z_off_t len2; { return adler32_combine_(adler1, adler2, len2); } uLong ZEXPORT adler32_combine64(adler1, adler2, len2) uLong adler1; uLong adler2; z_off64_t len2; { return adler32_combine_(adler1, adler2, len2); } varnish-4.1.1/lib/libvmod_directors/0000755000201500234410000000000012652366757014467 500000000000000varnish-4.1.1/lib/libvmod_directors/vmod.vcc0000644000201500234410000001322612652366721016044 00000000000000#- # Copyright (c) 2013-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. $Module directors 3 Varnish Directors Module DESCRIPTION =========== `vmod_directors` enables backend load balancing in Varnish. The module implements a set of basic load balancing techniques, and also serves as an example on how one could extend the load balancing capabilities of Varnish. To enable load balancing you must import this vmod (directors). Then you define your backends. Once you have the backends declared you can add them to a director. This happens in executed VCL code. If you want to emulate the previous behavior of Varnish 3.0 you can just initialize the directors in vcl_init, like this:: sub vcl_init { new vdir = directors.round_robin(); vdir.add_backend(backend1); vdir.add_backend(backend2); } As you can see there is nothing keeping you from manipulating the directors elsewhere in VCL. So, you could have VCL code that would add more backends to a director when a certain URL is called. Note that directors can use other directors as backends. $Object round_robin() Description Create a round robin director. This director will pick backends in a round robin fashion. Example new vdir = directors.round_robin(); $Method VOID .add_backend(BACKEND) Description Add a backend to the round-robin director. Example vdir.add_backend(backend1); vdir.add_backend(backend2); $Method VOID .remove_backend(BACKEND) Description Remove a backend from the round-robin director. Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); $Method BACKEND .backend() Description Pick a backend from the director. Example set req.backend_hint = vdir.backend(); $Object fallback() Description Create a fallback director. A fallback director will try each of the added backends in turn, and return the first one that is healthy. Example new vdir = directors.fallback(); $Method VOID .add_backend(BACKEND) Description Add a backend to the director. Note that the order in which this is done matters for the fallback director. Example vdir.add_backend(backend1); vdir.add_backend(backend2); $Method VOID .remove_backend(BACKEND) Description Remove a backend from the director. Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); $Method BACKEND .backend() Description Pick a backend from the director. Example set req.backend_hint = vdir.backend(); $Object random() Description Create a random backend director. The random director distributes load over the backends using a weighted random probability distribution. Example new vdir = directors.random(); $Method VOID .add_backend(BACKEND, REAL) Description Add a backend to the director with a given weight. Each backend backend will receive approximately 100 * (weight / (sum(all_added_weights))) per cent of the traffic sent to this director. Example # 2/3 to backend1, 1/3 to backend2. vdir.add_backend(backend1, 10.0); vdir.add_backend(backend2, 5.0); $Method VOID .remove_backend(BACKEND) Description Remove a backend from the director. Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); $Method BACKEND .backend() Description Pick a backend from the director. Example set req.backend_hint = vdir.backend(); $Object hash() Description Create a hashing backend director. The director chooses the backend server by computing a hash/digest of the string given to .backend(). Commonly used with ``client.ip`` or a session cookie to get sticky sessions. Example new vdir = directors.hash(); $Method VOID .add_backend(BACKEND, REAL) Description Add a backend to the director with a certain weight. Weight is used as in the random director. Recommended value is 1.0 unless you have special needs. Example vdir.add_backend(backend1, 1.0); vdir.add_backend(backend2, 1.0); $Method VOID .remove_backend(BACKEND) Description Remove a backend from the director. Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); $Method BACKEND .backend(STRING_LIST) Description Pick a backend from the backend director. Use the string or list of strings provided to pick the backend. Example # pick a backend based on the cookie header from the client set req.backend_hint = vdir.backend(req.http.cookie); COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2013-2015 Varnish Software AS varnish-4.1.1/lib/libvmod_directors/random.c0000644000201500234410000000745012652366721016030 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include "cache/cache.h" #include "cache/cache_director.h" #include "vrt.h" #include "vbm.h" #include "vdir.h" #include "vcc_if.h" struct vmod_directors_random { unsigned magic; #define VMOD_DIRECTORS_RANDOM_MAGIC 0x4732d092 struct vdir *vd; }; static unsigned __match_proto__(vdi_healthy) vmod_random_healthy(const struct director *dir, const struct busyobj *bo, double *changed) { struct vmod_directors_random *rr; CAST_OBJ_NOTNULL(rr, dir->priv, VMOD_DIRECTORS_RANDOM_MAGIC); return (vdir_any_healthy(rr->vd, bo, changed)); } static const struct director * __match_proto__(vdi_resolve_f) vmod_random_resolve(const struct director *dir, struct worker *wrk, struct busyobj *bo) { struct vmod_directors_random *rr; VCL_BACKEND be; double r; CHECK_OBJ_NOTNULL(dir, DIRECTOR_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CAST_OBJ_NOTNULL(rr, dir->priv, VMOD_DIRECTORS_RANDOM_MAGIC); r = scalbn(random(), -31); assert(r >= 0 && r < 1.0); be = vdir_pick_be(rr->vd, r, bo); return (be); } VCL_VOID __match_proto__() vmod_random__init(VRT_CTX, struct vmod_directors_random **rrp, const char *vcl_name) { struct vmod_directors_random *rr; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(rrp); AZ(*rrp); ALLOC_OBJ(rr, VMOD_DIRECTORS_RANDOM_MAGIC); AN(rr); *rrp = rr; vdir_new(&rr->vd, "random", vcl_name, vmod_random_healthy, vmod_random_resolve, rr); } VCL_VOID __match_proto__() vmod_random__fini(struct vmod_directors_random **rrp) { struct vmod_directors_random *rr; rr = *rrp; *rrp = NULL; CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_RANDOM_MAGIC); vdir_delete(&rr->vd); FREE_OBJ(rr); } VCL_VOID __match_proto__() vmod_random_add_backend(VRT_CTX, struct vmod_directors_random *rr, VCL_BACKEND be, double w) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_RANDOM_MAGIC); (void)vdir_add_backend(rr->vd, be, w); } VCL_VOID vmod_random_remove_backend(VRT_CTX, struct vmod_directors_random *rr, VCL_BACKEND be) __match_proto__() { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_RANDOM_MAGIC); (void)vdir_remove_backend(rr->vd, be); } VCL_BACKEND __match_proto__() vmod_random_backend(VRT_CTX, struct vmod_directors_random *rr) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_RANDOM_MAGIC); return (rr->vd->dir); } varnish-4.1.1/lib/libvmod_directors/vdir.h0000644000201500234410000000434212652366721015516 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ struct vbitmap; struct vdir { unsigned magic; #define VDIR_MAGIC 0x99f4b726 pthread_rwlock_t mtx; unsigned n_backend; unsigned l_backend; VCL_BACKEND *backend; double *weight; double total_weight; struct director *dir; struct vbitmap *vbm; }; void vdir_new(struct vdir **vdp, const char *name, const char *vcl_name, vdi_healthy_f *healthy, vdi_resolve_f *resolve, void *priv); void vdir_delete(struct vdir **vdp); void vdir_rdlock(struct vdir *vd); void vdir_wrlock(struct vdir *vd); void vdir_unlock(struct vdir *vd); unsigned vdir_add_backend(struct vdir *, VCL_BACKEND be, double weight); unsigned vdir_remove_backend(struct vdir *, VCL_BACKEND be); unsigned vdir_any_healthy(struct vdir *, const struct busyobj *, double *changed); VCL_BACKEND vdir_pick_be(struct vdir *, double w, const struct busyobj *); varnish-4.1.1/lib/libvmod_directors/Makefile.am0000644000201500234410000000204012652366721016426 00000000000000# AM_LDFLAGS = $(AM_LT_LDFLAGS) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/bin/varnishd \ -I$(top_builddir)/include vmoddir = $(pkglibdir)/vmods vmod_srcdir = $(top_srcdir)/lib/libvmod_directors vmodtool = $(top_srcdir)/lib/libvcc/vmodtool.py vmodtoolargs = --strict vmod_LTLIBRARIES = libvmod_directors.la libvmod_directors_la_LDFLAGS = $(AM_LDFLAGS) -module -export-dynamic -avoid-version -shared libvmod_directors_la_SOURCES = \ vdir.c \ vdir.h \ fall_back.c \ hash.c \ random.c \ round_robin.c nodist_libvmod_directors_la_SOURCES = \ vcc_if.c \ vcc_if.h # BUILT_SOURCES is only a hack and dependency tracking does not help for the first build vdir.lo fall_back.lo hash.lo random.lo round_robin.lo: vcc_if.h vcc_if.c vcc_if.h vmod_directors.rst vmod_directors.man.rst: $(vmodtool) $(vmod_srcdir)/vmod.vcc @PYTHON@ $(vmodtool) $(vmodtoolargs) $(vmod_srcdir)/vmod.vcc EXTRA_DIST = vmod.vcc CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \ $(builddir)/vmod_directors.rst \ $(builddir)/vmod_directors.man.rst varnish-4.1.1/lib/libvmod_directors/Makefile.in0000644000201500234410000005021612652366727016455 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = lib/libvmod_directors DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(vmoddir)" LTLIBRARIES = $(vmod_LTLIBRARIES) libvmod_directors_la_LIBADD = am_libvmod_directors_la_OBJECTS = vdir.lo fall_back.lo hash.lo \ random.lo round_robin.lo nodist_libvmod_directors_la_OBJECTS = vcc_if.lo libvmod_directors_la_OBJECTS = $(am_libvmod_directors_la_OBJECTS) \ $(nodist_libvmod_directors_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent libvmod_directors_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libvmod_directors_la_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libvmod_directors_la_SOURCES) \ $(nodist_libvmod_directors_la_SOURCES) DIST_SOURCES = $(libvmod_directors_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ # AM_LDFLAGS = $(AM_LT_LDFLAGS) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/bin/varnishd \ -I$(top_builddir)/include vmoddir = $(pkglibdir)/vmods vmod_srcdir = $(top_srcdir)/lib/libvmod_directors vmodtool = $(top_srcdir)/lib/libvcc/vmodtool.py vmodtoolargs = --strict vmod_LTLIBRARIES = libvmod_directors.la libvmod_directors_la_LDFLAGS = $(AM_LDFLAGS) -module -export-dynamic -avoid-version -shared libvmod_directors_la_SOURCES = \ vdir.c \ vdir.h \ fall_back.c \ hash.c \ random.c \ round_robin.c nodist_libvmod_directors_la_SOURCES = \ vcc_if.c \ vcc_if.h EXTRA_DIST = vmod.vcc CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \ $(builddir)/vmod_directors.rst \ $(builddir)/vmod_directors.man.rst all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/libvmod_directors/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/libvmod_directors/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-vmodLTLIBRARIES: $(vmod_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(vmoddir)" || $(MKDIR_P) "$(DESTDIR)$(vmoddir)" @list='$(vmod_LTLIBRARIES)'; test -n "$(vmoddir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(vmoddir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(vmoddir)"; \ } uninstall-vmodLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(vmod_LTLIBRARIES)'; test -n "$(vmoddir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(vmoddir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(vmoddir)/$$f"; \ done clean-vmodLTLIBRARIES: -test -z "$(vmod_LTLIBRARIES)" || rm -f $(vmod_LTLIBRARIES) @list='$(vmod_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libvmod_directors.la: $(libvmod_directors_la_OBJECTS) $(libvmod_directors_la_DEPENDENCIES) $(EXTRA_libvmod_directors_la_DEPENDENCIES) $(AM_V_CCLD)$(libvmod_directors_la_LINK) -rpath $(vmoddir) $(libvmod_directors_la_OBJECTS) $(libvmod_directors_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fall_back.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round_robin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_if.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vdir.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(vmoddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-vmodLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-vmodLTLIBRARIES install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-vmodLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-vmodLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip install-vmodLTLIBRARIES installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-vmodLTLIBRARIES # BUILT_SOURCES is only a hack and dependency tracking does not help for the first build vdir.lo fall_back.lo hash.lo random.lo round_robin.lo: vcc_if.h vcc_if.c vcc_if.h vmod_directors.rst vmod_directors.man.rst: $(vmodtool) $(vmod_srcdir)/vmod.vcc @PYTHON@ $(vmodtool) $(vmodtoolargs) $(vmod_srcdir)/vmod.vcc # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/lib/libvmod_directors/round_robin.c0000644000201500234410000001011612652366721017061 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include "cache/cache.h" #include "cache/cache_director.h" #include "vrt.h" #include "vcc_if.h" #include "vdir.h" struct vmod_directors_round_robin { unsigned magic; #define VMOD_DIRECTORS_ROUND_ROBIN_MAGIC 0xa80970cf struct vdir *vd; unsigned nxt; }; static unsigned __match_proto__(vdi_healthy) vmod_rr_healthy(const struct director *dir, const struct busyobj *bo, double *changed) { struct vmod_directors_round_robin *rr; CAST_OBJ_NOTNULL(rr, dir->priv, VMOD_DIRECTORS_ROUND_ROBIN_MAGIC); return (vdir_any_healthy(rr->vd, bo, changed)); } static const struct director * __match_proto__(vdi_resolve_f) vmod_rr_resolve(const struct director *dir, struct worker *wrk, struct busyobj *bo) { struct vmod_directors_round_robin *rr; unsigned u; VCL_BACKEND be = NULL; CHECK_OBJ_NOTNULL(dir, DIRECTOR_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CAST_OBJ_NOTNULL(rr, dir->priv, VMOD_DIRECTORS_ROUND_ROBIN_MAGIC); vdir_rdlock(rr->vd); for (u = 0; u < rr->vd->n_backend; u++) { rr->nxt %= rr->vd->n_backend; be = rr->vd->backend[rr->nxt]; rr->nxt++; CHECK_OBJ_NOTNULL(be, DIRECTOR_MAGIC); if (be->healthy(be, bo, NULL)) break; } vdir_unlock(rr->vd); if (u == rr->vd->n_backend) be = NULL; return (be); } VCL_VOID __match_proto__() vmod_round_robin__init(VRT_CTX, struct vmod_directors_round_robin **rrp, const char *vcl_name) { struct vmod_directors_round_robin *rr; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(rrp); AZ(*rrp); ALLOC_OBJ(rr, VMOD_DIRECTORS_ROUND_ROBIN_MAGIC); AN(rr); *rrp = rr; vdir_new(&rr->vd, "round-robin", vcl_name, vmod_rr_healthy, vmod_rr_resolve, rr); } VCL_VOID __match_proto__() vmod_round_robin__fini(struct vmod_directors_round_robin **rrp) { struct vmod_directors_round_robin *rr; rr = *rrp; *rrp = NULL; CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_ROUND_ROBIN_MAGIC); vdir_delete(&rr->vd); FREE_OBJ(rr); } VCL_VOID __match_proto__() vmod_round_robin_add_backend(VRT_CTX, struct vmod_directors_round_robin *rr, VCL_BACKEND be) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_ROUND_ROBIN_MAGIC); (void)vdir_add_backend(rr->vd, be, 0.0); } VCL_VOID __match_proto__() vmod_round_robin_remove_backend(VRT_CTX, struct vmod_directors_round_robin *rr, VCL_BACKEND be) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_ROUND_ROBIN_MAGIC); (void)vdir_remove_backend(rr->vd, be); } VCL_BACKEND __match_proto__() vmod_round_robin_backend(VRT_CTX, struct vmod_directors_round_robin *rr) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_ROUND_ROBIN_MAGIC); return (rr->vd->dir); } varnish-4.1.1/lib/libvmod_directors/vdir.c0000644000201500234410000001262112652366721015510 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include "cache/cache.h" #include "cache/cache_director.h" #include "vrt.h" #include "vbm.h" #include "vdir.h" static void vdir_expand(struct vdir *vd, unsigned n) { CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC); vd->backend = realloc(vd->backend, n * sizeof *vd->backend); AN(vd->backend); vd->weight = realloc(vd->weight, n * sizeof *vd->weight); AN(vd->weight); vd->l_backend = n; } void vdir_new(struct vdir **vdp, const char *name, const char *vcl_name, vdi_healthy_f *healthy, vdi_resolve_f *resolve, void *priv) { struct vdir *vd; AN(name); AN(vcl_name); AN(vdp); AZ(*vdp); ALLOC_OBJ(vd, VDIR_MAGIC); AN(vd); *vdp = vd; AZ(pthread_rwlock_init(&vd->mtx, NULL)); ALLOC_OBJ(vd->dir, DIRECTOR_MAGIC); AN(vd->dir); vd->dir->name = name; REPLACE(vd->dir->vcl_name, vcl_name); vd->dir->priv = priv; vd->dir->healthy = healthy; vd->dir->resolve = resolve; vd->vbm = vbit_init(8); AN(vd->vbm); } void vdir_delete(struct vdir **vdp) { struct vdir *vd; AN(vdp); vd = *vdp; *vdp = NULL; CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC); free(vd->backend); free(vd->weight); AZ(pthread_rwlock_destroy(&vd->mtx)); free(vd->dir->vcl_name); FREE_OBJ(vd->dir); vbit_destroy(vd->vbm); FREE_OBJ(vd); } void vdir_rdlock(struct vdir *vd) { CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC); AZ(pthread_rwlock_rdlock(&vd->mtx)); } void vdir_wrlock(struct vdir *vd) { CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC); AZ(pthread_rwlock_wrlock(&vd->mtx)); } void vdir_unlock(struct vdir *vd) { CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC); AZ(pthread_rwlock_unlock(&vd->mtx)); } unsigned vdir_add_backend(struct vdir *vd, VCL_BACKEND be, double weight) { unsigned u; CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC); AN(be); vdir_wrlock(vd); if (vd->n_backend >= vd->l_backend) vdir_expand(vd, vd->l_backend + 16); assert(vd->n_backend < vd->l_backend); u = vd->n_backend++; vd->backend[u] = be; vd->weight[u] = weight; vd->total_weight += weight; vdir_unlock(vd); return (u); } unsigned vdir_remove_backend(struct vdir *vd, VCL_BACKEND be) { unsigned u, n; CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC); if (be == NULL) return (vd->n_backend); CHECK_OBJ(be, DIRECTOR_MAGIC); vdir_wrlock(vd); for (u = 0; u < vd->n_backend; u++) if (vd->backend[u] == be) break; if (u == vd->n_backend) { vdir_unlock(vd); return (vd->n_backend); } vd->total_weight -= vd->weight[u]; n = (vd->n_backend - u) - 1; memmove(&vd->backend[u], &vd->backend[u+1], n * sizeof(vd->backend[0])); memmove(&vd->weight[u], &vd->weight[u+1], n * sizeof(vd->weight[0])); vd->n_backend--; vdir_unlock(vd); return (vd->n_backend); } unsigned vdir_any_healthy(struct vdir *vd, const struct busyobj *bo, double *changed) { unsigned retval = 0; VCL_BACKEND be; unsigned u; double c; CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC); CHECK_OBJ_ORNULL(bo, BUSYOBJ_MAGIC); vdir_rdlock(vd); if (changed != NULL) *changed = 0; for (u = 0; u < vd->n_backend; u++) { be = vd->backend[u]; CHECK_OBJ_NOTNULL(be, DIRECTOR_MAGIC); retval = be->healthy(be, bo, &c); if (changed != NULL && c > *changed) *changed = c; if (retval) break; } vdir_unlock(vd); return (retval); } static unsigned vdir_pick_by_weight(const struct vdir *vd, double w, const struct vbitmap *blacklist) { double a = 0.0; VCL_BACKEND be = NULL; unsigned u; for (u = 0; u < vd->n_backend; u++) { be = vd->backend[u]; CHECK_OBJ_NOTNULL(be, DIRECTOR_MAGIC); if (blacklist != NULL && vbit_test(blacklist, u)) continue; a += vd->weight[u]; if (w < a) return (u); } WRONG(""); } VCL_BACKEND vdir_pick_be(struct vdir *vd, double w, const struct busyobj *bo) { unsigned u; double tw = 0.0; VCL_BACKEND be = NULL; vdir_rdlock(vd); for (u = 0; u < vd->n_backend; u++) { if (vd->backend[u]->healthy(vd->backend[u], bo, NULL)) { vbit_clr(vd->vbm, u); tw += vd->weight[u]; } else vbit_set(vd->vbm, u); } if (tw > 0.0) { u = vdir_pick_by_weight(vd, w * tw, vd->vbm); assert(u < vd->n_backend); be = vd->backend[u]; CHECK_OBJ_NOTNULL(be, DIRECTOR_MAGIC); } vdir_unlock(vd); return (be); } varnish-4.1.1/lib/libvmod_directors/hash.c0000644000201500234410000000676112652366721015477 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include "cache/cache.h" #include "cache/cache_director.h" #include "vrt.h" #include "vend.h" #include "vsha256.h" #include "vdir.h" #include "vcc_if.h" struct vmod_directors_hash { unsigned magic; #define VMOD_DIRECTORS_HASH_MAGIC 0xc08dd611 struct vdir *vd; }; VCL_VOID __match_proto__() vmod_hash__init(VRT_CTX, struct vmod_directors_hash **rrp, const char *vcl_name) { struct vmod_directors_hash *rr; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(rrp); AZ(*rrp); ALLOC_OBJ(rr, VMOD_DIRECTORS_HASH_MAGIC); AN(rr); *rrp = rr; vdir_new(&rr->vd, "hash", vcl_name, NULL, NULL, rr); } VCL_VOID __match_proto__() vmod_hash__fini(struct vmod_directors_hash **rrp) { struct vmod_directors_hash *rr; rr = *rrp; *rrp = NULL; CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_HASH_MAGIC); vdir_delete(&rr->vd); FREE_OBJ(rr); } VCL_VOID __match_proto__() vmod_hash_add_backend(VRT_CTX, struct vmod_directors_hash *rr, VCL_BACKEND be, double w) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_HASH_MAGIC); (void)vdir_add_backend(rr->vd, be, w); } VCL_VOID __match_proto__() vmod_hash_remove_backend(VRT_CTX, struct vmod_directors_hash *rr, VCL_BACKEND be) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_HASH_MAGIC); (void)vdir_remove_backend(rr->vd, be); } VCL_BACKEND __match_proto__() vmod_hash_backend(VRT_CTX, struct vmod_directors_hash *rr, const char *arg, ...) { struct SHA256Context sha_ctx; va_list ap; const char *p; unsigned char sha256[SHA256_LEN]; VCL_BACKEND be; double r; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_ORNULL(ctx->bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_HASH_MAGIC); SHA256_Init(&sha_ctx); va_start(ap, arg); p = arg; while (p != vrt_magic_string_end) { if (p != NULL && *p != '\0') SHA256_Update(&sha_ctx, p, strlen(p)); p = va_arg(ap, const char *); } va_end(ap); SHA256_Final(sha256, &sha_ctx); r = vbe32dec(sha256); r = scalbn(r, -32); assert(r >= 0 && r <= 1.0); be = vdir_pick_be(rr->vd, r, ctx->bo); return (be); } varnish-4.1.1/lib/libvmod_directors/fall_back.c0000644000201500234410000000773112652366721016450 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include "cache/cache.h" #include "cache/cache_director.h" #include "vrt.h" #include "vcc_if.h" #include "vdir.h" struct vmod_directors_fallback { unsigned magic; #define VMOD_DIRECTORS_FALLBACK_MAGIC 0xad4e26ba struct vdir *vd; }; static unsigned __match_proto__(vdi_healthy) vmod_fallback_healthy(const struct director *dir, const struct busyobj *bo, double *changed) { struct vmod_directors_fallback *rr; CAST_OBJ_NOTNULL(rr, dir->priv, VMOD_DIRECTORS_FALLBACK_MAGIC); return (vdir_any_healthy(rr->vd, bo, changed)); } static const struct director * __match_proto__(vdi_resolve_f) vmod_fallback_resolve(const struct director *dir, struct worker *wrk, struct busyobj *bo) { struct vmod_directors_fallback *rr; unsigned u; VCL_BACKEND be = NULL; CHECK_OBJ_NOTNULL(dir, DIRECTOR_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CAST_OBJ_NOTNULL(rr, dir->priv, VMOD_DIRECTORS_FALLBACK_MAGIC); vdir_rdlock(rr->vd); for (u = 0; u < rr->vd->n_backend; u++) { be = rr->vd->backend[u]; CHECK_OBJ_NOTNULL(be, DIRECTOR_MAGIC); if (be->healthy(be, bo, NULL)) break; } vdir_unlock(rr->vd); if (u == rr->vd->n_backend) be = NULL; return (be); } VCL_VOID __match_proto__() vmod_fallback__init(VRT_CTX, struct vmod_directors_fallback **rrp, const char *vcl_name) { struct vmod_directors_fallback *rr; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(rrp); AZ(*rrp); ALLOC_OBJ(rr, VMOD_DIRECTORS_FALLBACK_MAGIC); AN(rr); *rrp = rr; vdir_new(&rr->vd, "fallback", vcl_name, vmod_fallback_healthy, vmod_fallback_resolve, rr); } VCL_VOID __match_proto__() vmod_fallback__fini(struct vmod_directors_fallback **rrp) { struct vmod_directors_fallback *rr; rr = *rrp; *rrp = NULL; CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_FALLBACK_MAGIC); vdir_delete(&rr->vd); FREE_OBJ(rr); } VCL_VOID __match_proto__() vmod_fallback_add_backend(VRT_CTX, struct vmod_directors_fallback *rr, VCL_BACKEND be) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_FALLBACK_MAGIC); (void)vdir_add_backend(rr->vd, be, 0.0); } VCL_VOID __match_proto__() vmod_fallback_remove_backend(VRT_CTX, struct vmod_directors_fallback *fb, VCL_BACKEND be) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(fb, VMOD_DIRECTORS_FALLBACK_MAGIC); (void)vdir_remove_backend(fb->vd, be); } VCL_BACKEND __match_proto__() vmod_fallback_backend(VRT_CTX, struct vmod_directors_fallback *rr) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_FALLBACK_MAGIC); return (rr->vd->dir); } varnish-4.1.1/lib/libvarnishtools/0000755000201500234410000000000012652366756014176 500000000000000varnish-4.1.1/lib/libvarnishtools/vut.c0000644000201500234410000002110612652366721015070 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 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. * * Common functions for the utilities */ #include "config.h" #include #include #include #include #include #include #include #include #include #include "compat/daemon.h" #include "vdef.h" #include "vpf.h" #include "vapi/vsm.h" #include "vapi/vsl.h" #include "vtim.h" #include "vas.h" #include "miniobj.h" #include "vcs.h" #include "vnum.h" #include "vut.h" struct VUT VUT; static void vut_vpf_remove(void) { if (VUT.pfh) { VPF_Remove(VUT.pfh); VUT.pfh = NULL; } } static void vut_sighup(int sig) { (void)sig; VUT.sighup = 1; } static void vut_sigint(int sig) { (void)sig; VUT.sigint = 1; } static void vut_sigusr1(int sig) { (void)sig; VUT.sigusr1 = 1; } static int __match_proto__(VSLQ_dispatch_f) vut_dispatch(struct VSL_data *vsl, struct VSL_transaction * const trans[], void *priv) { int i; (void)priv; if (VUT.k_arg == 0) return (-1); /* End of file */ AN(VUT.dispatch_f); i = VUT.dispatch_f(vsl, trans, VUT.dispatch_priv); if (VUT.k_arg > 0) VUT.k_arg--; if (i >= 0 && VUT.k_arg == 0) return (-1); /* End of file */ return (i); } void VUT_Error(int status, const char *fmt, ...) { va_list ap; AN(fmt); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); if (status) exit(status); } int VUT_g_Arg(const char *arg) { VUT.g_arg = VSLQ_Name2Grouping(arg, -1); if (VUT.g_arg == -2) VUT_Error(1, "Ambiguous grouping type: %s", arg); else if (VUT.g_arg < 0) VUT_Error(1, "Unknown grouping type: %s", arg); return (1); } int VUT_Arg(int opt, const char *arg) { int i; char *p; switch (opt) { case 'd': /* Head */ VUT.d_opt = 1; return (1); case 'D': /* Daemon mode */ VUT.D_opt = 1; return (1); case 'g': /* Grouping */ return (VUT_g_Arg(arg)); case 'k': /* Log transaction limit */ VUT.k_arg = (int)strtol(arg, &p, 10); if (*p != '\0' || VUT.k_arg <= 0) VUT_Error(1, "-k: Invalid number '%s'", arg); return (1); case 'n': /* Varnish instance name */ REPLACE(VUT.n_arg, arg); return (1); case 'N': /* Varnish stale VSM file */ REPLACE(VUT.N_arg, arg); return (1); case 'P': /* PID file */ REPLACE(VUT.P_arg, arg); return (1); case 'q': /* Query to use */ REPLACE(VUT.q_arg, arg); return (1); case 'r': /* Binary file input */ REPLACE(VUT.r_arg, arg); return (1); case 't': /* VSM connect timeout */ if (!strcasecmp("off", arg)) VUT.t_arg = -1.; else { VUT.t_arg = VNUM(arg); if (isnan(VUT.t_arg)) VUT_Error(1, "-t: Syntax error"); if (VUT.t_arg < 0.) VUT_Error(1, "-t: Range error"); } return (1); case 'V': /* Print version number and exit */ VCS_Message(VUT.progname); exit(0); default: AN(VUT.vsl); i = VSL_Arg(VUT.vsl, opt, arg); if (i < 0) VUT_Error(1, "%s", VSL_Error(VUT.vsl)); return (i); } } 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(); AN(VUT.vsl); VUT.k_arg = -1; VUT.t_arg = 5.; } void VUT_Setup(void) { struct VSL_cursor *c; double t_start; int i; AN(VUT.vsl); AZ(VUT.vsm); AZ(VUT.vslq); /* Check input arguments */ if ((VUT.n_arg == NULL ? 0 : 1) + (VUT.N_arg == NULL ? 0 : 1) + (VUT.r_arg == NULL ? 0 : 1) > 1) VUT_Error(1, "Only one of -n, -N and -r options may be used"); /* Create and validate the query expression */ VUT.vslq = VSLQ_New(VUT.vsl, NULL, VUT.g_arg, VUT.q_arg); if (VUT.vslq == NULL) VUT_Error(1, "Query expression error:\n%s", VSL_Error(VUT.vsl)); /* Setup input */ if (VUT.r_arg) { REPLACE(VUT.name, VUT.r_arg); c = VSL_CursorFile(VUT.vsl, VUT.r_arg, 0); if (c == NULL) VUT_Error(1, "Can't open log file (%s)", VSL_Error(VUT.vsl)); } else { VUT.vsm = VSM_New(); AN(VUT.vsm); if (VUT.n_arg && VSM_n_Arg(VUT.vsm, VUT.n_arg) <= 0) VUT_Error(1, "%s", VSM_Error(VUT.vsm)); if (VUT.N_arg && VSM_N_Arg(VUT.vsm, VUT.N_arg) <= 0) VUT_Error(1, "%s", VSM_Error(VUT.vsm)); REPLACE(VUT.name, VSM_Name(VUT.vsm)); t_start = NAN; c = NULL; while (1) { i = VSM_Open(VUT.vsm); if (!i) c = VSL_CursorVSM(VUT.vsl, VUT.vsm, (VUT.d_opt ? VSL_COPT_TAILSTOP : VSL_COPT_TAIL) | VSL_COPT_BATCH); if (c) break; if (isnan(t_start) && VUT.t_arg > 0.) { VUT_Error(0, "Can't open log -" " retrying for %.0f seconds", VUT.t_arg); t_start = VTIM_real(); } VSM_Close(VUT.vsm); if (VUT.t_arg <= 0.) break; if (VTIM_real() - t_start > VUT.t_arg) break; VSM_ResetError(VUT.vsm); VSL_ResetError(VUT.vsl); VTIM_sleep(0.5); } if (VUT.t_arg >= 0. && (i || !c)) { if (i) VUT_Error(1, "Can't open VSM file (%s)", VSM_Error(VUT.vsm)); else VUT_Error(1, "Can't open log (%s)", VSL_Error(VUT.vsl)); } else if (!isnan(t_start)) VUT_Error(0, "Log opened"); } if (c) VSLQ_SetCursor(VUT.vslq, &c); AZ(c); /* Signal handlers */ (void)signal(SIGHUP, vut_sighup); (void)signal(SIGINT, vut_sigint); (void)signal(SIGTERM, vut_sigint); (void)signal(SIGUSR1, vut_sigusr1); /* Open PID file */ if (VUT.P_arg) { AZ(VUT.pfh); VUT.pfh = VPF_Open(VUT.P_arg, 0644, NULL); if (VUT.pfh == NULL) VUT_Error(1, "%s: %s", VUT.P_arg, strerror(errno)); } /* Daemon mode */ if (VUT.D_opt && varnish_daemon(0, 0) == -1) VUT_Error(1, "Daemon mode: %s", strerror(errno)); /* Write PID and setup exit handler */ if (VUT.pfh != NULL) { VPF_Write(VUT.pfh); AZ(atexit(vut_vpf_remove)); } } void VUT_Fini(void) { free(VUT.n_arg); free(VUT.N_arg); free(VUT.r_arg); free(VUT.P_arg); free(VUT.name); vut_vpf_remove(); AZ(VUT.pfh); if (VUT.vslq) VSLQ_Delete(&VUT.vslq); if (VUT.vsl) VSL_Delete(VUT.vsl); if (VUT.vsm) VSM_Delete(VUT.vsm); memset(&VUT, 0, sizeof VUT); } int VUT_Main(void) { struct VSL_cursor *c; int i = -1; AN(VUT.vslq); while (!VUT.sigint) { if (VUT.sighup && VUT.sighup_f) { /* sighup callback */ VUT.sighup = 0; i = (VUT.sighup_f)(); if (i) break; } if (VUT.sigusr1) { /* Flush and report any incomplete records */ VUT.sigusr1 = 0; VSLQ_Flush(VUT.vslq, vut_dispatch, NULL); } if (VUT.vsm != NULL && !VSM_IsOpen(VUT.vsm)) { /* Reconnect VSM */ AZ(VUT.r_arg); VTIM_sleep(0.1); if (VSM_Open(VUT.vsm)) { VSM_ResetError(VUT.vsm); continue; } c = VSL_CursorVSM(VUT.vsl, VUT.vsm, VSL_COPT_TAIL | VSL_COPT_BATCH); if (c == NULL) { VSL_ResetError(VUT.vsl); VSM_Close(VUT.vsm); continue; } VSLQ_SetCursor(VUT.vslq, &c); AZ(c); VUT_Error(0, "Log reacquired"); } i = VSLQ_Dispatch(VUT.vslq, vut_dispatch, NULL); if (i == 1) /* Call again */ continue; else if (i == 0) { /* Nothing to do but wait */ if (VUT.idle_f) { i = (VUT.idle_f)(); if (i) break; } VTIM_sleep(0.01); continue; } else if (i == -1) { /* EOF */ break; } if (VUT.vsm == NULL) break; /* XXX: Make continuation optional */ VSLQ_Flush(VUT.vslq, vut_dispatch, NULL); if (i == -2) /* Abandoned */ VUT_Error(0, "Log abandoned"); else if (i < -2) /* Overrun */ VUT_Error(0, "Log overrun"); VSM_Close(VUT.vsm); } return (i); } varnish-4.1.1/lib/libvarnishtools/Makefile.am0000644000201500234410000000004612652366721016142 00000000000000# EXTRA_DIST = \ vut.c \ opt2rst.c varnish-4.1.1/lib/libvarnishtools/Makefile.in0000644000201500234410000002573312652366727016173 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = lib/libvarnishtools DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ EXTRA_DIST = \ vut.c \ opt2rst.c all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/libvarnishtools/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/libvarnishtools/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/lib/libvarnishtools/opt2rst.c0000644000201500234410000000516212652366721015673 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-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. */ #include #include #include #include #include "vapi/voptget.h" static void print_nobrackets(const char *s) { const char *e; /* Remove whitespace */ while (isspace(*s)) s++; e = s + strlen(s); while (e > s && isspace(e[-1])) e--; /* Remove outer layer brackets if present */ if (e > s && *s == '[' && e[-1] == ']') { s++; e--; } printf("%.*s", (int)(e - s), s); } static void print_tabbed(const char *string, int tabs) { int i; const char *c; for (c = string; *c; c++) { if (c == string || *(c - 1) == '\n') for (i = 0; i < tabs; i++) printf("\t"); printf("%c", *c); } } static void print_opt(const struct vopt_list *opt) { print_nobrackets(opt->synopsis); printf("\n\n"); print_tabbed(opt->ldesc, 1); printf("\n\n"); } static void usage(void) { fprintf(stderr, "Usage: opt2rst {synopsis|options}\n"); exit(1); } int main(int argc, char * const *argv) { int i; if (argc != 2) usage(); if (!strcmp(argv[1], "synopsis")) printf(".. |synopsis| replace:: %s\n", vopt_synopsis); else if (!strcmp(argv[1], "options")) for (i = 0; i < vopt_list_n; i++) print_opt(&vopt_list[i]); else usage(); return (0); } varnish-4.1.1/INSTALL0000644000201500234410000000143712652366721011154 00000000000000 Installation Instructions Varnish uses the GNU autotools. To build and install Varnish, simply run the 'configure' script in the top-level directory, then run 'make' and 'make install'. On Linux, you need to run 'ldconfig' as root afterwards in order to update the shared library cache. If you obtained the sources directly from the Git repository, you will need to run autogen.sh first to create the configure script. Varnish will store run-time state in $localstatedir/varnish; you may want to tune this using configure's --localstatedir parameter. Additional configure options of interest: --enable-developer-warnings enable strict warnings (default is NO) --enable-debugging-symbols enable debugging symbols (default is NO) varnish-4.1.1/configure.ac0000644000201500234410000004442312652366721012413 00000000000000AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2016 Varnish Software AS]) AC_REVISION([$Id$]) AC_INIT([Varnish], [4.1.1], [varnish-dev@varnish-cache.org]) AC_CONFIG_SRCDIR(include/miniobj.h) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) AC_USE_SYSTEM_EXTENSIONS # save command line CFLAGS for use in VCC_CC (to pass through things like -m64) OCFLAGS="$CFLAGS" AC_CANONICAL_SYSTEM AC_LANG(C) AM_MAINTAINER_MODE([disable]) AM_INIT_AUTOMAKE([1.11 foreign color-tests parallel-tests]) AM_SILENT_RULES([yes]) AC_DISABLE_STATIC AC_PROG_LIBTOOL # Checks for programs. AC_GNU_SOURCE AC_PROG_CC AC_PROG_CC_STDC if test "x$ac_cv_prog_cc_c99" = "xno" || test "x$ac_cv_prog_cc_c99" = "x"; then # We might be on RHEL5 with a git checkout and so broken # autoconf. Check if CC is gcc and if it bails when given -std=gnu99. # If not, use that. Yuck. if test "x$ac_cv_c_compiler_gnu" = "xyes"; then CC="$CC -std=gnu99" AC_RUN_IFELSE( [AC_LANG_PROGRAM([],[[ return 0; ]])], [], [AC_MSG_ERROR([Could not find a C99 compatible compiler])]) else AC_MSG_ERROR([Could not find a C99 compatible compiler]) fi fi AC_PROG_CPP AX_PTHREAD(,[AC_MSG_ERROR([Could not configure pthreads support])]) LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" AC_PROG_INSTALL AC_PROG_MAKE_SET AC_ARG_WITH([rst2man], AS_HELP_STRING([--with-rst2man=PATH], [Location of rst2man (auto)]), [RST2MAN="$withval"], AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], [no])) if test "x$RST2MAN" = "xno"; then AC_MSG_ERROR( [rst2man is needed to build Varnish, please install python-docutils.]) fi AC_ARG_WITH([rst2html], AS_HELP_STRING([--with-rst2html=PATH], [Location of rst2html (auto)]), [RST2HTML="$withval"], [AC_CHECK_PROGS(RST2HTML, [rst2html rst2html.py], "no") if test "x$RST2HTML" = "xno"; then AC_MSG_WARN([rst2html not found - not building changelog]) fi]) AM_CONDITIONAL(HAVE_RST2HTML,[test "x$RST2HTML" != "xno"]) AC_ARG_WITH([dot], AS_HELP_STRING([--with-dot=PATH], [Location of the dot tool from graphviz (auto)]), [DOT="$withval"], [AC_CHECK_PROGS(DOT, [dot], [no]) if test "x$DOT" = "xno"; then AC_MSG_WARN( [dot not found - can't generate graphviz output for documentation.]) fi]) AM_CONDITIONAL(HAVE_DOT,[test "x$DOT" != "xno"]) # Checks for libraries. save_LIBS="${LIBS}" LIBS="" AC_CHECK_LIB(rt, clock_gettime) RT_LIBS="${LIBS}" LIBS="${save_LIBS}" AC_SUBST(RT_LIBS) save_LIBS="${LIBS}" LIBS="" AC_CHECK_LIB(dl, dlopen) DL_LIBS="${LIBS}" LIBS="${save_LIBS}" AC_SUBST(DL_LIBS) AX_WITH_CURSES if test "x$ax_cv_curses" != xyes; then AC_MSG_ERROR([requires an X/Open-compatible Curses library]) fi save_LIBS="${LIBS}" LIBS="" AC_SEARCH_LIBS(pthread_create, [thr pthread c_r]) PTHREAD_LIBS="${LIBS}" LIBS="${save_LIBS}" AC_SUBST(PTHREAD_LIBS) save_LIBS="${LIBS}" LIBS="" AC_CHECK_LIB(socket, socket) AC_CHECK_LIB(nsl, getaddrinfo) NET_LIBS="${LIBS}" LIBS="${save_LIBS}" AC_SUBST(NET_LIBS) AC_CHECK_LIBM AC_SUBST(LIBM) m4_ifndef([PKG_PROG_PKG_CONFIG], [m4_fatal([pkg.m4 missing, please install pkg-config])]) PKG_PROG_PKG_CONFIG if test -n $PKG_CONFIG; then PKG_CHECK_MODULES([PCRE], [libpcre]) else AC_CHECK_PROG(PCRE_CONFIG, pcre-config, pcre-config) AC_ARG_WITH(pcre-config, AS_HELP_STRING([--with-pcre-config=PATH], [Location of PCRE pcre-config (auto)]), [pcre_config="$withval"], [pcre_config=""]) if test "x$pcre_config" != "x" ; then AC_MSG_CHECKING(for $pcre_config) if test -f $pcre_config ; then PCRE_CONFIG=$pcre_config AC_MSG_RESULT(yes) else AC_MSG_RESULT(no - searching PATH) fi fi if test "x$PCRE_CONFIG" = "x"; then AC_CHECK_PROGS(PCRE_CONFIG, pcre-config) fi PCRE_CFLAGS=`$PCRE_CONFIG --cflags` PCRE_LIBS=`$PCRE_CONFIG --libs` fi AC_SUBST(PCRE_CFLAGS) AC_SUBST(PCRE_LIBS) # --enable-pcre-jit AC_ARG_ENABLE(pcre-jit, AS_HELP_STRING([--enable-pcre-jit], [use the PCRE JIT compiler (default is YES)]), [], [enable_pcre_jit=yes]) if test "$enable_pcre_jit" = yes; then AC_MSG_CHECKING(for PCRE JIT usability) save_CFLAGS="${CFLAGS}" CFLAGS="${PCRE_CFLAGS}" AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include "pcre.h" #if PCRE_MAJOR != 8 || PCRE_MINOR < 32 #error no jit #endif]])], [AC_MSG_RESULT(yes) AC_DEFINE([USE_PCRE_JIT], [1], [Use the PCRE JIT compiler]) ], [AC_MSG_RESULT(no)] ) CFLAGS="${save_CFLAGS}" fi AC_CHECK_HEADERS([edit/readline/readline.h], [AC_DEFINE([HAVE_LIBEDIT], [1], [Define if we have libedit]) LIBEDIT_LIBS="-ledit"], [PKG_CHECK_MODULES([LIBEDIT], [libedit], # having the module does not imply having the header [AC_CHECK_HEADERS([editline/readline.h], [AC_DEFINE([HAVE_LIBEDIT], [1], [Define if we have libedit])], [AC_MSG_ERROR([Found libedit, but header file is missing. Hint: Install dev package?])])], [ # AX_LIB_READLINE overwrites LIBS which leads to every binary getting # linked against libreadline uselessly. So we re-use LIBEDIT_LIBS which # we have for libedit to add the lib specifically where needed save_LIBS="${LIBS}" AX_LIB_READLINE LIBS="${save_LIBS}" if test "$ax_cv_lib_readline" = "no"; then AC_MSG_ERROR([neither libedit nor another readline compatible library found]) fi if test "x$ax_cv_lib_readline_history" != "xyes"; then AC_MSG_ERROR([need readline history support]) fi LIBEDIT_LIBS="$ax_cv_lib_readline" ]) ]) # Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_HEADER_TIME AC_CHECK_HEADERS([sys/param.h]) AC_CHECK_HEADERS([sys/types.h]) AC_CHECK_HEADERS([sys/endian.h]) AC_CHECK_HEADERS([sys/filio.h]) AC_CHECK_HEADERS([sys/mount.h], [], [], [#include ]) AC_CHECK_HEADERS([sys/socket.h]) AC_CHECK_HEADERS([sys/statvfs.h]) AC_CHECK_HEADERS([sys/vfs.h]) AC_CHECK_HEADERS([endian.h]) AC_CHECK_HEADERS([execinfo.h]) AC_CHECK_HEADERS([netinet/in.h]) AC_CHECK_HEADERS([pthread_np.h], [], [], [#include ]) AC_CHECK_HEADERS([stddef.h]) AC_CHECK_HEADERS([stdlib.h]) AC_CHECK_HEADERS([unistd.h]) AC_CHECK_HEADERS([priv.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,[ #include #ifdef HAVE_SYS_SOCKET_H #include #endif ]) # Checks for library functions. AC_TYPE_SIGNAL AC_TYPE_SIZE_T AC_FUNC_VPRINTF AC_CHECK_FUNCS([strerror]) AC_FUNC_STRERROR_R AC_CHECK_FUNCS([dladdr]) AC_CHECK_FUNCS([socket]) AC_CHECK_FUNCS([strptime]) AC_CHECK_FUNCS([fmtcheck]) AC_CHECK_FUNCS([getdtablesize]) AC_CHECK_FUNCS([nanosleep]) AC_CHECK_FUNCS([setppriv]) AC_CHECK_FUNCS([fallocate]) AC_CHECK_FUNCS([closefrom]) save_LIBS="${LIBS}" LIBS="${PTHREAD_LIBS}" AC_CHECK_FUNCS([pthread_set_name_np]) AC_CHECK_FUNCS([pthread_mutex_isowned_np]) AC_CHECK_FUNCS([pthread_timedjoin_np]) LIBS="${save_LIBS}" # Support for visibility attribute save_CFLAGS="${CFLAGS}" CFLAGS="${CFLAGS} -Werror" AC_CACHE_CHECK([whether we have support for visibility attributes], [ac_cv_have_viz], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL #endif int ZLIB_INTERNAL foo; ]],[])], [ac_cv_have_viz=yes], [ac_cv_have_viz=no]) ]) if test "$ac_cv_have_viz" = no; then libvgz_extra_cflags="-DNO_VIZ" AC_SUBST(libvgz_extra_cflags) fi CFLAGS="${save_CFLAGS}" # Use jemalloc on Linux JEMALLOC_LDADD= AC_ARG_WITH([jemalloc], [AS_HELP_STRING([--with-jemalloc], [use jemalloc memory allocator. Default is yes on Linux, no elsewhere])], [], [with_jemalloc=check]) case $target in *-*-linux*) if test "x$with_jemalloc" != xno; then AC_CHECK_LIB([jemalloc], [malloc_conf], [JEMALLOC_LDADD="-ljemalloc"], [AC_MSG_WARN([No system jemalloc found, using system malloc])]) fi ;; esac AC_SUBST(JEMALLOC_LDADD) # Userland slab allocator, available only on Solaris case $target in *-*-solaris*) AC_CHECK_HEADERS([umem.h]) if test "$ac_cv_have_umem_h" = yes; then save_LIBS="${LIBS}" LIBS="" AC_CHECK_LIB(umem, umem_alloc) LIBUMEM="${LIBS}" LIBS="${save_LIBS}" fi ;; esac AC_SUBST(LIBUMEM) # These functions are provided by libcompat on platforms where they # are not available AC_CHECK_FUNCS([setproctitle]) AC_SEARCH_LIBS(backtrace, [execinfo],[AC_DEFINE([HAVE_BACKTRACE],[1],[Define to 1 if the backtrace function exists])]) # white lie - we don't actually test it AC_MSG_CHECKING([whether daemon() works]) case $target in *-*-darwin*) # present but not functional AC_MSG_RESULT([no]) ac_cv_func_daemon=no ;; *) AC_CHECK_FUNCS([daemon]) ;; esac AC_SYS_LARGEFILE save_LIBS="${LIBS}" LIBS="${LIBS} ${RT_LIBS}" AC_CHECK_FUNCS([clock_gettime]) AC_CHECK_FUNCS([gethrtime]) LIBS="${save_LIBS}" # --enable-kqueue AC_ARG_ENABLE(kqueue, AS_HELP_STRING([--enable-kqueue], [use kqueue if available (default is YES)]), , [enable_kqueue=yes]) if test "$enable_kqueue" = yes; then AC_CHECK_FUNCS([kqueue]) else ac_cv_func_kqueue=no fi # --enable-epoll AC_ARG_ENABLE(epoll, AS_HELP_STRING([--enable-epoll], [use epoll if available (default is YES)]), , [enable_epoll=yes]) if test "$enable_epoll" = yes; then AC_CHECK_FUNCS([epoll_ctl]) else ac_cv_func_epoll_ctl=no fi # --enable-ports AC_ARG_ENABLE(ports, AS_HELP_STRING([--enable-ports], [use ports if available (default is YES)]), , [enable_ports=yes]) if test "$enable_ports" = yes; then AC_CHECK_FUNCS([port_create]) else ac_cv_func_port_create=no fi AM_MISSING_HAS_RUN AC_CHECK_PROGS(PYTHON, [python3 python3.1 python3.2 python2.7 python2.6 python2.5 python2 python], "no") if test "x$PYTHON" = "xno"; then AC_MSG_ERROR([Python is needed to build Varnish, please install python.]) fi AC_CHECK_DECL([SO_ACCEPTFILTER], AC_DEFINE(HAVE_ACCEPT_FILTERS,1,[Define to 1 if you have accept filters]), , [ #include #include ] ) # Older Solaris versions define SO_{RCV,SND}TIMEO, but do not # implement them. # # Varnish will build and run without these, but connections will not # time out, which may leave Varnish vulnerable to denail-of-service # attacks which would not be possible on other platforms. # # Newer Solaris releases with the Volo framework (Solaris 11, # Opensolaris starting with onnv_106) do support SO_{RCV,SND}TIMEO # (see PSARC 2007/587, initially committed into onnv-gate / # OpenSolaris 8348:4137e18bfaf0 Thu Dec 11 20:04:13 2008) save_LIBS="${LIBS}" LIBS="${LIBS} ${NET_LIBS}" AC_CACHE_CHECK([whether SO_RCVTIMEO works], [ac_cv_so_rcvtimeo_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include #include #include ]],[[ int sd = socket(AF_INET, SOCK_STREAM, 0); struct timeval tv = { 1, 0 }; if (setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv) == 0) { socklen_t l = sizeof tv; if (getsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, &l) == 0) { return (l != sizeof tv); } } return 1; ]])], [ac_cv_so_rcvtimeo_works=yes], [ac_cv_so_rcvtimeo_works=no]) ]) if test "$ac_cv_so_rcvtimeo_works" = yes; then AC_DEFINE([SO_RCVTIMEO_WORKS], [1], [Define if SO_RCVTIMEO works]) fi LIBS="${save_LIBS}" save_LIBS="${LIBS}" LIBS="${LIBS} ${NET_LIBS}" AC_CACHE_CHECK([whether SO_SNDTIMEO works], [ac_cv_so_sndtimeo_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include #include #include ]],[[ int sd = socket(AF_INET, SOCK_STREAM, 0); struct timeval tv = { 1, 0 }; if (setsockopt(sd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv) == 0) { socklen_t l = sizeof tv; if (getsockopt(sd, SOL_SOCKET, SO_SNDTIMEO, &tv, &l) == 0) { return (l != sizeof tv); } } return 1; ]])], [ac_cv_so_sndtimeo_works=yes], [ac_cv_so_sndtimeo_works=no]) ]) if test "$ac_cv_so_sndtimeo_works" = yes; then AC_DEFINE([SO_SNDTIMEO_WORKS], [1], [Define if SO_SNDTIMEO works]) fi if test "$ac_cv_so_rcvtimeo_works" = no || test "$ac_cv_so_sndtimeo_works" = no; then AC_MSG_WARN([connection timeouts will not work]) fi LIBS="${save_LIBS}" # Check if the OS supports TCP_KEEP(CNT|IDLE|INTVL) socket options save_LIBS="${LIBS}" LIBS="${LIBS} ${NET_LIBS}" AC_CACHE_CHECK([for TCP_KEEP(CNT|IDLE|INTVL) socket options], [ac_cv_have_tcp_keep], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include #include #include #include #include ]],[[ int s = socket(AF_INET, SOCK_STREAM, 0); int i; i = 5; if (setsockopt(s, IPPROTO_TCP, TCP_KEEPCNT, &i, sizeof i)) return (1); if (setsockopt(s, IPPROTO_TCP, TCP_KEEPIDLE, &i, sizeof i)) return (1); if (setsockopt(s, IPPROTO_TCP, TCP_KEEPINTVL, &i, sizeof i)) return (1); return (0); ]])], [ac_cv_have_tcp_keep=yes], [ac_cv_have_tcp_keep=no]) ]) if test "$ac_cv_have_tcp_keep" = yes; then AC_DEFINE([HAVE_TCP_KEEP], [1], [Define if OS supports TCP_KEEP* socket options]) fi LIBS="${save_LIBS}" # Run-time directory VARNISH_STATE_DIR='${localstatedir}/varnish' AC_SUBST(VARNISH_STATE_DIR) # Default configuration directory. varnishconfdir='${sysconfdir}/varnish' AC_SUBST(varnishconfdir) # Check for linker script support gl_LD_VERSION_SCRIPT ####################################################################### # Now that we're done using the compiler to look for functions and # libraries, set CFLAGS to what we want them to be for our own code # This is a test to see how much havoc Jenkins exposes. # # The reason for -Wno-error=unused-result is a glibc/gcc interaction # idiocy where write is marked as warn_unused_result, causing build # failures. CFLAGS="${CFLAGS} -Wall -Werror" OCFLAGS="${OCFLAGS} -Wall -Werror" AX_CHECK_COMPILE_FLAG([-Werror=unused-result], [CFLAGS="${CFLAGS} -Wno-error=unused-result" OCFLAGS="${OCFLAGS} -Wno-error=unused-result"], [AX_CHECK_COMPILE_FLAG([-Wunused-result], [CFLAGS="${CFLAGS} -Wno-unused-result" OCFLAGS="${OCFLAGS} -Wno-unused-result"])]) # This corresponds to FreeBSD's WARNS level 6 DEVELOPER_CFLAGS=" \ -Werror \ -Wall \ -Wno-format-y2k \ -W \ -Wstrict-prototypes \ -Wmissing-prototypes \ -Wpointer-arith \ -Wreturn-type \ -Wcast-qual \ -Wwrite-strings \ -Wswitch \ -Wshadow \ -Wunused-parameter \ -Wcast-align \ -Wchar-subscripts \ -Wnested-externs \ -Wextra \ -Wno-sign-compare \ " # These are not compliable yet DEVELOPER_GCC_CFLAGS="-Wold-style-definition -Wredundant-decls " #DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} ${DEVELOPER_GCC_CFLAGS}" # These are compilable 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_stack_protector" != "xno"; then AX_CHECK_COMPILE_FLAG([-fstack-protector], AX_CHECK_LINK_FLAG([-fstack-protector], [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)]), [], [enable_developer_warnings=no]) if test "x$enable_developer_warnings" != "xno"; then # compiler flags not available on gcc3 AX_CHECK_COMPILE_FLAG([-Wno-pointer-sign], [DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-pointer-sign"], [], []) # Not available in gcc 4.1.2 AX_CHECK_COMPILE_FLAG([-Wno-address], [DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-address"]) # no known way to specifically disabling missing-field-initializers warnings # keeping the rest of Wextra AX_CHECK_COMPILE_FLAG([-Wno-missing-field-initializers], [DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-missing-field-initializers"], [DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-extra"], []) CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}" OCFLAGS="${OCFLAGS} ${DEVELOPER_CFLAGS}" fi # --enable-debugging-symbols AC_ARG_ENABLE(debugging-symbols, AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]), CFLAGS="${CFLAGS} -O0 -g -fno-inline") AC_SUBST(AM_LT_LDFLAGS) # --enable-tests AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[build test programs (default is NO)])) AM_CONDITIONAL([ENABLE_TESTS], [test x$enable_tests = xyes]) # Command line for compiling VCL code. I wish there were a simple way # to figure this out dynamically without introducing a run-time # dependency on libtool. AC_ARG_VAR([VCC_CC], [C compiler command line for VCL code]) if test "$ac_cv_env_VCC_CC_set" = "set"; then VCC_CC="$ac_cv_env_VCC_CC_value" else case $target in *-*-solaris*) case $PTHREAD_CC in *gcc*) VCC_CC="$PTHREAD_CC $OCFLAGS $PTHREAD_CFLAGS -fpic -shared -o %o %s" break ;; *cc) VCC_CC="$PTHREAD_CC $OCFLAGS $PTHREAD_CFLAGS -Kpic -G -o %o %s" ;; esac ;; *-*-darwin*) VCC_CC="exec cc $OCFLAGS -dynamiclib -Wl,-undefined,dynamic_lookup -o %o %s" ;; *) VCC_CC="exec $PTHREAD_CC $OCFLAGS $PTHREAD_CFLAGS -fpic -shared -Wl,-x -o %o %s" ;; esac fi AC_DEFINE_UNQUOTED([VCC_CC],"$VCC_CC",[C compiler command line for VCL code]) # Stupid automake needs this VTC_TESTS="$(cd $srcdir/bin/varnishtest && echo tests/*.vtc)" AC_SUBST(VTC_TESTS) # Make sure this include dir exists AC_CONFIG_COMMANDS([mkdir], [$MKDIR_P doc/sphinx/include]) # Generate output AC_CONFIG_FILES([ Makefile bin/Makefile bin/varnishadm/Makefile bin/varnishd/Makefile bin/varnishlog/Makefile bin/varnishstat/Makefile bin/varnishtop/Makefile bin/varnishhist/Makefile bin/varnishtest/Makefile bin/varnishncsa/Makefile doc/Makefile doc/graphviz/Makefile doc/sphinx/Makefile doc/sphinx/conf.py etc/Makefile include/Makefile lib/Makefile lib/libvarnish/Makefile lib/libvarnishapi/Makefile lib/libvarnishtools/Makefile lib/libvarnishcompat/Makefile lib/libvcc/Makefile lib/libvgz/Makefile lib/libvmod_debug/Makefile lib/libvmod_std/Makefile lib/libvmod_directors/Makefile man/Makefile varnishapi.pc varnishapi-uninstalled.pc ]) AC_OUTPUT varnish-4.1.1/ChangeLog0000644000201500234410000000013712652366721011671 00000000000000 Please note that this file is no longer maintained. Please refer to the changes files in doc/varnish-4.1.1/bin/0000755000201500234410000000000012652366757010757 500000000000000varnish-4.1.1/bin/varnishstat/0000755000201500234410000000000012652366757013325 500000000000000varnish-4.1.1/bin/varnishstat/varnishstat.h0000644000201500234410000000304312652366721015753 00000000000000/*- * Copyright (c) 2010-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. * */ #include #include "vapi/vsm.h" #include "vapi/vsc.h" #include "vas.h" #include "vcs.h" void do_curses(struct VSM_data *vd, double delay); varnish-4.1.1/bin/varnishstat/Makefile.am0000644000201500234410000000111012652366721015261 00000000000000# AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include bin_PROGRAMS = varnishstat varnishstat_SOURCES = \ varnishstat.h \ \ varnishstat.c \ varnishstat_curses.c \ $(top_srcdir)/lib/libvarnish/vas.c \ $(top_srcdir)/lib/libvarnish/version.c \ $(top_srcdir)/lib/libvarnish/vtim.c varnishstat_LDADD = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ @CURSES_LIB@ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS} noinst_PROGRAMS = vsc2rst vsc2rst_SOURCES = vsc2rst.c $(top_srcdir)/include/tbl/vsc_fields.h varnish-4.1.1/bin/varnishstat/Makefile.in0000644000201500234410000006234512652366726015320 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = varnishstat$(EXEEXT) noinst_PROGRAMS = vsc2rst$(EXEEXT) subdir = bin/varnishstat DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_varnishstat_OBJECTS = varnishstat.$(OBJEXT) \ varnishstat_curses.$(OBJEXT) vas.$(OBJEXT) version.$(OBJEXT) \ vtim.$(OBJEXT) varnishstat_OBJECTS = $(am_varnishstat_OBJECTS) am__DEPENDENCIES_1 = varnishstat_DEPENDENCIES = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am_vsc2rst_OBJECTS = vsc2rst.$(OBJEXT) vsc2rst_OBJECTS = $(am_vsc2rst_OBJECTS) vsc2rst_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(varnishstat_SOURCES) $(vsc2rst_SOURCES) DIST_SOURCES = $(varnishstat_SOURCES) $(vsc2rst_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include varnishstat_SOURCES = \ varnishstat.h \ \ varnishstat.c \ varnishstat_curses.c \ $(top_srcdir)/lib/libvarnish/vas.c \ $(top_srcdir)/lib/libvarnish/version.c \ $(top_srcdir)/lib/libvarnish/vtim.c varnishstat_LDADD = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ @CURSES_LIB@ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS} vsc2rst_SOURCES = vsc2rst.c $(top_srcdir)/include/tbl/vsc_fields.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/varnishstat/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign bin/varnishstat/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list varnishstat$(EXEEXT): $(varnishstat_OBJECTS) $(varnishstat_DEPENDENCIES) $(EXTRA_varnishstat_DEPENDENCIES) @rm -f varnishstat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(varnishstat_OBJECTS) $(varnishstat_LDADD) $(LIBS) vsc2rst$(EXEEXT): $(vsc2rst_OBJECTS) $(vsc2rst_DEPENDENCIES) $(EXTRA_vsc2rst_DEPENDENCIES) @rm -f vsc2rst$(EXEEXT) $(AM_V_CCLD)$(LINK) $(vsc2rst_OBJECTS) $(vsc2rst_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishstat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishstat_curses.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vas.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsc2rst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vtim.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< vas.o: $(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vas.o -MD -MP -MF $(DEPDIR)/vas.Tpo -c -o vas.o `test -f '$(top_srcdir)/lib/libvarnish/vas.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vas.Tpo $(DEPDIR)/vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vas.c' object='vas.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vas.o `test -f '$(top_srcdir)/lib/libvarnish/vas.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vas.c vas.obj: $(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vas.obj -MD -MP -MF $(DEPDIR)/vas.Tpo -c -o vas.obj `if test -f '$(top_srcdir)/lib/libvarnish/vas.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vas.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vas.Tpo $(DEPDIR)/vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vas.c' object='vas.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vas.obj `if test -f '$(top_srcdir)/lib/libvarnish/vas.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vas.c'; fi` version.o: $(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT version.o -MD -MP -MF $(DEPDIR)/version.Tpo -c -o version.o `test -f '$(top_srcdir)/lib/libvarnish/version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/version.Tpo $(DEPDIR)/version.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/version.c' object='version.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o version.o `test -f '$(top_srcdir)/lib/libvarnish/version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/version.c version.obj: $(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT version.obj -MD -MP -MF $(DEPDIR)/version.Tpo -c -o version.obj `if test -f '$(top_srcdir)/lib/libvarnish/version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/version.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/version.Tpo $(DEPDIR)/version.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/version.c' object='version.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o version.obj `if test -f '$(top_srcdir)/lib/libvarnish/version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/version.c'; fi` vtim.o: $(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vtim.o -MD -MP -MF $(DEPDIR)/vtim.Tpo -c -o vtim.o `test -f '$(top_srcdir)/lib/libvarnish/vtim.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vtim.Tpo $(DEPDIR)/vtim.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vtim.c' object='vtim.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vtim.o `test -f '$(top_srcdir)/lib/libvarnish/vtim.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vtim.c vtim.obj: $(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vtim.obj -MD -MP -MF $(DEPDIR)/vtim.Tpo -c -o vtim.obj `if test -f '$(top_srcdir)/lib/libvarnish/vtim.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vtim.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vtim.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vtim.Tpo $(DEPDIR)/vtim.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vtim.c' object='vtim.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vtim.obj `if test -f '$(top_srcdir)/lib/libvarnish/vtim.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vtim.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vtim.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/bin/varnishstat/varnishstat_curses.c0000644000201500234410000005176312652366721017346 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * Author: Dag-Erling Smørgrav * 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. * * Statistics output program */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include "vas.h" #include "miniobj.h" #include "vqueue.h" #include "vapi/vsm.h" #include "vapi/vsc.h" #include "vtim.h" #include "varnishstat.h" #include "vcurses.h" #define LINES_STATUS 3 #define LINES_BAR_T 1 #define LINES_BAR_B 1 #define LINES_INFO 3 #define LINES_POINTS_MIN 3 #define N_COL 6 #define COLW 14 #define COLW_NAME_MIN 24 struct ma { unsigned n, nmax; double acc; }; struct pt { unsigned magic; #define PT_MAGIC 0x41698E4F VTAILQ_ENTRY(pt) list; const struct VSC_point *vpt; char *key; char *name; int semantics; int format; const volatile uint64_t *ptr; char seen; uint64_t cur, last; double t_cur, t_last; double chg, avg; struct ma ma_10, ma_100, ma_1000; }; struct hitrate { double lt; uint64_t lhit, lmiss; struct ma hr_10; struct ma hr_100; struct ma hr_1000; }; static struct hitrate hitrate; static VTAILQ_HEAD(, pt) ptlist = VTAILQ_HEAD_INITIALIZER(ptlist); static int n_ptlist = 0; static int n_ptarray = 0; static struct pt **ptarray = NULL; static const struct VSC_C_mgt *VSC_C_mgt = NULL; static const struct VSC_C_main *VSC_C_main = NULL; static int l_status, l_bar_t, l_points, l_bar_b, l_info; static int colw_name = COLW_NAME_MIN; static WINDOW *w_status = NULL; static WINDOW *w_bar_t = NULL; static WINDOW *w_points = NULL; static WINDOW *w_bar_b = NULL; static WINDOW *w_info = NULL; static int verbosity = VSC_level_info; static int keep_running = 1; static int show_info = 1; static int hide_unseen = 1; static int page_start = 0; static int current = 0; static int rebuild = 0; static int redraw = 0; static int sample = 0; static int scale = 1; static double t_sample = 0.; static double interval = 1.; static void init_hitrate(void) { memset(&hitrate, 0, sizeof (struct hitrate)); if (VSC_C_main != NULL) { hitrate.lhit = VSC_C_main->cache_hit; hitrate.lmiss = VSC_C_main->cache_miss; } hitrate.hr_10.nmax = 10; hitrate.hr_100.nmax = 100; hitrate.hr_1000.nmax = 1000; } static void update_ma(struct ma *ma, double val) { AN(ma); AN(ma->nmax); if (ma->n < ma->nmax) ma->n++; ma->acc += (val - ma->acc) / (double)ma->n; } static void update_position(void) { int old_current, old_page_start; old_current = current; old_page_start = page_start; if (n_ptarray == 0) { current = 0; page_start = 0; } else { if (current < 0) current = 0; if (current > n_ptarray - 1) current = n_ptarray - 1; if (current < page_start) page_start = current; if (current > page_start + (l_points - 1)) page_start = current - (l_points - 1); if (page_start < 0) page_start = 0; if (page_start > n_ptarray - 1) page_start = n_ptarray - 1; } if (current != old_current || page_start != old_page_start) redraw = 1; } static void delete_pt_array(void) { if (ptarray != NULL) free(ptarray); ptarray = NULL; n_ptarray = 0; update_position(); } static void build_pt_array(void) { int i; struct pt *pt; struct pt *pt_current = NULL; int current_line = 0; if (current < n_ptarray) { pt_current = ptarray[current]; current_line = current - page_start; } if (ptarray != NULL) delete_pt_array(); AZ(n_ptarray); ptarray = calloc(n_ptlist, sizeof *ptarray); AN(ptarray); VTAILQ_FOREACH(pt, &ptlist, list) { CHECK_OBJ_NOTNULL(pt, PT_MAGIC); if (!pt->seen && hide_unseen) continue; if (pt->vpt->desc->level->verbosity > verbosity) continue; assert(n_ptarray < n_ptlist); ptarray[n_ptarray++] = pt; } assert(n_ptarray <= n_ptlist); for (i = 0; pt_current != NULL && i < n_ptarray; i++) if (ptarray[i] == pt_current) break; current = i; page_start = current - current_line; update_position(); rebuild = 0; redraw = 1; } static void delete_pt_list(void) { struct pt *pt; unsigned i = 0; delete_pt_array(); while (!VTAILQ_EMPTY(&ptlist)) { pt = VTAILQ_FIRST(&ptlist); CHECK_OBJ_NOTNULL(pt, PT_MAGIC); VTAILQ_REMOVE(&ptlist, pt, list); free(pt->name); FREE_OBJ(pt); i++; } assert(i == n_ptlist); n_ptlist = 0; update_position(); } struct pt_priv { unsigned magic; #define PT_PRIV_MAGIC 0x34ACBAD6 VTAILQ_HEAD(, pt) ptlist; unsigned n_ptlist; }; static int build_pt_list_cb(void *priv, const struct VSC_point *vpt) { struct pt_priv *pt_priv; struct pt *pt; char buf[128]; if (vpt == NULL) return (0); CAST_OBJ_NOTNULL(pt_priv, priv, PT_PRIV_MAGIC); AZ(strcmp(vpt->desc->ctype, "uint64_t")); snprintf(buf, sizeof buf, "%s.%s.%s", vpt->section->type, vpt->section->ident, vpt->desc->name); buf[sizeof buf - 1] = '\0'; VTAILQ_FOREACH(pt, &ptlist, list) { CHECK_OBJ_NOTNULL(pt, PT_MAGIC); AN(pt->key); if (strcmp(buf, pt->key)) continue; VTAILQ_REMOVE(&ptlist, pt, list); AN(n_ptlist); n_ptlist--; pt->vpt = vpt; VTAILQ_INSERT_TAIL(&pt_priv->ptlist, pt, list); pt_priv->n_ptlist++; return (0); } AZ(pt); ALLOC_OBJ(pt, PT_MAGIC); AN(pt); pt->key = strdup(buf); AN(pt->key); *buf = '\0'; if (strcmp(vpt->section->type, "")) { strncat(buf, vpt->section->type, sizeof buf - strlen(buf) - 1); strncat(buf, ".", sizeof buf - strlen(buf) - 1); } if (strcmp(vpt->section->ident, "")) { strncat(buf, vpt->section->ident, sizeof buf - strlen(buf) - 1); strncat(buf, ".", sizeof buf - strlen(buf) - 1); } strncat(buf, vpt->desc->name, sizeof buf - strlen(buf) - 1); pt->name = strdup(buf); AN(pt->name); pt->vpt = vpt; pt->ptr = vpt->ptr; pt->last = *pt->ptr; pt->semantics = vpt->desc->semantics; pt->format = vpt->desc->format; pt->ma_10.nmax = 10; pt->ma_100.nmax = 100; pt->ma_1000.nmax = 1000; VTAILQ_INSERT_TAIL(&pt_priv->ptlist, pt, list); pt_priv->n_ptlist++; return (0); } static void build_pt_list(struct VSM_data *vd, struct VSM_fantom *fantom) { struct pt_priv pt_priv; int i; struct pt *pt_current = NULL; int current_line = 0; if (current < n_ptarray) { pt_current = ptarray[current]; current_line = current - page_start; } pt_priv.magic = PT_PRIV_MAGIC; VTAILQ_INIT(&pt_priv.ptlist); pt_priv.n_ptlist = 0; (void)VSC_Iter(vd, fantom, build_pt_list_cb, &pt_priv); delete_pt_list(); AN(VTAILQ_EMPTY(&ptlist)); AZ(n_ptlist); VTAILQ_CONCAT(&ptlist, &pt_priv.ptlist, list); n_ptlist = pt_priv.n_ptlist; build_pt_array(); for (i = 0; pt_current != NULL && i < n_ptarray; i++) if (ptarray[i] == pt_current) break; current = i; page_start = current - current_line; update_position(); } static void sample_points(void) { struct pt *pt; VTAILQ_FOREACH(pt, &ptlist, list) { AN(pt->vpt); AN(pt->ptr); if (*pt->ptr == 0 && !pt->seen) continue; if (!pt->seen) { pt->seen = 1; rebuild = 1; } pt->last = pt->cur; pt->cur = *pt->ptr; pt->t_last = pt->t_cur; pt->t_cur = VTIM_mono(); if (pt->t_last) pt->chg = ((int64_t)pt->cur - (int64_t)pt->last) / (pt->t_cur - pt->t_last); if (pt->semantics == 'g') { pt->avg = 0.; update_ma(&pt->ma_10, (int64_t)pt->cur); update_ma(&pt->ma_100, (int64_t)pt->cur); update_ma(&pt->ma_1000, (int64_t)pt->cur); } else if (pt->semantics == 'c') { if (VSC_C_main != NULL && VSC_C_main->uptime) pt->avg = pt->cur / VSC_C_main->uptime; else pt->avg = 0.; if (pt->t_last) { update_ma(&pt->ma_10, pt->chg); update_ma(&pt->ma_100, pt->chg); update_ma(&pt->ma_1000, pt->chg); } } } } static void sample_hitrate(void) { double tv,dt; double hr, mr, ratio; uint64_t hit, miss; if (VSC_C_main == NULL) return; tv = VTIM_mono(); dt = tv - hitrate.lt; hitrate.lt= tv; hit = VSC_C_main->cache_hit; miss = VSC_C_main->cache_miss; hr = (hit - hitrate.lhit) / dt; mr = (miss - hitrate.lmiss) / dt; hitrate.lhit = hit; hitrate.lmiss = miss; if (hr + mr != 0) ratio = hr / (hr + mr); else ratio = 0; update_ma(&hitrate.hr_10, ratio); update_ma(&hitrate.hr_100, ratio); update_ma(&hitrate.hr_1000, ratio); } static void sample_data(void) { t_sample = VTIM_mono(); sample = 0; redraw = 1; sample_points(); sample_hitrate(); } static void make_windows(void) { int Y, X; int y; int y_status, y_bar_t, y_points, y_bar_b, y_info; if (w_status) { delwin(w_status); w_status = NULL; } if (w_bar_t) { delwin(w_bar_t); w_bar_t = NULL; } if (w_points) { delwin(w_points); w_points = NULL; } if (w_bar_b) { delwin(w_bar_b); w_bar_b = NULL; } if (w_info) { delwin(w_info); w_info = NULL; } Y = LINES; X = COLS; l_status = LINES_STATUS; l_bar_t = LINES_BAR_T; l_bar_b = LINES_BAR_B; l_info = (show_info ? LINES_INFO : 0); l_points = Y - (l_status + l_bar_t + l_bar_b + l_info); if (l_points < LINES_POINTS_MIN) { l_points += l_info; l_info = 0; } if (l_points < LINES_POINTS_MIN) l_points = LINES_POINTS_MIN; y = 0; y_status = y; y += l_status; y_bar_t = y; y += l_bar_t; y_points = y; y += l_points; y_bar_b = y; y += l_bar_b; y_info = y; y += l_info; assert(y >= Y); w_status = newwin(l_status, X, y_status, 0); AN(w_status); nodelay(w_status, 1); keypad(w_status, 1); wnoutrefresh(w_status); w_bar_t = newwin(l_bar_t, X, y_bar_t, 0); AN(w_bar_t); wbkgd(w_bar_t, A_REVERSE); wnoutrefresh(w_bar_t); w_points = newwin(l_points, X, y_points, 0); AN(w_points); wnoutrefresh(w_points); w_bar_b = newwin(l_bar_b, X, y_bar_b, 0); AN(w_bar_b); wbkgd(w_bar_b, A_REVERSE); wnoutrefresh(w_bar_b); if (l_info) { w_info = newwin(l_info, X, y_info, 0); AN(w_info); wnoutrefresh(w_info); } if (X - COLW_NAME_MIN > N_COL * COLW) colw_name = X - (N_COL * COLW); else colw_name = COLW_NAME_MIN; redraw = 1; } static void print_duration(WINDOW *w, time_t t) { wprintw(w, "%4lu+%02lu:%02lu:%02lu", t / 86400, (t % 86400) / 3600, (t % 3600) / 60, t % 60); } static void draw_status(void) { time_t up_mgt = 0; time_t up_chld = 0; static const char discon[] = "*** DISCONNECTED ***"; AN(w_status); werase(w_status); if (VSC_C_mgt != NULL) up_mgt = VSC_C_mgt->uptime; if (VSC_C_main != NULL) up_chld = VSC_C_main->uptime; mvwprintw(w_status, 0, 0, "Uptime mgt: "); print_duration(w_status, up_mgt); mvwprintw(w_status, 1, 0, "Uptime child:"); print_duration(w_status, up_chld); if (VSC_C_mgt == NULL) mvwprintw(w_status, 0, COLS - strlen(discon), discon); else if (COLS > 70) { mvwprintw(w_status, 0, getmaxx(w_status) - 37, "Hitrate n: %8u %8u %8u", hitrate.hr_10.n, hitrate.hr_100.n, hitrate.hr_1000.n); mvwprintw(w_status, 1, getmaxx(w_status) - 37, " avg(n): %8.4f %8.4f %8.4f", hitrate.hr_10.acc, hitrate.hr_100.acc, hitrate.hr_1000.acc); } wnoutrefresh(w_status); } static void draw_bar_t(void) { int X, x; enum { COL_CUR, COL_CHG, COL_AVG, COL_MA10, COL_MA100, COL_MA1000, COL_LAST } col; AN(w_bar_t); X = getmaxx(w_bar_t); x = 0; werase(w_bar_t); if (page_start > 0) mvwprintw(w_bar_t, 0, x, "^^^"); x += 4; mvwprintw(w_bar_t, 0, x, "%.*s", colw_name - 4, "NAME"); x += colw_name - 4; col = 0; while (col < COL_LAST) { if (X - x < COLW) break; switch (col) { case COL_CUR: mvwprintw(w_bar_t, 0, x, " %12.12s", "CURRENT"); break; case COL_CHG: mvwprintw(w_bar_t, 0, x, " %12.12s", "CHANGE"); break; case COL_AVG: mvwprintw(w_bar_t, 0, x, " %12.12s", "AVERAGE"); break; case COL_MA10: mvwprintw(w_bar_t, 0, x, " %12.12s", "AVG_10"); break; case COL_MA100: mvwprintw(w_bar_t, 0, x, " %12.12s", "AVG_100"); break; case COL_MA1000: mvwprintw(w_bar_t, 0, x, " %12.12s", "AVG_1000"); break; default: break; } x += COLW; col++; } wnoutrefresh(w_bar_t); } static void draw_line_default(WINDOW *w, int y, int x, int X, struct pt *pt) { enum { COL_CUR, COL_CHG, COL_AVG, COL_MA10, COL_MA100, COL_MA1000, COL_LAST } col; AN(w); AN(pt); col = 0; while (col < COL_LAST) { if (X - x < COLW) break; switch (col) { case COL_CUR: mvwprintw(w, y, x, " %12ju", (uintmax_t)pt->cur); break; case COL_CHG: if (pt->t_last) mvwprintw(w, y, x, " %12.2f", pt->chg); else mvwprintw(w, y, x, " %12s", ". "); break; case COL_AVG: if (pt->avg) mvwprintw(w, y, x, " %12.2f", pt->avg); else mvwprintw(w, y, x, " %12s", ". "); break; case COL_MA10: mvwprintw(w, y, x, " %12.2f", pt->ma_10.acc); break; case COL_MA100: mvwprintw(w, y, x, " %12.2f", pt->ma_100.acc); break; case COL_MA1000: mvwprintw(w, y, x, " %12.2f", pt->ma_1000.acc); break; default: break; } x += COLW; col++; } } static double scale_bytes(double val, char *q) { const char *p; for (p = " KMGTPEZY"; *p; p++) { if (fabs(val) < 1024.) break; val /= 1024.; } *q = *p; return (val); } static void print_bytes(WINDOW *w, double val) { char q = ' '; if (scale) val = scale_bytes(val, &q); wprintw(w, " %12.2f%c", val, q); } static void draw_line_bytes(WINDOW *w, int y, int x, int X, struct pt *pt) { enum { COL_CUR, COL_CHG, COL_AVG, COL_MA10, COL_MA100, COL_MA1000, COL_LAST } col; AN(w); AN(pt); col = 0; while (col < COL_LAST) { if (X - x < COLW) break; wmove(w, y, x); switch (col) { case COL_CUR: if (scale && pt->cur > 1024) print_bytes(w, (double)pt->cur); else wprintw(w, " %12ju", (uintmax_t)pt->cur); break; case COL_CHG: if (pt->t_last) print_bytes(w, pt->chg); else wprintw(w, " %12s", ". "); break; case COL_AVG: if (pt->avg) print_bytes(w, pt->avg); else wprintw(w, " %12s", ". "); break; case COL_MA10: print_bytes(w, pt->ma_10.acc); break; case COL_MA100: print_bytes(w, pt->ma_100.acc); break; case COL_MA1000: print_bytes(w, pt->ma_1000.acc); break; default: break; } x += COLW; col++; } } static void draw_line_bitmap(WINDOW *w, int y, int x, int X, struct pt *pt) { int ch; enum { COL_VAL, COL_MAP, COL_LAST } col; AN(w); AN(pt); assert(pt->format == 'b'); col = 0; while (col < COL_LAST) { switch (col) { case COL_VAL: if (X - x < COLW) return; mvwprintw(w, y, x, " %10.10jx", (uintmax_t)((pt->cur >> 24) & 0xffffffffffLL)); x += COLW; break; case COL_MAP: if (X - x < 2 * COLW) return; x += (2 * COLW) - 24; for (ch = 0x800000; ch; ch >>= 1) { if (pt->cur & ch) mvwaddch(w, y, x, 'V'); else mvwaddch(w, y, x, '_'); x++; } break; default: break; } col++; } } static void draw_line_duration(WINDOW *w, int y, int x, int X, struct pt *pt) { enum { COL_DUR, COL_LAST } col; AN(w); AN(pt); col = 0; while (col < COL_LAST) { if (X - x < COLW) break; switch (col) { case COL_DUR: wmove(w, y, x); if (scale) print_duration(w, pt->cur); else wprintw(w, " %12ju", (uintmax_t)pt->cur); break; default: break; } x += COLW; col++; } } static void draw_line(WINDOW *w, int y, struct pt *pt) { int x, X; assert(colw_name >= COLW_NAME_MIN); X = getmaxx(w); x = 0; if (strlen(pt->name) > colw_name) mvwprintw(w, y, x, "%.*s...", colw_name - 3, pt->name); else mvwprintw(w, y, x, "%.*s", colw_name, pt->name); x += colw_name; switch (pt->format) { case 'b': draw_line_bitmap(w, y, x, X, pt); break; case 'B': draw_line_bytes(w, y, x, X, pt); break; case 'd': draw_line_duration(w, y, x, X, pt); break; default: draw_line_default(w, y, x, X, pt); break; } } static void draw_points(void) { int Y, X; int line; int n; AN(w_points); werase(w_points); if (n_ptarray == 0) { wnoutrefresh(w_points); return; } assert(current >= 0); assert(current < n_ptarray); assert(page_start >= 0); assert(page_start < n_ptarray); assert(current >= page_start); assert(current - page_start < l_points); getmaxyx(w_points, Y, X); (void)Y; (void)X; for (line = 0; line < l_points; line++) { n = line + page_start; if (n >= n_ptarray) break; if (n == current) wattron(w_points, A_BOLD); draw_line(w_points, line, ptarray[n]); if (n == current) wattroff(w_points, A_BOLD); } wnoutrefresh(w_points); } static void draw_bar_b(void) { int x, X; const struct VSC_level_desc *level; char buf[64]; AN(w_bar_b); x = 0; X = getmaxx(w_bar_b); werase(w_bar_b); if (page_start + l_points < n_ptarray) mvwprintw(w_bar_b, 0, x, "vvv"); x += 4; if (current < n_ptarray - 1) mvwprintw(w_bar_b, 0, x, "%s", ptarray[current]->name); snprintf(buf, sizeof(buf) - 1, "%d-%d/%d", page_start + 1, page_start + l_points < n_ptarray ? page_start + l_points : n_ptarray, n_ptarray); mvwprintw(w_bar_b, 0, X - strlen(buf), "%s", buf); X -= strlen(buf) + 2; level = VSC_LevelDesc(verbosity); if (level != NULL) { mvwprintw(w_bar_b, 0, X - strlen(level->label), "%s", level->label); X -= strlen(level->label) + 2; } if (!hide_unseen) mvwprintw(w_bar_b, 0, X - 6, "%s", "UNSEEN"); wnoutrefresh(w_bar_b); } static void draw_info(void) { if (w_info == NULL) return; werase(w_info); if (current < n_ptarray - 1) { /* XXX: Word wrapping, and overflow handling? */ mvwprintw(w_info, 0, 0, "%s:", ptarray[current]->vpt->desc->sdesc); mvwprintw(w_info, 1, 0, "%s", ptarray[current]->vpt->desc->ldesc); } wnoutrefresh(w_info); } static void draw_screen(void) { draw_status(); draw_bar_t(); draw_points(); draw_bar_b(); draw_info(); doupdate(); redraw = 0; } static void handle_keypress(int ch) { switch (ch) { case KEY_UP: if (current == 0) return; current--; break; case KEY_DOWN: if (current == n_ptarray - 1) return; current++; break; case KEY_PPAGE: case 'b': current -= l_points; page_start -= l_points; break; case KEY_NPAGE: case ' ': current += l_points; if (page_start + l_points < n_ptarray - 1) page_start += l_points; break; case 'd': hide_unseen = 1 - hide_unseen; rebuild = 1; break; case 'e': scale = 1 - scale; rebuild = 1; break; case 'g': current = 0; page_start = 0; break; case 'G': current = n_ptarray - 1; page_start = current - l_points + 1; break; case 'v': verbosity++; if (VSC_LevelDesc(verbosity) == NULL) verbosity = 0; rebuild = 1; break; case 'q': keep_running = 0; return; case '\003': /* Ctrl-C */ AZ(raise(SIGINT)); return; case '\024': /* Ctrl-T */ sample = 1; return; case '\032': /* Ctrl-Z */ AZ(raise(SIGTSTP)); return; default: return; } update_position(); redraw = 1; } void do_curses(struct VSM_data *vd, double delay) { struct pollfd pollfd; long t; int ch; double now; struct VSM_fantom f_main = VSM_FANTOM_NULL; struct VSM_fantom f_mgt = VSM_FANTOM_NULL; struct VSM_fantom f_iter = VSM_FANTOM_NULL; interval = delay; initscr(); raw(); noecho(); nonl(); curs_set(0); pollfd.fd = STDIN_FILENO; pollfd.events = POLLIN; make_windows(); doupdate(); VSC_C_mgt = VSC_Mgt(vd, &f_mgt); VSC_C_main = VSC_Main(vd, &f_main); init_hitrate(); while (keep_running) { if (VSM_Abandoned(vd)) { init_hitrate(); delete_pt_list(); VSM_Close(vd); VSM_Open(vd); } VSC_C_mgt = VSC_Mgt(vd, &f_mgt); VSC_C_main = VSC_Main(vd, &f_main); if (VSM_valid != VSM_StillValid(vd, &f_iter)) build_pt_list(vd, &f_iter); now = VTIM_mono(); if (now - t_sample > interval) sample = 1; if (sample) sample_data(); if (rebuild) build_pt_array(); if (redraw) draw_screen(); t = (t_sample + interval - now) * 1000; if (t > 0) (void)poll(&pollfd, 1, t); switch (ch = wgetch(w_status)) { case ERR: break; #ifdef KEY_RESIZE /* sigh, Solaris lacks this.. */ case KEY_RESIZE: make_windows(); update_position(); break; #endif default: handle_keypress(ch); break; } } VSM_Close(vd); AZ(endwin()); } varnish-4.1.1/bin/varnishstat/varnishstat.c0000644000201500234410000002173112652366721015752 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * Author: Dag-Erling Smørgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Statistics output program */ #include "config.h" #include #include #include #include #include #include #include #include #include "vnum.h" #include "vtim.h" #include "varnishstat.h" /*--------------------------------------------------------------------*/ static int do_xml_cb(void *priv, const struct VSC_point * const pt) { uint64_t val; const struct VSC_section *sec; (void)priv; if (pt == NULL) return (0); AZ(strcmp(pt->desc->ctype, "uint64_t")); val = *(const volatile uint64_t*)pt->ptr; sec = pt->section; printf("\t\n"); if (strcmp(sec->fantom->type, "")) printf("\t\t%s\n", sec->fantom->type); if (strcmp(sec->fantom->ident, "")) printf("\t\t%s\n", sec->fantom->ident); printf("\t\t%s\n", pt->desc->name); printf("\t\t%ju\n", (uintmax_t)val); printf("\t\t%c\n", pt->desc->semantics); printf("\t\t%c\n", pt->desc->format); printf("\t\t%s\n", pt->desc->sdesc); printf("\t\n"); return (0); } static void do_xml(struct VSM_data *vd) { char time_stamp[20]; time_t now; printf("\n"); now = time(NULL); (void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now)); printf("\n", time_stamp); (void)VSC_Iter(vd, NULL, do_xml_cb, NULL); printf("\n"); } /*--------------------------------------------------------------------*/ static int do_json_cb(void *priv, const struct VSC_point * const pt) { uint64_t val; int *jp; const struct VSC_section *sec; if (pt == NULL) return (0); jp = priv; AZ(strcmp(pt->desc->ctype, "uint64_t")); val = *(const volatile uint64_t*)pt->ptr; sec = pt->section; if (*jp) *jp = 0; else printf(",\n"); printf(" \""); /* build the JSON key name. */ if (sec->fantom->type[0]) printf("%s.", sec->fantom->type); if (sec->fantom->ident[0]) printf("%s.", sec->fantom->ident); printf("%s\": {\n", pt->desc->name); printf(" \"description\": \"%s\",\n", pt->desc->sdesc); if (strcmp(sec->fantom->type, "")) printf(" \"type\": \"%s\", ", sec->fantom->type); if (strcmp(sec->fantom->ident, "")) printf("\"ident\": \"%s\", ", sec->fantom->ident); printf("\"flag\": \"%c\", ", pt->desc->semantics); printf("\"format\": \"%c\",\n", pt->desc->format); printf(" \"value\": %ju", (uintmax_t)val); printf("\n }"); if (*jp) printf("\n"); return (0); } static void do_json(struct VSM_data *vd) { char time_stamp[20]; time_t now; int jp; jp = 1; printf("{\n"); now = time(NULL); (void)strftime(time_stamp, 20, "%Y-%m-%dT%H:%M:%S", localtime(&now)); printf(" \"timestamp\": \"%s\",\n", time_stamp); (void)VSC_Iter(vd, NULL, do_json_cb, &jp); printf("\n}\n"); fflush(stdout); } /*--------------------------------------------------------------------*/ struct once_priv { double up; int pad; }; static int do_once_cb(void *priv, const struct VSC_point * const pt) { struct once_priv *op; uint64_t val; int i; const struct VSC_section *sec; if (pt == NULL) return (0); op = priv; AZ(strcmp(pt->desc->ctype, "uint64_t")); val = *(const volatile uint64_t*)pt->ptr; sec = pt->section; i = 0; if (strcmp(sec->fantom->type, "")) i += printf("%s.", sec->fantom->type); if (strcmp(sec->fantom->ident, "")) i += printf("%s.", sec->fantom->ident); i += printf("%s", pt->desc->name); if (i >= op->pad) op->pad = i + 1; printf("%*.*s", op->pad - i, op->pad - i, ""); if (pt->desc->semantics == 'c') printf("%12ju %12.2f %s\n", (uintmax_t)val, val / op->up, pt->desc->sdesc); else printf("%12ju %12s %s\n", (uintmax_t)val, ". ", pt->desc->sdesc); return (0); } static void do_once(struct VSM_data *vd, const struct VSC_C_main *VSC_C_main) { struct once_priv op; memset(&op, 0, sizeof op); if (VSC_C_main != NULL) op.up = VSC_C_main->uptime; op.pad = 18; (void)VSC_Iter(vd, NULL, do_once_cb, &op); } /*--------------------------------------------------------------------*/ static int do_list_cb(void *priv, const struct VSC_point * const pt) { int i; const struct VSC_section * sec; (void)priv; if (pt == NULL) return (0); sec = pt->section; i = 0; if (strcmp(sec->fantom->type, "")) i += fprintf(stderr, "%s.", sec->fantom->type); if (strcmp(sec->fantom->ident, "")) i += fprintf(stderr, "%s.", sec->fantom->ident); i += fprintf(stderr, "%s", pt->desc->name); if (i < 30) fprintf(stderr, "%*s", i - 30, ""); fprintf(stderr, " %s\n", pt->desc->sdesc); return (0); } static void list_fields(struct VSM_data *vd) { fprintf(stderr, "Varnishstat -f option fields:\n"); fprintf(stderr, "Field name Description\n"); fprintf(stderr, "---------- -----------\n"); (void)VSC_Iter(vd, NULL, do_list_cb, NULL); } /*--------------------------------------------------------------------*/ static void usage(void) { #define FMT " %-28s # %s\n" fprintf(stderr, "usage: varnishstat " "[-1lV] [-f field] [-t seconds|] " VSC_n_USAGE "\n"); fprintf(stderr, FMT, "-1", "Print the statistics to stdout."); fprintf(stderr, FMT, "-f field", "Field inclusion glob"); fprintf(stderr, FMT, "", "If it starts with '^' it is used as an exclusion list."); fprintf(stderr, FMT, "-l", "Lists the available fields to use with the -f option."); fprintf(stderr, FMT, "-n varnish_name", "The varnishd instance to get logs from."); fprintf(stderr, FMT, "-N filename", "Filename of a stale VSM instance."); fprintf(stderr, FMT, "-t seconds|", "Timeout before returning error on initial VSM connection."); fprintf(stderr, FMT, "-V", "Display the version number and exit."); fprintf(stderr, FMT, "-x", "Print statistics to stdout as XML."); fprintf(stderr, FMT, "-j", "Print statistics to stdout as JSON."); #undef FMT exit(1); } int main(int argc, char * const *argv) { int c; struct VSM_data *vd; double t_arg = 5.0, t_start = NAN; int once = 0, xml = 0, json = 0, f_list = 0, curses = 0; int i; vd = VSM_New(); AN(vd); while ((c = getopt(argc, argv, VSC_ARGS "1f:lVxjt:")) != -1) { switch (c) { case '1': once = 1; break; case 'l': f_list = 1; break; case 't': if (!strcasecmp(optarg, "off")) t_arg = -1.; else { t_arg = VNUM(optarg); if (isnan(t_arg)) { fprintf(stderr, "-t: Syntax error"); exit(1); } if (t_arg < 0.) { fprintf(stderr, "-t: Range error"); exit(1); } } break; case 'V': VCS_Message("varnishstat"); exit(0); case 'x': xml = 1; break; case 'j': json = 1; break; default: if (VSC_Arg(vd, c, optarg) > 0) break; fprintf(stderr, "%s\n", VSM_Error(vd)); usage(); } } if (!(xml || json || once || f_list)) curses = 1; while (1) { i = VSM_Open(vd); if (!i) break; if (isnan(t_start) && t_arg > 0.) { fprintf(stderr, "Can't open log -" " retrying for %.0f seconds\n", t_arg); t_start = VTIM_real(); } if (t_arg <= 0.) break; if (VTIM_real() - t_start > t_arg) break; VSM_ResetError(vd); VTIM_sleep(0.5); } if (curses) { if (i && t_arg >= 0.) { fprintf(stderr, "%s\n", VSM_Error(vd)); exit(1); } do_curses(vd, 1.0); exit(0); } if (i) { fprintf(stderr, "%s\n", VSM_Error(vd)); exit(1); } if (xml) do_xml(vd); else if (json) do_json(vd); else if (once) do_once(vd, VSC_Main(vd, NULL)); else if (f_list) list_fields(vd); else assert(0); /* end of output block marker. */ printf("\n"); exit(0); } varnish-4.1.1/bin/varnishstat/vsc2rst.c0000644000201500234410000000574212652366721015016 00000000000000/*- * Copyright (c) 2011-2015 Varnish Software AS * All rights reserved. * * Author: Tollef Fog Heen * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "config.h" #include #define VSC_LEVEL_F(v,l,e,d) \ static const char VSC_level_##v[] = l; #include "tbl/vsc_levels.h" #undef VSC_LEVEL_F #define P(x, ...) \ printf(x "\n", ##__VA_ARGS__) #define VSC_LEVEL_F(v,l,e,d) \ printf("%s – %s\n\t%s\n\n", l, e, d); #define VSC_F(n, t, l, s, f, v, d, e) \ printf("%s – %s (%s)\n\t%s\n\n", #n, e, VSC_level_##v, d); int main(int argc, char **argv) { (void)argc; (void)argv; P("COUNTER LEVELS"); P("=============="); P(""); #include "tbl/vsc_levels.h" P(""); P("MAIN COUNTERS (MAIN.*)"); P("======================"); P(""); #include "tbl/vsc_f_main.h" P("MANAGEMENT PROCESS COUNTERS (MGT.*)"); P("==================================="); P(""); #define VSC_DO_MGT #include "tbl/vsc_fields.h" #undef VSC_DO_MGT P(""); P("PER MEMORY POOL COUNTERS (MEMPOOL.*)"); P("===================================="); P(""); #define VSC_DO_MEMPOOL #include "tbl/vsc_fields.h" #undef VSC_DO_MEMPOOL P(""); P("PER MALLOC STORAGE COUNTERS (SMA.*)"); P("==================================="); P(""); #define VSC_DO_SMA #include "tbl/vsc_fields.h" #undef VSC_DO_SMA P(""); P("PER FILE STORAGE COUNTERS (SMF.*)"); P("================================="); P(""); #define VSC_DO_SMF #include "tbl/vsc_fields.h" #undef VSC_DO_SMF P(""); P("PER BACKEND COUNTERS (VBE.*)"); P("============================"); P(""); #define VSC_DO_VBE #include "tbl/vsc_fields.h" #undef VSC_DO_VBE P(""); P("LOCK COUNTERS (LCK.*)"); P("====================="); P(""); #define VSC_DO_LCK #include "tbl/vsc_fields.h" #undef VSC_DO_LCK return (0); } varnish-4.1.1/bin/Makefile.am0000644000201500234410000000026712652366721012727 00000000000000# # Disabling building of the tools while api is in flux SUBDIRS = \ varnishadm \ varnishd \ varnishhist \ varnishlog \ varnishncsa \ varnishstat \ varnishtest \ varnishtop varnish-4.1.1/bin/varnishadm/0000755000201500234410000000000012652366757013113 500000000000000varnish-4.1.1/bin/varnishadm/Makefile.am0000644000201500234410000000102012652366721015047 00000000000000# AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include bin_PROGRAMS = varnishadm varnishadm_SOURCES = \ varnishadm.c \ $(top_srcdir)/lib/libvarnish/vas.c \ $(top_srcdir)/lib/libvarnish/vsa.c \ $(top_srcdir)/lib/libvarnish/vtcp.c \ $(top_srcdir)/lib/libvarnish/vss.c varnishadm_CFLAGS = @LIBEDIT_CFLAGS@ varnishadm_LDADD = \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ ${PTHREAD_LIBS} ${RT_LIBS} ${NET_LIBS} @LIBEDIT_LIBS@ ${LIBM} varnish-4.1.1/bin/varnishadm/Makefile.in0000644000201500234410000007220312652366725015077 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = varnishadm$(EXEEXT) subdir = bin/varnishadm DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_varnishadm_OBJECTS = varnishadm-varnishadm.$(OBJEXT) \ varnishadm-vas.$(OBJEXT) varnishadm-vsa.$(OBJEXT) \ varnishadm-vtcp.$(OBJEXT) varnishadm-vss.$(OBJEXT) varnishadm_OBJECTS = $(am_varnishadm_OBJECTS) am__DEPENDENCIES_1 = varnishadm_DEPENDENCIES = \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent varnishadm_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(varnishadm_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(varnishadm_SOURCES) DIST_SOURCES = $(varnishadm_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include varnishadm_SOURCES = \ varnishadm.c \ $(top_srcdir)/lib/libvarnish/vas.c \ $(top_srcdir)/lib/libvarnish/vsa.c \ $(top_srcdir)/lib/libvarnish/vtcp.c \ $(top_srcdir)/lib/libvarnish/vss.c varnishadm_CFLAGS = @LIBEDIT_CFLAGS@ varnishadm_LDADD = \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ ${PTHREAD_LIBS} ${RT_LIBS} ${NET_LIBS} @LIBEDIT_LIBS@ ${LIBM} all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/varnishadm/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign bin/varnishadm/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list varnishadm$(EXEEXT): $(varnishadm_OBJECTS) $(varnishadm_DEPENDENCIES) $(EXTRA_varnishadm_DEPENDENCIES) @rm -f varnishadm$(EXEEXT) $(AM_V_CCLD)$(varnishadm_LINK) $(varnishadm_OBJECTS) $(varnishadm_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishadm-varnishadm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishadm-vas.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishadm-vsa.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishadm-vss.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishadm-vtcp.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< varnishadm-varnishadm.o: varnishadm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -MT varnishadm-varnishadm.o -MD -MP -MF $(DEPDIR)/varnishadm-varnishadm.Tpo -c -o varnishadm-varnishadm.o `test -f 'varnishadm.c' || echo '$(srcdir)/'`varnishadm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishadm-varnishadm.Tpo $(DEPDIR)/varnishadm-varnishadm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='varnishadm.c' object='varnishadm-varnishadm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -c -o varnishadm-varnishadm.o `test -f 'varnishadm.c' || echo '$(srcdir)/'`varnishadm.c varnishadm-varnishadm.obj: varnishadm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -MT varnishadm-varnishadm.obj -MD -MP -MF $(DEPDIR)/varnishadm-varnishadm.Tpo -c -o varnishadm-varnishadm.obj `if test -f 'varnishadm.c'; then $(CYGPATH_W) 'varnishadm.c'; else $(CYGPATH_W) '$(srcdir)/varnishadm.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishadm-varnishadm.Tpo $(DEPDIR)/varnishadm-varnishadm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='varnishadm.c' object='varnishadm-varnishadm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -c -o varnishadm-varnishadm.obj `if test -f 'varnishadm.c'; then $(CYGPATH_W) 'varnishadm.c'; else $(CYGPATH_W) '$(srcdir)/varnishadm.c'; fi` varnishadm-vas.o: $(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -MT varnishadm-vas.o -MD -MP -MF $(DEPDIR)/varnishadm-vas.Tpo -c -o varnishadm-vas.o `test -f '$(top_srcdir)/lib/libvarnish/vas.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishadm-vas.Tpo $(DEPDIR)/varnishadm-vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vas.c' object='varnishadm-vas.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -c -o varnishadm-vas.o `test -f '$(top_srcdir)/lib/libvarnish/vas.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vas.c varnishadm-vas.obj: $(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -MT varnishadm-vas.obj -MD -MP -MF $(DEPDIR)/varnishadm-vas.Tpo -c -o varnishadm-vas.obj `if test -f '$(top_srcdir)/lib/libvarnish/vas.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vas.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishadm-vas.Tpo $(DEPDIR)/varnishadm-vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vas.c' object='varnishadm-vas.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -c -o varnishadm-vas.obj `if test -f '$(top_srcdir)/lib/libvarnish/vas.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vas.c'; fi` varnishadm-vsa.o: $(top_srcdir)/lib/libvarnish/vsa.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -MT varnishadm-vsa.o -MD -MP -MF $(DEPDIR)/varnishadm-vsa.Tpo -c -o varnishadm-vsa.o `test -f '$(top_srcdir)/lib/libvarnish/vsa.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vsa.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishadm-vsa.Tpo $(DEPDIR)/varnishadm-vsa.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vsa.c' object='varnishadm-vsa.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -c -o varnishadm-vsa.o `test -f '$(top_srcdir)/lib/libvarnish/vsa.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vsa.c varnishadm-vsa.obj: $(top_srcdir)/lib/libvarnish/vsa.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -MT varnishadm-vsa.obj -MD -MP -MF $(DEPDIR)/varnishadm-vsa.Tpo -c -o varnishadm-vsa.obj `if test -f '$(top_srcdir)/lib/libvarnish/vsa.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vsa.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vsa.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishadm-vsa.Tpo $(DEPDIR)/varnishadm-vsa.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vsa.c' object='varnishadm-vsa.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -c -o varnishadm-vsa.obj `if test -f '$(top_srcdir)/lib/libvarnish/vsa.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vsa.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vsa.c'; fi` varnishadm-vtcp.o: $(top_srcdir)/lib/libvarnish/vtcp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -MT varnishadm-vtcp.o -MD -MP -MF $(DEPDIR)/varnishadm-vtcp.Tpo -c -o varnishadm-vtcp.o `test -f '$(top_srcdir)/lib/libvarnish/vtcp.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vtcp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishadm-vtcp.Tpo $(DEPDIR)/varnishadm-vtcp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vtcp.c' object='varnishadm-vtcp.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -c -o varnishadm-vtcp.o `test -f '$(top_srcdir)/lib/libvarnish/vtcp.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vtcp.c varnishadm-vtcp.obj: $(top_srcdir)/lib/libvarnish/vtcp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -MT varnishadm-vtcp.obj -MD -MP -MF $(DEPDIR)/varnishadm-vtcp.Tpo -c -o varnishadm-vtcp.obj `if test -f '$(top_srcdir)/lib/libvarnish/vtcp.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vtcp.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vtcp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishadm-vtcp.Tpo $(DEPDIR)/varnishadm-vtcp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vtcp.c' object='varnishadm-vtcp.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -c -o varnishadm-vtcp.obj `if test -f '$(top_srcdir)/lib/libvarnish/vtcp.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vtcp.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vtcp.c'; fi` varnishadm-vss.o: $(top_srcdir)/lib/libvarnish/vss.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -MT varnishadm-vss.o -MD -MP -MF $(DEPDIR)/varnishadm-vss.Tpo -c -o varnishadm-vss.o `test -f '$(top_srcdir)/lib/libvarnish/vss.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vss.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishadm-vss.Tpo $(DEPDIR)/varnishadm-vss.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vss.c' object='varnishadm-vss.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -c -o varnishadm-vss.o `test -f '$(top_srcdir)/lib/libvarnish/vss.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vss.c varnishadm-vss.obj: $(top_srcdir)/lib/libvarnish/vss.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -MT varnishadm-vss.obj -MD -MP -MF $(DEPDIR)/varnishadm-vss.Tpo -c -o varnishadm-vss.obj `if test -f '$(top_srcdir)/lib/libvarnish/vss.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vss.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vss.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishadm-vss.Tpo $(DEPDIR)/varnishadm-vss.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vss.c' object='varnishadm-vss.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishadm_CFLAGS) $(CFLAGS) -c -o varnishadm-vss.obj `if test -f '$(top_srcdir)/lib/libvarnish/vss.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vss.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vss.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/bin/varnishadm/varnishadm.c0000644000201500234410000002537412652366721015335 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Cecilie Fritzvold * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #if defined(HAVE_EDIT_READLINE_READLINE_H) # include #elif defined(HAVE_LIBEDIT) # include #elif defined (HAVE_READLINE_READLINE_H) # include # ifdef HAVE_READLINE_HISTORY_H # include # else # error missing history.h - this should have got caught in configure # endif #else # error missing readline.h - this should have got caught in configure #endif #include #include #include #include #include #include #include #include #include "vapi/vsl.h" #include "vapi/vsm.h" #include "vas.h" #include "vcli.h" #include "vnum.h" #include "vtcp.h" #define RL_EXIT(status) \ do { \ rl_callback_handler_remove(); \ exit(status); \ } while (0) static double timeout = 5; static void cli_write(int sock, const char *s) { int i, l; i = strlen(s); l = write (sock, s, i); if (i == l) return; perror("Write error CLI socket"); RL_EXIT(1); } /* * This function establishes a connection to the specified ip and port and * sends a command to varnishd. If varnishd returns an OK status, the result * is printed and 0 returned. Else, an error message is printed and 1 is * returned */ static int cli_sock(const char *T_arg, const char *S_arg) { int fd; int sock; unsigned status; char *answer = NULL; char buf[CLI_AUTH_RESPONSE_LEN + 1]; const char *err; sock = VTCP_open(T_arg, NULL, timeout, &err); if (sock < 0) { fprintf(stderr, "Connection failed (%s): %s\n", T_arg, err); return (-1); } (void)VCLI_ReadResult(sock, &status, &answer, timeout); if (status == CLIS_AUTH) { if (S_arg == NULL) { fprintf(stderr, "Authentication required\n"); AZ(close(sock)); return(-1); } fd = open(S_arg, O_RDONLY); if (fd < 0) { fprintf(stderr, "Cannot open \"%s\": %s\n", S_arg, strerror(errno)); AZ(close(sock)); return (-1); } VCLI_AuthResponse(fd, answer, buf); AZ(close(fd)); free(answer); cli_write(sock, "auth "); cli_write(sock, buf); cli_write(sock, "\n"); (void)VCLI_ReadResult(sock, &status, &answer, timeout); } if (status != CLIS_OK) { fprintf(stderr, "Rejected %u\n%s\n", status, answer); AZ(close(sock)); free(answer); return (-1); } free(answer); cli_write(sock, "ping\n"); (void)VCLI_ReadResult(sock, &status, &answer, timeout); if (status != CLIS_OK || strstr(answer, "PONG") == NULL) { fprintf(stderr, "No pong received from server\n"); AZ(close(sock)); free(answer); return (-1); } free(answer); return (sock); } static void do_args(int sock, int argc, char * const *argv) { int i; unsigned status; char *answer = NULL; for (i=0; i 0) cli_write(sock, " "); cli_write(sock, argv[i]); } cli_write(sock, "\n"); (void)VCLI_ReadResult(sock, &status, &answer, 2000); /* XXX: AZ() ? */ (void)close(sock); printf("%s\n", answer); if (status == CLIS_OK) { exit(0); } fprintf(stderr, "Command failed with error code %u\n", status); exit(1); } /* Callback for readline, doesn't take a private pointer, so we need * to have a global variable. */ static int _line_sock; static void send_line(char *l) { if (l) { cli_write(_line_sock, l); cli_write(_line_sock, "\n"); add_history(l); rl_callback_handler_install("varnish> ", send_line); } else { RL_EXIT(0); } } static char *commands[256]; static char * command_generator (const char *text, int state) { static int list_index, len; const char *name; /* If this is a new word to complete, initialize now. This includes saving the length of TEXT for efficiency, and initializing the index variable to 0. */ if (!state) { list_index = 0; len = strlen(text); } while ((name = commands[list_index]) != NULL) { list_index++; if (strncmp (name, text, len) == 0) return (strdup(name)); } /* If no names matched, then return NULL. */ return (NULL); } static char ** varnishadm_completion (const char *text, int start, int end) { char **matches; (void)end; matches = (char **)NULL; if (start == 0) matches = rl_completion_matches(text, command_generator); return (matches); } /* * No arguments given, simply pass bytes on stdin/stdout and CLI socket * Send a "banner" to varnish, to provoke a welcome message. */ static void interactive(int sock) { struct pollfd fds[2]; char buf[1024]; int i; char *answer = NULL; unsigned u, status; _line_sock = sock; rl_already_prompted = 1; rl_callback_handler_install("varnish> ", send_line); rl_attempted_completion_function = varnishadm_completion; fds[0].fd = sock; fds[0].events = POLLIN; fds[1].fd = 0; fds[1].events = POLLIN; /* Grab the commands, for completion */ cli_write(sock, "help\n"); u = VCLI_ReadResult(fds[0].fd, &status, &answer, timeout); if (!u) { char *t, c[128]; if (status == CLIS_COMMS) { RL_EXIT(0); } t = answer; i = 0; while (*t) { if (sscanf(t, "%127s", c) == 1) { commands[i++] = strdup(c); while (*t != '\n' && *t != '\0') t++; if (*t == '\n') t++; } else { /* what? */ fprintf(stderr, "Unknown command '%s' parsing " "help output. Tab completion may be " "broken\n", t); break; } } } cli_write(sock, "banner\n"); while (1) { i = poll(fds, 2, -1); if (i == -1 && errno == EINTR) { continue; } assert(i > 0); if (fds[0].revents & POLLIN) { /* Get rid of the prompt, kinda hackish */ u = write(1, "\r \r", 13); u = VCLI_ReadResult(fds[0].fd, &status, &answer, timeout); if (u) { if (status == CLIS_COMMS) RL_EXIT(0); if (answer) fprintf(stderr, "%s\n", answer); RL_EXIT(1); } sprintf(buf, "%u\n", status); u = write(1, buf, strlen(buf)); if (answer) { u = write(1, answer, strlen(answer)); u = write(1, "\n", 1); free(answer); answer = NULL; } rl_forced_update_display(); } if (fds[1].revents & POLLIN) { rl_callback_read_char(); } } } /* * No arguments given, simply pass bytes on stdin/stdout and CLI socket */ static void pass(int sock) { struct pollfd fds[2]; char buf[1024]; int i; char *answer = NULL; unsigned u, status; ssize_t n; fds[0].fd = sock; fds[0].events = POLLIN; fds[1].fd = 0; fds[1].events = POLLIN; while (1) { i = poll(fds, 2, -1); if (i == -1 && errno == EINTR) { continue; } assert(i > 0); if (fds[0].revents & POLLIN) { u = VCLI_ReadResult(fds[0].fd, &status, &answer, timeout); if (u) { if (status == CLIS_COMMS) RL_EXIT(0); if (answer) fprintf(stderr, "%s\n", answer); RL_EXIT(1); } sprintf(buf, "%u\n", status); u = write(1, buf, strlen(buf)); if (answer) { u = write(1, answer, strlen(answer)); u = write(1, "\n", 1); free(answer); answer = NULL; } } if (fds[1].revents & POLLIN || fds[1].revents & POLLHUP) { n = read(fds[1].fd, buf, sizeof buf - 1); if (n == 0) { AZ(shutdown(sock, SHUT_WR)); fds[1].fd = -1; } else if (n < 0) { RL_EXIT(0); } else { buf[n] = '\0'; cli_write(sock, buf); } } } } static void usage(void) { fprintf(stderr, "Usage: varnishadm [-n ident] [-t timeout] [-S secretfile] " "[-T [address]:port] [command [...]]\n"); fprintf(stderr, "\t-n is mutually exclusive with -S and -T\n"); exit(1); } static int n_arg_sock(const char *n_arg) { char *T_arg = NULL, *T_start = NULL; char *S_arg = NULL; struct VSM_data *vsm; char *p; int sock; struct VSM_fantom vt; vsm = VSM_New(); AN(vsm); if (VSM_n_Arg(vsm, n_arg) < 0) { fprintf(stderr, "%s\n", VSM_Error(vsm)); VSM_Delete(vsm); return (-1); } if (VSM_Open(vsm)) { fprintf(stderr, "%s\n", VSM_Error(vsm)); VSM_Delete(vsm); return (-1); } if (!VSM_Get(vsm, &vt, "Arg", "-T", "")) { fprintf(stderr, "No -T arg in shared memory\n"); VSM_Delete(vsm); return (-1); } AN(vt.b); T_start = T_arg = strdup(vt.b); if (VSM_Get(vsm, &vt, "Arg", "-S", "")) { AN(vt.b); S_arg = strdup(vt.b); } VSM_Delete(vsm); sock = -1; while (*T_arg) { p = strchr(T_arg, '\n'); AN(p); *p = '\0'; sock = cli_sock(T_arg, S_arg); if (sock >= 0) break; T_arg = p + 1; } free(T_start); free(S_arg); return (sock); } int main(int argc, char * const *argv) { const char *T_arg = NULL; const char *S_arg = NULL; const char *n_arg = NULL; int opt, sock; /* * By default linux::getopt(3) mangles the argv order, such that * varnishadm -n bla param.set foo -bar * gets interpreted as * varnishadm -n bla -bar param.set foo * The '+' stops that from happening * See #1496 */ while ((opt = getopt(argc, argv, "+n:S:T:t:")) != -1) { switch (opt) { case 'n': n_arg = optarg; break; case 'S': S_arg = optarg; break; case 'T': T_arg = optarg; break; case 't': timeout = VNUM(optarg); if (isnan(timeout)) usage(); break; default: usage(); } } argc -= optind; argv += optind; if (n_arg != NULL) { if (T_arg != NULL || S_arg != NULL) { usage(); } sock = n_arg_sock(n_arg); } else if (T_arg == NULL) { sock = n_arg_sock(""); } else { assert(T_arg != NULL); sock = cli_sock(T_arg, S_arg); } if (sock < 0) exit(2); if (argc > 0) do_args(sock, argc, argv); else { if (isatty(0)) { interactive(sock); } else { pass(sock); } } exit(0); } varnish-4.1.1/bin/varnishtop/0000755000201500234410000000000012652366760013146 500000000000000varnish-4.1.1/bin/varnishtop/Makefile.am0000644000201500234410000000145212652366721015121 00000000000000# AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include bin_PROGRAMS = varnishtop 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 \ $(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 \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ @CURSES_LIB@ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS} noinst_PROGRAMS = varnishtop_opt2rst varnishtop_opt2rst_SOURCES = \ varnishtop_options.h \ varnishtop_options.c \ $(top_srcdir)/lib/libvarnishtools/opt2rst.c varnish-4.1.1/bin/varnishtop/Makefile.in0000644000201500234410000010713512652366726015144 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = varnishtop$(EXEEXT) noinst_PROGRAMS = varnishtop_opt2rst$(EXEEXT) subdir = bin/varnishtop DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_varnishtop_OBJECTS = varnishtop.$(OBJEXT) \ varnishtop_options.$(OBJEXT) vut.$(OBJEXT) vas.$(OBJEXT) \ flopen.$(OBJEXT) version.$(OBJEXT) vpf.$(OBJEXT) \ vtim.$(OBJEXT) vsb.$(OBJEXT) varnishtop_OBJECTS = $(am_varnishtop_OBJECTS) am__DEPENDENCIES_1 = varnishtop_DEPENDENCIES = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am_varnishtop_opt2rst_OBJECTS = varnishtop_options.$(OBJEXT) \ opt2rst.$(OBJEXT) varnishtop_opt2rst_OBJECTS = $(am_varnishtop_opt2rst_OBJECTS) varnishtop_opt2rst_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(varnishtop_SOURCES) $(varnishtop_opt2rst_SOURCES) DIST_SOURCES = $(varnishtop_SOURCES) $(varnishtop_opt2rst_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include 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 \ $(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 \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ @CURSES_LIB@ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS} varnishtop_opt2rst_SOURCES = \ varnishtop_options.h \ varnishtop_options.c \ $(top_srcdir)/lib/libvarnishtools/opt2rst.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/varnishtop/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign bin/varnishtop/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list varnishtop$(EXEEXT): $(varnishtop_OBJECTS) $(varnishtop_DEPENDENCIES) $(EXTRA_varnishtop_DEPENDENCIES) @rm -f varnishtop$(EXEEXT) $(AM_V_CCLD)$(LINK) $(varnishtop_OBJECTS) $(varnishtop_LDADD) $(LIBS) varnishtop_opt2rst$(EXEEXT): $(varnishtop_opt2rst_OBJECTS) $(varnishtop_opt2rst_DEPENDENCIES) $(EXTRA_varnishtop_opt2rst_DEPENDENCIES) @rm -f varnishtop_opt2rst$(EXEEXT) $(AM_V_CCLD)$(LINK) $(varnishtop_opt2rst_OBJECTS) $(varnishtop_opt2rst_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flopen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opt2rst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishtop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishtop_options.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vas.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vpf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vtim.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vut.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< vut.o: $(top_srcdir)/lib/libvarnishtools/vut.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vut.o -MD -MP -MF $(DEPDIR)/vut.Tpo -c -o vut.o `test -f '$(top_srcdir)/lib/libvarnishtools/vut.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/vut.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vut.Tpo $(DEPDIR)/vut.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/vut.c' object='vut.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vut.o `test -f '$(top_srcdir)/lib/libvarnishtools/vut.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/vut.c vut.obj: $(top_srcdir)/lib/libvarnishtools/vut.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vut.obj -MD -MP -MF $(DEPDIR)/vut.Tpo -c -o vut.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/vut.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/vut.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/vut.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vut.Tpo $(DEPDIR)/vut.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/vut.c' object='vut.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vut.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/vut.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/vut.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/vut.c'; fi` vas.o: $(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vas.o -MD -MP -MF $(DEPDIR)/vas.Tpo -c -o vas.o `test -f '$(top_srcdir)/lib/libvarnish/vas.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vas.Tpo $(DEPDIR)/vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vas.c' object='vas.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vas.o `test -f '$(top_srcdir)/lib/libvarnish/vas.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vas.c vas.obj: $(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vas.obj -MD -MP -MF $(DEPDIR)/vas.Tpo -c -o vas.obj `if test -f '$(top_srcdir)/lib/libvarnish/vas.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vas.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vas.Tpo $(DEPDIR)/vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vas.c' object='vas.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vas.obj `if test -f '$(top_srcdir)/lib/libvarnish/vas.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vas.c'; fi` flopen.o: $(top_srcdir)/lib/libvarnish/flopen.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT flopen.o -MD -MP -MF $(DEPDIR)/flopen.Tpo -c -o flopen.o `test -f '$(top_srcdir)/lib/libvarnish/flopen.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/flopen.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/flopen.Tpo $(DEPDIR)/flopen.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/flopen.c' object='flopen.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o flopen.o `test -f '$(top_srcdir)/lib/libvarnish/flopen.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/flopen.c flopen.obj: $(top_srcdir)/lib/libvarnish/flopen.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT flopen.obj -MD -MP -MF $(DEPDIR)/flopen.Tpo -c -o flopen.obj `if test -f '$(top_srcdir)/lib/libvarnish/flopen.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/flopen.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/flopen.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/flopen.Tpo $(DEPDIR)/flopen.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/flopen.c' object='flopen.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o flopen.obj `if test -f '$(top_srcdir)/lib/libvarnish/flopen.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/flopen.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/flopen.c'; fi` version.o: $(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT version.o -MD -MP -MF $(DEPDIR)/version.Tpo -c -o version.o `test -f '$(top_srcdir)/lib/libvarnish/version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/version.Tpo $(DEPDIR)/version.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/version.c' object='version.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o version.o `test -f '$(top_srcdir)/lib/libvarnish/version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/version.c version.obj: $(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT version.obj -MD -MP -MF $(DEPDIR)/version.Tpo -c -o version.obj `if test -f '$(top_srcdir)/lib/libvarnish/version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/version.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/version.Tpo $(DEPDIR)/version.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/version.c' object='version.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o version.obj `if test -f '$(top_srcdir)/lib/libvarnish/version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/version.c'; fi` vpf.o: $(top_srcdir)/lib/libvarnish/vpf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vpf.o -MD -MP -MF $(DEPDIR)/vpf.Tpo -c -o vpf.o `test -f '$(top_srcdir)/lib/libvarnish/vpf.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vpf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vpf.Tpo $(DEPDIR)/vpf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vpf.c' object='vpf.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vpf.o `test -f '$(top_srcdir)/lib/libvarnish/vpf.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vpf.c vpf.obj: $(top_srcdir)/lib/libvarnish/vpf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vpf.obj -MD -MP -MF $(DEPDIR)/vpf.Tpo -c -o vpf.obj `if test -f '$(top_srcdir)/lib/libvarnish/vpf.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vpf.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vpf.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vpf.Tpo $(DEPDIR)/vpf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vpf.c' object='vpf.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vpf.obj `if test -f '$(top_srcdir)/lib/libvarnish/vpf.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vpf.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vpf.c'; fi` vtim.o: $(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vtim.o -MD -MP -MF $(DEPDIR)/vtim.Tpo -c -o vtim.o `test -f '$(top_srcdir)/lib/libvarnish/vtim.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vtim.Tpo $(DEPDIR)/vtim.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vtim.c' object='vtim.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vtim.o `test -f '$(top_srcdir)/lib/libvarnish/vtim.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vtim.c vtim.obj: $(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vtim.obj -MD -MP -MF $(DEPDIR)/vtim.Tpo -c -o vtim.obj `if test -f '$(top_srcdir)/lib/libvarnish/vtim.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vtim.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vtim.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vtim.Tpo $(DEPDIR)/vtim.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vtim.c' object='vtim.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vtim.obj `if test -f '$(top_srcdir)/lib/libvarnish/vtim.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vtim.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vtim.c'; fi` vsb.o: $(top_srcdir)/lib/libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vsb.o -MD -MP -MF $(DEPDIR)/vsb.Tpo -c -o vsb.o `test -f '$(top_srcdir)/lib/libvarnish/vsb.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vsb.Tpo $(DEPDIR)/vsb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vsb.c' object='vsb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vsb.o `test -f '$(top_srcdir)/lib/libvarnish/vsb.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vsb.c vsb.obj: $(top_srcdir)/lib/libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vsb.obj -MD -MP -MF $(DEPDIR)/vsb.Tpo -c -o vsb.obj `if test -f '$(top_srcdir)/lib/libvarnish/vsb.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vsb.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vsb.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vsb.Tpo $(DEPDIR)/vsb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vsb.c' object='vsb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vsb.obj `if test -f '$(top_srcdir)/lib/libvarnish/vsb.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vsb.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vsb.c'; fi` opt2rst.o: $(top_srcdir)/lib/libvarnishtools/opt2rst.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT opt2rst.o -MD -MP -MF $(DEPDIR)/opt2rst.Tpo -c -o opt2rst.o `test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/opt2rst.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/opt2rst.Tpo $(DEPDIR)/opt2rst.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/opt2rst.c' object='opt2rst.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o opt2rst.o `test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/opt2rst.c opt2rst.obj: $(top_srcdir)/lib/libvarnishtools/opt2rst.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT opt2rst.obj -MD -MP -MF $(DEPDIR)/opt2rst.Tpo -c -o opt2rst.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/opt2rst.Tpo $(DEPDIR)/opt2rst.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/opt2rst.c' object='opt2rst.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o opt2rst.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/bin/varnishtop/varnishtop_options.c0000644000201500234410000000304612652366721017202 00000000000000/*- * 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" varnish-4.1.1/bin/varnishtop/varnishtop_options.h0000644000201500234410000000465212652366721017213 00000000000000/*- * Copyright (c) 2014-2015 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" #define TOP_OPT_1 \ VOPT("1", "[-1]", "Run once", \ "Instead of a continuously 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 TOP_OPT_f VUT_OPT_g 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 VUT_OPT_t VSL_OPT_T VSL_OPT_x VSL_OPT_X VUT_OPT_V varnish-4.1.1/bin/varnishtop/varnishtop.c0000644000201500234410000002007312652366721015426 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * 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 * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Log tailer for Varnish */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include "vcurses.h" #include "vapi/vsm.h" #include "vapi/vsl.h" #include "vapi/voptget.h" #include "vas.h" #include "vdef.h" #include "vcs.h" #include "vtree.h" #include "vsb.h" #include "vut.h" #if 0 #define AC(x) assert((x) != ERR) #else #define AC(x) x #endif static const char progname[] = "varnishtop"; static float period = 60; /* seconds */ static int end_of_file = 0; struct top { uint8_t tag; const char *rec_data; char *rec_buf; int clen; unsigned hash; VRB_ENTRY(top) e_order; VRB_ENTRY(top) e_key; double count; }; static VRB_HEAD(t_order, top) h_order = VRB_INITIALIZER(&h_order); static VRB_HEAD(t_key, top) h_key = VRB_INITIALIZER(&h_key); static inline int cmp_key(const struct top *a, const struct top *b) { if (a->hash != b->hash) return (a->hash - b->hash); if (a->tag != b->tag) return (a->tag - b->tag); if (a->clen != b->clen) return (a->clen - b->clen); return (memcmp(a->rec_data, b->rec_data, a->clen)); } static inline int cmp_order(const struct top *a, const struct top *b) { if (a->count > b->count) return (-1); else if (a->count < b->count) return (1); return (cmp_key(a, b)); } static unsigned ntop; static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; static int f_flag = 0; static unsigned maxfieldlen = 0; VRB_PROTOTYPE_STATIC(t_order, top, e_order, cmp_order); VRB_GENERATE_STATIC(t_order, top, e_order, cmp_order); VRB_PROTOTYPE_STATIC(t_key, top, e_key, cmp_key); VRB_GENERATE_STATIC(t_key, top, e_key, cmp_key); static int __match_proto__(VSLQ_dispatch_f) accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[], void *priv) { struct top *tp, t; unsigned int u; unsigned tag; const char *b, *e, *p; unsigned len; struct VSL_transaction *tr; (void)priv; 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); 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; t.clen = len; t.rec_data = VSL_CDATA(tr->c->rec.ptr); AZ(pthread_mutex_lock(&mtx)); tp = VRB_FIND(t_key, &h_key, &t); if (tp) { VRB_REMOVE(t_order, &h_order, tp); tp->count += 1.0; /* Reinsert to rebalance */ VRB_INSERT(t_order, &h_order, tp); } 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_buf = strdup(t.rec_data); tp->rec_data = tp->rec_buf; AN(tp->rec_data); VRB_INSERT(t_key, &h_key, tp); VRB_INSERT(t_order, &h_order, tp); } AZ(pthread_mutex_unlock(&mtx)); } } return (0); } static int __match_proto__(VUT_cb_f) sighup(void) { return (1); } static void update(int p) { struct top *tp, *tp2; int l, len; double t = 0; static time_t last = 0; static unsigned n; time_t now; now = time(NULL); if (now == last) return; last = now; l = 1; if (n < p) n++; AC(erase()); 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(t_order, &h_order); tp != NULL; tp = tp2) { tp2 = VRB_NEXT(t_order, &h_order, 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)); t = tp->count; } 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(t_key, &h_key, tp); VRB_REMOVE(t_order, &h_order, tp); free(tp->rec_buf); free(tp); ntop--; } } AC(refresh()); } static void * do_curses(void *arg) { int i; (void)arg; for (i = 0; i < 256; i++) { if (VSL_tags[i] == NULL) continue; if (maxfieldlen < strlen(VSL_tags[i])) maxfieldlen = strlen(VSL_tags[i]); } (void)initscr(); AC(raw()); AC(noecho()); AC(nonl()); AC(intrflush(stdscr, FALSE)); (void)curs_set(0); AC(erase()); for (;;) { AZ(pthread_mutex_lock(&mtx)); update(period); AZ(pthread_mutex_unlock(&mtx)); timeout(1000); switch (getch()) { case ERR: break; #ifdef KEY_RESIZE case KEY_RESIZE: AC(erase()); break; #endif case '\014': /* Ctrl-L */ case '\024': /* Ctrl-T */ AC(redrawwin(stdscr)); AC(refresh()); break; case '\032': /* Ctrl-Z */ AC(endwin()); AZ(raise(SIGTSTP)); break; case '\003': /* Ctrl-C */ case '\021': /* Ctrl-Q */ case 'Q': case 'q': AZ(raise(SIGINT)); AC(endwin()); return NULL; default: AC(beep()); break; } } return NULL; } static void dump(void) { struct top *tp, *tp2; for (tp = VRB_MIN(t_order, &h_order); tp != NULL; tp = tp2) { tp2 = VRB_NEXT(t_order, &h_order, tp); if (tp->count <= 1.0) break; printf("%9.2f %s %*.*s\n", tp->count, VSL_tags[tp->tag], tp->clen, tp->clen, tp->rec_data); } } static void usage(int status) { 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 main(int argc, char **argv) { int o, once = 0; pthread_t thr; VUT_Init(progname); while ((o = getopt(argc, argv, vopt_optstring)) != -1) { switch (o) { case '1': AN(VUT_Arg('d', NULL)); once = 1; break; case 'f': f_flag = 1; break; case 'h': /* Usage help */ usage(0); case 'p': errno = 0; period = strtol(optarg, NULL, 0); if (errno != 0) { fprintf(stderr, "Syntax error, %s is not a number", optarg); exit(1); } break; default: if (!VUT_Arg(o, optarg)) usage(1); } } VUT_Setup(); if (!once) { if (pthread_create(&thr, NULL, do_curses, NULL) != 0) { fprintf(stderr, "pthread_create(): %s\n", strerror(errno)); exit(1); } } VUT.dispatch_f = &accumulate; VUT.dispatch_priv = NULL; VUT.sighup_f = sighup; VUT_Main(); end_of_file = 1; if (once) dump(); else pthread_join(thr, NULL); VUT_Fini(); exit(0); } varnish-4.1.1/bin/varnishlog/0000755000201500234410000000000012652366757013133 500000000000000varnish-4.1.1/bin/varnishlog/varnishlog.c0000644000201500234410000000755412652366721015375 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * 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. * * Log tailer for Varnish */ #include "config.h" #include #include #include #include #include #include #include #include "vapi/vsm.h" #include "vapi/vsl.h" #include "vapi/voptget.h" #include "vas.h" #include "vdef.h" #include "vpf.h" #include "vsb.h" #include "vut.h" #include "miniobj.h" static const char progname[] = "varnishlog"; struct log { /* Options */ int a_opt; int A_opt; char *w_arg; /* State */ FILE *fo; } LOG; static void usage(int status) { 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); } static void openout(int append) { AN(LOG.w_arg); if (LOG.A_opt) LOG.fo = fopen(LOG.w_arg, append ? "a" : "w"); else LOG.fo = VSL_WriteOpen(VUT.vsl, LOG.w_arg, append, 0); if (LOG.fo == NULL) VUT_Error(2, "Can't open output file (%s)", LOG.A_opt ? strerror(errno) : VSL_Error(VUT.vsl)); VUT.dispatch_priv = LOG.fo; } static int __match_proto__(VUT_cb_f) rotateout(void) { AN(LOG.w_arg); AN(LOG.fo); fclose(LOG.fo); openout(1); AN(LOG.fo); return (0); } static int __match_proto__(VUT_cb_f) flushout(void) { AN(LOG.fo); if (fflush(LOG.fo)) return (-5); return (0); } static int __match_proto__(VUT_cb_f) sighup(void) { return (1); } int main(int argc, char * const *argv) { int opt; memset(&LOG, 0, sizeof LOG); VUT_Init(progname); while ((opt = getopt(argc, argv, vopt_optstring)) != -1) { switch (opt) { case 'a': /* Append to file */ LOG.a_opt = 1; break; case 'A': /* Text output */ LOG.A_opt = 1; break; case 'h': /* Usage help */ usage(0); break; case 'w': /* Write to file */ REPLACE(LOG.w_arg, optarg); break; default: if (!VUT_Arg(opt, optarg)) usage(1); } } if (optind != argc) usage(1); if (VUT.D_opt && !LOG.w_arg) VUT_Error(1, "Missing -w option"); /* Setup output */ if (LOG.A_opt || !LOG.w_arg) VUT.dispatch_f = VSL_PrintTransactions; else VUT.dispatch_f = VSL_WriteTransactions; VUT.sighup_f = sighup; if (LOG.w_arg) { openout(LOG.a_opt); AN(LOG.fo); if (VUT.D_opt) VUT.sighup_f = rotateout; } else LOG.fo = stdout; VUT.idle_f = flushout; VUT_Setup(); VUT_Main(); VUT_Fini(); (void)flushout(); exit(0); } varnish-4.1.1/bin/varnishlog/Makefile.am0000644000201500234410000000143712652366721015103 00000000000000# AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include bin_PROGRAMS = varnishlog varnishlog_SOURCES = \ varnishlog.c \ varnishlog_options.h \ varnishlog_options.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/vsb.c \ $(top_srcdir)/lib/libvarnish/vpf.c \ $(top_srcdir)/lib/libvarnish/vtim.c varnishlog_LDADD = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS} noinst_PROGRAMS = varnishlog_opt2rst varnishlog_opt2rst_SOURCES = \ varnishlog_options.h \ varnishlog_options.c \ $(top_srcdir)/lib/libvarnishtools/opt2rst.c varnish-4.1.1/bin/varnishlog/Makefile.in0000644000201500234410000010712312652366726015120 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = varnishlog$(EXEEXT) noinst_PROGRAMS = varnishlog_opt2rst$(EXEEXT) subdir = bin/varnishlog DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_varnishlog_OBJECTS = varnishlog.$(OBJEXT) \ varnishlog_options.$(OBJEXT) vut.$(OBJEXT) vas.$(OBJEXT) \ flopen.$(OBJEXT) version.$(OBJEXT) vsb.$(OBJEXT) vpf.$(OBJEXT) \ vtim.$(OBJEXT) varnishlog_OBJECTS = $(am_varnishlog_OBJECTS) am__DEPENDENCIES_1 = varnishlog_DEPENDENCIES = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am_varnishlog_opt2rst_OBJECTS = varnishlog_options.$(OBJEXT) \ opt2rst.$(OBJEXT) varnishlog_opt2rst_OBJECTS = $(am_varnishlog_opt2rst_OBJECTS) varnishlog_opt2rst_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(varnishlog_SOURCES) $(varnishlog_opt2rst_SOURCES) DIST_SOURCES = $(varnishlog_SOURCES) $(varnishlog_opt2rst_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include varnishlog_SOURCES = \ varnishlog.c \ varnishlog_options.h \ varnishlog_options.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/vsb.c \ $(top_srcdir)/lib/libvarnish/vpf.c \ $(top_srcdir)/lib/libvarnish/vtim.c varnishlog_LDADD = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS} varnishlog_opt2rst_SOURCES = \ varnishlog_options.h \ varnishlog_options.c \ $(top_srcdir)/lib/libvarnishtools/opt2rst.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/varnishlog/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign bin/varnishlog/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list varnishlog$(EXEEXT): $(varnishlog_OBJECTS) $(varnishlog_DEPENDENCIES) $(EXTRA_varnishlog_DEPENDENCIES) @rm -f varnishlog$(EXEEXT) $(AM_V_CCLD)$(LINK) $(varnishlog_OBJECTS) $(varnishlog_LDADD) $(LIBS) varnishlog_opt2rst$(EXEEXT): $(varnishlog_opt2rst_OBJECTS) $(varnishlog_opt2rst_DEPENDENCIES) $(EXTRA_varnishlog_opt2rst_DEPENDENCIES) @rm -f varnishlog_opt2rst$(EXEEXT) $(AM_V_CCLD)$(LINK) $(varnishlog_opt2rst_OBJECTS) $(varnishlog_opt2rst_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flopen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opt2rst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishlog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishlog_options.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vas.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vpf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vtim.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vut.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< vut.o: $(top_srcdir)/lib/libvarnishtools/vut.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vut.o -MD -MP -MF $(DEPDIR)/vut.Tpo -c -o vut.o `test -f '$(top_srcdir)/lib/libvarnishtools/vut.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/vut.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vut.Tpo $(DEPDIR)/vut.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/vut.c' object='vut.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vut.o `test -f '$(top_srcdir)/lib/libvarnishtools/vut.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/vut.c vut.obj: $(top_srcdir)/lib/libvarnishtools/vut.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vut.obj -MD -MP -MF $(DEPDIR)/vut.Tpo -c -o vut.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/vut.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/vut.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/vut.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vut.Tpo $(DEPDIR)/vut.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/vut.c' object='vut.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vut.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/vut.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/vut.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/vut.c'; fi` vas.o: $(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vas.o -MD -MP -MF $(DEPDIR)/vas.Tpo -c -o vas.o `test -f '$(top_srcdir)/lib/libvarnish/vas.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vas.Tpo $(DEPDIR)/vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vas.c' object='vas.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vas.o `test -f '$(top_srcdir)/lib/libvarnish/vas.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vas.c vas.obj: $(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vas.obj -MD -MP -MF $(DEPDIR)/vas.Tpo -c -o vas.obj `if test -f '$(top_srcdir)/lib/libvarnish/vas.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vas.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vas.Tpo $(DEPDIR)/vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vas.c' object='vas.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vas.obj `if test -f '$(top_srcdir)/lib/libvarnish/vas.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vas.c'; fi` flopen.o: $(top_srcdir)/lib/libvarnish/flopen.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT flopen.o -MD -MP -MF $(DEPDIR)/flopen.Tpo -c -o flopen.o `test -f '$(top_srcdir)/lib/libvarnish/flopen.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/flopen.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/flopen.Tpo $(DEPDIR)/flopen.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/flopen.c' object='flopen.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o flopen.o `test -f '$(top_srcdir)/lib/libvarnish/flopen.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/flopen.c flopen.obj: $(top_srcdir)/lib/libvarnish/flopen.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT flopen.obj -MD -MP -MF $(DEPDIR)/flopen.Tpo -c -o flopen.obj `if test -f '$(top_srcdir)/lib/libvarnish/flopen.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/flopen.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/flopen.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/flopen.Tpo $(DEPDIR)/flopen.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/flopen.c' object='flopen.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o flopen.obj `if test -f '$(top_srcdir)/lib/libvarnish/flopen.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/flopen.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/flopen.c'; fi` version.o: $(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT version.o -MD -MP -MF $(DEPDIR)/version.Tpo -c -o version.o `test -f '$(top_srcdir)/lib/libvarnish/version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/version.Tpo $(DEPDIR)/version.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/version.c' object='version.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o version.o `test -f '$(top_srcdir)/lib/libvarnish/version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/version.c version.obj: $(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT version.obj -MD -MP -MF $(DEPDIR)/version.Tpo -c -o version.obj `if test -f '$(top_srcdir)/lib/libvarnish/version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/version.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/version.Tpo $(DEPDIR)/version.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/version.c' object='version.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o version.obj `if test -f '$(top_srcdir)/lib/libvarnish/version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/version.c'; fi` vsb.o: $(top_srcdir)/lib/libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vsb.o -MD -MP -MF $(DEPDIR)/vsb.Tpo -c -o vsb.o `test -f '$(top_srcdir)/lib/libvarnish/vsb.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vsb.Tpo $(DEPDIR)/vsb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vsb.c' object='vsb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vsb.o `test -f '$(top_srcdir)/lib/libvarnish/vsb.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vsb.c vsb.obj: $(top_srcdir)/lib/libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vsb.obj -MD -MP -MF $(DEPDIR)/vsb.Tpo -c -o vsb.obj `if test -f '$(top_srcdir)/lib/libvarnish/vsb.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vsb.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vsb.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vsb.Tpo $(DEPDIR)/vsb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vsb.c' object='vsb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vsb.obj `if test -f '$(top_srcdir)/lib/libvarnish/vsb.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vsb.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vsb.c'; fi` vpf.o: $(top_srcdir)/lib/libvarnish/vpf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vpf.o -MD -MP -MF $(DEPDIR)/vpf.Tpo -c -o vpf.o `test -f '$(top_srcdir)/lib/libvarnish/vpf.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vpf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vpf.Tpo $(DEPDIR)/vpf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vpf.c' object='vpf.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vpf.o `test -f '$(top_srcdir)/lib/libvarnish/vpf.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vpf.c vpf.obj: $(top_srcdir)/lib/libvarnish/vpf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vpf.obj -MD -MP -MF $(DEPDIR)/vpf.Tpo -c -o vpf.obj `if test -f '$(top_srcdir)/lib/libvarnish/vpf.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vpf.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vpf.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vpf.Tpo $(DEPDIR)/vpf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vpf.c' object='vpf.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vpf.obj `if test -f '$(top_srcdir)/lib/libvarnish/vpf.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vpf.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vpf.c'; fi` vtim.o: $(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vtim.o -MD -MP -MF $(DEPDIR)/vtim.Tpo -c -o vtim.o `test -f '$(top_srcdir)/lib/libvarnish/vtim.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vtim.Tpo $(DEPDIR)/vtim.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vtim.c' object='vtim.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vtim.o `test -f '$(top_srcdir)/lib/libvarnish/vtim.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vtim.c vtim.obj: $(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vtim.obj -MD -MP -MF $(DEPDIR)/vtim.Tpo -c -o vtim.obj `if test -f '$(top_srcdir)/lib/libvarnish/vtim.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vtim.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vtim.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vtim.Tpo $(DEPDIR)/vtim.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vtim.c' object='vtim.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vtim.obj `if test -f '$(top_srcdir)/lib/libvarnish/vtim.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vtim.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vtim.c'; fi` opt2rst.o: $(top_srcdir)/lib/libvarnishtools/opt2rst.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT opt2rst.o -MD -MP -MF $(DEPDIR)/opt2rst.Tpo -c -o opt2rst.o `test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/opt2rst.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/opt2rst.Tpo $(DEPDIR)/opt2rst.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/opt2rst.c' object='opt2rst.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o opt2rst.o `test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/opt2rst.c opt2rst.obj: $(top_srcdir)/lib/libvarnishtools/opt2rst.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT opt2rst.obj -MD -MP -MF $(DEPDIR)/opt2rst.Tpo -c -o opt2rst.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/opt2rst.Tpo $(DEPDIR)/opt2rst.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/opt2rst.c' object='opt2rst.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o opt2rst.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/bin/varnishlog/varnishlog_options.h0000644000201500234410000000513712652366721017150 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 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. */ #include "vapi/vapi_options.h" #include "vut_options.h" #define LOG_OPT_a \ VOPT("a", "[-a]", "Append to file", \ "When writing output to a file with the -w option, append" \ " to it rather than overwrite it." \ ) #define LOG_OPT_A \ VOPT("A", "[-A]", "Text output", \ "When writing output to a file with the -w option, output" \ " data in ascii format." \ ) #define LOG_OPT_w \ VOPT("w:", "[-w filename]", "Output filename", \ "Redirect output to file. The file will be overwritten" \ " unless the -a option was specified. If the application" \ " receives a SIGHUP in daemon mode the file will be " \ " reopened allowing the old one to be rotated away. The" \ " file can then be read by varnishlog and other tools with" \ " the -r option, unless the -A option was specified. This" \ " option is required when running in daemon mode." \ ) LOG_OPT_a LOG_OPT_A VSL_OPT_b VSL_OPT_c VSL_OPT_C VUT_OPT_d VUT_OPT_D VUT_OPT_g VUT_OPT_h VSL_OPT_i VSL_OPT_I VUT_OPT_k VSL_OPT_L VUT_OPT_n VUT_OPT_N VUT_OPT_P VUT_OPT_q VUT_OPT_r VUT_OPT_t VSL_OPT_T VSL_OPT_v VUT_OPT_V LOG_OPT_w VSL_OPT_x VSL_OPT_X varnish-4.1.1/bin/varnishlog/varnishlog_options.c0000644000201500234410000000312112652366721017132 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-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 varnishlog */ #include #define VOPT_DEFINITION #define VOPT_INC "varnishlog_options.h" #include "vapi/voptget.h" varnish-4.1.1/bin/varnishd/0000755000201500234410000000000012652366757012575 500000000000000varnish-4.1.1/bin/varnishd/hash/0000755000201500234410000000000012652366757013520 500000000000000varnish-4.1.1/bin/varnishd/hash/hash_classic.c0000644000201500234410000001241112652366721016216 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * A classic bucketed hash */ #include "config.h" #include #include #include "cache/cache.h" #include "hash/hash_slinger.h" static struct VSC_C_lck *lck_hcl; /*--------------------------------------------------------------------*/ struct hcl_hd { unsigned magic; #define HCL_HEAD_MAGIC 0x0f327016 VTAILQ_HEAD(, objhead) head; struct lock mtx; }; static unsigned hcl_nhash = 16383; static struct hcl_hd *hcl_head; /*-------------------------------------------------------------------- * The ->init method allows the management process to pass arguments */ static void __match_proto__(hash_init_f) hcl_init(int ac, char * const *av) { int i; unsigned u; if (ac == 0) return; if (ac > 1) ARGV_ERR("(-hclassic) too many arguments\n"); i = sscanf(av[0], "%u", &u); if (i <= 0 || u == 0) return; if (u > 2 && !(u & (u - 1))) { fprintf(stderr, "NOTE:\n" "\tA power of two number of hash buckets is " "marginally less efficient\n" "\twith systematic URLs. Reducing by one" " hash bucket.\n"); u--; } hcl_nhash = u; fprintf(stderr, "Classic hash: %u buckets\n", hcl_nhash); } /*-------------------------------------------------------------------- * The ->start method is called during cache process start and allows * initialization to happen before the first lookup. */ static void __match_proto__(hash_start_f) hcl_start(void) { unsigned u; lck_hcl = Lck_CreateClass("hcl"); hcl_head = calloc(sizeof *hcl_head, hcl_nhash); XXXAN(hcl_head); for (u = 0; u < hcl_nhash; u++) { VTAILQ_INIT(&hcl_head[u].head); Lck_New(&hcl_head[u].mtx, lck_hcl); hcl_head[u].magic = HCL_HEAD_MAGIC; } } /*-------------------------------------------------------------------- * Lookup and possibly insert element. * If nobj != NULL and the lookup does not find key, nobj is inserted. * If nobj == NULL and the lookup does not find key, NULL is returned. * A reference to the returned object is held. * We use a two-pass algorithm to handle inserts as they are quite * rare and collisions even rarer. */ static struct objhead * __match_proto__(hash_lookup_f) hcl_lookup(struct worker *wrk, const void *digest, struct objhead **noh) { struct objhead *oh; struct hcl_hd *hp; unsigned u1, hdigest; int i; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AN(digest); if (noh != NULL) CHECK_OBJ_NOTNULL(*noh, OBJHEAD_MAGIC); assert(sizeof oh->digest >= sizeof hdigest); memcpy(&hdigest, digest, sizeof hdigest); u1 = hdigest % hcl_nhash; hp = &hcl_head[u1]; Lck_Lock(&hp->mtx); VTAILQ_FOREACH(oh, &hp->head, hoh_list) { CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); i = memcmp(oh->digest, digest, sizeof oh->digest); if (i < 0) continue; if (i > 0) break; oh->refcnt++; Lck_Unlock(&hp->mtx); Lck_Lock(&oh->mtx); return (oh); } if (noh == NULL) { Lck_Unlock(&hp->mtx); return (NULL); } if (oh != NULL) VTAILQ_INSERT_BEFORE(oh, *noh, hoh_list); else VTAILQ_INSERT_TAIL(&hp->head, *noh, hoh_list); oh = *noh; *noh = NULL; memcpy(oh->digest, digest, sizeof oh->digest); oh->hoh_head = hp; Lck_Unlock(&hp->mtx); Lck_Lock(&oh->mtx); return (oh); } /*-------------------------------------------------------------------- * Dereference and if no references are left, free. */ static int __match_proto__(hash_deref_f) hcl_deref(struct objhead *oh) { struct hcl_hd *hp; int ret; CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); CAST_OBJ_NOTNULL(hp, oh->hoh_head, HCL_HEAD_MAGIC); assert(oh->refcnt > 0); Lck_Lock(&hp->mtx); if (--oh->refcnt == 0) { VTAILQ_REMOVE(&hp->head, oh, hoh_list); ret = 0; } else ret = 1; Lck_Unlock(&hp->mtx); return (ret); } /*--------------------------------------------------------------------*/ const struct hash_slinger hcl_slinger = { .magic = SLINGER_MAGIC, .name = "classic", .init = hcl_init, .start = hcl_start, .lookup = hcl_lookup, .deref = hcl_deref, }; varnish-4.1.1/bin/varnishd/hash/hash_slinger.h0000644000201500234410000000743612652366721016260 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ struct sess; struct req; struct objcore; struct busyobj; struct worker; struct object; typedef void hash_init_f(int ac, char * const *av); typedef void hash_start_f(void); typedef void hash_prep_f(struct worker *); typedef struct objhead *hash_lookup_f(struct worker *wrk, const void *digest, struct objhead **nobj); typedef int hash_deref_f(struct objhead *obj); struct hash_slinger { unsigned magic; #define SLINGER_MAGIC 0x1b720cba const char *name; hash_init_f *init; hash_start_f *start; hash_prep_f *prep; hash_lookup_f *lookup; hash_deref_f *deref; }; enum lookup_e { HSH_MISS, HSH_BUSY, HSH_HIT, HSH_EXP, HSH_EXPBUSY }; /* cache_hash.c */ void HSH_Cleanup(struct worker *w); enum lookup_e HSH_Lookup(struct req *, struct objcore **, struct objcore **, int wait_for_busy, int always_insert); void HSH_Ref(struct objcore *o); void HSH_Init(const struct hash_slinger *slinger); void HSH_AddString(struct req *, void *ctx, const char *str); void HSH_Insert(struct worker *, const void *hash, struct objcore *); void HSH_Purge(struct worker *, struct objhead *, double ttl, double grace, double keep); void HSH_config(const char *h_arg); struct busyobj *HSH_RefBusy(const struct objcore *oc); struct objcore *HSH_Private(struct worker *wrk); #ifdef VARNISH_CACHE_CHILD struct waitinglist { unsigned magic; #define WAITINGLIST_MAGIC 0x063a477a VTAILQ_HEAD(, req) list; }; struct objhead { unsigned magic; #define OBJHEAD_MAGIC 0x1b96615d int refcnt; struct lock mtx; VTAILQ_HEAD(,objcore) objcs; uint8_t digest[DIGEST_LEN]; struct waitinglist *waitinglist; /*---------------------------------------------------- * The fields below are for the sole private use of * the hash implementation(s). */ union { struct { VTAILQ_ENTRY(objhead) u_n_hoh_list; void *u_n_hoh_head; } n; } _u; #define hoh_list _u.n.u_n_hoh_list #define hoh_head _u.n.u_n_hoh_head }; void HSH_Fail(struct objcore *); void HSH_Unbusy(struct worker *, struct objcore *); void HSH_Complete(struct objcore *oc); void HSH_DeleteObjHead(struct worker *, struct objhead *oh); int HSH_DerefObjHead(struct worker *, struct objhead **poh); int HSH_DerefObjCore(struct worker *, struct objcore **ocp); #endif /* VARNISH_CACHE_CHILD */ extern const struct hash_slinger hsl_slinger; extern const struct hash_slinger hcl_slinger; extern const struct hash_slinger hcb_slinger; varnish-4.1.1/bin/varnishd/hash/hash_simple_list.c0000644000201500234410000000737412652366721017135 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * This is the reference hash(/lookup) implementation */ #include "config.h" #include "cache/cache.h" #include "hash/hash_slinger.h" static struct VSC_C_lck *lck_hsl; /*--------------------------------------------------------------------*/ static VTAILQ_HEAD(, objhead) hsl_head = VTAILQ_HEAD_INITIALIZER(hsl_head); static struct lock hsl_mtx; /*-------------------------------------------------------------------- * The ->init method is called during process start and allows * initialization to happen before the first lookup. */ static void __match_proto__(hash_start_f) hsl_start(void) { lck_hsl = Lck_CreateClass("hsl"); Lck_New(&hsl_mtx, lck_hsl); } /*-------------------------------------------------------------------- * Lookup and possibly insert element. * If nobj != NULL and the lookup does not find key, nobj is inserted. * If nobj == NULL and the lookup does not find key, NULL is returned. * A reference to the returned object is held. */ static struct objhead * __match_proto__(hash_lookup_f) hsl_lookup(struct worker *wrk, const void *digest, struct objhead **noh) { struct objhead *oh; int i; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AN(digest); if (noh != NULL) CHECK_OBJ_NOTNULL(*noh, OBJHEAD_MAGIC); Lck_Lock(&hsl_mtx); VTAILQ_FOREACH(oh, &hsl_head, hoh_list) { i = memcmp(oh->digest, digest, sizeof oh->digest); if (i < 0) continue; if (i > 0) break; oh->refcnt++; Lck_Unlock(&hsl_mtx); Lck_Lock(&oh->mtx); return (oh); } if (noh == NULL) return (NULL); if (oh != NULL) VTAILQ_INSERT_BEFORE(oh, *noh, hoh_list); else VTAILQ_INSERT_TAIL(&hsl_head, *noh, hoh_list); oh = *noh; *noh = NULL; memcpy(oh->digest, digest, sizeof oh->digest); Lck_Unlock(&hsl_mtx); Lck_Lock(&oh->mtx); return (oh); } /*-------------------------------------------------------------------- * Dereference and if no references are left, free. */ static int __match_proto__(hash_deref_f) hsl_deref(struct objhead *oh) { int ret; Lck_Lock(&hsl_mtx); if (--oh->refcnt == 0) { VTAILQ_REMOVE(&hsl_head, oh, hoh_list); ret = 0; } else ret = 1; Lck_Unlock(&hsl_mtx); return (ret); } /*--------------------------------------------------------------------*/ const struct hash_slinger hsl_slinger = { .magic = SLINGER_MAGIC, .name = "simple", .start = hsl_start, .lookup = hsl_lookup, .deref = hsl_deref, }; varnish-4.1.1/bin/varnishd/hash/mgt_hash.c0000644000201500234410000000504512652366721015371 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ #include "config.h" #include #include #include #include #include "mgt/mgt.h" #include "common/heritage.h" #include "hash/hash_slinger.h" #include "vav.h" static const struct choice hsh_choice[] = { { "classic", &hcl_slinger }, { "simple", &hsl_slinger }, { "simple_list", &hsl_slinger }, /* backwards compat */ { "critbit", &hcb_slinger }, { NULL, NULL } }; /*--------------------------------------------------------------------*/ void HSH_config(const char *h_arg) { char **av; int ac; const struct hash_slinger *hp; ASSERT_MGT(); av = VAV_Parse(h_arg, NULL, ARGV_COMMA); AN(av); if (av[0] != NULL) ARGV_ERR("%s\n", av[0]); if (av[1] == NULL) ARGV_ERR("-h argument is empty\n"); for (ac = 0; av[ac + 2] != NULL; ac++) continue; hp = pick(hsh_choice, av[1], "hash"); CHECK_OBJ_NOTNULL(hp, SLINGER_MAGIC); VSB_printf(vident, ",-h%s", av[1]); heritage.hash = hp; if (hp->init != NULL) hp->init(ac, av + 2); else if (ac > 0) ARGV_ERR("Hash method \"%s\" takes no arguments\n", hp->name); /* NB: Don't free av, the hasher is allowed to keep it. */ } varnish-4.1.1/bin/varnishd/hash/hash_critbit.c0000644000201500234410000002653612652366721016252 00000000000000/*- * Copyright (c) 2008-2011 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. * * A Crit Bit tree based hash */ // #define PHK #include "config.h" #include #include "cache/cache.h" #include "hash/hash_slinger.h" #include "vcli_priv.h" #include "vmb.h" #include "vtim.h" static struct lock hcb_mtx; /*--------------------------------------------------------------------- * Table for finding out how many bits two bytes have in common, * counting from the MSB towards the LSB. * ie: * hcb_bittbl[0x01 ^ 0x22] == 2 * hcb_bittbl[0x10 ^ 0x0b] == 3 * */ static unsigned char hcb_bittbl[256]; static unsigned char hcb_bits(unsigned char x, unsigned char y) { return (hcb_bittbl[x ^ y]); } static void hcb_build_bittbl(void) { unsigned char x; unsigned y; y = 0; for (x = 0; x < 8; x++) for (; y < (1U << x); y++) hcb_bittbl[y] = 8 - x; /* Quick asserts for sanity check */ assert(hcb_bits(0x34, 0x34) == 8); AZ(hcb_bits(0xaa, 0x55)); assert(hcb_bits(0x01, 0x22) == 2); assert(hcb_bits(0x10, 0x0b) == 3); } /*--------------------------------------------------------------------- * For space reasons we overload the two pointers with two different * kinds of of pointers. We cast them to uintptr_t's and abuse the * low two bits to tell them apart, assuming that Varnish will never * run on machines with less than 32bit alignment. * * Asserts will explode if these assumptions are not met. */ struct hcb_y { unsigned magic; #define HCB_Y_MAGIC 0x125c4bd2 unsigned short critbit; unsigned char ptr; unsigned char bitmask; volatile uintptr_t leaf[2]; VSTAILQ_ENTRY(hcb_y) list; }; #define HCB_BIT_NODE (1<<0) #define HCB_BIT_Y (1<<1) struct hcb_root { volatile uintptr_t origo; }; static struct hcb_root hcb_root; static VSTAILQ_HEAD(, hcb_y) cool_y = VSTAILQ_HEAD_INITIALIZER(cool_y); static VSTAILQ_HEAD(, hcb_y) dead_y = VSTAILQ_HEAD_INITIALIZER(dead_y); static VTAILQ_HEAD(, objhead) cool_h = VTAILQ_HEAD_INITIALIZER(cool_h); static VTAILQ_HEAD(, objhead) dead_h = VTAILQ_HEAD_INITIALIZER(dead_h); /*--------------------------------------------------------------------- * Pointer accessor functions */ static int hcb_is_node(uintptr_t u) { return (u & HCB_BIT_NODE); } static int hcb_is_y(uintptr_t u) { return (u & HCB_BIT_Y); } static uintptr_t hcb_r_node(struct objhead *n) { AZ((uintptr_t)n & (HCB_BIT_NODE | HCB_BIT_Y)); return (HCB_BIT_NODE | (uintptr_t)n); } static struct objhead * hcb_l_node(uintptr_t u) { assert(u & HCB_BIT_NODE); AZ(u & HCB_BIT_Y); return ((struct objhead *)(u & ~HCB_BIT_NODE)); } static uintptr_t hcb_r_y(struct hcb_y *y) { CHECK_OBJ_NOTNULL(y, HCB_Y_MAGIC); AZ((uintptr_t)y & (HCB_BIT_NODE | HCB_BIT_Y)); return (HCB_BIT_Y | (uintptr_t)y); } static struct hcb_y * hcb_l_y(uintptr_t u) { AZ(u & HCB_BIT_NODE); assert(u & HCB_BIT_Y); return ((struct hcb_y *)(u & ~HCB_BIT_Y)); } /*--------------------------------------------------------------------- * Find the "critical" bit that separates these two digests */ static unsigned hcb_crit_bit(const uint8_t *digest, const struct objhead *oh2, struct hcb_y *y) { unsigned char u, r; CHECK_OBJ_NOTNULL(y, HCB_Y_MAGIC); for (u = 0; u < DIGEST_LEN && digest[u] == oh2->digest[u]; u++) ; assert(u < DIGEST_LEN); r = hcb_bits(digest[u], oh2->digest[u]); y->ptr = u; y->bitmask = 0x80 >> r; y->critbit = u * 8 + r; return (y->critbit); } /*--------------------------------------------------------------------- * Unless we have the lock, we need to be very careful about pointer * references into the tree, we cannot trust things to be the same * in two consequtive memory accesses. */ static struct objhead * hcb_insert(struct worker *wrk, struct hcb_root *root, const uint8_t *digest, struct objhead **noh) { volatile uintptr_t *p; uintptr_t pp; struct hcb_y *y, *y2; struct objhead *oh2; unsigned s, s2; p = &root->origo; pp = *p; if (pp == 0) { if (noh == NULL) return (NULL); oh2 = *noh; *noh = NULL; memcpy(oh2->digest, digest, sizeof oh2->digest); *p = hcb_r_node(oh2); return (oh2); } while(hcb_is_y(pp)) { y = hcb_l_y(pp); CHECK_OBJ_NOTNULL(y, HCB_Y_MAGIC); assert(y->ptr < DIGEST_LEN); s = (digest[y->ptr] & y->bitmask) != 0; assert(s < 2); p = &y->leaf[s]; pp = *p; } if (pp == 0) { /* We raced hcb_delete and got a NULL pointer */ assert(noh == NULL); return (NULL); } assert(hcb_is_node(pp)); /* We found a node, does it match ? */ oh2 = hcb_l_node(pp); CHECK_OBJ_NOTNULL(oh2, OBJHEAD_MAGIC); if (!memcmp(oh2->digest, digest, DIGEST_LEN)) return (oh2); if (noh == NULL) return (NULL); /* Insert */ CAST_OBJ_NOTNULL(y2, wrk->nhashpriv, HCB_Y_MAGIC); wrk->nhashpriv = NULL; (void)hcb_crit_bit(digest, oh2, y2); s2 = (digest[y2->ptr] & y2->bitmask) != 0; assert(s2 < 2); oh2 = *noh; *noh = NULL; memcpy(oh2->digest, digest, sizeof oh2->digest); y2->leaf[s2] = hcb_r_node(oh2); s2 = 1-s2; p = &root->origo; AN(*p); while(hcb_is_y(*p)) { y = hcb_l_y(*p); CHECK_OBJ_NOTNULL(y, HCB_Y_MAGIC); assert(y->critbit != y2->critbit); if (y->critbit > y2->critbit) break; assert(y->ptr < DIGEST_LEN); s = (digest[y->ptr] & y->bitmask) != 0; assert(s < 2); p = &y->leaf[s]; } y2->leaf[s2] = *p; VWMB(); *p = hcb_r_y(y2); return(oh2); } /*--------------------------------------------------------------------*/ static void hcb_delete(struct hcb_root *r, struct objhead *oh) { struct hcb_y *y; volatile uintptr_t *p; unsigned s; if (r->origo == hcb_r_node(oh)) { r->origo = 0; return; } p = &r->origo; assert(hcb_is_y(*p)); y = NULL; while(1) { assert(hcb_is_y(*p)); y = hcb_l_y(*p); assert(y->ptr < DIGEST_LEN); s = (oh->digest[y->ptr] & y->bitmask) != 0; assert(s < 2); if (y->leaf[s] == hcb_r_node(oh)) { *p = y->leaf[1 - s]; VSTAILQ_INSERT_TAIL(&cool_y, y, list); return; } p = &y->leaf[s]; } } /*--------------------------------------------------------------------*/ static void dumptree(struct cli *cli, uintptr_t p, int indent) { int i; const struct objhead *oh; const struct hcb_y *y; if (p == 0) return; if (hcb_is_node(p)) { oh = hcb_l_node(p); VCLI_Out(cli, "%*.*sN %d r%u <%02x%02x%02x...>\n", indent, indent, "", indent / 2, oh->refcnt, oh->digest[0], oh->digest[1], oh->digest[2]); return; } assert(hcb_is_y(p)); y = hcb_l_y(p); VCLI_Out(cli, "%*.*sY c %u p %u b %02x i %d\n", indent, indent, "", y->critbit, y->ptr, y->bitmask, indent / 2); indent += 2; for (i = 0; i < 2; i++) dumptree(cli, y->leaf[i], indent); } static void hcb_dump(struct cli *cli, const char * const *av, void *priv) { (void)priv; (void)av; VCLI_Out(cli, "HCB dump:\n"); dumptree(cli, hcb_root.origo, 0); VCLI_Out(cli, "Coollist:\n"); } static struct cli_proto hcb_cmds[] = { { "hcb.dump", "hcb.dump", "\tDump HCB tree.", 0, 0, "d", hcb_dump }, { NULL } }; /*--------------------------------------------------------------------*/ static void * __match_proto__(bgthread_t) hcb_cleaner(struct worker *wrk, void *priv) { struct hcb_y *y, *y2; struct objhead *oh, *oh2; (void)priv; while (1) { VSTAILQ_FOREACH_SAFE(y, &dead_y, list, y2) { VSTAILQ_REMOVE_HEAD(&dead_y, list); FREE_OBJ(y); } VTAILQ_FOREACH_SAFE(oh, &dead_h, hoh_list, oh2) { VTAILQ_REMOVE(&dead_h, oh, hoh_list); HSH_DeleteObjHead(wrk, oh); } Lck_Lock(&hcb_mtx); VSTAILQ_CONCAT(&dead_y, &cool_y); VTAILQ_CONCAT(&dead_h, &cool_h, hoh_list); Lck_Unlock(&hcb_mtx); Pool_Sumstat(wrk); VTIM_sleep(cache_param->critbit_cooloff); } NEEDLESS_RETURN(NULL); } /*--------------------------------------------------------------------*/ static void __match_proto__(hash_start_f) hcb_start(void) { struct objhead *oh = NULL; pthread_t tp; (void)oh; CLI_AddFuncs(hcb_cmds); Lck_New(&hcb_mtx, lck_hcb); WRK_BgThread(&tp, "hcb-cleaner", hcb_cleaner, NULL); memset(&hcb_root, 0, sizeof hcb_root); hcb_build_bittbl(); } static int __match_proto__(hash_deref_f) hcb_deref(struct objhead *oh) { CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); Lck_Lock(&oh->mtx); assert(oh->refcnt > 0); oh->refcnt--; if (oh->refcnt == 0) { Lck_Lock(&hcb_mtx); hcb_delete(&hcb_root, oh); VTAILQ_INSERT_TAIL(&cool_h, oh, hoh_list); Lck_Unlock(&hcb_mtx); assert(VTAILQ_EMPTY(&oh->objcs)); AZ(oh->waitinglist); } Lck_Unlock(&oh->mtx); #ifdef PHK fprintf(stderr, "hcb_defef %d %d <%s>\n", __LINE__, r, oh->hash); #endif return (1); } static struct objhead * __match_proto__(hash_lookup_f) hcb_lookup(struct worker *wrk, const void *digest, struct objhead **noh) { struct objhead *oh; struct hcb_y *y; unsigned u; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AN(digest); if (noh != NULL) { CHECK_OBJ_NOTNULL(*noh, OBJHEAD_MAGIC); assert((*noh)->refcnt == 1); } /* First try in read-only mode without holding a lock */ wrk->stats->hcb_nolock++; oh = hcb_insert(wrk, &hcb_root, digest, NULL); if (oh != NULL) { Lck_Lock(&oh->mtx); /* * A refcount of zero indicates that the tree changed * under us, so fall through and try with the lock held. */ u = oh->refcnt; if (u > 0) { oh->refcnt++; return (oh); } Lck_Unlock(&oh->mtx); } while (1) { /* No luck, try with lock held, so we can modify tree */ CAST_OBJ_NOTNULL(y, wrk->nhashpriv, HCB_Y_MAGIC); Lck_Lock(&hcb_mtx); VSC_C_main->hcb_lock++; oh = hcb_insert(wrk, &hcb_root, digest, noh); Lck_Unlock(&hcb_mtx); if (oh == NULL) return (NULL); Lck_Lock(&oh->mtx); CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); if (noh != NULL && *noh == NULL) { assert(oh->refcnt > 0); VSC_C_main->hcb_insert++; return (oh); } /* * A refcount of zero indicates that the tree changed * under us, so fall through and try with the lock held. */ u = oh->refcnt; if (u > 0) { oh->refcnt++; return (oh); } Lck_Unlock(&oh->mtx); } } static void __match_proto__(hash_prep_f) hcb_prep(struct worker *wrk) { struct hcb_y *y; if (wrk->nhashpriv == NULL) { ALLOC_OBJ(y, HCB_Y_MAGIC); AN(y); wrk->nhashpriv = y; } } const struct hash_slinger hcb_slinger = { .magic = SLINGER_MAGIC, .name = "critbit", .start = hcb_start, .lookup = hcb_lookup, .prep = hcb_prep, .deref = hcb_deref, }; varnish-4.1.1/bin/varnishd/proxy/0000755000201500234410000000000012652366757013756 500000000000000varnish-4.1.1/bin/varnishd/proxy/cache_proxy_proto.c0000644000201500234410000002263412652366721017567 00000000000000/*- * Copyright (c) 2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "config.h" #include #include #include #include #include #include #include "../cache/cache.h" #include "vend.h" #include "vsa.h" #include "vtcp.h" /********************************************************************** * PROXY 1 protocol */ static const char vpx1_sig[] = {'P', 'R', 'O', 'X', 'Y'}; static int vpx_proto1(const struct worker *wrk, struct req *req) { const char *fld[5]; int i; char *p, *q; struct addrinfo hints, *res; struct suckaddr *sa; int pfam = -1; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req->sp, SESS_MAGIC); q = strchr(req->htc->rxbuf_b, '\r'); if (q == NULL) return (-1); *q++ = '\0'; /* Nuke the CRLF */ if (*q != '\n') return (-1); *q++ = '\0'; /* Split the fields */ p = req->htc->rxbuf_b; for (i = 0; i < 5; i++) { p = strchr(p, ' '); if (p == NULL) { VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY1: Too few fields"); return (-1); } *p++ = '\0'; fld[i] = p; } if (strchr(p, ' ')) { VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY1: Too many fields"); return (-1); } if (!strcmp(fld[0], "TCP4")) pfam = AF_INET; else if (!strcmp(fld[0], "TCP6")) pfam = AF_INET6; else { VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY1: Wrong TCP[46] field"); return (-1); } memset(&hints, 0, sizeof hints); hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV; i = getaddrinfo(fld[1], fld[3], &hints, &res); if (i != 0) { VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY1: Cannot resolve source address (%s)", gai_strerror(i)); return (-1); } AZ(res->ai_next); if (res->ai_family != pfam) { VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY1: %s got wrong protocol (%d)", fld[0], res->ai_family); freeaddrinfo(res); return (-1); } SES_Reserve_client_addr(req->sp, &sa); AN(VSA_Build(sa, res->ai_addr, res->ai_addrlen)); SES_Set_String_Attr(req->sp, SA_CLIENT_IP, fld[1]); SES_Set_String_Attr(req->sp, SA_CLIENT_PORT, fld[3]); freeaddrinfo(res); i = getaddrinfo(fld[2], fld[4], &hints, &res); if (i != 0) { VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY1: Cannot resolve destination address (%s)", gai_strerror(i)); return (-1); } AZ(res->ai_next); if (res->ai_family != pfam) { VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY1: %s got wrong protocol (%d)", fld[0], res->ai_family); freeaddrinfo(res); return (-1); } SES_Reserve_server_addr(req->sp, &sa); AN(VSA_Build(sa, res->ai_addr, res->ai_addrlen)); freeaddrinfo(res); VSL(SLT_Proxy, req->sp->vxid, "1 %s %s %s %s", fld[1], fld[3], fld[2], fld[4]); req->htc->pipeline_b = q; return (0); } /********************************************************************** * PROXY 2 protocol */ static const char vpx2_sig[] = { '\r', '\n', '\r', '\n', '\0', '\r', '\n', 'Q', 'U', 'I', 'T', '\n', }; static int vpx_proto2(const struct worker *wrk, struct req *req) { int l; const uint8_t *p; sa_family_t pfam = 0xff; struct sockaddr_in sin4; struct sockaddr_in6 sin6; struct suckaddr *sa = NULL; char ha[VTCP_ADDRBUFSIZE]; char pa[VTCP_PORTBUFSIZE]; char hb[VTCP_ADDRBUFSIZE]; char pb[VTCP_PORTBUFSIZE]; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req->sp, SESS_MAGIC); assert(req->htc->rxbuf_e - req->htc->rxbuf_b >= 16L); l = vbe16dec(req->htc->rxbuf_b + 14); assert(req->htc->rxbuf_e - req->htc->rxbuf_b >= 16L + l); req->htc->pipeline_b = req->htc->rxbuf_b + 16L + l; p = (const void *)req->htc->rxbuf_b; /* Version @12 top half */ if ((p[12] >> 4) != 2) { VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY2: bad version (%d)", p[12] >> 4); return (-1); } /* Command @12 bottom half */ switch(p[12] & 0x0f) { case 0x0: /* Local connection from proxy, ignore addresses */ return (0); case 0x1: /* Proxied connection */ break; default: VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY2: bad command (%d)", p[12] & 0x0f); return (-1); } /* Address family & protocol @13 */ switch(p[13]) { case 0x00: /* UNSPEC|UNSPEC, ignore proxy header */ VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY2: Ignoring UNSPEC|UNSPEC addresses"); return (0); case 0x11: /* IPv4|TCP */ pfam = AF_INET; if (l < 12) { VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY2: Ignoring short IPv4 addresses (%d)", l); return (0); } break; case 0x21: /* IPv6|TCP */ pfam = AF_INET6; if (l < 36) { VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY2: Ignoring short IPv6 addresses (%d)", l); return (0); } break; default: /* Ignore proxy header */ VSL(SLT_ProxyGarbage, req->sp->vxid, "PROXY2: Ignoring unsupported protocol (0x%02x)", p[13]); return (0); } switch (pfam) { case AF_INET: memset(&sin4, 0, sizeof sin4); sin4.sin_family = pfam; /* dst/server */ memcpy(&sin4.sin_addr, p + 20, 4); memcpy(&sin4.sin_port, p + 26, 2); SES_Reserve_server_addr(req->sp, &sa); AN(VSA_Build(sa, &sin4, sizeof sin4)); VTCP_name(sa, ha, sizeof ha, pa, sizeof pa); /* src/client */ memcpy(&sin4.sin_addr, p + 16, 4); memcpy(&sin4.sin_port, p + 24, 2); SES_Reserve_client_addr(req->sp, &sa); AN(VSA_Build(sa, &sin4, sizeof sin4)); break; case AF_INET6: memset(&sin6, 0, sizeof sin6); sin6.sin6_family = pfam; /* dst/server */ memcpy(&sin6.sin6_addr, p + 32, 16); memcpy(&sin6.sin6_port, p + 50, 2); SES_Reserve_server_addr(req->sp, &sa); AN(VSA_Build(sa, &sin6, sizeof sin6)); VTCP_name(sa, ha, sizeof ha, pa, sizeof pa); /* src/client */ memcpy(&sin6.sin6_addr, p + 16, 16); memcpy(&sin6.sin6_port, p + 48, 2); SES_Reserve_client_addr(req->sp, &sa); AN(VSA_Build(sa, &sin6, sizeof sin6)); break; default: WRONG("Wrong pfam"); } AN(sa); VTCP_name(sa, hb, sizeof hb, pb, sizeof pb); SES_Set_String_Attr(req->sp, SA_CLIENT_IP, hb); SES_Set_String_Attr(req->sp, SA_CLIENT_PORT, pb); VSL(SLT_Proxy, req->sp->vxid, "2 %s %s %s %s", hb, pb, ha, pa); return (0); } /********************************************************************** * HTC_Rx completion detector */ static enum htc_status_e __match_proto__(htc_complete_f) vpx_complete(struct http_conn *htc) { int i, l, j; char *p, *q; CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); AZ(htc->pipeline_b); AZ(htc->pipeline_e); l = htc->rxbuf_e - htc->rxbuf_b; p = htc->rxbuf_b; j = 0x3; for (i = 0; i < l; i++) { if (i < sizeof vpx1_sig && p[i] != vpx1_sig[i]) j &= ~1; if (i < sizeof vpx2_sig && p[i] != vpx2_sig[i]) j &= ~2; if (j == 0) return (HTC_S_JUNK); if (j == 1 && i == sizeof vpx1_sig) { q = strchr(p + i, '\n'); if (q != NULL && (q - htc->rxbuf_b) > 107) return (HTC_S_OVERFLOW); if (q == NULL) return (HTC_S_MORE); return (HTC_S_COMPLETE); } if (j == 2 && i == sizeof vpx2_sig) { if (l < 16) return (HTC_S_MORE); j = vbe16dec(p + 14); if (l < 16 + j) return (HTC_S_MORE); return (HTC_S_COMPLETE); } } return (HTC_S_MORE); } void __match_proto__(task_func_t) VPX_Proto_Sess(struct worker *wrk, void *priv) { struct req *req; struct sess *sp; enum htc_status_e hs; char *p; int i; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CAST_OBJ_NOTNULL(req, priv, REQ_MAGIC); sp = req->sp; /* Per specification */ assert(sizeof vpx1_sig == 5); assert(sizeof vpx2_sig == 12); hs = SES_RxStuff(req->htc, vpx_complete, NULL, NULL, NAN, sp->t_idle + cache_param->timeout_idle); XXXAZ(req->htc->ws->r); if (hs != HTC_S_COMPLETE) { Req_Release(req); SES_Delete(sp, SC_RX_JUNK, NAN); return; } p = req->htc->rxbuf_b; if (p[0] == vpx1_sig[0]) i = vpx_proto1(wrk, req); else if (p[0] == vpx2_sig[0]) i = vpx_proto2(wrk, req); else WRONG("proxy sig mismatch"); if (i) { Req_Release(req); SES_Delete(sp, SC_RX_JUNK, NAN); return; } if (req->htc->rxbuf_e == req->htc->pipeline_b) req->htc->pipeline_b = NULL; else req->htc->pipeline_e = req->htc->rxbuf_e; SES_RxReInit(req->htc); req->sp->sess_step = S_STP_H1NEWREQ; wrk->task.func = SES_Proto_Req; wrk->task.priv = req; } varnish-4.1.1/bin/varnishd/waiter/0000755000201500234410000000000012652366757014070 500000000000000varnish-4.1.1/bin/varnishd/waiter/mgt_waiter.h0000644000201500234410000000354112652366721016315 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Private interfaces */ struct waiter_impl; /* mgt_waiter.c */ extern struct waiter_impl const * waiter; #if defined(HAVE_EPOLL_CTL) extern const struct waiter_impl waiter_epoll; #endif #if defined(HAVE_KQUEUE) extern const struct waiter_impl waiter_kqueue; #endif #if defined(HAVE_PORT_CREATE) extern const struct waiter_impl waiter_ports; #endif extern const struct waiter_impl waiter_poll; void Wait_config(const char *arg); varnish-4.1.1/bin/varnishd/waiter/mgt_waiter.c0000644000201500234410000000405712652366721016313 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ #include "config.h" #include #include #include #include "mgt/mgt.h" #include "waiter/mgt_waiter.h" static const struct choice waiter_choice[] = { #if defined(HAVE_KQUEUE) { "kqueue", &waiter_kqueue }, #endif #if defined(HAVE_EPOLL_CTL) { "epoll", &waiter_epoll }, #endif #if defined(HAVE_PORT_CREATE) { "ports", &waiter_ports }, #endif { "poll", &waiter_poll }, { NULL, NULL} }; struct waiter_impl const *waiter; void Wait_config(const char *arg) { ASSERT_MGT(); if (arg != NULL) waiter = pick(waiter_choice, arg, "waiter"); else waiter = waiter_choice[0].ptr; } varnish-4.1.1/bin/varnishd/waiter/cache_waiter.c0000644000201500234410000001137412652366721016567 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "config.h" #include #include #include #include "binary_heap.h" #include "cache/cache.h" #include "waiter/waiter_priv.h" #include "waiter/mgt_waiter.h" static int __match_proto__(binheap_cmp_t) waited_cmp(void *priv, const void *a, const void *b) { const struct waiter *ww; const struct waited *aa, *bb; CAST_OBJ_NOTNULL(ww, priv, WAITER_MAGIC); CAST_OBJ_NOTNULL(aa, a, WAITED_MAGIC); CAST_OBJ_NOTNULL(bb, b, WAITED_MAGIC); return (Wait_When(aa) < Wait_When(bb)); } static void __match_proto__(binheap_update_t) waited_update(void *priv, void *p, unsigned u) { struct waited *pp; (void)priv; CAST_OBJ_NOTNULL(pp, p, WAITED_MAGIC); pp->idx = u; } /**********************************************************************/ void Wait_Call(const struct waiter *w, struct waited *wp, enum wait_event ev, double now) { CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC); CHECK_OBJ_NOTNULL(wp->waitfor, WAITFOR_MAGIC); AN(wp->waitfor->func); assert(wp->idx == BINHEAP_NOIDX); wp->waitfor->func(wp, ev, now); } /**********************************************************************/ void Wait_HeapInsert(const struct waiter *w, struct waited *wp) { CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC); assert(wp->idx == BINHEAP_NOIDX); binheap_insert(w->heap, wp); } /* * XXX: wp is const because otherwise FlexeLint complains. However, *wp * XXX: will actually change as a result of calling this function, via * XXX: the pointer stored in the bin-heap. I can see how this const * XXX: could maybe confuse a compilers optimizer, but I do not expect * XXX: any harm to come from it. Caveat Emptor. */ void Wait_HeapDelete(const struct waiter *w, const struct waited *wp) { CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC); if (wp->idx != BINHEAP_NOIDX) binheap_delete(w->heap, wp->idx); } double Wait_HeapDue(const struct waiter *w, struct waited **wpp) { struct waited *wp; wp = binheap_root(w->heap); CHECK_OBJ_ORNULL(wp, WAITED_MAGIC); if (wp == NULL) { if (wpp != NULL) *wpp = NULL; return (0); } if (wpp != NULL) *wpp = wp; return(Wait_When(wp)); } /**********************************************************************/ int Wait_Enter(const struct waiter *w, struct waited *wp) { CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC); assert(wp->fd > 0); // stdin never comes here CHECK_OBJ_NOTNULL(wp->waitfor, WAITFOR_MAGIC); wp->idx = BINHEAP_NOIDX; return (w->impl->enter(w->priv, wp)); } /**********************************************************************/ const char * Waiter_GetName(void) { if (waiter != NULL) return (waiter->name); else return ("(No Waiter?)"); } struct waiter * Waiter_New(void) { struct waiter *w; AN(waiter); AN(waiter->name); AN(waiter->init); AN(waiter->enter); AN(waiter->fini); w = calloc(1, sizeof (struct waiter) + waiter->size); AN(w); INIT_OBJ(w, WAITER_MAGIC); w->priv = (void*)(w + 1); w->impl = waiter; VTAILQ_INIT(&w->waithead); w->heap = binheap_new(w, waited_cmp, waited_update); waiter->init(w); return (w); } void Waiter_Destroy(struct waiter **wp) { struct waiter *w; AN(wp); w = *wp; *wp = NULL; CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); AZ(binheap_root(w->heap)); AN(w->impl->fini); w->impl->fini(w); FREE_OBJ(w); } varnish-4.1.1/bin/varnishd/waiter/waiter.h0000644000201500234410000000517412652366721015452 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Waiters are herders of connections: They monitor a large number of * connections and react if data arrives, the connection is closed or * if nothing happens for a specified timeout period. * * The "poll" waiter should be portable to just about anything, but it * is not very efficient because it has to setup state on each call to * poll(2). Almost all kernels have made better facilities for that * reason, needless to say, each with its own NIH-controlled API: * * - kqueue on FreeBSD * - epoll on Linux * - ports on Solaris * * Public interfaces */ struct waited; struct waiter; enum wait_event { WAITER_REMCLOSE, WAITER_TIMEOUT, WAITER_ACTION, WAITER_CLOSE }; typedef void waiter_handle_f(struct waited *, enum wait_event, double now); struct waitfor { unsigned magic; #define WAITFOR_MAGIC 0x16b79246 waiter_handle_f *func; volatile double *tmo; }; struct waited { unsigned magic; #define WAITED_MAGIC 0x1743992d int fd; unsigned idx; void *ptr; const struct waitfor *waitfor; double idle; }; /* cache_waiter.c */ int Wait_Enter(const struct waiter *, struct waited *); struct waiter *Waiter_New(void); void Waiter_Destroy(struct waiter **); const char *Waiter_GetName(void); varnish-4.1.1/bin/varnishd/waiter/cache_waiter_kqueue.c0000644000201500234410000001300312652366721020135 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ #include "config.h" #if defined(HAVE_KQUEUE) #include #include #include #include #include "cache/cache.h" #include "waiter/waiter_priv.h" #include "waiter/mgt_waiter.h" #include "vtim.h" #define NKEV 256 struct vwk { unsigned magic; #define VWK_MAGIC 0x1cc2acc2 int kq; struct waiter *waiter; pthread_t thread; double next; int pipe[2]; unsigned nwaited; int die; struct lock mtx; }; /*--------------------------------------------------------------------*/ static void * vwk_thread(void *priv) { struct vwk *vwk; struct kevent ke[NKEV], *kp; int j, n; double now, then; struct timespec ts; struct waited *wp; struct waiter *w; char c; CAST_OBJ_NOTNULL(vwk, priv, VWK_MAGIC); w = vwk->waiter; CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); THR_SetName("cache-kqueue"); now = VTIM_real(); while (1) { while (1) { Lck_Lock(&vwk->mtx); /* * XXX: We could avoid many syscalls here if we were * XXX: allowed to just close the fd's on timeout. */ then = Wait_HeapDue(w, &wp); if (wp == NULL) { vwk->next = now + 100; break; } else if (then > now) { vwk->next = then; break; } CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC); EV_SET(ke, wp->fd, EVFILT_READ, EV_DELETE, 0, 0, NULL); AZ(kevent(vwk->kq, ke, 1, NULL, 0, NULL)); Wait_HeapDelete(w, wp); Lck_Unlock(&vwk->mtx); Wait_Call(w, wp, WAITER_TIMEOUT, now); } then = vwk->next - now; ts.tv_sec = (time_t)floor(then); ts.tv_nsec = (long)(1e9 * (then - ts.tv_sec)); Lck_Unlock(&vwk->mtx); n = kevent(vwk->kq, NULL, 0, ke, NKEV, &ts); assert(n >= 0); assert(n <= NKEV); now = VTIM_real(); for (kp = ke, j = 0; j < n; j++, kp++) { assert(kp->filter == EVFILT_READ); if (ke[j].udata == vwk) { assert(read(vwk->pipe[0], &c, 1) == 1); continue; } CAST_OBJ_NOTNULL(wp, ke[j].udata, WAITED_MAGIC); Lck_Lock(&vwk->mtx); Wait_HeapDelete(w, wp); Lck_Unlock(&vwk->mtx); vwk->nwaited--; if (kp->flags & EV_EOF) Wait_Call(w, wp, WAITER_REMCLOSE, now); else Wait_Call(w, wp, WAITER_ACTION, now); } if (vwk->nwaited == 0 && vwk->die) break; } AZ(close(vwk->pipe[0])); AZ(close(vwk->pipe[1])); AZ(close(vwk->kq)); return(NULL); } /*--------------------------------------------------------------------*/ static int __match_proto__(waiter_enter_f) vwk_enter(void *priv, struct waited *wp) { struct vwk *vwk; struct kevent ke; CAST_OBJ_NOTNULL(vwk, priv, VWK_MAGIC); EV_SET(&ke, wp->fd, EVFILT_READ, EV_ADD|EV_ONESHOT, 0, 0, wp); Lck_Lock(&vwk->mtx); vwk->nwaited++; Wait_HeapInsert(vwk->waiter, wp); AZ(kevent(vwk->kq, &ke, 1, NULL, 0, NULL)); /* If the kqueue isn't due before our timeout, poke it via the pipe */ if (Wait_When(wp) < vwk->next) assert(write(vwk->pipe[1], "X", 1) == 1); Lck_Unlock(&vwk->mtx); return(0); } /*--------------------------------------------------------------------*/ static void __match_proto__(waiter_init_f) vwk_init(struct waiter *w) { struct vwk *vwk; struct kevent ke; CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); vwk = w->priv; INIT_OBJ(vwk, VWK_MAGIC); vwk->waiter = w; vwk->kq = kqueue(); assert(vwk->kq >= 0); Lck_New(&vwk->mtx, lck_waiter); AZ(pipe(vwk->pipe)); EV_SET(&ke, vwk->pipe[0], EVFILT_READ, EV_ADD, 0, 0, vwk); AZ(kevent(vwk->kq, &ke, 1, NULL, 0, NULL)); AZ(pthread_create(&vwk->thread, NULL, vwk_thread, vwk)); } /*-------------------------------------------------------------------- * It is the callers responsibility to trigger all fd's waited on to * fail somehow. */ static void __match_proto__(waiter_fini_f) vwk_fini(struct waiter *w) { struct vwk *vwk; void *vp; CAST_OBJ_NOTNULL(vwk, w->priv, VWK_MAGIC); Lck_Lock(&vwk->mtx); vwk->die = 1; assert(write(vwk->pipe[1], "Y", 1) == 1); Lck_Unlock(&vwk->mtx); AZ(pthread_join(vwk->thread, &vp)); Lck_Delete(&vwk->mtx); } /*--------------------------------------------------------------------*/ const struct waiter_impl waiter_kqueue = { .name = "kqueue", .init = vwk_init, .fini = vwk_fini, .enter = vwk_enter, .size = sizeof(struct vwk), }; #endif /* defined(HAVE_KQUEUE) */ varnish-4.1.1/bin/varnishd/waiter/waiter_priv.h0000644000201500234410000000543012652366721016505 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Private interfaces */ struct waited; struct binheap; struct waiter { unsigned magic; #define WAITER_MAGIC 0x17c399db const struct waiter_impl *impl; VTAILQ_ENTRY(waiter) list; VTAILQ_HEAD(,waited) waithead; void *priv; struct binheap *heap; }; typedef void waiter_init_f(struct waiter *); typedef void waiter_fini_f(struct waiter *); typedef int waiter_enter_f(void *priv, struct waited *); typedef void waiter_inject_f(const struct waiter *, struct waited *); typedef void waiter_evict_f(const struct waiter *, struct waited *); struct waiter_impl { const char *name; waiter_init_f *init; waiter_fini_f *fini; waiter_enter_f *enter; waiter_inject_f *inject; size_t size; }; static inline double Wait_Tmo(const struct waited *wp) { CHECK_OBJ_ORNULL(wp, WAITED_MAGIC); CHECK_OBJ_NOTNULL(wp->waitfor, WAITFOR_MAGIC); AN(wp->waitfor->tmo); return (*wp->waitfor->tmo); } static inline double Wait_When(const struct waited *wp) { CHECK_OBJ_ORNULL(wp, WAITED_MAGIC); CHECK_OBJ_NOTNULL(wp->waitfor, WAITFOR_MAGIC); return (wp->idle + *wp->waitfor->tmo); } void Wait_Call(const struct waiter *, struct waited *, enum wait_event ev, double now); void Wait_HeapInsert(const struct waiter *, struct waited *); void Wait_HeapDelete(const struct waiter *, const struct waited *); double Wait_HeapDue(const struct waiter *, struct waited **); varnish-4.1.1/bin/varnishd/waiter/cache_waiter_ports.c0000644000201500234410000001646112652366721020020 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006 Varnish Software AS * Copyright (c) 2007 OmniTI Computer Consulting, Inc. * Copyright (c) 2007 Theo Schlossnagle * Copyright (c) 2010-2015 UPLEX, Nils Goroll * All rights reserved. * * 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. * * On concurrency: * * There are several options for the enter method to add an fd for the waiter * thread to look after: * * - share the binheap (requiring a mutex) - implemented for epoll and kqueues * * - send events to be entered through the events interface and keep the binheap * private to the waiter thread - implemented here. * * - some other message passing / mailbox * * It has not yet been determined which option is best. In the best case, by * sharing the binheap, we can save two port syscalls - but not always: * * - if the waited event has a timeout earlier than the first element on the * binheap, we need to kick the waiter thread anyway * * - if the waiter thread is busy, it will get the passed waited event together * with other events * * on the other end we need to sync on the mtx to protect the binheap. Solaris * uses userland adaptive mutexes: if the thread holding the lock is running, * spinlock, otherwise syscall. * * and the critical section for the mtx is basically "whenever not blocking in * port_getn", which does not sound too good with respect to scalability. * * At any rate, we could save even more syscalls by increasing nevents * (port_getn returns when nevents exist or the timeout is reached). This would * increase our latency reacting on POLLIN events. * */ #include "config.h" #if defined(HAVE_PORT_CREATE) #include #include #include #include #include #include "cache/cache.h" #include "waiter/waiter_priv.h" #include "waiter/mgt_waiter.h" #include "vtim.h" // XXX replace with process.max-port-events bound to a sensible maximum #define MAX_EVENTS 256 struct vws { unsigned magic; #define VWS_MAGIC 0x0b771473 struct waiter *waiter; pthread_t thread; double next; int dport; unsigned nwaited; int die; }; static inline void vws_add(struct vws *vws, int fd, void *data) { // POLLIN should be all we need here AZ(port_associate(vws->dport, PORT_SOURCE_FD, fd, POLLIN, data)); } static inline void vws_del(struct vws *vws, int fd) { port_dissociate(vws->dport, PORT_SOURCE_FD, fd); } static inline void vws_port_ev(struct vws *vws, struct waiter *w, port_event_t *ev, double now) { struct waited *wp; if(ev->portev_source == PORT_SOURCE_USER) { CAST_OBJ_NOTNULL(wp, ev->portev_user, WAITED_MAGIC); assert(wp->fd >= 0); vws->nwaited++; Wait_HeapInsert(vws->waiter, wp); vws_add(vws, wp->fd, wp); } else { assert(ev->portev_source == PORT_SOURCE_FD); CAST_OBJ_NOTNULL(wp, ev->portev_user, WAITED_MAGIC); assert(wp->fd >= 0); vws->nwaited--; /* * port_getn does not implicitly disassociate * * Ref: http://opensolaris.org/jive/thread.jspa?\ * threadID=129476&tstart=0 */ vws_del(vws, wp->fd); Wait_HeapDelete(w, wp); Wait_Call(w, wp, ev->portev_events & POLLERR ? WAITER_REMCLOSE : WAITER_ACTION, now); } } static void * vws_thread(void *priv) { struct waited *wp; struct waiter *w; struct vws *vws; double now, then; struct timespec ts; const double max_t = 100.0; port_event_t ev[MAX_EVENTS]; u_int nevents; int ei, ret; CAST_OBJ_NOTNULL(vws, priv, VWS_MAGIC); w = vws->waiter; CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); THR_SetName("cache-ports"); now = VTIM_real(); while (!vws->die) { while (1) { then = Wait_HeapDue(w, &wp); if (wp == NULL) { vws->next = now + max_t; break; } else if (then > now) { vws->next = then; break; } CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC); vws_del(vws, wp->fd); Wait_Call(w, wp, WAITER_TIMEOUT, now); } then = vws->next - now; ts.tv_sec = (time_t)floor(then); ts.tv_nsec = (long)(1e9 * (then - ts.tv_sec)); /* * min number of events we accept. could consider to scale up * for efficiency, but as we always get all waiting events up to * the maximum, we'd only optimize the idle case sacrificing * some latency */ nevents = 1; /* * see disucssion in * - https://issues.apache.org/bugzilla/show_bug.cgi?id=47645 * - http://mail.opensolaris.org/pipermail/\ * networking-discuss/2009-August/011979.html * * comment from apr/poll/unix/port.c : * * This confusing API can return an event at the same time * that it reports EINTR or ETIME. * */ ret = port_getn(vws->dport, ev, MAX_EVENTS, &nevents, &ts); now = VTIM_real(); if (ret < 0 && errno == EBADF) { /* close on dport is our stop signal */ AN(vws->die); break; } if (ret < 0) assert((errno == EINTR) || (errno == ETIME)); for (ei = 0; ei < nevents; ei++) vws_port_ev(vws, w, &ev[ei], now); } return NULL; } /*--------------------------------------------------------------------*/ static int vws_enter(void *priv, struct waited *wp) { int r; struct vws *vws; CAST_OBJ_NOTNULL(vws, priv, VWS_MAGIC); r = port_send(vws->dport, 0, TRUST_ME(wp)); if (r == -1 && errno == EAGAIN) return (-1); AZ(r); return (0); } /*--------------------------------------------------------------------*/ static void __match_proto__(waiter_init_f) vws_init(struct waiter *w) { struct vws *vws; CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); vws = w->priv; INIT_OBJ(vws, VWS_MAGIC); vws->waiter = w; vws->dport = port_create(); assert(vws->dport >= 0); AZ(pthread_create(&vws->thread, NULL, vws_thread, vws)); } /*--------------------------------------------------------------------*/ static void __match_proto__(waiter_fini_f) vws_fini(struct waiter *w) { struct vws *vws; void *vp; CAST_OBJ_NOTNULL(vws, w->priv, VWS_MAGIC); vws->die = 1; AZ(close(vws->dport)); AZ(pthread_join(vws->thread, &vp)); } /*--------------------------------------------------------------------*/ const struct waiter_impl waiter_ports = { .name = "ports", .init = vws_init, .fini = vws_fini, .enter = vws_enter, .size = sizeof(struct vws), }; #endif /* defined(HAVE_PORT_CREATE) */ varnish-4.1.1/bin/varnishd/waiter/cache_waiter_poll.c0000644000201500234410000001575612652366721017625 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ #include "config.h" #include #include #include #include "cache/cache.h" #include "waiter/waiter_priv.h" #include "waiter/mgt_waiter.h" #include "vtim.h" struct vwp { unsigned magic; #define VWP_MAGIC 0x4b2cc735 struct waiter *waiter; int pipes[2]; pthread_t thread; struct pollfd *pollfd; struct waited **idx; size_t npoll; size_t hpoll; }; /*-------------------------------------------------------------------- * It would make much more sense to not use two large vectors, but * the poll(2) API forces us to use at least one, so ... KISS. */ static void vwp_extend_pollspace(struct vwp *vwp) { size_t inc; if (vwp->npoll < (1<<12)) inc = (1<<10); else if (vwp->npoll < (1<<14)) inc = (1<<12); else if (vwp->npoll < (1<<16)) inc = (1<<14); else inc = (1<<16); VSL(SLT_Debug, 0, "Acceptor poll space increased by %zu to %zu", inc, vwp->npoll + inc); vwp->pollfd = realloc(vwp->pollfd, (vwp->npoll + inc) * sizeof(*vwp->pollfd)); AN(vwp->pollfd); memset(vwp->pollfd + vwp->npoll, 0, inc * sizeof(*vwp->pollfd)); vwp->idx = realloc(vwp->idx, (vwp->npoll + inc) * sizeof(*vwp->idx)); AN(vwp->idx); memset(vwp->idx + vwp->npoll, 0, inc * sizeof(*vwp->idx)); for (; inc > 0; inc--) vwp->pollfd[vwp->npoll++].fd = -1; } /*--------------------------------------------------------------------*/ static void vwp_add(struct vwp *vwp, struct waited *wp) { VSL(SLT_Debug, wp->fd, "ADD"); CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC); CHECK_OBJ_NOTNULL(vwp, VWP_MAGIC); if (vwp->hpoll == vwp->npoll) vwp_extend_pollspace(vwp); assert(vwp->hpoll < vwp->npoll); assert(vwp->pollfd[vwp->hpoll].fd == -1); AZ(vwp->idx[vwp->hpoll]); vwp->pollfd[vwp->hpoll].fd = wp->fd; vwp->pollfd[vwp->hpoll].events = POLLIN; vwp->idx[vwp->hpoll] = wp; vwp->hpoll++; Wait_HeapInsert(vwp->waiter, wp); } static void vwp_del(struct vwp *vwp, int n) { vwp->hpoll--; if (n != vwp->hpoll) { vwp->pollfd[n] = vwp->pollfd[vwp->hpoll]; vwp->idx[n] = vwp->idx[vwp->hpoll]; } VSL(SLT_Debug, vwp->pollfd[vwp->hpoll].fd, "DEL"); memset(&vwp->pollfd[vwp->hpoll], 0, sizeof(*vwp->pollfd)); vwp->pollfd[vwp->hpoll].fd = -1; vwp->idx[vwp->hpoll] = NULL; } /*--------------------------------------------------------------------*/ static void vwp_dopipe(struct vwp *vwp) { struct waited *w[128]; ssize_t ss; int i; ss = read(vwp->pipes[0], w, sizeof w); assert(ss > 0); i = 0; while (ss) { if (w[i] == NULL) { assert(ss == sizeof w[0]); assert(vwp->hpoll == 1); pthread_exit(NULL); } CHECK_OBJ_NOTNULL(w[i], WAITED_MAGIC); assert(w[i]->fd > 0); // no stdin vwp_add(vwp, w[i++]); ss -= sizeof w[0]; } } /*--------------------------------------------------------------------*/ static void * vwp_main(void *priv) { int v; struct vwp *vwp; struct waiter *w; struct waited *wp; double now, then; int i; THR_SetName("cache-poll"); CAST_OBJ_NOTNULL(vwp, priv, VWP_MAGIC); w = vwp->waiter; while (1) { then = Wait_HeapDue(w, &wp); if (wp == NULL) i = -1; else i = (int)floor(1e3 * (then - VTIM_real())); assert(vwp->hpoll > 0); AN(vwp->pollfd); v = poll(vwp->pollfd, vwp->hpoll, i); assert(v >= 0); now = VTIM_real(); if (vwp->pollfd[0].revents) v--; for (i = 1; i < vwp->hpoll;) { VSL(SLT_Debug, vwp->pollfd[i].fd, "POLL loop i=%d revents=0x%x", i, vwp->pollfd[i].revents); assert(vwp->pollfd[i].fd != vwp->pipes[0]); wp = vwp->idx[i]; CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC); if (v == 0 && Wait_HeapDue(w, NULL) > now) break; if (vwp->pollfd[i].revents) v--; then = Wait_When(wp); if (then <= now) { Wait_HeapDelete(w, wp); Wait_Call(w, wp, WAITER_TIMEOUT, now); vwp_del(vwp, i); } else if (vwp->pollfd[i].revents & POLLIN) { assert(wp->fd > 0); assert(wp->fd == vwp->pollfd[i].fd); Wait_HeapDelete(w, wp); Wait_Call(w, wp, WAITER_ACTION, now); vwp_del(vwp, i); } else { i++; } } if (vwp->pollfd[0].revents) vwp_dopipe(vwp); } NEEDLESS_RETURN(NULL); } /*--------------------------------------------------------------------*/ static int __match_proto__(waiter_enter_f) vwp_enter(void *priv, struct waited *wp) { struct vwp *vwp; CAST_OBJ_NOTNULL(vwp, priv, VWP_MAGIC); if (write(vwp->pipes[1], &wp, sizeof wp) != sizeof wp) return (-1); return (0); } /*--------------------------------------------------------------------*/ static void __match_proto__(waiter_init_f) vwp_init(struct waiter *w) { struct vwp *vwp; CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); vwp = w->priv; INIT_OBJ(vwp, VWP_MAGIC); vwp->waiter = w; AZ(pipe(vwp->pipes)); // XXX: set write pipe non-blocking vwp->hpoll = 1; vwp_extend_pollspace(vwp); vwp->pollfd[0].fd = vwp->pipes[0]; vwp->pollfd[0].events = POLLIN; AZ(pthread_create(&vwp->thread, NULL, vwp_main, vwp)); } /*-------------------------------------------------------------------- * It is the callers responsibility to trigger all fd's waited on to * fail somehow. */ static void __match_proto__(waiter_fini_f) vwp_fini(struct waiter *w) { struct vwp *vwp; void *vp; CAST_OBJ_NOTNULL(vwp, w->priv, VWP_MAGIC); vp = NULL; while (vwp->hpoll > 1) (void)usleep(100000); // XXX: set write pipe blocking assert(write(vwp->pipes[1], &vp, sizeof vp) == sizeof vp); AZ(pthread_join(vwp->thread, &vp)); AZ(close(vwp->pipes[0])); AZ(close(vwp->pipes[1])); free(vwp->pollfd); free(vwp->idx); } /*--------------------------------------------------------------------*/ const struct waiter_impl waiter_poll = { .name = "poll", .init = vwp_init, .fini = vwp_fini, .enter = vwp_enter, .size = sizeof(struct vwp), }; varnish-4.1.1/bin/varnishd/waiter/cache_waiter_epoll.c0000644000201500234410000001412312652366721017755 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 Varnish Software AS * All rights reserved. * * Author: Rogerio Carvalho Schneider * * 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. * * XXX: We need to pass sessions back into the event engine when they are * reused. Not sure what the most efficient way is for that. For now * write the session pointer to a pipe which the event engine monitors. */ #include "config.h" #if defined(HAVE_EPOLL_CTL) #include #include #include #include "cache/cache.h" #include "waiter/waiter_priv.h" #include "waiter/mgt_waiter.h" #include "vtim.h" #include "vfil.h" #ifndef EPOLLRDHUP # define EPOLLRDHUP 0 #endif #define NEEV 8192 struct vwe { unsigned magic; #define VWE_MAGIC 0x6bd73424 int epfd; struct waiter *waiter; pthread_t thread; double next; int pipe[2]; unsigned nwaited; int die; struct lock mtx; }; /*--------------------------------------------------------------------*/ static void * vwe_thread(void *priv) { struct epoll_event ev[NEEV], *ep; struct waited *wp; struct waiter *w; double now, then; int i, n; struct vwe *vwe; char c; CAST_OBJ_NOTNULL(vwe, priv, VWE_MAGIC); w = vwe->waiter; CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); THR_SetName("cache-epoll"); now = VTIM_real(); while (1) { while (1) { Lck_Lock(&vwe->mtx); /* * XXX: We could avoid many syscalls here if we were * XXX: allowed to just close the fd's on timeout. */ then = Wait_HeapDue(w, &wp); if (wp == NULL) { vwe->next = now + 100; break; } else if (then > now) { vwe->next = then; break; } CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC); AZ(epoll_ctl(vwe->epfd, EPOLL_CTL_DEL, wp->fd, NULL)); vwe->nwaited--; Wait_HeapDelete(w, wp); Lck_Unlock(&vwe->mtx); Wait_Call(w, wp, WAITER_TIMEOUT, now); } then = vwe->next - now; i = (int)ceil(1e3 * then); assert(i > 0); Lck_Unlock(&vwe->mtx); do { /* Due to a linux kernel bug, epoll_wait can return EINTR when the process is subjected to ptrace or waking from OS suspend. */ n = epoll_wait(vwe->epfd, ev, NEEV, i); } while (n < 0 && errno == EINTR); assert(n >= 0); assert(n <= NEEV); now = VTIM_real(); for (ep = ev, i = 0; i < n; i++, ep++) { if (ep->data.ptr == vwe) { assert(read(vwe->pipe[0], &c, 1) == 1); continue; } CAST_OBJ_NOTNULL(wp, ep->data.ptr, WAITED_MAGIC); Lck_Lock(&vwe->mtx); Wait_HeapDelete(w, wp); Lck_Unlock(&vwe->mtx); AZ(epoll_ctl(vwe->epfd, EPOLL_CTL_DEL, wp->fd, NULL)); vwe->nwaited--; if (ep->events & EPOLLIN) Wait_Call(w, wp, WAITER_ACTION, now); else if (ep->events & EPOLLERR) Wait_Call(w, wp, WAITER_REMCLOSE, now); else if (ep->events & EPOLLHUP) Wait_Call(w, wp, WAITER_REMCLOSE, now); else Wait_Call(w, wp, WAITER_REMCLOSE, now); } if (vwe->nwaited == 0 && vwe->die) break; } AZ(close(vwe->pipe[0])); AZ(close(vwe->pipe[1])); AZ(close(vwe->epfd)); return (NULL); } /*--------------------------------------------------------------------*/ static int __match_proto__(waiter_enter_f) vwe_enter(void *priv, struct waited *wp) { struct vwe *vwe; struct epoll_event ee; CAST_OBJ_NOTNULL(vwe, priv, VWE_MAGIC); ee.events = EPOLLIN | EPOLLRDHUP; ee.data.ptr = wp; Lck_Lock(&vwe->mtx); vwe->nwaited++; Wait_HeapInsert(vwe->waiter, wp); AZ(epoll_ctl(vwe->epfd, EPOLL_CTL_ADD, wp->fd, &ee)); /* If the epoll isn't due before our timeout, poke it via the pipe */ if (Wait_When(wp) < vwe->next) assert(write(vwe->pipe[1], "X", 1) == 1); Lck_Unlock(&vwe->mtx); return(0); } /*--------------------------------------------------------------------*/ static void __match_proto__(waiter_init_f) vwe_init(struct waiter *w) { struct vwe *vwe; struct epoll_event ee; CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); vwe = w->priv; INIT_OBJ(vwe, VWE_MAGIC); vwe->waiter = w; vwe->epfd = epoll_create(1); assert(vwe->epfd >= 0); Lck_New(&vwe->mtx, lck_waiter); AZ(pipe(vwe->pipe)); ee.events = EPOLLIN | EPOLLRDHUP; ee.data.ptr = vwe; AZ(epoll_ctl(vwe->epfd, EPOLL_CTL_ADD, vwe->pipe[0], &ee)); AZ(pthread_create(&vwe->thread, NULL, vwe_thread, vwe)); } /*-------------------------------------------------------------------- * It is the callers responsibility to trigger all fd's waited on to * fail somehow. */ static void __match_proto__(waiter_fini_f) vwe_fini(struct waiter *w) { struct vwe *vwe; void *vp; CAST_OBJ_NOTNULL(vwe, w->priv, VWE_MAGIC); Lck_Lock(&vwe->mtx); vwe->die = 1; assert(write(vwe->pipe[1], "Y", 1) == 1); Lck_Unlock(&vwe->mtx); AZ(pthread_join(vwe->thread, &vp)); Lck_Delete(&vwe->mtx); } /*--------------------------------------------------------------------*/ const struct waiter_impl waiter_epoll = { .name = "epoll", .init = vwe_init, .fini = vwe_fini, .enter = vwe_enter, .size = sizeof(struct vwe), }; #endif /* defined(HAVE_EPOLL_CTL) */ varnish-4.1.1/bin/varnishd/Makefile.am0000644000201500234410000000765312652366721014553 00000000000000# AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/lib/libvgz \ -I$(top_builddir)/bin/varnishd \ -I$(top_builddir)/include sbin_PROGRAMS = varnishd varnishd_SOURCES = \ cache/cache_acceptor.c \ cache/cache_backend.c \ cache/cache_backend_cfg.c \ cache/cache_backend_probe.c \ cache/cache_backend_tcp.c \ cache/cache_ban.c \ cache/cache_ban_build.c \ cache/cache_ban_lurker.c \ cache/cache_busyobj.c \ cache/cache_cli.c \ cache/cache_deliver_proc.c \ cache/cache_director.c \ cache/cache_esi_deliver.c \ cache/cache_esi_fetch.c \ cache/cache_esi_parse.c \ cache/cache_expire.c \ cache/cache_fetch.c \ cache/cache_fetch_proc.c \ cache/cache_gzip.c \ cache/cache_hash.c \ cache/cache_http.c \ cache/cache_lck.c \ cache/cache_main.c \ cache/cache_mempool.c \ cache/cache_obj.c \ cache/cache_panic.c \ cache/cache_pool.c \ cache/cache_req.c \ cache/cache_req_body.c \ cache/cache_req_fsm.c \ cache/cache_rfc2616.c \ cache/cache_range.c \ cache/cache_session.c \ cache/cache_shmlog.c \ cache/cache_vary.c \ cache/cache_vcl.c \ cache/cache_vrt.c \ cache/cache_vrt_priv.c \ cache/cache_vrt_re.c \ cache/cache_vrt_var.c \ cache/cache_vrt_vmod.c \ cache/cache_wrk.c \ cache/cache_ws.c \ common/common_vsm.c \ common/common_vsc.c \ hash/hash_classic.c \ hash/hash_critbit.c \ hash/mgt_hash.c \ hash/hash_simple_list.c \ http1/cache_http1_deliver.c \ http1/cache_http1_fetch.c \ http1/cache_http1_fsm.c \ http1/cache_http1_line.c \ http1/cache_http1_pipe.c \ http1/cache_http1_proto.c \ http1/cache_http1_vfp.c \ mgt/mgt_acceptor.c \ mgt/mgt_child.c \ mgt/mgt_cli.c \ mgt/mgt_jail.c \ mgt/mgt_jail_unix.c \ mgt/mgt_jail_solaris.c \ mgt/mgt_main.c \ 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_shmem.c \ mgt/mgt_vcc.c \ mgt/mgt_vcl.c \ proxy/cache_proxy_proto.c \ storage/stevedore.c \ storage/mgt_stevedore.c \ storage/stevedore_utils.c \ storage/storage_file.c \ storage/storage_malloc.c \ storage/storage_persistent.c \ storage/mgt_storage_persistent.c \ storage/storage_persistent_silo.c \ storage/storage_persistent_subr.c \ storage/storage_umem.c \ waiter/mgt_waiter.c \ waiter/cache_waiter.c \ waiter/cache_waiter_epoll.c \ waiter/cache_waiter_kqueue.c \ waiter/cache_waiter_poll.c \ waiter/cache_waiter_ports.c noinst_HEADERS = \ builtin_vcl.h \ cache/cache_ban.h \ cache/cache_esi.h \ cache/cache_pool.h \ cache/cache_priv.h \ common/heritage.h \ hash/hash_slinger.h \ http1/cache_http1.h \ mgt/mgt.h \ mgt/mgt_cli.h \ mgt/mgt_param.h \ storage/storage.h \ storage/storage_persistent.h \ waiter/waiter_priv.h \ waiter/mgt_waiter.h # Headers for use with vmods nobase_pkginclude_HEADERS = \ cache/cache.h \ cache/cache_filter.h \ cache/cache_backend.h \ cache/cache_director.h \ common/common.h \ common/params.h \ waiter/waiter.h varnishd_CFLAGS = \ @PCRE_CFLAGS@ \ -DVARNISHD_IS_NOT_A_VMOD \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' \ -DVARNISH_VMOD_DIR='"${pkglibdir}/vmods"' \ -DVARNISH_VCL_DIR='"${varnishconfdir}"' varnishd_LDFLAGS = -export-dynamic varnishd_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvcc/libvcc.la \ $(top_builddir)/lib/libvgz/libvgz.la \ @JEMALLOC_LDADD@ \ @PCRE_LIBS@ \ ${DL_LIBS} ${PTHREAD_LIBS} ${NET_LIBS} ${LIBM} ${LIBUMEM} EXTRA_DIST = builtin.vcl DISTCLEANFILES = builtin_vcl.h # # Turn the builtin.vcl file into a C-string we can include in the program. # builtin_vcl.h: builtin.vcl echo '/*' > $@ echo ' * NB: This file is machine generated, DO NOT EDIT!' >> $@ echo ' *' >> $@ echo ' * Edit builtin.vcl instead and run make' >> $@ echo ' *' >> $@ echo ' */' >> $@ echo '' >> $@ sed -e 's/"/\\"/g' \ -e 's/$$/\\n"/' \ -e 's/^/ "/' $(srcdir)/builtin.vcl >> $@ # Explicitly record dependency mgt/mgt_vcc.c: builtin_vcl.h varnish-4.1.1/bin/varnishd/http1/0000755000201500234410000000000012652366757013635 500000000000000varnish-4.1.1/bin/varnishd/http1/cache_http1_fsm.c0000644000201500234410000001766412652366721016756 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This file contains the two central state machine for pushing HTTP1 * sessions through their states. * */ #include "config.h" #include #include #include #include "cache/cache.h" #include "cache_http1.h" #include "hash/hash_slinger.h" #include "vtcp.h" static const struct transport http1_transport = { .magic = TRANSPORT_MAGIC, .deliver = V1D_Deliver, }; /*---------------------------------------------------------------------- */ static int http1_dissect(struct worker *wrk, struct req *req) { const char *r_100 = "HTTP/1.1 100 Continue\r\n\r\n"; const char *r_400 = "HTTP/1.1 400 Bad Request\r\n\r\n"; const char *r_417 = "HTTP/1.1 417 Expectation Failed\r\n\r\n"; const char *p; ssize_t r; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); /* Allocate a new vxid now that we know we'll need it. */ AZ(req->vsl->wid); req->vsl->wid = VXID_Get(wrk, VSL_CLIENTMARKER); VSLb(req->vsl, SLT_Begin, "req %u rxreq", VXID(req->sp->vxid)); VSL(SLT_Link, req->sp->vxid, "req %u rxreq", VXID(req->vsl->wid)); AZ(isnan(req->t_first)); /* First byte timestamp set by http1_wait */ AZ(isnan(req->t_req)); /* Complete req rcvd set by http1_wait */ req->t_prev = req->t_first; VSLb_ts_req(req, "Start", req->t_first); VSLb_ts_req(req, "Req", req->t_req); /* Borrow VCL reference from worker thread */ VCL_Refresh(&wrk->vcl); req->vcl = wrk->vcl; wrk->vcl = NULL; HTTP_Setup(req->http, req->ws, req->vsl, SLT_ReqMethod); req->err_code = HTTP1_DissectRequest(req->htc, req->http); /* If we could not even parse the request, just close */ if (req->err_code != 0) { VSLb(req->vsl, SLT_HttpGarbage, "%.*s", (int)(req->htc->rxbuf_e - req->htc->rxbuf_b), req->htc->rxbuf_b); wrk->stats->client_req_400++; r = write(req->sp->fd, r_400, strlen(r_400)); if (r > 0) req->acct.resp_hdrbytes += r; req->doclose = SC_RX_JUNK; return (-1); } assert (req->req_body_status == REQ_BODY_INIT); if (req->htc->body_status == BS_CHUNKED) { req->req_body_status = REQ_BODY_WITHOUT_LEN; } else if (req->htc->body_status == BS_LENGTH) { req->req_body_status = REQ_BODY_WITH_LEN; } else if (req->htc->body_status == BS_NONE) { req->req_body_status = REQ_BODY_NONE; } else if (req->htc->body_status == BS_EOF) { req->req_body_status = REQ_BODY_WITHOUT_LEN; } else { WRONG("Unknown req.body_length situation"); } if (http_GetHdr(req->http, H_Expect, &p)) { if (strcasecmp(p, "100-continue")) { wrk->stats->client_req_417++; req->err_code = 417; r = write(req->sp->fd, r_417, strlen(r_417)); if (r > 0) req->acct.resp_hdrbytes += r; req->doclose = SC_RX_JUNK; return (-1); } r = write(req->sp->fd, r_100, strlen(r_100)); if (r > 0) req->acct.resp_hdrbytes += r; if (r != strlen(r_100)) { req->doclose = SC_REM_CLOSE; return (-1); } http_Unset(req->http, H_Expect); } wrk->stats->client_req++; wrk->stats->s_req++; AZ(req->err_code); req->ws_req = WS_Snapshot(req->ws); req->doclose = http_DoConnection(req->http); if (req->doclose == SC_RX_BAD) { r = write(req->sp->fd, r_400, strlen(r_400)); if (r > 0) req->acct.resp_hdrbytes += r; return (-1); } assert(req->req_body_status != REQ_BODY_INIT); HTTP_Copy(req->http0, req->http); // For ESI & restart return (0); } /*---------------------------------------------------------------------- */ void HTTP1_Session(struct worker *wrk, struct req *req) { enum htc_status_e hs; struct sess *sp; int i; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); sp = req->sp; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); /* * Whenever we come in from the acceptor or waiter, we need to set * blocking mode. It would be simpler to do this in the acceptor * or waiter, but we'd rather do the syscall in the worker thread. * On systems which return errors for ioctl, we close early */ if (sp->sess_step == S_STP_H1NEWREQ && VTCP_blocking(sp->fd)) { if (errno == ECONNRESET) SES_Close(sp, SC_REM_CLOSE); else SES_Close(sp, SC_TX_ERROR); AN(Req_Cleanup(sp, wrk, req)); return; } while (1) { switch (sp->sess_step) { case S_STP_H1NEWSESS: if (VTCP_blocking(sp->fd)) { if (errno == ECONNRESET) SES_Close(sp, SC_REM_CLOSE); else SES_Close(sp, SC_TX_ERROR); AN(Req_Cleanup(sp, wrk, req)); return; } sp->sess_step = S_STP_H1NEWREQ; break; case S_STP_H1NEWREQ: assert(isnan(req->t_prev)); assert(isnan(req->t_req)); AZ(req->vcl); AZ(req->esi_level); hs = SES_RxStuff(req->htc, HTTP1_Complete, &req->t_first, &req->t_req, sp->t_idle + cache_param->timeout_linger, sp->t_idle + cache_param->timeout_idle); XXXAZ(req->htc->ws->r); if (hs < HTC_S_EMPTY) { req->acct.req_hdrbytes += req->htc->rxbuf_e - req->htc->rxbuf_b; CNT_AcctLogCharge(wrk->stats, req); Req_Release(req); switch(hs) { case HTC_S_CLOSE: SES_Delete(sp, SC_REM_CLOSE, NAN); return; case HTC_S_TIMEOUT: SES_Delete(sp, SC_RX_TIMEOUT, NAN); return; case HTC_S_OVERFLOW: SES_Delete(sp, SC_RX_OVERFLOW, NAN); return; case HTC_S_EOF: SES_Delete(sp, SC_REM_CLOSE, NAN); return; default: WRONG("htc_status (bad)"); } } if (hs == HTC_S_IDLE) { wrk->stats->sess_herd++; Req_Release(req); SES_Wait(sp); return; } if (hs != HTC_S_COMPLETE) WRONG("htc_status (nonbad)"); i = http1_dissect(wrk, req); req->acct.req_hdrbytes += req->htc->rxbuf_e - req->htc->rxbuf_b; if (i) { SES_Close(req->sp, req->doclose); sp->sess_step = S_STP_H1CLEANUP; break; } req->req_step = R_STP_RECV; sp->sess_step = S_STP_H1PROC; break; case S_STP_H1BUSY: /* * Return from waitinglist. * Check to see if the remote has left. */ if (VTCP_check_hup(sp->fd)) { AN(req->hash_objhead); (void)HSH_DerefObjHead(wrk, &req->hash_objhead); AZ(req->hash_objhead); SES_Close(sp, SC_REM_CLOSE); AN(Req_Cleanup(sp, wrk, req)); return; } sp->sess_step = S_STP_H1PROC; break; case S_STP_H1PROC: req->transport = &http1_transport; if (CNT_Request(wrk, req) == REQ_FSM_DISEMBARK) { sp->sess_step = S_STP_H1BUSY; return; } req->transport = NULL; sp->sess_step = S_STP_H1CLEANUP; break; case S_STP_H1CLEANUP: if (Req_Cleanup(sp, wrk, req)) return; SES_RxReInit(req->htc); if (req->htc->rxbuf_e != req->htc->rxbuf_b) wrk->stats->sess_readahead++; sp->sess_step = S_STP_H1NEWREQ; break; default: WRONG("Wrong H1 session state"); } } } varnish-4.1.1/bin/varnishd/http1/cache_http1_pipe.c0000644000201500234410000000731412652366721017115 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * XXX: charge bytes to srcaddr */ #include "config.h" #include #include #include "cache/cache.h" #include "vrt.h" #include "cache_http1.h" static struct lock pipestat_mtx; static int rdf(int fd0, int fd1, uint64_t *pcnt) { int i, j; char buf[BUFSIZ], *p; i = read(fd0, buf, sizeof buf); if (i <= 0) return (1); for (p = buf; i > 0; i -= j, p += j) { j = write(fd1, p, i); if (j <= 0) return (1); *pcnt += j; if (i != j) (void)usleep(100000); /* XXX hack */ } return (0); } void V1P_Charge(struct req *req, const struct v1p_acct *a, struct VSC_C_vbe *b) { AN(b); VSLb(req->vsl, SLT_PipeAcct, "%ju %ju %ju %ju", (uintmax_t)a->req, (uintmax_t)a->bereq, (uintmax_t)a->in, (uintmax_t)a->out); Lck_Lock(&pipestat_mtx); VSC_C_main->s_pipe_hdrbytes += a->req; VSC_C_main->s_pipe_in += a->in; VSC_C_main->s_pipe_out += a->out; b->pipe_hdrbytes += a->bereq; b->pipe_out += a->in; b->pipe_in += a->out; Lck_Unlock(&pipestat_mtx); } void V1P_Process(struct req *req, int fd, struct v1p_acct *v1a) { struct pollfd fds[2]; int i, j; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req->sp, SESS_MAGIC); assert(fd > 0); if (req->htc->pipeline_b != NULL) { j = write(fd, req->htc->pipeline_b, req->htc->pipeline_e - req->htc->pipeline_b); if (j < 0) return; req->htc->pipeline_b = NULL; req->htc->pipeline_e = NULL; v1a->in += j; } memset(fds, 0, sizeof fds); fds[0].fd = fd; fds[0].events = POLLIN | POLLERR; fds[1].fd = req->sp->fd; fds[1].events = POLLIN | POLLERR; while (fds[0].fd > -1 || fds[1].fd > -1) { fds[0].revents = 0; fds[1].revents = 0; i = poll(fds, 2, (int)(cache_param->pipe_timeout * 1e3)); if (i < 1) break; if (fds[0].revents && rdf(fd, req->sp->fd, &v1a->out)) { if (fds[1].fd == -1) break; (void)shutdown(fd, SHUT_RD); (void)shutdown(req->sp->fd, SHUT_WR); fds[0].events = 0; fds[0].fd = -1; } if (fds[1].revents && rdf(req->sp->fd, fd, &v1a->in)) { if (fds[0].fd == -1) break; (void)shutdown(req->sp->fd, SHUT_RD); (void)shutdown(fd, SHUT_WR); fds[1].events = 0; fds[1].fd = -1; } } } /*--------------------------------------------------------------------*/ void V1P_Init(void) { Lck_New(&pipestat_mtx, lck_pipestat); } varnish-4.1.1/bin/varnishd/http1/cache_http1_deliver.c0000644000201500234410000001043512652366721017610 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include "cache/cache.h" #include "cache/cache_filter.h" #include "cache_http1.h" /*--------------------------------------------------------------------*/ static int __match_proto__(vdp_bytes) v1d_bytes(struct req *req, enum vdp_action act, void **priv, const void *ptr, ssize_t len) { ssize_t wl = 0; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); (void)priv; if (act == VDP_INIT || act == VDP_FINI) return (0); AZ(req->vdp_nxt); /* always at the bottom of the pile */ if (len > 0) wl = V1L_Write(req->wrk, ptr, len); req->acct.resp_bodybytes += len; if (act > VDP_NULL && V1L_Flush(req->wrk)) return (-1); if (len != wl) return (-1); return (0); } static void v1d_error(struct req *req, const char *msg) { static const char r_500[] = "HTTP/1.1 500 Internal Server Error\r\n" "Server: Varnish\r\n" "Connection: close\r\n\r\n"; VSLb(req->vsl, SLT_Error, "%s", msg); VSLb(req->vsl, SLT_RespProtocol, "HTTP/1.1"); VSLb(req->vsl, SLT_RespStatus, "500"); VSLb(req->vsl, SLT_RespReason, "Internal Server Error"); (void)write(req->sp->fd, r_500, sizeof r_500 - 1); req->doclose = SC_TX_EOF; } /*-------------------------------------------------------------------- */ void __match_proto__(vtr_deliver_f) V1D_Deliver(struct req *req, struct busyobj *bo, int sendbody) { enum objiter_status ois; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_ORNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); if (sendbody) { if (http_GetHdr(req->resp, H_Content_Length, NULL)) req->res_mode |= RES_LEN; else if (req->http->protover == 11) { req->res_mode |= RES_CHUNKED; http_SetHeader(req->resp, "Transfer-Encoding: chunked"); } else { req->res_mode |= RES_EOF; req->doclose = SC_TX_EOF; } } VSLb(req->vsl, SLT_Debug, "RES_MODE %x", req->res_mode); if (req->doclose) { if (!http_HdrIs(req->resp, H_Connection, "close")) { http_Unset(req->resp, H_Connection); http_SetHeader(req->resp, "Connection: close"); } } else if (!http_GetHdr(req->resp, H_Connection, NULL)) http_SetHeader(req->resp, "Connection: keep-alive"); if (sendbody && req->resp_len != 0) VDP_push(req, v1d_bytes, NULL, 1); AZ(req->wrk->v1l); V1L_Reserve(req->wrk, req->ws, &req->sp->fd, req->vsl, req->t_prev); if (WS_Overflowed(req->ws)) { v1d_error(req, "workspace_client overflow"); AZ(req->wrk->v1l); return; } req->acct.resp_hdrbytes += HTTP1_Write(req->wrk, req->resp, HTTP1_Resp); if (DO_DEBUG(DBG_FLUSH_HEAD)) (void)V1L_Flush(req->wrk); ois = OIS_DONE; if (sendbody && req->resp_len != 0) { if (req->res_mode & RES_CHUNKED) V1L_Chunked(req->wrk); ois = VDP_DeliverObj(req); if (ois == OIS_DONE && (req->res_mode & RES_CHUNKED)) V1L_EndChunk(req->wrk); } if ((V1L_FlushRelease(req->wrk) || ois != OIS_DONE) && req->sp->fd >= 0) SES_Close(req->sp, SC_REM_CLOSE); AZ(req->wrk->v1l); VDP_close(req); } varnish-4.1.1/bin/varnishd/http1/cache_http1_proto.c0000644000201500234410000002702512652366721017324 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * HTTP protocol requests * * The trouble with the "until magic sequence" design of HTTP protocol messages * is that either you have to read a single character at a time, which is * inefficient, or you risk reading too much, and pre-read some of the object, * or even the next pipelined request, which follows the one you want. * * HTC reads a HTTP protocol header into a workspace, subject to limits, * and stops when we see the magic marker (double [CR]NL), and if we overshoot, * it keeps track of the "pipelined" data. * * Until we see the magic marker, we have to keep the rxbuf NUL terminated * because we use strchr(3) on it. * * We use this both for client and backend connections. */ #include "config.h" #include "cache/cache.h" #include "cache_http1.h" #include "vct.h" const int HTTP1_Req[3] = { HTTP_HDR_METHOD, HTTP_HDR_URL, HTTP_HDR_PROTO }; const int HTTP1_Resp[3] = { HTTP_HDR_PROTO, HTTP_HDR_STATUS, HTTP_HDR_REASON }; /*-------------------------------------------------------------------- * Check if we have a complete HTTP request or response yet */ enum htc_status_e __match_proto__(htc_complete_f) HTTP1_Complete(struct http_conn *htc) { char *p; CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); AZ(htc->pipeline_b); AZ(htc->pipeline_e); assert(htc->rxbuf_e >= htc->rxbuf_b); assert(*htc->rxbuf_e == '\0'); /* Skip any leading white space */ for (p = htc->rxbuf_b ; vct_islws(*p); p++) continue; if (p == htc->rxbuf_e) { /* All white space */ htc->rxbuf_e = htc->rxbuf_b; *htc->rxbuf_e = '\0'; return (HTC_S_EMPTY); } /* * Here we just look for NL[CR]NL to see that reception * is completed. More stringent validation happens later. */ while (1) { p = strchr(p, '\n'); if (p == NULL) return (HTC_S_MORE); p++; if (*p == '\r') p++; if (*p == '\n') break; } return (HTC_S_COMPLETE); } /*-------------------------------------------------------------------- * Dissect the headers of the HTTP protocol message. * Detect conditionals (headers which start with '^[Ii][Ff]-') */ static uint16_t http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc) { char *q, *r; assert(p > htc->rxbuf_b); assert(p <= htc->rxbuf_e); hp->nhd = HTTP_HDR_FIRST; hp->conds = 0; r = NULL; /* For FlexeLint */ for (; p < htc->rxbuf_e; p = r) { /* Find end of next header */ q = r = p; if (vct_iscrlf(p)) break; while (r < htc->rxbuf_e) { if (!vct_iscrlf(r)) { r++; continue; } q = r; assert(r < htc->rxbuf_e); r += vct_skipcrlf(r); if (r >= htc->rxbuf_e) break; if (vct_iscrlf(r)) break; /* If line does not continue: got it. */ if (!vct_issp(*r)) break; /* Clear line continuation LWS to spaces */ while (vct_islws(*q)) *q++ = ' '; } if (q - p > htc->maxhdr) { VSLb(hp->vsl, SLT_BogoHeader, "Header too long: %.*s", (int)(q - p > 20 ? 20 : q - p), p); return (400); } /* Empty header = end of headers */ if (p == q) break; if (vct_islws(*p)) { VSLb(hp->vsl, SLT_BogoHeader, "1st header has white space: %.*s", (int)(q - p > 20 ? 20 : q - p), p); return (400); } if ((p[0] == 'i' || p[0] == 'I') && (p[1] == 'f' || p[1] == 'F') && p[2] == '-') hp->conds = 1; while (q > p && vct_issp(q[-1])) q--; *q = '\0'; if (strchr(p, ':') == NULL) { VSLb(hp->vsl, SLT_BogoHeader, "Header without ':' %.*s", (int)(q - p > 20 ? 20 : q - p), p); return (400); } if (hp->nhd < hp->shd) { hp->hdf[hp->nhd] = 0; hp->hd[hp->nhd].b = p; hp->hd[hp->nhd].e = q; hp->nhd++; } else { VSLb(hp->vsl, SLT_BogoHeader, "Too many headers: %.*s", (int)(q - p > 20 ? 20 : q - p), p); return (400); } } if (p < htc->rxbuf_e) p += vct_skipcrlf(p); if (p < htc->rxbuf_e) { htc->pipeline_b = p; htc->pipeline_e = htc->rxbuf_e; htc->rxbuf_e = p; } return (0); } /*-------------------------------------------------------------------- * Deal with first line of HTTP protocol message. */ static uint16_t http1_splitline(struct http *hp, struct http_conn *htc, const int *hf) { char *p; int i; assert(hf == HTTP1_Req || hf == HTTP1_Resp); CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); assert(htc->rxbuf_e >= htc->rxbuf_b); AZ(hp->hd[hf[0]].b); AZ(hp->hd[hf[1]].b); AZ(hp->hd[hf[2]].b); /* Skip leading LWS */ for (p = htc->rxbuf_b ; vct_islws(*p); p++) continue; hp->hd[hf[0]].b = p; /* First field cannot contain SP or CTL */ for (; !vct_issp(*p); p++) { if (vct_isctl(*p)) return (400); } hp->hd[hf[0]].e = p; assert(Tlen(hp->hd[hf[0]])); *p++ = '\0'; /* Skip SP */ for (; vct_issp(*p); p++) { if (vct_isctl(*p)) return (400); } hp->hd[hf[1]].b = p; /* Second field cannot contain LWS or CTL */ for (; !vct_islws(*p); p++) { if (vct_isctl(*p)) return (400); } hp->hd[hf[1]].e = p; if (!Tlen(hp->hd[hf[1]])) return (400); *p++ = '\0'; /* Skip SP */ for (; vct_issp(*p); p++) { if (vct_isctl(*p)) return (400); } hp->hd[hf[2]].b = p; /* Third field is optional and cannot contain CTL except TAB */ for (; !vct_iscrlf(p); p++) { if (vct_isctl(*p) && !vct_issp(*p)) { hp->hd[hf[2]].b = NULL; return (400); } } hp->hd[hf[2]].e = p; /* Skip CRLF */ i = vct_skipcrlf(p); *p = '\0'; p += i; return (http1_dissect_hdrs(hp, p, htc)); } /*--------------------------------------------------------------------*/ static enum body_status http1_body_status(const struct http *hp, struct http_conn *htc) { ssize_t cl; const char *b; CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); htc->content_length = -1; cl = http_GetContentLength(hp); if (http_GetHdr(hp, H_Transfer_Encoding, &b)) { if (strcasecmp(b, "chunked")) return (BS_ERROR); if (cl != -1) { /* * RFC7230 3.3.3 allows more lenient handling * but we're going to be strict. */ return (BS_ERROR); } return (BS_CHUNKED); } if (cl == -2) return (BS_ERROR); if (cl >= 0) { htc->content_length = cl; return (cl == 0 ? BS_NONE : BS_LENGTH); } if (hp->protover == 11) return (BS_NONE); if (http_HdrIs(hp, H_Connection, "keep-alive")) { /* * Keep alive with neither TE=Chunked or C-Len is impossible. * We assume a zero length body. */ return (BS_NONE); } /* * Fall back to EOF transfer. */ return (BS_EOF); } /*--------------------------------------------------------------------*/ static int8_t http1_proto_ver(const struct http *hp) { if (!strcasecmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.0")) return (10); else if (!strcasecmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.1")) return (11); else return (0); } /*--------------------------------------------------------------------*/ uint16_t HTTP1_DissectRequest(struct http_conn *htc, struct http *hp) { uint16_t retval; const char *p; const char *b, *e; CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); retval = http1_splitline(hp, htc, HTTP1_Req); if (retval != 0) return (retval); hp->protover = http1_proto_ver(hp); if (hp->protover == 0) return (400); if (http_CountHdr(hp, H_Host) > 1) return (400); if (http_CountHdr(hp, H_Content_Length) > 1) return (400); /* RFC2616, section 5.2, point 1 */ if (!strncasecmp(hp->hd[HTTP_HDR_URL].b, "http://", 7)) { b = e = hp->hd[HTTP_HDR_URL].b + 7; while (*e != '/' && *e != '\0') e++; if (*e == '/') { http_Unset(hp, H_Host); http_PrintfHeader(hp, "Host: %.*s", (int)(e - b), b); hp->hd[HTTP_HDR_URL].b = e; } } htc->body_status = http1_body_status(hp, htc); if (htc->body_status == BS_ERROR) return (400); p = http_GetMethod(hp); AN(p); /* We handle EOF bodies only for PUT and POST */ if (htc->body_status == BS_EOF && strcasecmp(p, "put") && strcasecmp(p, "post")) htc->body_status = BS_NONE; /* HEAD with a body is a hard error */ if (htc->body_status != BS_NONE && !strcasecmp(p, "head")) return (400); return (retval); } /*--------------------------------------------------------------------*/ uint16_t HTTP1_DissectResponse(struct http_conn *htc, struct http *hp, const struct http *req) { uint16_t retval = 0; const char *p; int8_t rv; CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); CHECK_OBJ_NOTNULL(req, HTTP_MAGIC); if (http1_splitline(hp, htc, HTTP1_Resp)) retval = 503; if (retval == 0) { hp->protover = http1_proto_ver(hp); if (hp->protover == 0) retval = 503; rv = http1_proto_ver(req); if (hp->protover > rv) hp->protover = rv; } if (retval == 0 && Tlen(hp->hd[HTTP_HDR_STATUS]) != 3) retval = 503; if (retval == 0) { p = hp->hd[HTTP_HDR_STATUS].b; if (p[0] >= '1' && p[0] <= '9' && p[1] >= '0' && p[1] <= '9' && p[2] >= '0' && p[2] <= '9') hp->status = 100 * (p[0] - '0') + 10 * (p[1] - '0') + p[2] - '0'; else retval = 503; } if (retval != 0) { VSLb(hp->vsl, SLT_HttpGarbage, "%.*s", (int)(htc->rxbuf_e - htc->rxbuf_b), htc->rxbuf_b); assert(retval >= 100 && retval <= 999); assert(retval == 503); hp->status = retval; http_SetH(hp, HTTP_HDR_STATUS, "503"); http_SetH(hp, HTTP_HDR_REASON, http_Status2Reason(retval)); } if (hp->hd[HTTP_HDR_REASON].b == NULL || !Tlen(hp->hd[HTTP_HDR_REASON])) http_SetH(hp, HTTP_HDR_REASON, http_Status2Reason(hp->status)); htc->body_status = http1_body_status(hp, htc); return (retval); } /*--------------------------------------------------------------------*/ static unsigned http1_WrTxt(const struct worker *wrk, const txt *hh, const char *suf) { unsigned u; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AN(wrk); AN(hh); AN(hh->b); AN(hh->e); u = V1L_Write(wrk, hh->b, hh->e - hh->b); if (suf != NULL) u += V1L_Write(wrk, suf, -1); return (u); } unsigned HTTP1_Write(const struct worker *w, const struct http *hp, const int *hf) { unsigned u, l; assert(hf == HTTP1_Req || hf == HTTP1_Resp); AN(hp->hd[hf[0]].b); AN(hp->hd[hf[1]].b); AN(hp->hd[hf[2]].b); l = http1_WrTxt(w, &hp->hd[hf[0]], " "); l += http1_WrTxt(w, &hp->hd[hf[1]], " "); l += http1_WrTxt(w, &hp->hd[hf[2]], "\r\n"); for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) l += http1_WrTxt(w, &hp->hd[u], "\r\n"); l += V1L_Write(w, "\r\n", -1); return (l); } varnish-4.1.1/bin/varnishd/http1/cache_http1_vfp.c0000644000201500234410000001631212652366721016751 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * HTTP1 Fetch Filters * * These filters are used for both req.body and beresp.body to handle * the HTTP/1 aspects (C-L/Chunked/EOF) * */ #include "config.h" #include #include #include "cache/cache.h" #include "cache/cache_filter.h" #include "cache_http1.h" #include "vct.h" /*-------------------------------------------------------------------- * Read up to len bytes, returning pipelined data first. */ static ssize_t v1f_read(const struct vfp_ctx *vc, struct http_conn *htc, void *d, ssize_t len) { ssize_t l; unsigned char *p; ssize_t i = 0; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); assert(len > 0); l = 0; p = d; if (htc->pipeline_b) { l = htc->pipeline_e - htc->pipeline_b; assert(l > 0); if (l > len) l = len; memcpy(p, htc->pipeline_b, l); p += l; len -= l; htc->pipeline_b += l; if (htc->pipeline_b == htc->pipeline_e) htc->pipeline_b = htc->pipeline_e = NULL; } if (len > 0) { i = read(htc->fd, p, len); if (i < 0) { // XXX: VTCP_Assert(i); // but also: EAGAIN VSLb(vc->wrk->vsl, SLT_FetchError, "%s", strerror(errno)); return (i); } } return (i + l); } /*-------------------------------------------------------------------- * Read a chunked HTTP object. * * XXX: Reading one byte at a time is pretty pessimal. */ static enum vfp_status __match_proto__(vfp_pull_f) v1f_pull_chunked(struct vfp_ctx *vc, struct vfp_entry *vfe, void *ptr, ssize_t *lp) { struct http_conn *htc; int i; char buf[20]; /* XXX: 20 is arbitrary */ char *q; unsigned u; uintmax_t cll; ssize_t cl, l, lr; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); CAST_OBJ_NOTNULL(htc, vfe->priv1, HTTP_CONN_MAGIC); AN(ptr); AN(lp); AN(ptr); AN(lp); l = *lp; *lp = 0; if (vfe->priv2 == -1) { /* Skip leading whitespace */ do { lr = v1f_read(vc, htc, buf, 1); if (lr <= 0) return (VFP_Error(vc, "chunked read err")); } while (vct_islws(buf[0])); if (!vct_ishex(buf[0])) return (VFP_Error(vc, "chunked header non-hex")); /* Collect hex digits, skipping leading zeros */ for (u = 1; u < sizeof buf; u++) { do { lr = v1f_read(vc, htc, buf + u, 1); if (lr <= 0) return (VFP_Error(vc, "chunked read err")); } while (u == 1 && buf[0] == '0' && buf[u] == '0'); if (!vct_ishex(buf[u])) break; } if (u >= sizeof buf) return (VFP_Error(vc, "chunked header too long")); /* Skip trailing white space */ while(vct_islws(buf[u]) && buf[u] != '\n') { lr = v1f_read(vc, htc, buf + u, 1); if (lr <= 0) return (VFP_Error(vc, "chunked read err")); } if (buf[u] != '\n') return (VFP_Error(vc, "chunked header no NL")); buf[u] = '\0'; cll = strtoumax(buf, &q, 16); if (q == NULL || *q != '\0') return (VFP_Error(vc, "chunked header number syntax")); cl = (ssize_t)cll; if((uintmax_t)cl != cll) return (VFP_Error(vc, "bogusly large chunk size")); vfe->priv2 = cl; } if (vfe->priv2 > 0) { if (vfe->priv2 < l) l = vfe->priv2; lr = v1f_read(vc, htc, ptr, l); if (lr <= 0) return (VFP_Error(vc, "straight insufficient bytes")); *lp = lr; vfe->priv2 -= lr; if (vfe->priv2 == 0) vfe->priv2 = -1; return (VFP_OK); } AZ(vfe->priv2); i = v1f_read(vc, htc, buf, 1); if (i <= 0) return (VFP_Error(vc, "chunked read err")); if (buf[0] == '\r' && v1f_read(vc, htc, buf, 1) <= 0) return (VFP_Error(vc, "chunked read err")); if (buf[0] != '\n') return (VFP_Error(vc, "chunked tail no NL")); return (VFP_END); } static const struct vfp v1f_chunked = { .name = "V1F_CHUNKED", .pull = v1f_pull_chunked, }; /*--------------------------------------------------------------------*/ static enum vfp_status __match_proto__(vfp_pull_f) v1f_pull_straight(struct vfp_ctx *vc, struct vfp_entry *vfe, void *p, ssize_t *lp) { ssize_t l, lr; struct http_conn *htc; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); CAST_OBJ_NOTNULL(htc, vfe->priv1, HTTP_CONN_MAGIC); AN(p); AN(lp); l = *lp; *lp = 0; if (vfe->priv2 == 0) // XXX: Optimize Content-Len: 0 out earlier return (VFP_END); if (vfe->priv2 < l) l = vfe->priv2; lr = v1f_read(vc, htc, p, l); if (lr <= 0) return (VFP_Error(vc, "straight insufficient bytes")); *lp = lr; vfe->priv2 -= lr; if (vfe->priv2 == 0) return (VFP_END); return (VFP_OK); } static const struct vfp v1f_straight = { .name = "V1F_STRAIGHT", .pull = v1f_pull_straight, }; /*--------------------------------------------------------------------*/ static enum vfp_status __match_proto__(vfp_pull_f) v1f_pull_eof(struct vfp_ctx *vc, struct vfp_entry *vfe, void *p, ssize_t *lp) { ssize_t l, lr; struct http_conn *htc; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); CAST_OBJ_NOTNULL(htc, vfe->priv1, HTTP_CONN_MAGIC); AN(p); AN(lp); l = *lp; *lp = 0; lr = v1f_read(vc, htc, p, l); if (lr < 0) return (VFP_Error(vc, "eof socket fail")); if (lr == 0) return (VFP_END); *lp = lr; return (VFP_OK); } static const struct vfp v1f_eof = { .name = "V1F_EOF", .pull = v1f_pull_eof, }; /*-------------------------------------------------------------------- */ void V1F_Setup_Fetch(struct vfp_ctx *vfc, struct http_conn *htc) { struct vfp_entry *vfe; CHECK_OBJ_NOTNULL(vfc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); switch(htc->body_status) { case BS_EOF: assert(htc->content_length == -1); vfe = VFP_Push(vfc, &v1f_eof, 0); vfe->priv2 = 0; break; case BS_LENGTH: assert(htc->content_length > 0); vfe = VFP_Push(vfc, &v1f_straight, 0); vfe->priv2 = htc->content_length; break; case BS_CHUNKED: assert(htc->content_length == -1); vfe = VFP_Push(vfc, &v1f_chunked, 0); vfe->priv2 = -1; break; default: WRONG("Wrong body_status"); break; } vfe->priv1 = htc; } varnish-4.1.1/bin/varnishd/http1/cache_http1.h0000644000201500234410000000470112652366721016102 00000000000000/*- * Copyright (c) 2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ /* cache_http1_fetch.c [V1F] */ int V1F_SendReq(struct worker *, struct busyobj *, uint64_t *ctr, int onlycached); int V1F_FetchRespHdr(struct busyobj *); void V1F_Setup_Fetch(struct vfp_ctx *vfc, struct http_conn *htc); /* cache_http1_fsm.c [HTTP1] */ void HTTP1_Session(struct worker *, struct req *); extern const int HTTP1_Req[3]; extern const int HTTP1_Resp[3]; /* cache_http1_deliver.c */ vtr_deliver_f V1D_Deliver; /* cache_http1_pipe.c */ struct v1p_acct { uint64_t req; uint64_t bereq; uint64_t in; uint64_t out; }; void V1P_Init(void); void V1P_Process(struct req *, int fd, struct v1p_acct *); void V1P_Charge(struct req *, const struct v1p_acct *, struct VSC_C_vbe *); /* cache_http1_line.c */ void V1L_Chunked(const struct worker *w); void V1L_EndChunk(const struct worker *w); void V1L_Reserve(struct worker *, struct ws *, int *fd, struct vsl_log *, double t0); unsigned V1L_Flush(const struct worker *w); unsigned V1L_FlushRelease(struct worker *w); size_t V1L_Write(const struct worker *w, const void *ptr, ssize_t len); varnish-4.1.1/bin/varnishd/http1/cache_http1_line.c0000644000201500234410000001653512652366721017114 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Write data to fd * We try to use writev() if possible in order to minimize number of * syscalls made and packets sent. It also just might allow the worker * thread to complete the request without holding stuff locked. */ #include "config.h" #include #include #include #include #include "cache/cache.h" #include "cache_http1.h" #include "vtim.h" /*--------------------------------------------------------------------*/ struct v1l { unsigned magic; #define V1L_MAGIC 0x2f2142e5 int *wfd; unsigned werr; /* valid after V1L_Flush() */ struct iovec *iov; unsigned siov; unsigned niov; ssize_t liov; ssize_t cliov; unsigned ciov; /* Chunked header marker */ double t0; struct vsl_log *vsl; ssize_t cnt; /* Flushed byte count */ struct ws *ws; void *res; }; /*-------------------------------------------------------------------- */ void V1L_Reserve(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl, double t0) { struct v1l *v1l; unsigned u; void *res; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AZ(wrk->v1l); if (WS_Overflowed(ws)) return; res = WS_Snapshot(ws); v1l = WS_Alloc(ws, sizeof *v1l); if (v1l == NULL) return; INIT_OBJ(v1l, V1L_MAGIC); v1l->ws = ws; v1l->res = res; u = WS_Reserve(ws, 0); u = PRNDDN(u); u /= sizeof(struct iovec); if (u == 0) { WS_Release(ws, 0); WS_MarkOverflow(ws); return; } else if (u > IOV_MAX) u = IOV_MAX; v1l->iov = (void*)PRNDUP(ws->f); v1l->siov = u; v1l->ciov = u; v1l->werr = 0; v1l->liov = 0; v1l->niov = 0; v1l->wfd = fd; v1l->t0 = t0; v1l->vsl = vsl; wrk->v1l = v1l; } unsigned V1L_FlushRelease(struct worker *wrk) { struct v1l *v1l; unsigned u; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); u = V1L_Flush(wrk); v1l = wrk->v1l; wrk->v1l = NULL; CHECK_OBJ_NOTNULL(v1l, V1L_MAGIC); WS_Release(v1l->ws, 0); WS_Reset(v1l->ws, v1l->res); return (u); } static void v1l_prune(struct v1l *v1l, ssize_t bytes) { ssize_t used = 0; ssize_t j, used_here; for (j = 0; j < v1l->niov; j++) { if (used + v1l->iov[j].iov_len > bytes) { /* Cutoff is in this iov */ used_here = bytes - used; v1l->iov[j].iov_len -= used_here; v1l->iov[j].iov_base = (char*)v1l->iov[j].iov_base + used_here; memmove(v1l->iov, &v1l->iov[j], (v1l->niov - j) * sizeof(struct iovec)); v1l->niov -= j; v1l->liov -= bytes; return; } used += v1l->iov[j].iov_len; } AZ(v1l->liov); } unsigned V1L_Flush(const struct worker *wrk) { ssize_t i; struct v1l *v1l; char cbuf[32]; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); v1l = wrk->v1l; CHECK_OBJ_NOTNULL(v1l, V1L_MAGIC); AN(v1l->wfd); /* For chunked, there must be one slot reserved for the chunked tail */ if (v1l->ciov < v1l->siov) assert(v1l->niov < v1l->siov); if (*v1l->wfd >= 0 && v1l->liov > 0 && v1l->werr == 0) { if (v1l->ciov < v1l->siov && v1l->cliov > 0) { /* Add chunk head & tail */ bprintf(cbuf, "00%zx\r\n", v1l->cliov); i = strlen(cbuf); v1l->iov[v1l->ciov].iov_base = cbuf; v1l->iov[v1l->ciov].iov_len = i; v1l->liov += i; v1l->iov[v1l->niov].iov_base = cbuf + i - 2; v1l->iov[v1l->niov++].iov_len = 2; v1l->liov += 2; } else if (v1l->ciov < v1l->siov) { v1l->iov[v1l->ciov].iov_base = cbuf; v1l->iov[v1l->ciov].iov_len = 0; } i = writev(*v1l->wfd, v1l->iov, v1l->niov); if (i > 0) v1l->cnt += i; while (i != v1l->liov && i > 0) { /* Remove sent data from start of I/O vector, * then retry; we hit a timeout, but some data * was sent. * * XXX: Add a "minimum sent data per timeout * counter to prevent slowlaris attacks */ if (VTIM_real() - v1l->t0 > cache_param->send_timeout) { VSLb(v1l->vsl, SLT_Debug, "Hit total send timeout, " "wrote = %zd/%zd; not retrying", i, v1l->liov); i = -1; break; } VSLb(v1l->vsl, SLT_Debug, "Hit idle send timeout, wrote = %zd/%zd; retrying", i, v1l->liov); v1l_prune(v1l, i); i = writev(*v1l->wfd, v1l->iov, v1l->niov); if (i > 0) v1l->cnt += i; } if (i <= 0) { v1l->werr++; VSLb(v1l->vsl, SLT_Debug, "Write error, retval = %zd, len = %zd, errno = %s", i, v1l->liov, strerror(errno)); } } v1l->liov = 0; v1l->cliov = 0; v1l->niov = 0; if (v1l->ciov < v1l->siov) v1l->ciov = v1l->niov++; return (v1l->werr); } size_t V1L_Write(const struct worker *wrk, const void *ptr, ssize_t len) { struct v1l *v1l; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); v1l = wrk->v1l; CHECK_OBJ_NOTNULL(v1l, V1L_MAGIC); AN(v1l->wfd); if (len == 0 || *v1l->wfd < 0) return (0); if (len == -1) len = strlen(ptr); if (v1l->niov >= v1l->siov - (v1l->ciov < v1l->siov ? 1 : 0)) (void)V1L_Flush(wrk); v1l->iov[v1l->niov].iov_base = TRUST_ME(ptr); v1l->iov[v1l->niov].iov_len = len; v1l->liov += len; v1l->niov++; if (v1l->ciov < v1l->siov) { assert(v1l->niov < v1l->siov); v1l->cliov += len; } return (len); } void V1L_Chunked(const struct worker *wrk) { struct v1l *v1l; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); v1l = wrk->v1l; CHECK_OBJ_NOTNULL(v1l, V1L_MAGIC); assert(v1l->ciov == v1l->siov); /* * If there are not space for chunked header, a chunk of data and * a chunk tail, we might as well flush right away. */ if (v1l->niov + 3 >= v1l->siov) (void)V1L_Flush(wrk); v1l->ciov = v1l->niov++; v1l->cliov = 0; assert(v1l->ciov < v1l->siov); assert(v1l->niov < v1l->siov); } /* * XXX: It is not worth the complexity to attempt to get the * XXX: end of chunk into the V1L_Flush(), because most of the time * XXX: if not always, that is a no-op anyway, because the calling * XXX: code already called V1L_Flush() to release local storage. */ void V1L_EndChunk(const struct worker *wrk) { struct v1l *v1l; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); v1l = wrk->v1l; CHECK_OBJ_NOTNULL(v1l, V1L_MAGIC); assert(v1l->ciov < v1l->siov); (void)V1L_Flush(wrk); v1l->ciov = v1l->siov; v1l->niov = 0; v1l->cliov = 0; (void)V1L_Write(wrk, "0\r\n\r\n", -1); } varnish-4.1.1/bin/varnishd/http1/cache_http1_fetch.c0000644000201500234410000001274712652366721017257 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include "cache/cache.h" #include "vcli_priv.h" #include "vrt.h" #include "vtcp.h" #include "vtim.h" #include "hash/hash_slinger.h" #include "cache_http1.h" /*-------------------------------------------------------------------- * Pass the request body to the backend */ static int __match_proto__(req_body_iter_f) vbf_iter_req_body(struct req *req, void *priv, void *ptr, size_t l) { struct busyobj *bo; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CAST_OBJ_NOTNULL(bo, priv, BUSYOBJ_MAGIC); if (l > 0) { bo->acct.bereq_bodybytes += V1L_Write(bo->wrk, ptr, l); if (V1L_Flush(bo->wrk)) return (-1); } return (0); } /*-------------------------------------------------------------------- * Send request to backend, including any (cached) req.body * * Return value: * 0 success * 1 failure */ int V1F_SendReq(struct worker *wrk, struct busyobj *bo, uint64_t *ctr, int onlycached) { struct http *hp; int j; ssize_t i; struct http_conn *htc; int do_chunked = 0; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo->htc, HTTP_CONN_MAGIC); CHECK_OBJ_ORNULL(bo->req, REQ_MAGIC); htc = bo->htc; hp = bo->bereq; if (bo->req != NULL && bo->req->req_body_status == REQ_BODY_WITHOUT_LEN) { http_PrintfHeader(hp, "Transfer-Encoding: chunked"); do_chunked = 1; } (void)VTCP_blocking(htc->fd); /* XXX: we should timeout instead */ V1L_Reserve(wrk, wrk->aws, &htc->fd, bo->vsl, bo->t_prev); *ctr += HTTP1_Write(wrk, hp, HTTP1_Req); /* Deal with any message-body the request might (still) have */ i = 0; if (bo->req != NULL && (bo->req->req_body_status == REQ_BODY_CACHED || !onlycached)) { if (do_chunked) V1L_Chunked(wrk); i = VRB_Iterate(bo->req, vbf_iter_req_body, bo); if (bo->req->req_body_status == REQ_BODY_FAIL) { assert(i < 0); VSLb(bo->vsl, SLT_FetchError, "req.body read error: %d (%s)", errno, strerror(errno)); bo->req->doclose = SC_RX_BODY; } if (do_chunked) V1L_EndChunk(wrk); } j = V1L_FlushRelease(wrk); if (j != 0 || i < 0) { VSLb(bo->vsl, SLT_FetchError, "backend write error: %d (%s)", errno, strerror(errno)); VSLb_ts_busyobj(bo, "Bereq", W_TIM_real(wrk)); htc->doclose = SC_TX_ERROR; return (-1); } VSLb_ts_busyobj(bo, "Bereq", W_TIM_real(wrk)); return (0); } int V1F_FetchRespHdr(struct busyobj *bo) { struct http *hp; int first, i; struct http_conn *htc; CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo->htc, HTTP_CONN_MAGIC); CHECK_OBJ_ORNULL(bo->req, REQ_MAGIC); htc = bo->htc; VSC_C_main->backend_req++; /* Receive response */ SES_RxInit(htc, bo->ws, cache_param->http_resp_size, cache_param->http_resp_hdr_len); CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); CHECK_OBJ_NOTNULL(bo->htc, HTTP_CONN_MAGIC); VTCP_set_read_timeout(htc->fd, htc->first_byte_timeout); first = 1; do { i = (htc->ws->r - htc->rxbuf_e) - 1; /* space for NUL */ if (i <= 0) { bo->acct.beresp_hdrbytes += htc->rxbuf_e - htc->rxbuf_b; WS_ReleaseP(htc->ws, htc->rxbuf_b); VSLb(bo->vsl, SLT_FetchError, "http %sread error: overflow", first ? "first " : ""); htc->doclose = SC_RX_OVERFLOW; return (-1); } i = read(htc->fd, htc->rxbuf_e, i); if (i <= 0) { bo->acct.beresp_hdrbytes += htc->rxbuf_e - htc->rxbuf_b; WS_ReleaseP(htc->ws, htc->rxbuf_b); VSLb(bo->vsl, SLT_FetchError, "http %sread error: EOF", first ? "first " : ""); htc->doclose = SC_RX_TIMEOUT; return (first ? 1 : -1); } if (first) { first = 0; VTCP_set_read_timeout(htc->fd, htc->between_bytes_timeout); } htc->rxbuf_e += i; *htc->rxbuf_e = '\0'; } while (HTTP1_Complete(htc) != HTC_S_COMPLETE); WS_ReleaseP(htc->ws, htc->rxbuf_e); hp = bo->beresp; i = HTTP1_DissectResponse(htc, hp, bo->bereq); bo->acct.beresp_hdrbytes += htc->rxbuf_e - htc->rxbuf_b; if (i) { VSLb(bo->vsl, SLT_FetchError, "http format error"); htc->doclose = SC_RX_JUNK; return (-1); } htc->doclose = http_DoConnection(hp); return (0); } varnish-4.1.1/bin/varnishd/mgt/0000755000201500234410000000000012652366757013364 500000000000000varnish-4.1.1/bin/varnishd/mgt/mgt_jail_solaris.c0000644000201500234410000003415112652366721016765 00000000000000/*- * Copyright (c) 2006-2011 Varnish Software AS * Copyright (c) 2011-2015 UPLEX - Nils Goroll Systemoptimierung * All rights reserved. * * Author: Poul-Henning Kamp * Nils Goroll * * 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. * * "Jailing" *1) child processes on Solaris and Solaris-derivatives *2) * ==================================================================== * * *1) The name is motivated by the availability of the -j command line * option. Jailing Varnish is not to be confused with BSD Jails or * Solaris Zones. * * In Solaris parlour, jail == least privileges * * *2) e.g. illumos, SmartOS, OmniOS etc. * * * Note on use of symbolic PRIV_* constants * ---------------------------------------- * * We assume backwards compatibility only for Solaris Releases after the * OpenSolaris Launch. For privileges which existed at the time of the * OpenSolaris Launch, we use the constants from sys/priv_names.h and assert * that priv_addset must succeed. * * For privileges which have been added later, we need to use priv strings in * order not to break builds of varnish on older platforms. To remain binary * compatible, we can't assert that priv_addset succeeds, but we may assert that * it either succeeds or fails with EINVAL. * * See priv_setop_check() * * Note on introduction of new privileges (or: lack of forward compatibility) * -------------------------------------------------------------------------- * * For optimal build and binary forward compatibility, we could use subtractive * set specs like * * basic,!file_link_any,!proc_exec,!proc_fork,!proc_info,!proc_session * * which would implicitly keep any privileges newly introduced to the 'basic' * set. * * But we have a preference for making an informed decision about which * privileges varnish subprocesses should have, so we prefer to risk breaking * varnish temporarily on newer kernels and be notified of missing privileges * through bug reports. * * Notes on the SNOCD flag * ----------------------- * * On Solaris, any uid/gid fiddling which can be interpreted as 'waiving * privileges' will lead to the processes' SNOCD flag being set, disabling core * dumps unless explicitly allowed using coreadm (see below). There is no * equivalent to Linux PR_SET_DUMPABLE. The only way to clear the flag is a call * to some form of exec(). The presence of the SNOCD flag also prevents many * process manipulations from other processes with the same uid/gid unless the * latter have the proc_owner privilege. * * Thus, if we want to run subprocesses with a different uid/gid than the master * process, we cannot avoid the SNOCD flag for those subprocesses not exec'ing * (VCC, VCLLOAD, WORKER). * * * We should, however, avoid to accidentally set the SNOCD flag when setting * privileges (see https://www.varnish-cache.org/trac/ticket/671 ) * * When changing the logic herein, always check with mdb -k. Replace _PID_ with * the pid of your varnish child, the result should be 0, otherwise a regression * has been introduced. * * > 0t_PID_::pid2proc | ::print proc_t p_flag | >a * > ( #include #include #include #include #include "mgt/mgt.h" #include "common/heritage.h" #ifdef HAVE_PRIV_H #include #endif /* ============================================================ * the real thing */ // XXX @phk can we merge jail_subproc_e and jail_master_e please? #define JAILG_SHIFT 16 enum jail_gen_e { JAILG_SUBPROC_VCC = JAIL_SUBPROC_VCC, JAILG_SUBPROC_CC = JAIL_SUBPROC_CC, JAILG_SUBPROC_VCLLOAD = JAIL_SUBPROC_VCLLOAD, JAILG_SUBPROC_WORKER = JAIL_SUBPROC_WORKER, JAILG_MASTER_LOW = JAIL_MASTER_LOW << JAILG_SHIFT, JAILG_MASTER_STORAGE = JAIL_MASTER_STORAGE << JAILG_SHIFT, JAILG_MASTER_PRIVPORT = JAIL_MASTER_PRIVPORT << JAILG_SHIFT }; static inline enum jail_gen_e jail_subproc_gen(enum jail_subproc_e e) { assert(e < (1 << JAILG_SHIFT)); return (enum jail_gen_e)e; } static inline enum jail_gen_e jail_master_gen(enum jail_master_e e) { return (enum jail_gen_e)(e << JAILG_SHIFT); } static int __match_proto__(jail_init_f) vjs_init(char **args) { (void) args; return 0; } /* for priv_delset() and priv_addset() */ static inline int priv_setop_check(int a) { if (a == 0) return (1); if (errno == EINVAL) return (1); return (0); } #define priv_setop_assert(a) assert(priv_setop_check(a)) /* * we try to add all possible privileges to waive them later. * * when doing so, we need to expect EPERM */ /* for setppriv */ static inline int setppriv_check(int a) { if (a == 0) return (1); if (errno == EPERM) return (1); return (0); } #define setppriv_assert(a) assert(setppriv_check(a)) static void vjs_add_inheritable(priv_set_t *pset, enum jail_gen_e jge) { switch (jge) { case JAILG_SUBPROC_VCC: break; case JAILG_SUBPROC_CC: priv_setop_assert(priv_addset(pset, PRIV_PROC_EXEC)); priv_setop_assert(priv_addset(pset, PRIV_PROC_FORK)); priv_setop_assert(priv_addset(pset, "file_read")); priv_setop_assert(priv_addset(pset, "file_write")); break; case JAILG_SUBPROC_VCLLOAD: break; case JAILG_SUBPROC_WORKER: break; default: INCOMPL(); } } static void vjs_add_effective(priv_set_t *pset, enum jail_gen_e jge) { switch (jge) { case JAILG_SUBPROC_VCC: // open vmods priv_setop_assert(priv_addset(pset, "file_read")); // write .c output priv_setop_assert(priv_addset(pset, "file_write")); break; case JAILG_SUBPROC_CC: priv_setop_assert(priv_addset(pset, PRIV_PROC_EXEC)); priv_setop_assert(priv_addset(pset, PRIV_PROC_FORK)); priv_setop_assert(priv_addset(pset, "file_read")); priv_setop_assert(priv_addset(pset, "file_write")); break; case JAILG_SUBPROC_VCLLOAD: priv_setop_assert(priv_addset(pset, "file_read")); break; case JAILG_SUBPROC_WORKER: priv_setop_assert(priv_addset(pset, "net_access")); priv_setop_assert(priv_addset(pset, "file_read")); priv_setop_assert(priv_addset(pset, "file_write")); break; default: INCOMPL(); } } /* * permitted is initialized from effective (see vjs_waive) * so only additionally required privileges need to be added here */ static void vjs_add_permitted(priv_set_t *pset, enum jail_gen_e jge) { switch (jge) { case JAILG_SUBPROC_VCC: case JAILG_SUBPROC_CC: case JAILG_SUBPROC_VCLLOAD: break; case JAILG_SUBPROC_WORKER: /* for raising limits in cache_waiter_ports.c */ AZ(priv_addset(pset, PRIV_SYS_RESOURCE)); break; default: INCOMPL(); } } /* * additional privileges needed by vjs_privsep - * will get waived in vjs_waive */ static void vjs_add_initial(priv_set_t *pset, enum jail_gen_e jge) { (void)jge; /* for setgid/setuid */ AZ(priv_addset(pset, PRIV_PROC_SETID)); } /* * if we are not yet privilege-aware already (ie we have been started * not-privilege aware with euid 0), we try to grab any privileges we * will need later. * We will reduce to least privileges in vjs_waive * * We need to become privilege-aware to avoid setuid resetting them. */ static void vjs_setup(enum jail_gen_e jge) { priv_set_t *priv_all; if (! (priv_all = priv_allocset())) { MGT_complain(C_SECURITY, "Solaris Jail warning: " " vjs_setup - priv_allocset failed: errno=%d (%s)", errno, strerror(errno)); return; } priv_emptyset(priv_all); vjs_add_inheritable(priv_all, jge); vjs_add_effective(priv_all, jge); vjs_add_permitted(priv_all, jge); vjs_add_initial(priv_all, jge); /* try to get all possible privileges, expect EPERM here */ setppriv_assert(setppriv(PRIV_ON, PRIV_PERMITTED, priv_all)); setppriv_assert(setppriv(PRIV_ON, PRIV_EFFECTIVE, priv_all)); setppriv_assert(setppriv(PRIV_ON, PRIV_INHERITABLE, priv_all)); priv_freeset(priv_all); } static void vjs_privsep(enum jail_gen_e jge) { (void)jge; if (priv_ineffect(PRIV_PROC_SETID)) { if (getgid() != mgt_param.gid) XXXAZ(setgid(mgt_param.gid)); if (getuid() != mgt_param.uid) XXXAZ(setuid(mgt_param.uid)); } else { MGT_complain(C_SECURITY, "Privilege %s missing, will not change uid/gid", PRIV_PROC_SETID); } } /* * Waive most privileges in the child * * as of onnv_151a, we should end up with: * * > ppriv -v #pid of varnish child * PID: .../varnishd ... * flags = PRIV_AWARE * E: file_read,file_write,net_access * I: none * P: file_read,file_write,net_access,sys_resource * L: file_read,file_write,net_access,sys_resource * * We should keep sys_resource in P in order to adjust our limits if we need to */ static void vjs_waive(enum jail_gen_e jge) { priv_set_t *effective, *inheritable, *permitted, *limited; if (!(effective = priv_allocset()) || !(inheritable = priv_allocset()) || !(permitted = priv_allocset()) || !(limited = priv_allocset())) { MGT_complain(C_SECURITY, "Solaris Jail warning: " " vjs_waive - priv_allocset failed: errno=%d (%s)", errno, strerror(errno)); return; } /* * inheritable and effective are distinct sets * effective is a subset of permitted * limit is the union of all */ priv_emptyset(inheritable); vjs_add_inheritable(inheritable, jge); priv_emptyset(effective); vjs_add_effective(effective, jge); priv_copyset(effective, permitted); vjs_add_permitted(permitted, jge); priv_copyset(inheritable, limited); priv_union(permitted, limited); /* * invert the sets and clear privileges such that setppriv will always * succeed */ priv_inverse(limited); priv_inverse(permitted); priv_inverse(effective); priv_inverse(inheritable); AZ(setppriv(PRIV_OFF, PRIV_LIMIT, limited)); AZ(setppriv(PRIV_OFF, PRIV_PERMITTED, permitted)); AZ(setppriv(PRIV_OFF, PRIV_EFFECTIVE, effective)); AZ(setppriv(PRIV_OFF, PRIV_INHERITABLE, inheritable)); priv_freeset(limited); priv_freeset(permitted); priv_freeset(effective); priv_freeset(inheritable); } static void __match_proto__(jail_subproc_f) vjs_subproc(enum jail_subproc_e jse) { enum jail_gen_e jge = jail_subproc_gen(jse); vjs_setup(jge); vjs_privsep(jge); vjs_waive(jge); } static void __match_proto__(jail_master_f) vjs_master(enum jail_master_e jme) { enum jail_gen_e jge = jail_master_gen(jme); (void)jge; /* if (jme == JAILG_MASTER_HIGH) AZ(seteuid(0)); else AZ(seteuid(vju_uid)); */ } const struct jail_tech jail_tech_solaris = { .magic = JAIL_TECH_MAGIC, .name = "solaris", .init = vjs_init, .master = vjs_master, // .make_workdir = vjs_make_workdir, // .storage_file = vjs_storage_file, .subproc = vjs_subproc, }; #endif /* HAVE_SETPPRIV */ varnish-4.1.1/bin/varnishd/mgt/mgt_param_tcp.c0000644000201500234410000000700012652366721016251 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * 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 #include "mgt/mgt.h" #include "vtcp.h" #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", "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 } }; 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) { const char *err; int s; s = VTCP_listen_on(":0", NULL, 10, &err); if (err != NULL) ARGV_ERR("Could not probe TCP keepalives: %s", err); assert(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)); } #endif void MCF_TcpParams(void) { #ifdef HAVE_TCP_KEEP MCF_AddParams(mgt_parspec_tcp_keep); tcp_keep_probes(); #endif } varnish-4.1.1/bin/varnishd/mgt/mgt_vcl.c0000644000201500234410000002516712652366721015105 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * VCL management stuff */ #include "config.h" #include #include #include #include #include #include #include "mgt/mgt.h" #include "vcli.h" #include "vcli_priv.h" #include "vev.h" #include "vtim.h" #include "mgt_cli.h" static const char * const VCL_STATE_COLD = "cold"; static const char * const VCL_STATE_WARM = "warm"; static const char * const VCL_STATE_AUTO = "auto"; struct vclprog { VTAILQ_ENTRY(vclprog) list; char *name; char *fname; unsigned warm; char state[8]; double go_cold; }; static VTAILQ_HEAD(, vclprog) vclhead = VTAILQ_HEAD_INITIALIZER(vclhead); static struct vclprog *active_vcl; static struct vev *e_poker; /*--------------------------------------------------------------------*/ static struct vclprog * mgt_vcl_add(const char *name, const char *libfile, const char *state) { struct vclprog *vp; vp = calloc(sizeof *vp, 1); XXXAN(vp); REPLACE(vp->name, name); REPLACE(vp->fname, libfile); if (strcmp(state, "cold")) vp->warm = 1; else state = "auto"; bprintf(vp->state, "%s", state); if (active_vcl == NULL) active_vcl = vp; VTAILQ_INSERT_TAIL(&vclhead, vp, list); return (vp); } static void mgt_vcl_del(struct vclprog *vp) { char dn[256]; VTAILQ_REMOVE(&vclhead, vp, list); XXXAZ(unlink(vp->fname)); bprintf(dn, "vcl_%s", vp->name); VJ_master(JAIL_MASTER_FILE); (void)rmdir(dn); // compiler droppings, eg gcov VJ_master(JAIL_MASTER_LOW); free(vp->fname); free(vp->name); free(vp); } static struct vclprog * mgt_vcl_byname(const char *name) { struct vclprog *vp; VTAILQ_FOREACH(vp, &vclhead, list) if (!strcmp(name, vp->name)) return (vp); return (NULL); } int mgt_has_vcl(void) { return (!VTAILQ_EMPTY(&vclhead)); } static int mgt_vcl_setstate(struct cli *cli, struct vclprog *vp, const char *vs) { unsigned status, warm; double now; char *p; int i; if (vs == VCL_STATE_AUTO) { assert(vp != active_vcl); now = VTIM_mono(); vs = vp->warm ? VCL_STATE_WARM : VCL_STATE_COLD; if (vp->go_cold > 0 && !strcmp(vp->state, "auto") && vp->go_cold + mgt_param.vcl_cooldown < now) vs = VCL_STATE_COLD; } assert(vs != VCL_STATE_AUTO); warm = vs == VCL_STATE_WARM ? 1 : 0; if (vp->warm == warm) return (0); vp->warm = warm; if (vp->warm == 0) vp->go_cold = 0; if (child_pid < 0) return (0); i = mgt_cli_askchild(&status, &p, "vcl.state %s %d%s\n", vp->name, vp->warm, vp->state); if (i) { AN(cli); AN(vp->warm); VCLI_SetResult(cli, status); VCLI_Out(cli, "%s", p); } free(p); return (i); } /*--------------------------------------------------------------------*/ static void mgt_new_vcl(struct cli *cli, const char *vclname, const char *vclsrc, const char *vclsrcfile, const char *state, int C_flag) { unsigned status; char *lib, *p; struct vclprog *vp; char buf[32]; AN(cli); if (C_flag) { bprintf(buf, ".CflagTest.%d", (int)getpid()); vclname = buf; } if (state == NULL) state = "auto"; if (strcmp(state, "auto") && strcmp(state, "cold") && strcmp(state, "warm")) { VCLI_Out(cli, "State must be one of auto, cold or warm."); VCLI_SetResult(cli, CLIS_PARAM); return; } lib = mgt_VccCompile(cli, vclname, vclsrc, vclsrcfile, C_flag); if (lib == NULL) return; AZ(C_flag); vp = mgt_vcl_add(vclname, lib, state); free(lib); if (child_pid < 0) return; if (!mgt_cli_askchild(&status, &p, "vcl.load %s %s %d%s\n", vp->name, vp->fname, vp->warm, vp->state)) { free(p); return; } mgt_vcl_del(vp); VCLI_Out(cli, "%s", p); free(p); VCLI_SetResult(cli, CLIS_PARAM); } /*--------------------------------------------------------------------*/ void mgt_vcc_startup(struct cli *cli, const char *b_arg, const char *f_arg, const char *vclsrc, int C_flag) { char buf[BUFSIZ]; if (b_arg == NULL) { AN(vclsrc); AN(f_arg); mgt_new_vcl(cli, "boot", vclsrc, f_arg, NULL, C_flag); return; } AZ(vclsrc); bprintf(buf, "vcl 4.0;\n" "backend default {\n" " .host = \"%s\";\n" "}\n", b_arg); mgt_new_vcl(cli, "boot", buf, "<-b argument>", NULL, C_flag); } /*--------------------------------------------------------------------*/ int mgt_push_vcls_and_start(struct cli *cli, unsigned *status, char **p) { struct vclprog *vp; AN(active_vcl); /* The VCL has not been loaded yet, it cannot fail */ AZ(mgt_vcl_setstate(cli, active_vcl, VCL_STATE_WARM)); VTAILQ_FOREACH(vp, &vclhead, list) { if (mgt_cli_askchild(status, p, "vcl.load \"%s\" %s %d%s\n", vp->name, vp->fname, vp->warm, vp->state)) return (1); free(*p); } if (mgt_cli_askchild(status, p, "vcl.use \"%s\"\n", active_vcl->name)) return (1); free(*p); if (mgt_cli_askchild(status, p, "start\n")) return (1); free(*p); *p = NULL; return (0); } /*--------------------------------------------------------------------*/ void mcf_vcl_inline(struct cli *cli, const char * const *av, void *priv) { struct vclprog *vp; (void)priv; vp = mgt_vcl_byname(av[2]); if (vp != NULL) { VCLI_Out(cli, "Already a VCL program named %s", av[2]); VCLI_SetResult(cli, CLIS_PARAM); return; } mgt_new_vcl(cli, av[2], av[3], "", av[4], 0); } void mcf_vcl_load(struct cli *cli, const char * const *av, void *priv) { struct vclprog *vp; (void)priv; vp = mgt_vcl_byname(av[2]); if (vp != NULL) { VCLI_Out(cli, "Already a VCL program named %s", av[2]); VCLI_SetResult(cli, CLIS_PARAM); return; } mgt_new_vcl(cli, av[2], NULL, av[3], av[4], 0); } static struct vclprog * mcf_find_vcl(struct cli *cli, const char *name) { struct vclprog *vp; vp = mgt_vcl_byname(name); if (vp != NULL) return (vp); VCLI_SetResult(cli, CLIS_PARAM); VCLI_Out(cli, "No configuration named %s known.", name); return (NULL); } void mcf_vcl_state(struct cli *cli, const char * const *av, void *priv) { struct vclprog *vp; (void)priv; vp = mcf_find_vcl(cli, av[2]); if (vp == NULL) return; if (!strcmp(vp->state, av[3])) return; if (!strcmp(av[3], "auto")) { bprintf(vp->state, "%s", "auto"); if (vp != active_vcl) { vp->go_cold = VTIM_mono(); (void)mgt_vcl_setstate(cli, vp, VCL_STATE_AUTO); } } else if (!strcmp(av[3], "cold")) { if (vp == active_vcl) { VCLI_Out(cli, "Cannot set the active VCL cold."); VCLI_SetResult(cli, CLIS_PARAM); return; } bprintf(vp->state, "%s", "auto"); (void)mgt_vcl_setstate(cli, vp, VCL_STATE_COLD); } else if (!strcmp(av[3], "warm")) { if (mgt_vcl_setstate(cli, vp, VCL_STATE_WARM) == 0) bprintf(vp->state, "%s", av[3]); } else { VCLI_Out(cli, "State must be one of auto, cold or warm."); VCLI_SetResult(cli, CLIS_PARAM); } } void mcf_vcl_use(struct cli *cli, const char * const *av, void *priv) { unsigned status; char *p = NULL; struct vclprog *vp, *vp2; (void)priv; vp = mcf_find_vcl(cli, av[2]); if (vp == NULL) return; if (vp == active_vcl) return; if (mgt_vcl_setstate(cli, vp, VCL_STATE_WARM)) return; if (child_pid >= 0 && mgt_cli_askchild(&status, &p, "vcl.use %s\n", av[2])) { VCLI_SetResult(cli, status); VCLI_Out(cli, "%s", p); vp->go_cold = VTIM_mono(); (void)mgt_vcl_setstate(cli, vp, VCL_STATE_AUTO); } else { VCLI_Out(cli, "VCL '%s' now active", av[2]); vp2 = active_vcl; active_vcl = vp; if (vp2 != NULL) { vp2->go_cold = VTIM_mono(); (void)mgt_vcl_setstate(cli, vp2, VCL_STATE_AUTO); } } free(p); } void mcf_vcl_discard(struct cli *cli, const char * const *av, void *priv) { unsigned status; char *p = NULL; struct vclprog *vp; (void)priv; vp = mcf_find_vcl(cli, av[2]); if (vp == NULL) return; if (vp == active_vcl) { VCLI_SetResult(cli, CLIS_PARAM); VCLI_Out(cli, "Cannot discard active VCL program\n"); return; } (void)mgt_vcl_setstate(cli, vp, VCL_STATE_COLD); if (child_pid >= 0) { /* XXX If this fails the child is crashing, figure that later */ (void)mgt_cli_askchild(&status, &p, "vcl.discard %s\n", av[2]); free(p); } mgt_vcl_del(vp); } void mcf_vcl_list(struct cli *cli, const char * const *av, void *priv) { unsigned status; char *p; struct vclprog *vp; (void)av; (void)priv; if (child_pid >= 0) { if (!mgt_cli_askchild(&status, &p, "vcl.list\n")) { VCLI_SetResult(cli, status); VCLI_Out(cli, "%s", p); } free(p); } else { VTAILQ_FOREACH(vp, &vclhead, list) { VCLI_Out(cli, "%-10s %4s/%-8s %6s %s\n", vp == active_vcl ? "active" : "available", vp->state, vp->warm ? "warm" : "cold", "", vp->name); } } } /*--------------------------------------------------------------------*/ static int __match_proto__(vev_cb_f) mgt_vcl_poker(const struct vev *e, int what) { struct vclprog *vp; (void)e; (void)what; e_poker->timeout = mgt_param.vcl_cooldown * .45; VTAILQ_FOREACH(vp, &vclhead, list) { if (vp != active_vcl) (void)mgt_vcl_setstate(NULL, vp, VCL_STATE_AUTO); } return (0); } /*--------------------------------------------------------------------*/ static void mgt_vcl_atexit(void) { struct vclprog *vp; if (getpid() != mgt_pid) return; do { vp = VTAILQ_FIRST(&vclhead); if (vp != NULL) mgt_vcl_del(vp); } while (vp != NULL); } void mgt_vcl_init(void) { e_poker = vev_new(); AN(e_poker); e_poker->timeout = 3; // random, prime e_poker->callback = mgt_vcl_poker; e_poker->name = "vcl poker"; AZ(vev_add(mgt_evb, e_poker)); AZ(atexit(mgt_vcl_atexit)); } varnish-4.1.1/bin/varnishd/mgt/mgt_param.h0000644000201500234410000000467712652366721015431 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ struct parspec; typedef int tweak_t(struct vsb *, const struct parspec *, const char *arg); struct parspec { const char *name; tweak_t *func; volatile void *priv; const char *min; const char *max; const char *descr; int flags; #define DELAYED_EFFECT (1<<0) #define EXPERIMENTAL (1<<1) #define MUST_RESTART (1<<2) #define MUST_RELOAD (1<<3) #define WIZARD (1<<4) #define PROTECTED (1<<5) #define OBJ_STICKY (1<<6) #define ONLY_ROOT (1<<7) const char *def; const char *units; }; tweak_t tweak_bool; tweak_t tweak_bytes; tweak_t tweak_bytes_u; tweak_t tweak_double; tweak_t tweak_poolparam; tweak_t tweak_string; tweak_t tweak_timeout; tweak_t tweak_uint; tweak_t tweak_waiter; tweak_t tweak_vsl_buffer; tweak_t tweak_vsl_reclen; int tweak_generic_uint(struct vsb *vsb, volatile unsigned *dest, const char *arg, const char *min, const char *max); extern struct parspec mgt_parspec[]; /* mgt_param_tbl.c */ extern struct parspec VSL_parspec[]; /* mgt_param_vsl.c */ extern struct parspec WRK_parspec[]; /* mgt_pool.c */ varnish-4.1.1/bin/varnishd/mgt/mgt_param_bits.c0000644000201500234410000001516012652366721016432 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. */ #include "config.h" #include #include #include #include "mgt/mgt.h" #include "mgt/mgt_param.h" #include "vav.h" #include "vsl_priv.h" /*-------------------------------------------------------------------- */ enum bit_do {BSET, BCLR, BTST}; static int bit(uint8_t *p, unsigned no, enum bit_do act) { uint8_t b; p += (no >> 3); b = (0x80 >> (no & 7)); if (act == BSET) *p |= b; else if (act == BCLR) *p &= ~b; return (*p & b); } /*-------------------------------------------------------------------- */ static int bit_tweak(struct vsb *vsb, uint8_t *p, unsigned l, const char *arg, const char * const *tags, const char *desc, const char *sign) { int i, n; unsigned j; char **av; const char *s; av = VAV_Parse(arg, &n, ARGV_COMMA); if (av[0] != NULL) { VSB_printf(vsb, "Cannot parse: %s\n", av[0]); VAV_Free(av); return (-1); } for (i = 1; av[i] != NULL; i++) { s = av[i]; if (*s != '-' && *s != '+') { VSB_printf(vsb, "Missing '+' or '-' (%s)\n", s); VAV_Free(av); return (-1); } for (j = 0; j < l; j++) { if (tags[j] != NULL && !strcasecmp(s + 1, tags[j])) break; } if (tags[j] == NULL) { VSB_printf(vsb, "Unknown %s (%s)\n", desc, s); VAV_Free(av); return (-1); } assert(j < l); if (s[0] == *sign) (void)bit(p, j, BSET); else (void)bit(p, j, BCLR); } VAV_Free(av); return (0); } /*-------------------------------------------------------------------- * The vsl_mask parameter */ static const char * const VSL_tags[256] = { # define SLTM(foo,flags,sdesc,ldesc) [SLT_##foo] = #foo, # include "tbl/vsl_tags.h" # undef SLTM NULL }; static int tweak_vsl_mask(struct vsb *vsb, const struct parspec *par, const char *arg) { unsigned j; const char *s; (void)par; if (arg != NULL) { if (!strcmp(arg, "default")) { memset(mgt_param.vsl_mask, 0, sizeof mgt_param.vsl_mask); (void)bit(mgt_param.vsl_mask, SLT_VCL_trace, BSET); (void)bit(mgt_param.vsl_mask, SLT_WorkThread, BSET); (void)bit(mgt_param.vsl_mask, SLT_Hash, BSET); (void)bit(mgt_param.vsl_mask, SLT_VfpAcct, BSET); } else { return (bit_tweak(vsb, mgt_param.vsl_mask, SLT__Reserved, arg, VSL_tags, "VSL tag", "-")); } } else { s = ""; for (j = 0; j < (unsigned)SLT__Reserved; j++) { if (bit(mgt_param.vsl_mask, j, BTST)) { VSB_printf(vsb, "%s-%s", s, VSL_tags[j]); s = ","; } } if (*s == '\0') VSB_printf(vsb, "(all enabled)"); } return (0); } /*-------------------------------------------------------------------- * The debug parameter */ static const char * const debug_tags[] = { # define DEBUG_BIT(U, l, d) [DBG_##U] = #l, # include "tbl/debug_bits.h" # undef DEBUG_BIT NULL }; static int tweak_debug(struct vsb *vsb, const struct parspec *par, const char *arg) { const char *s; unsigned j; (void)par; if (arg != NULL) { if (!strcmp(arg, "none")) { memset(mgt_param.debug_bits, 0, sizeof mgt_param.debug_bits); } else { return (bit_tweak(vsb, mgt_param.debug_bits, DBG_Reserved, arg, debug_tags, "debug bit", "+")); } } else { s = ""; for (j = 0; j < (unsigned)DBG_Reserved; j++) { if (bit(mgt_param.debug_bits, j, BTST)) { VSB_printf(vsb, "%s+%s", s, debug_tags[j]); s = ","; } } if (*s == '\0') VSB_printf(vsb, "none"); } return (0); } /*-------------------------------------------------------------------- * The feature parameter */ static const char * const feature_tags[] = { # define FEATURE_BIT(U, l, d, ld) [FEATURE_##U] = #l, # include "tbl/feature_bits.h" # undef FEATURE_BIT NULL }; static int tweak_feature(struct vsb *vsb, const struct parspec *par, const char *arg) { const char *s; unsigned j; (void)par; if (arg != NULL) { if (!strcmp(arg, "none")) { memset(mgt_param.feature_bits, 0, sizeof mgt_param.feature_bits); } else { return (bit_tweak(vsb, mgt_param.feature_bits, FEATURE_Reserved, arg, feature_tags, "feature bit", "+")); } } else { s = ""; for (j = 0; j < (unsigned)FEATURE_Reserved; j++) { if (bit(mgt_param.feature_bits, j, BTST)) { VSB_printf(vsb, "%s+%s", s, feature_tags[j]); s = ","; } } if (*s == '\0') VSB_printf(vsb, "none"); } return (0); } /*-------------------------------------------------------------------- * The parameter table itself */ struct parspec VSL_parspec[] = { { "vsl_mask", tweak_vsl_mask, NULL, NULL, NULL, "Mask individual VSL messages from being logged.\n" "\tdefault\tSet default value\n" "\nUse +/- prefix in front of VSL tag name, to mask/unmask " "individual VSL messages.", 0, "default", "" }, { "debug", tweak_debug, NULL, NULL, NULL, "Enable/Disable various kinds of debugging.\n" "\tnone\tDisable all debugging\n\n" "Use +/- prefix to set/reset individual bits:" #define DEBUG_BIT(U, l, d) "\n\t" #l "\t" d #include "tbl/debug_bits.h" #undef DEBUG_BIT , 0, "none", "" }, { "feature", tweak_feature, NULL, NULL, NULL, "Enable/Disable various minor features.\n" "\tnone\tDisable all features.\n\n" "Use +/- prefix to enable/disable individual feature:" #define FEATURE_BIT(U, l, d, ld) "\n\t" #l "\t" d #include "tbl/feature_bits.h" #undef FEATURE_BIT , 0, "none", "" }, { NULL, NULL, NULL } }; varnish-4.1.1/bin/varnishd/mgt/mgt_vcc.c0000644000201500234410000001630412652366721015065 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * VCL compiler stuff */ #include "config.h" #include #include #include #include #include #include #include #include #include "mgt/mgt.h" #include "libvcc.h" #include "vcli.h" #include "vcli_priv.h" #include "vfil.h" #include "vsub.h" struct vcc_priv { unsigned magic; #define VCC_PRIV_MAGIC 0x70080cb8 char *dir; const char *vclsrc; const char *vclsrcfile; char *csrcfile; char *libfile; }; char *mgt_cc_cmd; const char *mgt_vcl_dir; const char *mgt_vmod_dir; unsigned mgt_vcc_err_unref; unsigned mgt_vcc_allow_inline_c; unsigned mgt_vcc_unsafe_path; static struct vcp *vcp; #define VGC_SRC "vgc.c" #define VGC_LIB "vgc.so" /*--------------------------------------------------------------------*/ static const char * const builtin_vcl = #include "builtin_vcl.h" "" ; /*-------------------------------------------------------------------- * Invoke system VCC compiler in a sub-process */ static void __match_proto__(vsub_func_f) run_vcc(void *priv) { char *csrc; struct vsb *sb; struct vcc_priv *vp; int fd, i, l; VJ_subproc(JAIL_SUBPROC_VCC); CAST_OBJ_NOTNULL(vp, priv, VCC_PRIV_MAGIC); AZ(chdir(vp->dir)); sb = VSB_new_auto(); XXXAN(sb); VCP_VCL_dir(vcp, mgt_vcl_dir); VCP_VMOD_dir(vcp, mgt_vmod_dir); VCP_Err_Unref(vcp, mgt_vcc_err_unref); VCP_Allow_InlineC(vcp, mgt_vcc_allow_inline_c); VCP_Unsafe_Path(vcp, mgt_vcc_unsafe_path); csrc = VCC_Compile(vcp, sb, vp->vclsrc, vp->vclsrcfile); AZ(VSB_finish(sb)); if (VSB_len(sb)) printf("%s", VSB_data(sb)); VSB_delete(sb); if (csrc == NULL) exit(2); fd = open(VGC_SRC, O_WRONLY|O_TRUNC|O_CREAT, 0600); if (fd < 0) { fprintf(stderr, "VCC cannot open %s", vp->csrcfile); exit(2); } l = strlen(csrc); i = write(fd, csrc, l); if (i != l) { fprintf(stderr, "VCC cannot write %s", vp->csrcfile); exit(2); } AZ(close(fd)); free(csrc); exit(0); } /*-------------------------------------------------------------------- * Invoke system C compiler in a sub-process */ static void __match_proto__(vsub_func_f) run_cc(void *priv) { struct vcc_priv *vp; struct vsb *sb; int pct; char *p; VJ_subproc(JAIL_SUBPROC_CC); CAST_OBJ_NOTNULL(vp, priv, VCC_PRIV_MAGIC); AZ(chdir(vp->dir)); sb = VSB_new_auto(); AN(sb); for (p = mgt_cc_cmd, pct = 0; *p; ++p) { if (pct) { switch (*p) { case 's': VSB_cat(sb, VGC_SRC); break; case 'o': VSB_cat(sb, VGC_LIB); break; case '%': VSB_putc(sb, '%'); break; default: VSB_putc(sb, '%'); VSB_putc(sb, *p); break; } pct = 0; } else if (*p == '%') { pct = 1; } else { VSB_putc(sb, *p); } } if (pct) VSB_putc(sb, '%'); AZ(VSB_finish(sb)); (void)umask(027); (void)execl("/bin/sh", "/bin/sh", "-c", VSB_data(sb), (char*)0); VSB_delete(sb); // For flexelint } /*-------------------------------------------------------------------- * Attempt to open compiled VCL in a sub-process */ static void __match_proto__(vsub_func_f) run_dlopen(void *priv) { struct vcc_priv *vp; VJ_subproc(JAIL_SUBPROC_VCLLOAD); CAST_OBJ_NOTNULL(vp, priv, VCC_PRIV_MAGIC); if (VCL_TestLoad(vp->libfile)) exit(1); exit(0); } /*-------------------------------------------------------------------- * Touch a filename and make it available to privsep-privs */ static int mgt_vcc_touchfile(const char *fn, struct vsb *sb) { int i; i = open(fn, O_WRONLY|O_CREAT|O_TRUNC, 0640); if (i < 0) { VSB_printf(sb, "Failed to create %s: %s", fn, strerror(errno)); return (2); } if (fchown(i, mgt_param.uid, mgt_param.gid) != 0) if (geteuid() == 0) VSB_printf(sb, "Failed to change owner on %s: %s\n", fn, strerror(errno)); AZ(close(i)); return (0); } /*-------------------------------------------------------------------- * Compile a VCL program, return shared object, errors in sb. */ static unsigned mgt_vcc_compile(struct vcc_priv *vp, struct vsb *sb, int C_flag) { char *csrc; unsigned subs; if (mgt_vcc_touchfile(vp->csrcfile, sb)) return (2); if (mgt_vcc_touchfile(vp->libfile, sb)) return (2); subs = VSUB_run(sb, run_vcc, vp, "VCC-compiler", -1); if (subs) return (subs); if (C_flag) { csrc = VFIL_readfile(NULL, vp->csrcfile, NULL); AN(csrc); VSB_cat(sb, csrc); free(csrc); } subs = VSUB_run(sb, run_cc, vp, "C-compiler", 10); if (subs) return (subs); subs = VSUB_run(sb, run_dlopen, vp, "dlopen", 10); return (subs); } /*--------------------------------------------------------------------*/ char * mgt_VccCompile(struct cli *cli, const char *vclname, const char *vclsrc, const char *vclsrcfile, int C_flag) { struct vcc_priv vp; struct vsb *sb; unsigned status; AN(cli); sb = VSB_new_auto(); XXXAN(sb); INIT_OBJ(&vp, VCC_PRIV_MAGIC); vp.vclsrc = vclsrc; vp.vclsrcfile = vclsrcfile; VSB_printf(sb, "vcl_%s", vclname); AZ(VSB_finish(sb)); vp.dir = strdup(VSB_data(sb)); AN(vp.dir); VJ_make_vcldir(vp.dir); VSB_clear(sb); VSB_printf(sb, "%s/%s", vp.dir, VGC_SRC); AZ(VSB_finish(sb)); vp.csrcfile = strdup(VSB_data(sb)); AN(vp.csrcfile); VSB_clear(sb); VSB_printf(sb, "%s/%s", vp.dir, VGC_LIB); AZ(VSB_finish(sb)); vp.libfile = strdup(VSB_data(sb)); AN(vp.csrcfile); VSB_clear(sb); status = mgt_vcc_compile(&vp, sb, C_flag); AZ(VSB_finish(sb)); if (VSB_len(sb) > 0) VCLI_Out(cli, "%s", VSB_data(sb)); VSB_delete(sb); (void)unlink(vp.csrcfile); free(vp.csrcfile); free(vp.dir); if (status || C_flag) { (void)unlink(vp.libfile); free(vp.libfile); if (status) { VCLI_Out(cli, "VCL compilation failed"); VCLI_SetResult(cli, CLIS_PARAM); } return(NULL); } VCLI_Out(cli, "VCL compiled.\n"); return (vp.libfile); } /*--------------------------------------------------------------------*/ void mgt_vcc_init(void) { vcp = VCP_New(); AN(vcp); VCP_Builtin_VCL(vcp, builtin_vcl); } varnish-4.1.1/bin/varnishd/mgt/mgt_acceptor.c0000644000201500234410000001307212652366721016111 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Acceptor socket management */ #include "config.h" #include #include #include #include #include #include #include #include #include "mgt/mgt.h" #include "common/heritage.h" #include "vav.h" #include "vcli_priv.h" #include "vsa.h" #include "vss.h" #include "vtcp.h" static int mac_opensocket(struct listen_sock *ls, struct cli *cli) { int fail; CHECK_OBJ_NOTNULL(ls, LISTEN_SOCK_MAGIC); if (ls->sock > 0) { mgt_child_inherit(ls->sock, NULL); AZ(close(ls->sock)); } ls->sock = VTCP_bind(ls->addr, NULL); fail = errno; if (ls->sock < 0) { if (cli != NULL) VCLI_Out(cli, "Could not get socket %s: %s\n", ls->name, strerror(errno)); AN(fail); return (fail); } mgt_child_inherit(ls->sock, "sock"); return (0); } /*===================================================================== * Reopen the accept sockets to get rid of listen status. */ void MAC_reopen_sockets(struct cli *cli) { struct listen_sock *ls; VJ_master(JAIL_MASTER_PRIVPORT); VTAILQ_FOREACH(ls, &heritage.socks, list) (void)mac_opensocket(ls, cli); VJ_master(JAIL_MASTER_LOW); } /*===================================================================== * Make sure we have all our sockets (and try once more to get them) */ int MAC_sockets_ready(struct cli *cli) { int retval = 1; struct listen_sock *ls; VJ_master(JAIL_MASTER_PRIVPORT); VTAILQ_FOREACH(ls, &heritage.socks, list) { if (ls->sock < 0) (void)mac_opensocket(ls, cli); if (ls->sock < 0) retval = 0; } VJ_master(JAIL_MASTER_LOW); return (retval); } /*--------------------------------------------------------------------*/ struct mac_help { unsigned magic; #define MAC_HELP_MAGIC 0x1e00a9d9 int good; const char *name; const char *proto_name; enum sess_step first_step; }; static int __match_proto__(vss_resolved_f) mac_callback(void *priv, const struct suckaddr *sa) { struct mac_help *mh; struct listen_sock *ls; CAST_OBJ_NOTNULL(mh, priv, MAC_HELP_MAGIC); VTAILQ_FOREACH(ls, &heritage.socks, list) { if (!VSA_Compare(sa, ls->addr)) ARGV_ERR("-a arguments %s and %s have same address\n", ls->name, mh->name); } ALLOC_OBJ(ls, LISTEN_SOCK_MAGIC); AN(ls); ls->sock = -1; ls->addr = VSA_Clone(sa); AN(ls->addr); ls->name = strdup(mh->name); AN(ls->name); ls->proto_name = mh->proto_name; ls->first_step = mh->first_step; VTAILQ_INSERT_TAIL(&heritage.socks, ls, list); mh->good++; return (0); } void MAC_Validate(void) { struct listen_sock *ls; int fail; char abuf[VTCP_ADDRBUFSIZE], pbuf[VTCP_PORTBUFSIZE]; char nbuf[VTCP_ADDRBUFSIZE+VTCP_PORTBUFSIZE+2]; VTAILQ_FOREACH(ls, &heritage.socks, list) { VJ_master(JAIL_MASTER_PRIVPORT); fail = mac_opensocket(ls, NULL); VJ_master(JAIL_MASTER_LOW); if (fail) ARGV_ERR("Cannot open socket: %s: %s\n", ls->name, strerror(fail)); if (VSA_Port(ls->addr) == 0) { /* * If the port number is zero, we adopt whatever * port number this VTCP_bind() found us, as if * specified by argument. */ free(ls->addr); ls->addr = VTCP_my_suckaddr(ls->sock); VTCP_myname(ls->sock, abuf, sizeof abuf, pbuf, sizeof pbuf); bprintf(nbuf, "%s:%s", abuf, pbuf); REPLACE(ls->name, nbuf); } } } void MAC_Arg(const char *arg) { char **av; struct mac_help *mh; const char *err; int error; av = VAV_Parse(arg, NULL, ARGV_COMMA); if (av == NULL) ARGV_ERR("Parse error: out of memory\n"); if (av[0] != NULL) ARGV_ERR("%s\n", av[0]); ALLOC_OBJ(mh, MAC_HELP_MAGIC); AN(mh); mh->name = av[1]; if (av[2] == NULL || !strcmp(av[2], "HTTP/1")) { mh->first_step = S_STP_H1NEWSESS; mh->proto_name = "HTTP/1"; if (av[2] != NULL && av[3] != NULL) ARGV_ERR("Too many sub-arguments to -a(HTTP/1)\n"); } else if (!strcmp(av[2], "PROXY")) { mh->first_step = S_STP_PROXYNEWSESS; mh->proto_name = "PROXY"; if (av[3] != NULL) ARGV_ERR("Too many sub-arguments to -a(PROXY)\n"); } else { ARGV_ERR("Unknown protocol '%s'\n", av[2]); } error = VSS_resolver(av[1], "80", mac_callback, mh, &err); if (mh->good == 0 || error) ARGV_ERR("socket %s didn't resolve\n", av[1]); VAV_Free(av); FREE_OBJ(mh); } varnish-4.1.1/bin/varnishd/mgt/mgt_param.c0000644000201500234410000003401712652366721015413 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. */ #include "config.h" #include #include #include #include #include "mgt/mgt.h" #include "common/heritage.h" #include "mgt/mgt_param.h" #include "vav.h" #include "vcli.h" #include "vcli_common.h" #include "vcli_priv.h" #include "mgt_cli.h" struct plist { unsigned magic; #define PLIST_MAGIC 0xbfc3ea16 VTAILQ_ENTRY(plist) list; struct parspec *spec; }; static VTAILQ_HEAD(, plist) phead = VTAILQ_HEAD_INITIALIZER(phead); struct params mgt_param; static const int margin1 = 8; static int margin2 = 0; static const int wrap_at = 72; static const int tab0 = 3; /*--------------------------------------------------------------------*/ static const char OBJ_STICKY_TEXT[] = "\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\n" "NB: This parameter may take quite some time to take (full) effect."; static const char MUST_RESTART_TEXT[] = "\n\n" "NB: This parameter will not take any effect until the " "child process has been restarted."; static const char MUST_RELOAD_TEXT[] = "\n\n" "NB: This parameter will not take any effect until the " "VCL programs have been reloaded."; static const char EXPERIMENTAL_TEXT[] = "\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\n" "NB: Do not change this parameter, unless a developer tell " "you to do so."; static const char PROTECTED_TEXT[] = "\n\n" "NB: This parameter is protected and can not be changed."; static const char ONLY_ROOT_TEXT[] = "\n\n" "NB: This parameter only works if varnishd is run as root."; /*--------------------------------------------------------------------*/ static struct parspec * mcf_findpar(const char *name) { struct plist *pl; AN(name); VTAILQ_FOREACH(pl, &phead, list) if (!strcmp(pl->spec->name, name)) return (pl->spec); return (NULL); } static void mcf_addpar(struct parspec *ps) { struct plist *pl, *pl2; int i; ALLOC_OBJ(pl, PLIST_MAGIC); AN(pl); pl->spec = ps; VTAILQ_FOREACH(pl2, &phead, list) { i = strcmp(pl2->spec->name, pl->spec->name); if (i == 0) { fprintf(stderr, "Duplicate param: %s\n", ps->name); exit(4); } else if (i > 0) { VTAILQ_INSERT_BEFORE(pl2, pl, list); return; } } VTAILQ_INSERT_TAIL(&phead, pl, list); } /*-------------------------------------------------------------------- * Wrap the text nicely. * Lines are allowed to contain two TABS and we render that as a table * taking the width of the first column into account. */ static void mcf_wrap_line(struct cli *cli, const char *b, const char *e, int tabs, int m0) { int n, hadtabs = 0; const char *w; n = m0; VCLI_Out(cli, "%*s", n, ""); while (b < e) { if (!isspace(*b)) { VCLI_Out(cli, "%c", *b); b++; n++; } else if (*b == '\t') { assert(tabs); assert(hadtabs < 2); do { VCLI_Out(cli, " "); n++; } while ((n % tabs) != (m0 + tab0) % tabs); b++; hadtabs++; } else { assert (*b == ' '); for (w = b + 1; w < e; w++) if (isspace(*w)) break; if (n + (w - b) < wrap_at) { VCLI_Out(cli, "%.*s", (int)(w - b), b); n += (w - b); b = w; } else { assert(hadtabs == 0 || hadtabs == 2); VCLI_Out(cli, "\n"); mcf_wrap_line(cli, b + 1, e, 0, hadtabs ? m0 + tab0 + tabs : m0); return; } } } assert(b == e); } static void mcf_wrap(struct cli *cli, const char *text) { const char *p, *q, *r; int tw = 0; if (strchr(text, '\t') != NULL) { for (p = text; *p != '\0'; ) { q = strstr(p, "\n\t"); if (q == NULL) break; q += 2; r = strchr(q, '\t'); if (r == NULL) { fprintf(stderr, "LINE with just one TAB: <%s>\n", text); exit(4); } if (r - q > tw) tw = r - q; p = q; } tw += 2; if (tw < 20) tw = 20; } for (p = text; *p != '\0'; ) { if (*p == '\n') { VCLI_Out(cli, "\n"); p++; continue; } q = strchr(p, '\n'); if (q == NULL) q = strchr(p, '\0'); mcf_wrap_line(cli, p, q, tw, margin1); p = q; } } /*--------------------------------------------------------------------*/ void mcf_param_show(struct cli *cli, const char * const *av, void *priv) { int n; struct plist *pl; const struct parspec *pp; int lfmt = 0, chg = 0; struct vsb *vsb; vsb = VSB_new_auto(); (void)priv; if (av[2] != NULL && !strcmp(av[2], "changed")) chg = 1; else if (av[2] != NULL) lfmt = 1; n = 0; VTAILQ_FOREACH(pl, &phead, list) { pp = pl->spec; if (lfmt && strcmp(pp->name, av[2]) && strcmp("-l", av[2])) continue; n++; VSB_clear(vsb); if (pp->func(vsb, pp, NULL)) VCLI_SetResult(cli, CLIS_PARAM); AZ(VSB_finish(vsb)); if (chg && pp->def != NULL && !strcmp(pp->def, VSB_data(vsb))) continue; if (lfmt) { VCLI_Out(cli, "%s\n", pp->name); VCLI_Out(cli, "%-*sValue is: ", margin1, " "); } else { VCLI_Out(cli, "%-*s", margin2, pp->name); } VCLI_Out(cli, "%s", VSB_data(vsb)); if (pp->units != NULL && *pp->units != '\0') VCLI_Out(cli, " [%s]", pp->units); if (pp->def != NULL && !strcmp(pp->def, VSB_data(vsb))) VCLI_Out(cli, " (default)"); VCLI_Out(cli, "\n"); if (lfmt) { if (pp->def != NULL && strcmp(pp->def, VSB_data(vsb))) VCLI_Out(cli, "%-*sDefault is: %s\n", margin1, "", pp->def); if (pp->min != NULL) VCLI_Out(cli, "%-*sMinimum is: %s\n", margin1, "", pp->min); if (pp->max != NULL) VCLI_Out(cli, "%-*sMaximum is: %s\n", margin1, "", pp->max); VCLI_Out(cli, "\n"); mcf_wrap(cli, pp->descr); if (pp->flags & OBJ_STICKY) mcf_wrap(cli, OBJ_STICKY_TEXT); if (pp->flags & DELAYED_EFFECT) mcf_wrap(cli, DELAYED_EFFECT_TEXT); if (pp->flags & EXPERIMENTAL) mcf_wrap(cli, EXPERIMENTAL_TEXT); if (pp->flags & MUST_RELOAD) mcf_wrap(cli, MUST_RELOAD_TEXT); if (pp->flags & MUST_RESTART) mcf_wrap(cli, MUST_RESTART_TEXT); if (pp->flags & WIZARD) mcf_wrap(cli, WIZARD_TEXT); if (pp->flags & PROTECTED) mcf_wrap(cli, PROTECTED_TEXT); if (pp->flags & ONLY_ROOT) mcf_wrap(cli, ONLY_ROOT_TEXT); VCLI_Out(cli, "\n\n"); } } if (av[2] != NULL && lfmt && strcmp(av[2], "-l") && n == 0) { VCLI_SetResult(cli, CLIS_PARAM); VCLI_Out(cli, "Unknown parameter \"%s\".", av[2]); } VSB_delete(vsb); } /*-------------------------------------------------------------------- * Mark parameters as protected */ void MCF_ParamProtect(struct cli *cli, const char *args) { char **av; struct parspec *pp; int i; av = VAV_Parse(args, NULL, ARGV_COMMA); if (av[0] != NULL) { VCLI_Out(cli, "Parse error: %s", av[0]); VCLI_SetResult(cli, CLIS_PARAM); VAV_Free(av); return; } for (i = 1; av[i] != NULL; i++) { pp = mcf_findpar(av[i]); if (pp == NULL) { VCLI_Out(cli, "Unknown parameter %s", av[i]); VCLI_SetResult(cli, CLIS_PARAM); VAV_Free(av); return; } pp->flags |= PROTECTED; } VAV_Free(av); } /*--------------------------------------------------------------------*/ void MCF_ParamSet(struct cli *cli, const char *param, const char *val) { const struct parspec *pp; pp = mcf_findpar(param); if (pp == NULL) { VCLI_SetResult(cli, CLIS_PARAM); VCLI_Out(cli, "Unknown parameter \"%s\".", param); return; } if (pp->flags & PROTECTED) { VCLI_SetResult(cli, CLIS_AUTH); VCLI_Out(cli, "parameter \"%s\" is protected.", param); return; } if (pp->func(cli->sb, pp, val)) VCLI_SetResult(cli, CLIS_PARAM); if (cli->result == CLIS_OK && heritage.param != NULL) *heritage.param = mgt_param; if (cli->result != CLIS_OK) { VCLI_Out(cli, "\n(attempting to set param '%s' to '%s')", pp->name, val); } else if (child_pid >= 0 && pp->flags & MUST_RESTART) { VCLI_Out(cli, "\nChange will take effect when child is restarted"); } else if (pp->flags & MUST_RELOAD) { VCLI_Out(cli, "\nChange will take effect when VCL script is reloaded"); } } /*--------------------------------------------------------------------*/ void mcf_param_set(struct cli *cli, const char * const *av, void *priv) { (void)priv; MCF_ParamSet(cli, av[2], av[3]); } /*-------------------------------------------------------------------- * Add a group of parameters to the global set and sort by name. */ void MCF_AddParams(struct parspec *ps) { struct parspec *pp; const char *s; for (pp = ps; pp->name != NULL; pp++) { AN(pp->func); s = strchr(pp->descr, '\0'); if (isspace(s[-1])) { fprintf(stderr, "Param->descr has trailing space: %s\n", pp->name); exit(4); } mcf_addpar(pp); if (strlen(pp->name) + 1 > margin2) margin2 = strlen(pp->name) + 1; } } /*-------------------------------------------------------------------- * Wash a min/max/default value */ static void mcf_wash_param(struct cli *cli, const struct parspec *pp, const char **val, const char *name, struct vsb *vsb) { int err; AN(*val); VSB_clear(vsb); VSB_printf(vsb, "FAILED to set %s for param %s: %s\n", name, pp->name, *val); err = pp->func(vsb, pp, *val); AZ(VSB_finish(vsb)); if (err) { VCLI_Out(cli, "%s\n", VSB_data(vsb)); VCLI_SetResult(cli, CLIS_CANT); return; } VSB_clear(vsb); err = pp->func(vsb, pp, NULL); AZ(err); AZ(VSB_finish(vsb)); if (strcmp(*val, VSB_data(vsb))) { *val = strdup(VSB_data(vsb)); AN(*val); } } /*-------------------------------------------------------------------- * Wash the min/max/default values, and leave the default set. */ void MCF_InitParams(struct cli *cli) { struct plist *pl; struct parspec *pp; struct vsb *vsb; vsb = VSB_new_auto(); AN(vsb); VTAILQ_FOREACH(pl, &phead, list) { pp = pl->spec; if (pp->min != NULL) mcf_wash_param(cli, pp, &pp->min, "minimum", vsb); if (pp->max != NULL) mcf_wash_param(cli, pp, &pp->max, "maximum", vsb); AN(pp->def); mcf_wash_param(cli, pp, &pp->def, "default", vsb); } VSB_delete(vsb); } /*--------------------------------------------------------------------*/ void MCF_CollectParams(void) { MCF_AddParams(mgt_parspec); MCF_AddParams(WRK_parspec); MCF_AddParams(VSL_parspec); } /*--------------------------------------------------------------------*/ void MCF_SetDefault(const char *param, const char *new_def) { struct parspec *pp; pp = mcf_findpar(param); AN(pp); pp->def = new_def; AN(pp->def); } void MCF_SetMinimum(const char *param, const char *new_min) { struct parspec *pp; AN(new_min); pp = mcf_findpar(param); AN(pp); pp->min = new_min; AN(pp->min); } void MCF_SetMaximum(const char *param, const char *new_max) { struct parspec *pp; AN(new_max); pp = mcf_findpar(param); AN(pp); pp->max = new_max; AN(pp->max); } /*--------------------------------------------------------------------*/ void MCF_DumpRstParam(void) { struct plist *pl; const struct parspec *pp; const char *p, *q, *t1, *t2; int j; printf("\n.. The following is the autogenerated " "output from varnishd -x dumprstparam\n\n"); VTAILQ_FOREACH(pl, &phead, list) { pp = pl->spec; printf(".. _ref_param_%s:\n\n", pp->name); printf("%s\n", pp->name); for (j = 0; j < strlen(pp->name); j++) printf("~"); printf("\n"); if (pp->units != NULL && *pp->units != '\0') printf("\t* Units: %s\n", pp->units); printf("\t* Default: %s\n", pp->def); if (pp->min != NULL) printf("\t* Minimum: %s\n", pp->min); if (pp->max != NULL) printf("\t* Maximum: %s\n", pp->max); /* * XXX: we should mark the params with one/two flags * XXX: that say if ->min/->max are valid, so we * XXX: can emit those also in help texts. */ if (pp->flags) { printf("\t* Flags: "); q = ""; if (pp->flags & DELAYED_EFFECT) { printf("%sdelayed", q); q = ", "; } if (pp->flags & MUST_RESTART) { printf("%smust_restart", q); q = ", "; } if (pp->flags & MUST_RELOAD) { printf("%smust_reload", q); q = ", "; } if (pp->flags & EXPERIMENTAL) { printf("%sexperimental", q); q = ", "; } if (pp->flags & WIZARD) { printf("%swizard", q); q = ", "; } if (pp->flags & ONLY_ROOT) { printf("%sonly_root", q); q = ", "; } if (pp->flags & OBJ_STICKY) { printf("%sobj_sticky", q); q = ", "; } printf("\n"); } printf("\n"); p = pp->descr; while (*p != '\0') { q = strchr(p, '\n'); if (q == NULL) q = strchr(p, '\0'); t1 = strchr(p, '\t'); if (t1 != NULL && t1 < q) { t2 = strchr(t1 + 1, '\t'); printf("\n\t*"); (void)fwrite(t1 + 1, (t2 - 1) - t1, 1, stdout); printf("*\n\t\t"); p = t2 + 1; } (void)fwrite(p, q - p, 1, stdout); p = q; if (*p == '\n') { printf("\n"); p++; } continue; } printf("\n\n"); } } varnish-4.1.1/bin/varnishd/mgt/mgt_child.c0000644000201500234410000004104212652366721015372 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The mechanics of handling the child process */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include "mgt/mgt.h" #include "common/heritage.h" #include "vbm.h" #include "vcli.h" #include "vcli_priv.h" #include "vev.h" #include "vlu.h" #include "vtim.h" #include "mgt_cli.h" pid_t child_pid = -1; static struct vbitmap *fd_map; static int child_cli_in = -1; static int child_cli_out = -1; static int child_output = -1; static enum { CH_STOPPED = 0, CH_STARTING = 1, CH_RUNNING = 2, CH_STOPPING = 3, CH_DIED = 4 } child_state = CH_STOPPED; static const char * const ch_state[] = { [CH_STOPPED] = "stopped", [CH_STARTING] = "starting", [CH_RUNNING] = "running", [CH_STOPPING] = "stopping", [CH_DIED] = "died, (restarting)", }; static struct vev *ev_poker; static struct vev *ev_listen; static struct vlu *child_std_vlu; static struct vsb *child_panic = NULL; static double mgt_uptime_t0 = 0.; static void mgt_reap_child(void); /*--------------------------------------------------------------------- * A handy little function */ static inline void closex(int *fd) { assert(*fd >= 0); AZ(close(*fd)); *fd = -1; } /*===================================================================== * Panic string evacuation and handling */ static void mgt_panic_record(pid_t r) { char time_str[30]; if (child_panic != NULL) VSB_delete(child_panic); child_panic = VSB_new_auto(); AN(child_panic); VTIM_format(VTIM_real(), time_str); VSB_printf(child_panic, "Last panic at: %s\n", time_str); VSB_quote(child_panic, heritage.panic_str, strnlen(heritage.panic_str, heritage.panic_str_len), VSB_QUOTE_NONL); AZ(VSB_finish(child_panic)); MGT_complain(C_ERR, "Child (%jd) %s", (intmax_t)r, VSB_data(child_panic)); } static void mgt_panic_clear(void) { VSB_delete(child_panic); child_panic = NULL; } void __match_proto__(cli_func_t) mcf_panic_show(struct cli *cli, const char * const *av, void *priv) { (void)av; (void)priv; if (!child_panic) { VCLI_SetResult(cli, CLIS_CANT); VCLI_Out(cli, "Child has not panicked or panic has been cleared"); return; } VCLI_Out(cli, "%s\n", VSB_data(child_panic)); } void __match_proto__(cli_func_t) mcf_panic_clear(struct cli *cli, const char * const *av, void *priv) { (void)priv; if (av[2] != NULL && strcmp(av[2], "-z")) { VCLI_SetResult(cli, CLIS_PARAM); VCLI_Out(cli, "Unknown parameter \"%s\".", av[2]); return; } else if (av[2] != NULL) { VSC_C_mgt->child_panic = static_VSC_C_mgt.child_panic = 0; if (child_panic == NULL) return; } if (child_panic == NULL) { VCLI_SetResult(cli, CLIS_CANT); VCLI_Out(cli, "No panic to clear"); return; } mgt_panic_clear(); } /*===================================================================== * Track the highest file descriptor the parent knows is being used. * * This allows the child process to clean/close only a small fraction * of the possible file descriptors after exec(2). * * This is likely to a bit on the low side, as libc and other libraries * has a tendency to cache file descriptors (syslog, resolver, etc.) * so we add a margin of 100 fds. */ static int mgt_max_fd; #define CLOSE_FD_UP_TO (mgt_max_fd + 100) void mgt_got_fd(int fd) { /* * Assert > 0, to catch bogus opens, we know where stdin goes * in the master process. */ assert(fd > 0); if (fd > mgt_max_fd) mgt_max_fd = fd; } /*-------------------------------------------------------------------- * Keep track of which filedescriptors the child should inherit and * which should be closed after fork() */ void mgt_child_inherit(int fd, const char *what) { assert(fd >= 0); if (fd_map == NULL) fd_map = vbit_init(128); AN(fd_map); if (what != NULL) vbit_set(fd_map, fd); else vbit_clr(fd_map, fd); } /*===================================================================== * Listen to stdout+stderr from the child */ static int child_line(void *priv, const char *p) { (void)priv; MGT_complain(C_INFO, "Child (%jd) said %s", (intmax_t)child_pid, p); return (0); } /*-------------------------------------------------------------------- * NB: Notice cleanup call from mgt_reap_child() */ static int __match_proto__(vev_cb_f) child_listener(const struct vev *e, int what) { if ((what & ~EV_RD) || VLU_Fd(child_output, child_std_vlu)) { ev_listen = NULL; if (e != NULL) mgt_reap_child(); return (1); } return (0); } /*===================================================================== * Periodically poke the child, to see that it still lives */ static int __match_proto__(vev_cb_f) child_poker(const struct vev *e, int what) { (void)e; (void)what; if (child_state != CH_RUNNING) return (1); if (child_pid < 0) return (0); if (!mgt_cli_askchild(NULL, NULL, "ping\n")) return (0); return (0); } /*===================================================================== * SIGSEGV handler for child process */ static void __match_proto__() child_sigsegv_handler(int s, siginfo_t *si, void *c) { char buf[1024]; (void)s; (void)c; sprintf(buf, "Segmentation fault by instruction at %p", si->si_addr); VAS_Fail(__func__, __FILE__, __LINE__, buf, VAS_ASSERT); } /*===================================================================== * Launch the child process */ static void mgt_launch_child(struct cli *cli) { pid_t pid; unsigned u; char *p; struct vev *e; int i, cp[2]; struct sigaction sa; if (child_state != CH_STOPPED && child_state != CH_DIED) return; if (!MAC_sockets_ready(cli)) { child_state = CH_STOPPED; if (cli != NULL) { VCLI_SetResult(cli, CLIS_CANT); return; } MGT_complain(C_ERR, "Child start failed: could not open sockets"); return; } child_state = CH_STARTING; /* Open pipe for mgr->child CLI */ AZ(pipe(cp)); heritage.cli_in = cp[0]; mgt_child_inherit(heritage.cli_in, "cli_in"); child_cli_out = cp[1]; /* Open pipe for child->mgr CLI */ AZ(pipe(cp)); heritage.cli_out = cp[1]; mgt_child_inherit(heritage.cli_out, "cli_out"); child_cli_in = cp[0]; /* * Open pipe for child stdout/err * NB: not inherited, because we dup2() it to stdout/stderr in child */ AZ(pipe(cp)); heritage.std_fd = cp[1]; child_output = cp[0]; AN(heritage.vsm); mgt_SHM_Size_Adjust(); AN(heritage.vsm); AN(heritage.param); if ((pid = fork()) < 0) { /* XXX */ perror("Could not fork child"); exit(1); } if (pid == 0) { /* Redirect stdin/out/err */ AZ(close(STDIN_FILENO)); assert(open("/dev/null", O_RDONLY) == STDIN_FILENO); assert(dup2(heritage.std_fd, STDOUT_FILENO) == STDOUT_FILENO); assert(dup2(heritage.std_fd, STDERR_FILENO) == STDERR_FILENO); /* Close anything we shouldn't know about */ closelog(); for (i = STDERR_FILENO + 1; i < CLOSE_FD_UP_TO; i++) { if (vbit_test(fd_map, i)) continue; (void)(close(i) == 0); } #ifdef HAVE_SETPROCTITLE setproctitle("Varnish-Chld %s", heritage.name); #endif if (mgt_param.sigsegv_handler) { memset(&sa, 0, sizeof sa); sa.sa_sigaction = child_sigsegv_handler; sa.sa_flags = SA_SIGINFO; (void)sigaction(SIGSEGV, &sa, NULL); (void)sigaction(SIGBUS, &sa, NULL); (void)sigaction(SIGABRT, &sa, NULL); } (void)signal(SIGINT, SIG_DFL); (void)signal(SIGTERM, SIG_DFL); VJ_subproc(JAIL_SUBPROC_WORKER); child_main(); exit(0); } assert(pid > 1); MGT_complain(C_DEBUG, "Child (%jd) Started", (intmax_t)pid); VSC_C_mgt->child_start = ++static_VSC_C_mgt.child_start; /* Close stuff the child got */ closex(&heritage.std_fd); mgt_child_inherit(heritage.cli_in, NULL); closex(&heritage.cli_in); mgt_child_inherit(heritage.cli_out, NULL); closex(&heritage.cli_out); child_std_vlu = VLU_New(NULL, child_line, 0); AN(child_std_vlu); AZ(ev_listen); e = vev_new(); XXXAN(e); e->fd = child_output; e->fd_flags = EV_RD; e->name = "Child listener"; e->callback = child_listener; AZ(vev_add(mgt_evb, e)); ev_listen = e; AZ(ev_poker); if (mgt_param.ping_interval > 0) { e = vev_new(); XXXAN(e); e->timeout = mgt_param.ping_interval; e->callback = child_poker; e->name = "child poker"; AZ(vev_add(mgt_evb, e)); ev_poker = e; } mgt_cli_start_child(child_cli_in, child_cli_out); child_pid = pid; if (mgt_push_vcls_and_start(cli, &u, &p)) { VCLI_SetResult(cli, u); MGT_complain(C_ERR, "Child (%jd) Pushing vcls failed:\n%s", (intmax_t)child_pid, p); free(p); child_state = CH_RUNNING; mgt_stop_child(); } else child_state = CH_RUNNING; } /*===================================================================== * Cleanup when child dies. */ static void mgt_reap_child(void) { int i; int status; struct vsb *vsb; pid_t r; assert(child_pid != -1); /* * Close the CLI connections * This signals orderly shut down to child */ mgt_cli_stop_child(); if (child_cli_out >= 0) closex(&child_cli_out); if (child_cli_in >= 0) closex(&child_cli_in); /* Stop the poker */ if (ev_poker != NULL) { vev_del(mgt_evb, ev_poker); free(ev_poker); } ev_poker = NULL; /* Stop the listener */ if (ev_listen != NULL) { vev_del(mgt_evb, ev_listen); free(ev_listen); ev_listen = NULL; } /* Wait 10 seconds for child to die */ for (i = 0; i < 10; i++) { r = waitpid(child_pid, &status, WNOHANG); if (r == child_pid) break; (void)sleep(1); } if (r == 0) { /* Kick it Jim... */ if (MGT_FEATURE(FEATURE_NO_COREDUMP)) (void)kill(child_pid, SIGKILL); else (void)kill(child_pid, SIGQUIT); r = waitpid(child_pid, &status, 0); } if (r != child_pid) fprintf(stderr, "WAIT 0x%jx\n", (uintmax_t)r); assert(r == child_pid); MAC_reopen_sockets(NULL); /* Compose obituary */ vsb = VSB_new_auto(); XXXAN(vsb); VSB_printf(vsb, "Child (%jd) %s", (intmax_t)r, status ? "died" : "ended"); if (WIFEXITED(status) && WEXITSTATUS(status)) { VSB_printf(vsb, " status=%d", WEXITSTATUS(status)); exit_status |= 0x20; if (WEXITSTATUS(status) == 1) VSC_C_mgt->child_exit = ++static_VSC_C_mgt.child_exit; else VSC_C_mgt->child_stop = ++static_VSC_C_mgt.child_stop; } if (WIFSIGNALED(status)) { VSB_printf(vsb, " signal=%d", WTERMSIG(status)); exit_status |= 0x40; VSC_C_mgt->child_died = ++static_VSC_C_mgt.child_died; } #ifdef WCOREDUMP if (WCOREDUMP(status)) { VSB_printf(vsb, " (core dumped)"); exit_status |= 0x80; VSC_C_mgt->child_dump = ++static_VSC_C_mgt.child_dump; } #endif AZ(VSB_finish(vsb)); MGT_complain(status ? C_ERR : C_INFO, "%s", VSB_data(vsb)); VSB_delete(vsb); /* Dispose of shared memory but evacuate panic messages first */ if (heritage.panic_str[0] != '\0') { mgt_panic_record(r); mgt_SHM_Destroy(1); VSC_C_mgt->child_panic = ++static_VSC_C_mgt.child_panic; } else { mgt_SHM_Destroy(MGT_DO_DEBUG(DBG_VSM_KEEP)); } mgt_SHM_Create(); mgt_SHM_Commit(); if (child_state == CH_RUNNING) child_state = CH_DIED; /* Pick up any stuff lingering on stdout/stderr */ (void)child_listener(NULL, EV_RD); closex(&child_output); VLU_Destroy(child_std_vlu); child_pid = -1; MGT_complain(C_DEBUG, "Child cleanup complete"); if (child_state == CH_DIED && mgt_param.auto_restart) mgt_launch_child(NULL); else if (child_state == CH_DIED) child_state = CH_STOPPED; else if (child_state == CH_STOPPING) child_state = CH_STOPPED; } /*===================================================================== * If CLI communications with the child process fails, there is nothing * for us to do but to drag it behind the barn and get it over with. * * The typical case is where the child process fails to return a reply * before the cli_timeout expires. This invalidates the CLI pipes for * all future use, as we don't know if the child was just slow and the * result gets piped later on, or if the child is catatonic. */ void MGT_Child_Cli_Fail(void) { if (child_state != CH_RUNNING) return; if (child_pid < 0) return; MGT_complain(C_ERR, "Child (%jd) not responding to CLI, killing it.", (intmax_t)child_pid); if (MGT_FEATURE(FEATURE_NO_COREDUMP)) (void)kill(child_pid, SIGKILL); else (void)kill(child_pid, SIGQUIT); } /*===================================================================== * Controlled stop of child process * * Reaping the child asks for orderly shutdown */ void mgt_stop_child(void) { if (child_state != CH_RUNNING) return; child_state = CH_STOPPING; MGT_complain(C_DEBUG, "Stopping Child"); mgt_reap_child(); } /*===================================================================== * CLI command to start/stop child */ void __match_proto__(cli_func_t) mcf_server_startstop(struct cli *cli, const char * const *av, void *priv) { (void)av; if (priv != NULL && child_state == CH_RUNNING) mgt_stop_child(); else if (priv == NULL && child_state == CH_STOPPED) { if (mgt_has_vcl()) { mgt_launch_child(cli); } else { VCLI_SetResult(cli, CLIS_CANT); VCLI_Out(cli, "No VCL available"); } } else { VCLI_SetResult(cli, CLIS_CANT); VCLI_Out(cli, "Child in state %s", ch_state[child_state]); } } /*--------------------------------------------------------------------*/ void mcf_server_status(struct cli *cli, const char * const *av, void *priv) { (void)av; (void)priv; VCLI_Out(cli, "Child in state %s", ch_state[child_state]); } /*--------------------------------------------------------------------*/ static int __match_proto__(vev_cb_f) mgt_sigint(const struct vev *e, int what) { (void)e; (void)what; MGT_complain(C_ERR, "Manager got SIGINT"); (void)fflush(stdout); if (child_pid >= 0) mgt_stop_child(); exit(0); } /*--------------------------------------------------------------------*/ static int __match_proto__(vev_cb_f) mgt_uptime(const struct vev *e, int what) { (void)e; (void)what; AN(VSC_C_mgt); VSC_C_mgt->uptime = static_VSC_C_mgt.uptime = (uint64_t)(VTIM_real() - mgt_uptime_t0); if (heritage.vsm != NULL) VSM_common_ageupdate(heritage.vsm); return (0); } /*===================================================================== * This thread is the master thread in the management process. * The relatively simple task is to start and stop the child process * and to reincarnate it in case of trouble. */ void MGT_Run(void) { struct sigaction sac; struct vev *e; int i; mgt_uptime_t0 = VTIM_real(); e = vev_new(); XXXAN(e); e->callback = mgt_uptime; e->timeout = 1.0; e->name = "mgt_uptime"; AZ(vev_add(mgt_evb, e)); e = vev_new(); XXXAN(e); e->sig = SIGTERM; e->callback = mgt_sigint; e->name = "mgt_sigterm"; AZ(vev_add(mgt_evb, e)); e = vev_new(); XXXAN(e); e->sig = SIGINT; e->callback = mgt_sigint; e->name = "mgt_sigint"; AZ(vev_add(mgt_evb, e)); #ifdef HAVE_SETPROCTITLE setproctitle("Varnish-Mgr %s", heritage.name); #endif memset(&sac, 0, sizeof sac); sac.sa_handler = SIG_IGN; sac.sa_flags = SA_RESTART; AZ(sigaction(SIGPIPE, &sac, NULL)); AZ(sigaction(SIGHUP, &sac, NULL)); if (!d_flag && !mgt_has_vcl()) MGT_complain(C_ERR, "No VCL loaded yet"); else if (!d_flag) { mgt_launch_child(NULL); if (child_state != CH_RUNNING) { // XXX correct? or 0? exit_status = 2; return; } } mgt_SHM_Commit(); i = vev_schedule(mgt_evb); if (i != 0) MGT_complain(C_ERR, "vev_schedule() = %d", i); MGT_complain(C_INFO, "manager dies"); } varnish-4.1.1/bin/varnishd/mgt/mgt_jail.c0000644000201500234410000001131212652366721015223 00000000000000/*- * Copyright (c) 2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Jailing * */ #include "config.h" #include #include #include #include #include #include #include #include "mgt/mgt.h" #include "vav.h" /********************************************************************** * A "none" jail implementation which doesn't do anything. */ static int __match_proto__(jail_init_f) vjn_init(char **args) { if (args != NULL && *args != NULL) ARGV_ERR("-jnone takes no arguments.\n"); return (0); } static void __match_proto__(jail_master_f) vjn_master(enum jail_master_e jme) { (void)jme; } static void __match_proto__(jail_subproc_f) vjn_subproc(enum jail_subproc_e jse) { (void)jse; } static const struct jail_tech jail_tech_none = { .magic = JAIL_TECH_MAGIC, .name = "none", .init = vjn_init, .master = vjn_master, .subproc = vjn_subproc, }; /**********************************************************************/ static const struct jail_tech *vjt; static const struct choice vj_choice[] = { #ifdef HAVE_SETPPRIV { "solaris", &jail_tech_solaris }, #endif { "unix", &jail_tech_unix }, { "none", &jail_tech_none }, { NULL, NULL }, }; void VJ_Init(const char *j_arg) { char **av; int i; if (j_arg != NULL) { av = VAV_Parse(j_arg, NULL, ARGV_COMMA); AN(av); if (av[0] != NULL) ARGV_ERR("-j argument: %s\n", av[0]); if (av[1] == NULL) ARGV_ERR("-j argument is emtpy\n"); vjt = pick(vj_choice, av[1], "jail"); CHECK_OBJ_NOTNULL(vjt, JAIL_TECH_MAGIC); (void)vjt->init(av + 2); VAV_Free(av); } else { /* * Go through list of jail technologies until one * succeeds, falling back to "none". */ for (i = 0; vj_choice[i].name != NULL; i++) { vjt = vj_choice[i].ptr; CHECK_OBJ_NOTNULL(vjt, JAIL_TECH_MAGIC); if (!vjt->init(NULL)) break; } } VSB_printf(vident, ",-j%s", vjt->name); } void VJ_master(enum jail_master_e jme) { CHECK_OBJ_NOTNULL(vjt, JAIL_TECH_MAGIC); vjt->master(jme); } void VJ_subproc(enum jail_subproc_e jse) { CHECK_OBJ_NOTNULL(vjt, JAIL_TECH_MAGIC); vjt->subproc(jse); } void VJ_make_workdir(const char *dname) { int fd; AN(dname); CHECK_OBJ_NOTNULL(vjt, JAIL_TECH_MAGIC); if (vjt->make_workdir != NULL) { vjt->make_workdir(dname); return; } VJ_master(JAIL_MASTER_FILE); if (mkdir(dname, 0755) < 0 && errno != EEXIST) ARGV_ERR("Cannot create working directory '%s': %s\n", dname, strerror(errno)); if (chdir(dname) < 0) ARGV_ERR("Cannot change to working directory '%s': %s\n", dname, strerror(errno)); fd = open("_.testfile", O_RDWR|O_CREAT|O_EXCL, 0600); if (fd < 0) ARGV_ERR("Error: Cannot create test-file in %s (%s)\n" "Check permissions (or delete old directory)\n", dname, strerror(errno)); AZ(close(fd)); AZ(unlink("_.testfile")); VJ_master(JAIL_MASTER_LOW); } void VJ_make_vcldir(const char *dname) { AN(dname); CHECK_OBJ_NOTNULL(vjt, JAIL_TECH_MAGIC); if (vjt->make_vcldir != NULL) { vjt->make_vcldir(dname); return; } if (mkdir(dname, 0755) < 0 && errno != EEXIST) ARGV_ERR("Cannot create VCL directory '%s': %s\n", dname, strerror(errno)); } void VJ_fix_storage_file(int fd) { CHECK_OBJ_NOTNULL(vjt, JAIL_TECH_MAGIC); if (vjt->storage_file != NULL) vjt->storage_file(fd); } void VJ_fix_vsm_file(int fd) { CHECK_OBJ_NOTNULL(vjt, JAIL_TECH_MAGIC); if (vjt->vsm_file != NULL) vjt->vsm_file(fd); } varnish-4.1.1/bin/varnishd/mgt/mgt_shmem.c0000644000201500234410000001761012652366721015424 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ #include "config.h" #include #include #include #include #include #include #include #include #include #include "mgt/mgt.h" #include "common/heritage.h" #include "flopen.h" #include "vsm_priv.h" #include "vmb.h" #include "vfil.h" #ifndef MAP_HASSEMAPHORE #define MAP_HASSEMAPHORE 0 /* XXX Linux */ #endif #ifndef MAP_NOSYNC #define MAP_NOSYNC 0 /* XXX Linux */ #endif #define PAN_CLASS "Panic" static void *mgt_vsm_p; static ssize_t mgt_vsm_l; /*-------------------------------------------------------------------- * Use a bogo-VSM to hold master-copies of the VSM chunks the master * publishes, such as -S & -T arguments. */ static struct vsm_sc *static_vsm; static char static_vsm_buf[1024]; void mgt_SHM_static_alloc(const void *ptr, ssize_t size, const char *class, const char *type, const char *ident) { void *p; p = VSM_common_alloc(static_vsm, size, class, type, ident); AN(p); memcpy(p, ptr, size); if (heritage.vsm != NULL) { p = VSM_common_alloc(heritage.vsm, size, class, type, ident); AN(p); memcpy(p, ptr, size); } } /*-------------------------------------------------------------------- * Check that we are not started with the same -n argument as an already * running varnishd. * * Non-zero return means we should exit and not trample the file. * */ static int vsm_n_check(void) { int fd, i; struct stat st; pid_t pid; struct VSM_head vsmh; int retval = 1; fd = open(VSM_FILENAME, O_RDWR); if (fd < 0) return (0); AZ(fstat(fd, &st)); if (!S_ISREG(st.st_mode)) { fprintf(stderr, "VSM (%s) not a regular file.\n", VSM_FILENAME); } else { i = fltest(fd, &pid); if (i < 0) { fprintf(stderr, "Cannot determine locking status of VSM (%s)\n.", VSM_FILENAME); } else if (i == 0) { /* * File is unlocked, mark it as dead, to help any * consumers still stuck on it. */ if (pread(fd, &vsmh, sizeof vsmh, 0) == sizeof vsmh) { vsmh.alloc_seq = 0; assert(sizeof vsmh == pwrite(fd, &vsmh, sizeof vsmh, 0)); } retval = 0; } else { /* The VSM is locked, we won't touch it. */ fprintf(stderr, "VSM locked by running varnishd master (pid=%jd)\n" "(Use unique -n arguments if you want" " multiple instances)\n", (intmax_t)pid); } } (void)close(fd); return (retval); } /*-------------------------------------------------------------------- * Build a zeroed file */ static int vsm_zerofile(const char *fn, ssize_t size) { int fd; int flags; fd = flopen(fn, O_RDWR | O_CREAT | O_EXCL | O_NONBLOCK, 0640); if (fd < 0) { fprintf(stderr, "Could not create %s: %s\n", fn, strerror(errno)); return (-1); } VJ_fix_vsm_file(fd); flags = fcntl(fd, F_GETFL); assert(flags != -1); flags &= ~O_NONBLOCK; AZ(fcntl(fd, F_SETFL, flags)); if (VFIL_allocate(fd, (off_t)size, 1)) { fprintf(stderr, "File allocation error %s: %s\n", fn, strerror(errno)); return (-1); } return (fd); } /*-------------------------------------------------------------------- * Create a VSM instance */ static size_t mgt_shm_size(void) { size_t size, ps; size = mgt_param.vsl_space + mgt_param.vsm_space; ps = getpagesize(); size = RUP2(size, ps); return (size); } void mgt_SHM_Create(void) { size_t size; void *p; char fnbuf[64]; int vsm_fd; AZ(heritage.vsm); size = mgt_shm_size(); bprintf(fnbuf, "%s.%jd", VSM_FILENAME, (intmax_t)getpid()); VJ_master(JAIL_MASTER_FILE); vsm_fd = vsm_zerofile(fnbuf, size); VJ_master(JAIL_MASTER_LOW); if (vsm_fd < 0) exit(1); p = (void *)mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED, vsm_fd, 0); AZ(close(vsm_fd)); if (p == MAP_FAILED) { fprintf(stderr, "Mmap error %s: %s\n", fnbuf, strerror(errno)); exit(1); } mgt_vsm_p = p; mgt_vsm_l = size; /* This may or may not work */ (void)mlock(p, size); heritage.vsm = VSM_common_new(p, size); VSM_common_copy(heritage.vsm, static_vsm); heritage.param = VSM_common_alloc(heritage.vsm, sizeof *heritage.param, VSM_CLASS_PARAM, "", ""); AN(heritage.param); *heritage.param = mgt_param; heritage.panic_str_len = 64 * 1024; heritage.panic_str = VSM_common_alloc(heritage.vsm, heritage.panic_str_len, PAN_CLASS, "", ""); AN(heritage.panic_str); /* Copy management counters to shm and update pointer */ VSC_C_mgt = VSM_common_alloc(heritage.vsm, sizeof *VSC_C_mgt, VSC_CLASS, VSC_type_mgt, ""); AN(VSC_C_mgt); *VSC_C_mgt = static_VSC_C_mgt; #ifdef __OpenBSD__ /* Commit changes, for OS's without coherent VM/buf */ AZ(msync(p, getpagesize(), MS_SYNC)); #endif } /*-------------------------------------------------------------------- * Commit the VSM */ void mgt_SHM_Commit(void) { char fnbuf[64]; bprintf(fnbuf, "%s.%jd", VSM_FILENAME, (intmax_t)getpid()); VJ_master(JAIL_MASTER_FILE); if (rename(fnbuf, VSM_FILENAME)) { fprintf(stderr, "Rename failed %s -> %s: %s\n", fnbuf, VSM_FILENAME, strerror(errno)); (void)unlink(fnbuf); exit(1); } VJ_master(JAIL_MASTER_LOW); } /*-------------------------------------------------------------------- * Destroy a VSM instance */ void mgt_SHM_Destroy(int keep) { /* Point mgt counters back at static version */ VSC_C_mgt = &static_VSC_C_mgt; AN(heritage.vsm); if (keep) (void)rename(VSM_FILENAME, VSM_FILENAME ".keep"); heritage.panic_str = NULL; heritage.panic_str_len = 0; heritage.param = NULL; VSM_common_delete(&heritage.vsm); AZ(munmap(mgt_vsm_p, mgt_vsm_l)); mgt_vsm_p = NULL; mgt_vsm_l = 0; } /*-------------------------------------------------------------------- * Destroy and recreate VSM if its size should change */ void mgt_SHM_Size_Adjust(void) { AN(heritage.vsm); if (mgt_vsm_l == mgt_shm_size()) return; mgt_SHM_Destroy(0); mgt_SHM_Create(); } /*-------------------------------------------------------------------- * Exit handler that clears the owning pid from the SHMLOG */ static void mgt_shm_atexit(void) { /* Do not let VCC kill our VSM */ if (getpid() != mgt_pid) return; if (heritage.vsm != NULL) VSM_common_delete(&heritage.vsm); } /*-------------------------------------------------------------------- * Initialize VSM subsystem */ void mgt_SHM_Init(void) { int i; /* Collision check with already running varnishd */ i = vsm_n_check(); if (i) exit(2); /* Create our static VSM instance */ static_vsm = VSM_common_new(static_vsm_buf, sizeof static_vsm_buf); /* Setup atexit handler */ AZ(atexit(mgt_shm_atexit)); } varnish-4.1.1/bin/varnishd/mgt/mgt_cli.c0000644000201500234410000003716412652366721015070 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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 management process' CLI handling */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include "mgt/mgt.h" #include "vcli.h" #include "vcli_common.h" #include "vcli_priv.h" #include "vcli_serve.h" #include "vev.h" #include "vrnd.h" #include "vsa.h" #include "vss.h" #include "vtcp.h" #include "mgt_cli.h" static int cli_i = -1, cli_o = -1; static struct VCLS *cls; static const char *secret_file; #define MCF_NOAUTH 0 /* NB: zero disables here-documents */ #define MCF_AUTH 16 /*--------------------------------------------------------------------*/ static void mcf_banner(struct cli *cli, const char *const *av, void *priv) { (void)av; (void)priv; VCLI_Out(cli, "-----------------------------\n"); VCLI_Out(cli, "Varnish Cache CLI 1.0\n"); VCLI_Out(cli, "-----------------------------\n"); VCLI_Out(cli, "%s\n", VSB_data(vident) + 1); VCLI_Out(cli, "%s\n", VCS_version); VCLI_Out(cli, "\n"); VCLI_Out(cli, "Type 'help' for command list.\n"); VCLI_Out(cli, "Type 'quit' to close CLI session.\n"); if (child_pid < 0) VCLI_Out(cli, "Type 'start' to launch worker process.\n"); VCLI_SetResult(cli, CLIS_OK); } /*--------------------------------------------------------------------*/ /* XXX: what order should this list be in ? */ static struct cli_proto cli_proto[] = { { CLI_BANNER, "", mcf_banner, NULL }, { CLI_SERVER_STATUS, "", mcf_server_status, NULL }, { CLI_SERVER_START, "", mcf_server_startstop, NULL }, { CLI_SERVER_STOP, "", mcf_server_startstop, cli_proto }, { CLI_VCL_LOAD, "", mcf_vcl_load, NULL }, { CLI_VCL_INLINE, "", mcf_vcl_inline, NULL }, { CLI_VCL_USE, "", mcf_vcl_use, NULL }, { CLI_VCL_STATE, "", mcf_vcl_state, NULL }, { CLI_VCL_DISCARD, "", mcf_vcl_discard, NULL }, { CLI_VCL_LIST, "", mcf_vcl_list, NULL }, { CLI_PARAM_SHOW, "", mcf_param_show, NULL }, { CLI_PARAM_SET, "", mcf_param_set, NULL }, { CLI_PANIC_SHOW, "", mcf_panic_show, NULL }, { CLI_PANIC_CLEAR, "", mcf_panic_clear, NULL }, { NULL } }; /*--------------------------------------------------------------------*/ static void mcf_panic(struct cli *cli, const char * const *av, void *priv) { (void)cli; (void)av; (void)priv; AZ(strcmp("", "You asked for it")); } static struct cli_proto cli_debug[] = { { "debug.panic.master", "debug.panic.master", "\tPanic the master process.", 0, 0, "d", mcf_panic, NULL}, { NULL } }; /*--------------------------------------------------------------------*/ static void mcf_askchild(struct cli *cli, const char * const *av, void *priv) { int i; char *q; unsigned u; struct vsb *vsb; (void)priv; /* * Command not recognized in master, try cacher if it is * running. */ if (cli_o <= 0) { if (!strcmp(av[1], "help")) { VCLI_Out(cli, "No help from child, (not running).\n"); return; } VCLI_SetResult(cli, CLIS_UNKNOWN); VCLI_Out(cli, "Unknown request in manager process " "(child not running).\n" "Type 'help' for more info."); return; } vsb = VSB_new_auto(); for (i = 1; av[i] != NULL; i++) { VSB_quote(vsb, av[i], strlen(av[i]), 0); VSB_putc(vsb, ' '); } VSB_putc(vsb, '\n'); AZ(VSB_finish(vsb)); i = write(cli_o, VSB_data(vsb), VSB_len(vsb)); if (i != VSB_len(vsb)) { VSB_delete(vsb); VCLI_SetResult(cli, CLIS_COMMS); VCLI_Out(cli, "CLI communication error"); MGT_Child_Cli_Fail(); return; } VSB_delete(vsb); if (VCLI_ReadResult(cli_i, &u, &q, mgt_param.cli_timeout)) MGT_Child_Cli_Fail(); VCLI_SetResult(cli, u); VCLI_Out(cli, "%s", q); free(q); } static struct cli_proto cli_askchild[] = { { "*", "", "\t\n", 0, 9999, "h*", mcf_askchild, NULL}, { NULL } }; /*-------------------------------------------------------------------- * Ask the child something over CLI, return zero only if everything is * happy happy. */ int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) { int i, j; va_list ap; unsigned u; char buf[mgt_param.cli_buffer], *p; if (resp != NULL) *resp = NULL; if (status != NULL) *status = 0; if (cli_i < 0|| cli_o < 0) { if (status != NULL) *status = CLIS_CANT; return (CLIS_CANT); } va_start(ap, fmt); vbprintf(buf, fmt, ap); va_end(ap); p = strchr(buf, '\0'); assert(p != NULL && p > buf && p[-1] == '\n'); i = p - buf; j = write(cli_o, buf, i); if (j != i) { if (status != NULL) *status = CLIS_COMMS; if (resp != NULL) *resp = strdup("CLI communication error"); MGT_Child_Cli_Fail(); return (CLIS_COMMS); } if (VCLI_ReadResult(cli_i, &u, resp, mgt_param.cli_timeout)) MGT_Child_Cli_Fail(); if (status != NULL) *status = u; return (u == CLIS_OK ? 0 : u); } /*--------------------------------------------------------------------*/ void mgt_cli_start_child(int fdi, int fdo) { cli_i = fdi; cli_o = fdo; } /*--------------------------------------------------------------------*/ void mgt_cli_stop_child(void) { cli_i = -1; cli_o = -1; /* XXX: kick any users */ } /*-------------------------------------------------------------------- * Generate a random challenge */ static void mgt_cli_challenge(struct cli *cli) { int i; VRND_Seed(); for (i = 0; i + 2L < sizeof cli->challenge; i++) cli->challenge[i] = (random() % 26) + 'a'; cli->challenge[i++] = '\n'; cli->challenge[i] = '\0'; VCLI_Out(cli, "%s", cli->challenge); VCLI_Out(cli, "\nAuthentication required.\n"); VCLI_SetResult(cli, CLIS_AUTH); } /*-------------------------------------------------------------------- * Validate the authentication */ static void mcf_auth(struct cli *cli, const char *const *av, void *priv) { int fd; char buf[CLI_AUTH_RESPONSE_LEN + 1]; AN(av[2]); (void)priv; if (secret_file == NULL) { VCLI_Out(cli, "Secret file not configured\n"); VCLI_SetResult(cli, CLIS_CANT); return; } VJ_master(JAIL_MASTER_FILE); fd = open(secret_file, O_RDONLY); if (fd < 0) { VCLI_Out(cli, "Cannot open secret file (%s)\n", strerror(errno)); VCLI_SetResult(cli, CLIS_CANT); VJ_master(JAIL_MASTER_LOW); return; } VJ_master(JAIL_MASTER_LOW); mgt_got_fd(fd); VCLI_AuthResponse(fd, cli->challenge, buf); AZ(close(fd)); if (strcasecmp(buf, av[2])) { MGT_complain(C_SECURITY, "CLI Authentication failure from %s", cli->ident); VCLI_SetResult(cli, CLIS_CLOSE); return; } cli->auth = MCF_AUTH; memset(cli->challenge, 0, sizeof cli->challenge); VCLI_SetResult(cli, CLIS_OK); mcf_banner(cli, av, priv); } static struct cli_proto cli_auth[] = { { CLI_HELP, "", VCLS_func_help, NULL }, { CLI_PING, "", VCLS_func_ping }, { CLI_AUTH, "", mcf_auth, NULL }, { CLI_QUIT, "", VCLS_func_close, NULL}, { NULL } }; /*--------------------------------------------------------------------*/ static void mgt_cli_cb_before(const struct cli *cli) { MGT_complain(C_CLI, "CLI %s Rd %s", cli->ident, cli->cmd); } static void mgt_cli_cb_after(const struct cli *cli) { MGT_complain(C_CLI, "CLI %s Wr %03u %s", cli->ident, cli->result, VSB_data(cli->sb)); } /*--------------------------------------------------------------------*/ static void mgt_cli_init_cls(void) { cls = VCLS_New(mgt_cli_cb_before, mgt_cli_cb_after, &mgt_param.cli_buffer, &mgt_param.cli_limit); AN(cls); AZ(VCLS_AddFunc(cls, MCF_NOAUTH, cli_auth)); AZ(VCLS_AddFunc(cls, MCF_AUTH, cli_proto)); AZ(VCLS_AddFunc(cls, MCF_AUTH, cli_debug)); AZ(VCLS_AddFunc(cls, MCF_AUTH, cli_stv)); AZ(VCLS_AddFunc(cls, MCF_AUTH, cli_askchild)); } /*-------------------------------------------------------------------- * Get rid of all CLI sessions */ void mgt_cli_close_all(void) { VCLS_Destroy(&cls); } /*-------------------------------------------------------------------- * Callback whenever something happens to the input fd of the session. */ static int mgt_cli_callback2(const struct vev *e, int what) { int i; (void)e; (void)what; i = VCLS_PollFd(cls, e->fd, 0); return (i); } /*--------------------------------------------------------------------*/ void mgt_cli_setup(int fdi, int fdo, int verbose, const char *ident, mgt_cli_close_f *closefunc, void *priv) { struct cli *cli; struct vev *ev; (void)ident; (void)verbose; if (cls == NULL) mgt_cli_init_cls(); cli = VCLS_AddFd(cls, fdi, fdo, closefunc, priv); cli->ident = strdup(ident); if (fdi != 0 && secret_file != NULL) { cli->auth = MCF_NOAUTH; mgt_cli_challenge(cli); } else { cli->auth = MCF_AUTH; mcf_banner(cli, NULL, NULL); } AZ(VSB_finish(cli->sb)); (void)VCLI_WriteResult(fdo, cli->result, VSB_data(cli->sb)); ev = vev_new(); AN(ev); ev->name = cli->ident; ev->fd = fdi; ev->fd_flags = EV_RD; ev->callback = mgt_cli_callback2; ev->priv = cli; AZ(vev_add(mgt_evb, ev)); } /*--------------------------------------------------------------------*/ static struct vsb * sock_id(const char *pfx, int fd) { struct vsb *vsb; char abuf1[VTCP_ADDRBUFSIZE], abuf2[VTCP_ADDRBUFSIZE]; char pbuf1[VTCP_PORTBUFSIZE], pbuf2[VTCP_PORTBUFSIZE]; vsb = VSB_new_auto(); AN(vsb); VTCP_myname(fd, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1); VTCP_hisname(fd, abuf2, sizeof abuf2, pbuf2, sizeof pbuf2); VSB_printf(vsb, "%s %s %s %s %s", pfx, abuf2, pbuf2, abuf1, pbuf1); AZ(VSB_finish(vsb)); return (vsb); } /*--------------------------------------------------------------------*/ struct telnet { unsigned magic; #define TELNET_MAGIC 0x53ec3ac0 int fd; struct vev *ev; }; static void telnet_close(void *priv) { struct telnet *tn; CAST_OBJ_NOTNULL(tn, priv, TELNET_MAGIC); (void)close(tn->fd); FREE_OBJ(tn); } static struct telnet * telnet_new(int fd) { struct telnet *tn; ALLOC_OBJ(tn, TELNET_MAGIC); AN(tn); tn->fd = fd; return (tn); } static int telnet_accept(const struct vev *ev, int what) { struct vsb *vsb; struct sockaddr_storage addr; socklen_t addrlen; struct telnet *tn; int i; (void)what; addrlen = sizeof addr; i = accept(ev->fd, (void *)&addr, &addrlen); if (i < 0 && errno == EBADF) return (1); if (i < 0) return (0); mgt_got_fd(i); tn = telnet_new(i); vsb = sock_id("telnet", i); mgt_cli_setup(i, i, 0, VSB_data(vsb), telnet_close, tn); VSB_delete(vsb); return (0); } void mgt_cli_secret(const char *S_arg) { int i, fd; char buf[BUFSIZ]; /* Save in shmem */ mgt_SHM_static_alloc(S_arg, strlen(S_arg) + 1L, "Arg", "-S", ""); VJ_master(JAIL_MASTER_FILE); fd = open(S_arg, O_RDONLY); if (fd < 0) { fprintf(stderr, "Can not open secret-file \"%s\"\n", S_arg); exit(2); } VJ_master(JAIL_MASTER_LOW); mgt_got_fd(fd); i = read(fd, buf, sizeof buf); if (i == 0) { fprintf(stderr, "Empty secret-file \"%s\"\n", S_arg); exit(2); } if (i < 0) { fprintf(stderr, "Can not read secret-file \"%s\"\n", S_arg); exit(2); } AZ(close(fd)); secret_file = S_arg; } static int __match_proto__(vss_resolved_f) mct_callback(void *priv, const struct suckaddr *sa) { int sock; struct vsb *vsb = priv; const char *err; char abuf[VTCP_ADDRBUFSIZE]; char pbuf[VTCP_PORTBUFSIZE]; struct telnet *tn; VJ_master(JAIL_MASTER_PRIVPORT); sock = VTCP_listen(sa, 10, &err); VJ_master(JAIL_MASTER_LOW); assert(sock != 0); // We know where stdin is if (sock > 0) { VTCP_myname(sock, abuf, sizeof abuf, pbuf, sizeof pbuf); VSB_printf(vsb, "%s %s\n", abuf, pbuf); tn = telnet_new(sock); tn->ev = vev_new(); AN(tn->ev); tn->ev->fd = sock; tn->ev->fd_flags = POLLIN; tn->ev->callback = telnet_accept; tn->ev->priv = tn; AZ(vev_add(mgt_evb, tn->ev)); } return (0); } void mgt_cli_telnet(const char *T_arg) { int error; const char *err; struct vsb *vsb; AN(T_arg); vsb = VSB_new_auto(); AN(vsb); error = VSS_resolver(T_arg, NULL, mct_callback, vsb, &err); if (err != NULL) ARGV_ERR("Could resolve -T argument to address\n\t%s\n", err); AZ(error); AZ(VSB_finish(vsb)); if (VSB_len(vsb) == 0) ARGV_ERR("-T %s could not be listened on.", T_arg); /* Save in shmem */ mgt_SHM_static_alloc(VSB_data(vsb), VSB_len(vsb) + 1, "Arg", "-T", ""); VSB_delete(vsb); } /* Reverse CLI ("Master") connections --------------------------------*/ struct m_addr { unsigned magic; #define M_ADDR_MAGIC 0xbc6217ed struct suckaddr *sa; VTAILQ_ENTRY(m_addr) list; }; static int M_fd = -1; static struct vev *M_poker, *M_conn; static double M_poll = 0.1; static VTAILQ_HEAD(,m_addr) m_addr_list = VTAILQ_HEAD_INITIALIZER(m_addr_list); static void Marg_closer(void *priv) { (void)priv; (void)close(M_fd); M_fd = -1; } static int __match_proto__(vev_cb_f) Marg_connect(const struct vev *e, int what) { struct vsb *vsb; struct m_addr *ma; assert(e == M_conn); (void)what; M_fd = VTCP_connected(M_fd); if (M_fd < 0) { MGT_complain(C_INFO, "Could not connect to CLI-master: %m"); ma = VTAILQ_FIRST(&m_addr_list); AN(ma); VTAILQ_REMOVE(&m_addr_list, ma, list); VTAILQ_INSERT_TAIL(&m_addr_list, ma, list); if (M_poll < 10) M_poll++; return (1); } vsb = sock_id("master", M_fd); mgt_cli_setup(M_fd, M_fd, 0, VSB_data(vsb), Marg_closer, NULL); VSB_delete(vsb); M_poll = 1; return (1); } static int __match_proto__(vev_cb_f) Marg_poker(const struct vev *e, int what) { int s; struct m_addr *ma; assert(e == M_poker); (void)what; M_poker->timeout = M_poll; /* XXX nasty ? */ if (M_fd > 0) return (0); ma = VTAILQ_FIRST(&m_addr_list); AN(ma); /* Try to connect asynchronously */ s = VTCP_connect(ma->sa, -1); if (s < 0) return (0); mgt_got_fd(s); M_conn = vev_new(); AN(M_conn); M_conn->callback = Marg_connect; M_conn->name = "-M connector"; M_conn->fd_flags = EV_WR; M_conn->fd = s; M_fd = s; AZ(vev_add(mgt_evb, M_conn)); return (0); } static int __match_proto__(vss_resolved_f) marg_cb(void *priv, const struct suckaddr *sa) { struct m_addr *ma; (void)priv; ALLOC_OBJ(ma, M_ADDR_MAGIC); AN(ma); ma->sa = VSA_Clone(sa); VTAILQ_INSERT_TAIL(&m_addr_list, ma, list); return(0); } void mgt_cli_master(const char *M_arg) { const char *err; int error; AN(M_arg); error = VSS_resolver(M_arg, NULL, marg_cb, NULL, &err); if (err != NULL) ARGV_ERR("Could resolve -M argument to address\n\t%s\n", err); AZ(error); if (VTAILQ_EMPTY(&m_addr_list)) ARGV_ERR("Could not resolve -M argument to address\n"); AZ(M_poker); M_poker = vev_new(); AN(M_poker); M_poker->timeout = M_poll; M_poker->callback = Marg_poker; M_poker->name = "-M poker"; AZ(vev_add(mgt_evb, M_poker)); } varnish-4.1.1/bin/varnishd/mgt/mgt.h0000644000201500234410000001366612652366721014247 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ #include #include "common/common.h" #include "common/params.h" struct cli; struct parspec; extern struct vev_base *mgt_evb; extern unsigned d_flag; extern int exit_status; /* mgt_acceptor.c */ void MAC_Arg(const char *); void MAC_Validate(void); void MAC_reopen_sockets(struct cli *); int MAC_sockets_ready(struct cli *); /* mgt_child.c */ extern pid_t child_pid; void MGT_Run(void); void mgt_stop_child(void); void mgt_got_fd(int fd); void MGT_Child_Cli_Fail(void); /* mgt_cli.c */ typedef void mgt_cli_close_f(void *priv); void mgt_cli_setup(int fdi, int fdo, int verbose, const char *ident, mgt_cli_close_f *close_func, void *priv); int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) __v_printflike(3, 4); void mgt_cli_start_child(int fdi, int fdo); void mgt_cli_stop_child(void); void mgt_cli_telnet(const char *T_arg); void mgt_cli_master(const char *M_arg); void mgt_cli_secret(const char *S_arg); void mgt_cli_close_all(void); /* mgt_jail.c */ enum jail_subproc_e { JAIL_SUBPROC_VCC, JAIL_SUBPROC_CC, JAIL_SUBPROC_VCLLOAD, JAIL_SUBPROC_WORKER, }; enum jail_master_e { JAIL_MASTER_LOW, JAIL_MASTER_FILE, JAIL_MASTER_STORAGE, JAIL_MASTER_PRIVPORT, }; typedef int jail_init_f(char **); typedef void jail_master_f(enum jail_master_e); typedef void jail_subproc_f(enum jail_subproc_e); typedef void jail_make_dir_f(const char *dname); typedef void jail_fixfile_f(int fd); struct jail_tech { unsigned magic; #define JAIL_TECH_MAGIC 0x4d00fa4d const char *name; jail_init_f *init; jail_master_f *master; jail_subproc_f *subproc; jail_make_dir_f *make_workdir; jail_make_dir_f *make_vcldir; jail_fixfile_f *vsm_file; jail_fixfile_f *storage_file; }; void VJ_Init(const char *j_arg); void VJ_master(enum jail_master_e jme); void VJ_subproc(enum jail_subproc_e jse); void VJ_make_workdir(const char *dname); void VJ_make_vcldir(const char *dname); void VJ_fix_vsm_file(int fd); void VJ_fix_storage_file(int fd); extern const struct jail_tech jail_tech_unix; extern const struct jail_tech jail_tech_solaris; /* mgt_main.c */ extern struct VSC_C_mgt *VSC_C_mgt; extern struct VSC_C_mgt static_VSC_C_mgt; struct choice { const char *name; const void *ptr; }; const void *pick(const struct choice *cp, const char *which, const char *kind); extern const char C_ERR[]; // Things are not as they should be extern const char C_INFO[]; // Normal stuff, keep a record for later extern const char C_DEBUG[]; // More detail than you'd normally want extern const char C_SECURITY[]; // Security issues extern const char C_CLI[]; // CLI traffic between master and child void MGT_complain(const char *loud, const char *, ...) __v_printflike(2, 3); /* mgt_param.c */ void MCF_InitParams(struct cli *); void MCF_CollectParams(void); void MCF_SetDefault(const char *param, const char *def); void MCF_SetMinimum(const char *param, const char *def); 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_shmem.c */ void mgt_SHM_Init(void); void mgt_SHM_static_alloc(const void *, ssize_t size, const char *class, const char *type, const char *ident); void mgt_SHM_Create(void); void mgt_SHM_Commit(void); void mgt_SHM_Destroy(int keep); void mgt_SHM_Size_Adjust(void); /* stevedore_mgt.c */ void STV_Config(const char *spec); void STV_Config_Transient(void); /* mgt_vcc.c */ char *mgt_VccCompile(struct cli *, const char *vclname, const char *vclsrc, const char *vclsrcfile, int C_flag); void mgt_vcc_init(void); void mgt_vcl_init(void); void mgt_vcc_startup(struct cli *, const char *b_arg, const char *f_arg, const char *vclsrc, int Cflag); int mgt_push_vcls_and_start(struct cli *, unsigned *status, char **p); int mgt_has_vcl(void); extern char *mgt_cc_cmd; extern const char *mgt_vcl_dir; extern const char *mgt_vmod_dir; extern unsigned mgt_vcc_err_unref; extern unsigned mgt_vcc_allow_inline_c; extern unsigned mgt_vcc_unsafe_path; #if defined(PTHREAD_CANCELED) || defined(PTHREAD_MUTEX_DEFAULT) #error "Keep pthreads out of in manager process" #endif static inline int MGT_FEATURE(enum feature_bits x) { return (mgt_param.feature_bits[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7))); } static inline int MGT_DO_DEBUG(enum debug_bits x) { return (mgt_param.debug_bits[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7))); } varnish-4.1.1/bin/varnishd/mgt/mgt_param_tbl.c0000644000201500234410000001106012652366721016245 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include "mgt/mgt.h" #include "mgt/mgt_param.h" #define MEMPOOL_TEXT \ "The three numbers are:\n" \ "\tmin_pool\tminimum size of free pool.\n" \ "\tmax_pool\tmaximum size of free pool.\n" \ "\tmax_age\tmax age of free element." struct parspec mgt_parspec[] = { #define PARAM(nm, ty, mi, ma, de, un, fl, st, lt, fn) \ { #nm, tweak_##ty, &mgt_param.nm, mi, ma, st, fl, de, un }, #include "tbl/params.h" #undef PARAM { "cc_command", tweak_string, &mgt_cc_cmd, NULL, NULL, "Command used for compiling the C source code to a " "dlopen(3) loadable object. Any occurrence of %s in " "the string will be replaced with the source file name, " "and %o will be replaced with the output file name.", MUST_RELOAD, VCC_CC , NULL }, { "vcl_dir", tweak_string, &mgt_vcl_dir, NULL, NULL, "Directory (or colon separated list of directories) " "from which relative VCL filenames (vcl.load and " "include) are to be found.", 0, VARNISH_VCL_DIR, NULL }, { "vmod_dir", tweak_string, &mgt_vmod_dir, NULL, NULL, "Directory (or colon separated list of directories) " "where VMODs are to be found.", 0, VARNISH_VMOD_DIR, NULL }, { "vcc_err_unref", tweak_bool, &mgt_vcc_err_unref, NULL, NULL, "Unreferenced VCL objects result in error.", 0, "on", "bool" }, { "vcc_allow_inline_c", tweak_bool, &mgt_vcc_allow_inline_c, NULL, NULL, "Allow inline C code in VCL.", 0, "off", "bool" }, { "vcc_unsafe_path", tweak_bool, &mgt_vcc_unsafe_path, NULL, NULL, "Allow '/' in vmod & include paths.\n" "Allow 'import ... from ...'.", 0, "on", "bool" }, { "pcre_match_limit", tweak_uint, &mgt_param.vre_limits.match, "1", NULL, "The limit for the number of calls to the internal match()" " function in pcre_exec().\n\n" "(See: PCRE_EXTRA_MATCH_LIMIT in pcre docs.)\n\n" "This parameter limits how much CPU time" " regular expression matching can soak up.", 0, "10000", ""}, { "pcre_match_limit_recursion", tweak_uint, &mgt_param.vre_limits.match_recursion, "1", NULL, "The recursion depth-limit for the internal match() function" " in a pcre_exec().\n\n" "(See: PCRE_EXTRA_MATCH_LIMIT_RECURSION in pcre docs.)\n\n" "This puts an upper limit on the amount of stack used" " by PCRE for certain classes of regular expressions.\n\n" "We have set the default value low in order to" " prevent crashes, at the cost of possible regexp" " matching failures.\n\n" "Matching failures will show up in the log as VCL_Error" " messages with regexp errors -27 or -21.\n\n" "Testcase r01576 can be useful when tuning this parameter.", 0, "20", ""}, { "pool_req", tweak_poolparam, &mgt_param.req_pool, NULL, NULL, "Parameters for per worker pool request memory pool.\n" MEMPOOL_TEXT, 0, "10,100,10", ""}, { "pool_sess", tweak_poolparam, &mgt_param.sess_pool, NULL, NULL, "Parameters for per worker pool session memory pool.\n" MEMPOOL_TEXT, 0, "10,100,10", ""}, { "pool_vbo", tweak_poolparam, &mgt_param.vbo_pool, NULL, NULL, "Parameters for backend object fetch memory pool.\n" MEMPOOL_TEXT, 0, "10,100,10", ""}, { NULL, NULL, NULL } }; varnish-4.1.1/bin/varnishd/mgt/mgt_cli.h0000644000201500234410000000354312652366721015067 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ /* mgt_child.c */ cli_func_t mcf_server_startstop; cli_func_t mcf_server_status; cli_func_t mcf_panic_show; cli_func_t mcf_panic_clear; /* mgt_param.c */ cli_func_t mcf_param_show; cli_func_t mcf_param_set; /* mgt_vcc.c */ cli_func_t mcf_vcl_load; cli_func_t mcf_vcl_inline; cli_func_t mcf_vcl_use; cli_func_t mcf_vcl_state; cli_func_t mcf_vcl_discard; cli_func_t mcf_vcl_list; /* stevedore.c */ extern struct cli_proto cli_stv[]; varnish-4.1.1/bin/varnishd/mgt/mgt_main.c0000644000201500234410000004670512652366721015246 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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 management process and CLI handling */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include "mgt/mgt.h" #include "common/heritage.h" #include "hash/hash_slinger.h" #include "vav.h" #include "vcli.h" #include "vcli_common.h" #include "vev.h" #include "vfil.h" #include "vin.h" #include "vpf.h" #include "vrnd.h" #include "vsha256.h" #include "vsub.h" #include "vtim.h" #include "waiter/mgt_waiter.h" #include "compat/daemon.h" struct heritage heritage; unsigned d_flag = 0; pid_t mgt_pid; struct vev_base *mgt_evb; int exit_status = 0; struct vsb *vident; struct VSC_C_mgt static_VSC_C_mgt; struct VSC_C_mgt *VSC_C_mgt; static struct vpf_fh *pfh = NULL; /*--------------------------------------------------------------------*/ static void mgt_sltm(const char *tag, const char *sdesc, const char *ldesc) { int i; assert(sdesc != NULL && ldesc != NULL); assert(*sdesc != '\0' || *ldesc != '\0'); printf("\n%s\n", tag); i = strlen(tag); printf("%*.*s\n\n", i, i, "------------------------------------"); if (*ldesc != '\0') printf("%s\n", ldesc); else if (*sdesc != '\0') printf("%s\n", sdesc); } /*lint -e{506} constant value boolean */ static void mgt_DumpRstVsl(void) { printf( "\n.. The following is autogenerated output from " "varnishd -x dumprstvsl\n\n"); #define SLTM(tag, flags, sdesc, ldesc) mgt_sltm(#tag, sdesc, ldesc); #include "tbl/vsl_tags.h" #undef SLTM } /*--------------------------------------------------------------------*/ static void build_vident(void) { struct utsname uts; vident = VSB_new_auto(); AN(vident); if (!uname(&uts)) { VSB_printf(vident, ",%s", uts.sysname); VSB_printf(vident, ",%s", uts.release); VSB_printf(vident, ",%s", uts.machine); } } /*-------------------------------------------------------------------- * 'Ello, I wish to register a complaint... */ #ifndef LOG_AUTHPRIV # define LOG_AUTHPRIV 0 #endif const char C_ERR[] = "Error:"; const char C_INFO[] = "Info:"; const char C_DEBUG[] = "Debug:"; const char C_SECURITY[] = "Security:"; const char C_CLI[] = "Cli:"; void MGT_complain(const char *loud, const char *fmt, ...) { va_list ap; struct vsb *vsb; int sf; if (loud == C_CLI && !mgt_param.syslog_cli_traffic) return; vsb = VSB_new_auto(); AN(vsb); va_start(ap, fmt); VSB_vprintf(vsb, fmt, ap); va_end(ap); AZ(VSB_finish(vsb)); if (loud == C_ERR) sf = LOG_ERR; else if (loud == C_INFO) sf = LOG_INFO; else if (loud == C_DEBUG) sf = LOG_DEBUG; else if (loud == C_SECURITY) sf = LOG_WARNING | LOG_AUTHPRIV; else if (loud == C_CLI) sf = LOG_INFO; else WRONG("Wrong complaint loudness"); if (loud != C_CLI) fprintf(stderr, "%s %s\n", loud, VSB_data(vsb)); if (!MGT_DO_DEBUG(DBG_VTC_MODE)) syslog(sf, "%s", VSB_data(vsb)); VSB_delete(vsb); } /*--------------------------------------------------------------------*/ const void * pick(const struct choice *cp, const char *which, const char *kind) { for(; cp->name != NULL; cp++) { if (!strcmp(cp->name, which)) return (cp->ptr); } ARGV_ERR("Unknown %s method \"%s\"\n", kind, which); } /*--------------------------------------------------------------------*/ static void usage(void) { #define FMT " %-28s # %s\n" fprintf(stderr, "usage: varnishd [options]\n"); fprintf(stderr, FMT, "-a address[:port][,proto]", "HTTP listen address and port (default: *:80)"); fprintf(stderr, FMT, "", " address: defaults to loopback"); fprintf(stderr, FMT, "", " port: port or service (default: 80)"); fprintf(stderr, FMT, "", " proto: HTTP/1 (default), PROXY"); fprintf(stderr, FMT, "-b address[:port]", "backend address and port"); fprintf(stderr, FMT, "", " address: hostname or IP"); fprintf(stderr, FMT, "", " port: port or service (default: 80)"); fprintf(stderr, FMT, "-C", "print VCL code compiled to C language"); fprintf(stderr, FMT, "-d", "debug"); fprintf(stderr, FMT, "-F", "Run in foreground"); fprintf(stderr, FMT, "-f file", "VCL script"); fprintf(stderr, FMT, "-h kind[,hashoptions]", "Hash specification"); fprintf(stderr, FMT, "", " -h critbit [default]"); fprintf(stderr, FMT, "", " -h simple_list"); fprintf(stderr, FMT, "", " -h classic"); fprintf(stderr, FMT, "", " -h classic,"); fprintf(stderr, FMT, "-i identity", "Identity of varnish instance"); fprintf(stderr, FMT, "-j jail[,jailoptions]", "Jail specification"); #ifdef HAVE_SETPPRIV fprintf(stderr, FMT, "", " -j solaris"); #endif fprintf(stderr, FMT, "", " -j unix[,user=][,ccgroup=]"); fprintf(stderr, FMT, "", " -j none"); fprintf(stderr, FMT, "-l vsl[,vsm]", "Size of shared memory file"); fprintf(stderr, FMT, "", " vsl: space for VSL records [80m]"); fprintf(stderr, FMT, "", " vsm: space for stats counters [1m]"); fprintf(stderr, FMT, "-M address:port", "Reverse CLI destination"); fprintf(stderr, FMT, "-n dir", "varnishd working directory"); fprintf(stderr, FMT, "-P file", "PID file"); fprintf(stderr, FMT, "-p param=value", "set parameter"); fprintf(stderr, FMT, "-r param[,param...]", "make parameter read-only"); fprintf(stderr, FMT, "-S secret-file", "Secret file for CLI authentication"); fprintf(stderr, FMT, "-s [name=]kind[,options]", "Backend storage specification"); fprintf(stderr, FMT, "", " -s malloc[,]"); #ifdef HAVE_LIBUMEM fprintf(stderr, FMT, "", " -s umem"); #endif fprintf(stderr, FMT, "", " -s file,"); fprintf(stderr, FMT, "", " -s file,,"); fprintf(stderr, FMT, "", " -s file,,,"); fprintf(stderr, FMT, "", " -s persistent (experimental)"); fprintf(stderr, FMT, "-T address:port", "Telnet listen address and port"); fprintf(stderr, FMT, "-t TTL", "Default TTL"); fprintf(stderr, FMT, "-V", "version"); fprintf(stderr, FMT, "-W waiter", "Waiter implementation"); #if defined(HAVE_KQUEUE) fprintf(stderr, FMT, "", " -W kqueue"); #endif #if defined(HAVE_EPOLL_CTL) fprintf(stderr, FMT, "", " -W epoll"); #endif #if defined(HAVE_PORT_CREATE) fprintf(stderr, FMT, "", " -W ports"); #endif fprintf(stderr, FMT, "", " -W poll"); #undef FMT exit(1); } /*--------------------------------------------------------------------*/ static void cli_check(const struct cli *cli) { if (cli->result == CLIS_OK) { VSB_clear(cli->sb); return; } AZ(VSB_finish(cli->sb)); fprintf(stderr, "Error:\n%s\n", VSB_data(cli->sb)); exit(2); } /*-------------------------------------------------------------------- * All praise POSIX! Thanks to our glorious standards there are no * standard way to get a back-trace of the stack, and even if we hack * that together from spit and pieces of string, there is no way no * standard way to translate a pointer to a symbol, which returns anything * usable. (See for instance FreeBSD PR-134391). * * Attempt to run nm(1) on our binary during startup, hoping it will * give us a usable list of symbols. */ struct symbols { uintptr_t a; uintptr_t l; char *n; VTAILQ_ENTRY(symbols) list; }; static VTAILQ_HEAD(,symbols) symbols = VTAILQ_HEAD_INITIALIZER(symbols); int Symbol_Lookup(struct vsb *vsb, void *ptr) { struct symbols *s, *s0; uintptr_t pp; pp = (uintptr_t)ptr; s0 = NULL; VTAILQ_FOREACH(s, &symbols, list) { if (s->a > pp || s->a + s->l <= pp) continue; if (s0 == NULL || s->l < s0->l) s0 = s; } if (s0 == NULL) return (-1); VSB_printf(vsb, "%p: %s", ptr, s0->n); if ((uintmax_t)pp != s0->a) VSB_printf(vsb, "+0x%jx", (uintmax_t)pp - s0->a); return (0); } static void Symbol_hack(const char *a0) { char buf[BUFSIZ]; FILE *fi; struct symbols *s; uintmax_t aa, ll; char type[10]; char name[100]; int i; bprintf(buf, "nm -t x -n -P %s 2>/dev/null", a0); fi = popen(buf, "r"); if (fi == NULL) return; while (fgets(buf, sizeof buf, fi)) { i = sscanf(buf, "%99s\t%9s\t%jx\t%jx\n", name, type, &aa, &ll); if (i != 4) continue; s = malloc(sizeof *s + strlen(name) + 1); AN(s); s->a = aa; s->l = ll; s->n = (void*)(s + 1); strcpy(s->n, name); VTAILQ_INSERT_TAIL(&symbols, s, list); } (void)pclose(fi); } /*-------------------------------------------------------------------- * This function is called when the CLI on stdin is closed. */ static void cli_stdin_close(void *priv) { (void)priv; if (d_flag) { mgt_stop_child(); mgt_cli_close_all(); if (pfh != NULL) (void)VPF_Remove(pfh); exit(0); } else { (void)close(0); (void)close(1); (void)close(2); AZ(open("/dev/null", O_RDONLY)); assert(open("/dev/null", O_WRONLY) == 1); assert(open("/dev/null", O_WRONLY) == 2); } } /*-------------------------------------------------------------------- * Autogenerate a -S file using strong random bits from the kernel. */ static void mgt_secret_atexit(void) { /* Only master process */ if (getpid() != mgt_pid) return; VJ_master(JAIL_MASTER_FILE); (void)unlink("_.secret"); VJ_master(JAIL_MASTER_LOW); } static const char * make_secret(const char *dirname) { char *fn; int fdo; int i, j; unsigned char b; int fdi; assert(asprintf(&fn, "%s/_.secret", dirname) > 0); VJ_master(JAIL_MASTER_FILE); fdo = open(fn, O_RDWR|O_CREAT|O_TRUNC, 0640); if (fdo < 0) ARGV_ERR("Cannot create secret-file in %s (%s)\n", dirname, strerror(errno)); fdi = open("/dev/urandom", O_RDONLY); if (fdi < 0) fdi = open("/dev/random", O_RDONLY); if (fdi < 0) ARGV_ERR("No /dev/[u]random, cannot autogenerate -S file\n"); for (i = 0; i < 256; i++) { j = read(fdi, &b, 1); assert(j == 1); assert(1 == write(fdo, &b, 1)); } AZ(close(fdi)); AZ(close(fdo)); VJ_master(JAIL_MASTER_LOW); AZ(atexit(mgt_secret_atexit)); return (fn); } /*--------------------------------------------------------------------*/ static char stackmin[20]; static char stackdef[20]; static void init_params(struct cli *cli) { ssize_t def, low; MCF_CollectParams(); MCF_TcpParams(); if (sizeof(void *) < 8) { /* * Adjust default parameters for 32 bit systems to conserve * VM space. */ MCF_SetDefault("workspace_client", "24k"); MCF_SetDefault("workspace_backend", "16k"); MCF_SetDefault("http_resp_size", "8k"); MCF_SetDefault("http_req_size", "12k"); MCF_SetDefault("gzip_buffer", "4k"); } #if !defined(HAVE_ACCEPT_FILTERS) || defined(__linux) MCF_SetDefault("accept_filter", "off"); #endif low = sysconf(_SC_THREAD_STACK_MIN); bprintf(stackmin, "%jd", (intmax_t)low); MCF_SetMinimum("thread_pool_stack", stackmin); def = 48 * 1024; if (def < low) def = low; bprintf(stackdef, "%jd", (intmax_t)def); MCF_SetDefault("thread_pool_stack", stackdef); MCF_InitParams(cli); } /*--------------------------------------------------------------------*/ static void identify(const char *i_arg) { char id[17], *p; int i; strcpy(id, "varnishd"); if (i_arg != NULL) { if (strlen(i_arg) + 1 > 1024) ARGV_ERR("Identity (-i) name too long (max 1023).\n"); heritage.identity = strdup(i_arg); AN(heritage.identity); i = strlen(id); id[i++] = '/'; for (; i < (sizeof(id) - 1L); i++) { if (!isalnum(*i_arg)) break; id[i] = *i_arg++; } id[i] = '\0'; } p = strdup(id); AN(p); openlog(p, LOG_PID, LOG_LOCAL0); } /*--------------------------------------------------------------------*/ int main(int argc, char * const *argv) { int o; unsigned C_flag = 0; unsigned F_flag = 0; const char *b_arg = NULL; const char *f_arg = NULL; const char *i_arg = NULL; const char *h_arg = "critbit"; const char *M_arg = NULL; const char *n_arg = NULL; const char *P_arg = NULL; const char *S_arg = NULL; const char *s_arg = "malloc,100m"; const char *W_arg = NULL; int s_arg_given = 0; const char *T_arg = "localhost:0"; char *p, *vcl = NULL; struct cli cli[1]; char *dirname; char **av; unsigned clilim; int jailed = 0; /* Set up the mgt counters */ memset(&static_VSC_C_mgt, 0, sizeof static_VSC_C_mgt); VSC_C_mgt = &static_VSC_C_mgt; /* * Start out by closing all unwanted file descriptors we might * have inherited from sloppy process control daemons. */ VSUB_closefrom(STDERR_FILENO + 1); VRND_Seed(); mgt_got_fd(STDERR_FILENO); setbuf(stdout, NULL); setbuf(stderr, NULL); build_vident(); Symbol_hack(argv[0]); /* for ASSERT_MGT() */ mgt_pid = getpid(); assert(VTIM_parse("Sun, 06 Nov 1994 08:49:37 GMT") == 784111777); assert(VTIM_parse("Sunday, 06-Nov-94 08:49:37 GMT") == 784111777); assert(VTIM_parse("Sun Nov 6 08:49:37 1994") == 784111777); /* Check that our SHA256 works */ SHA256_Test(); /* Create a cli for convenience in otherwise CLI functions */ INIT_OBJ(cli, CLI_MAGIC); cli[0].sb = VSB_new_auto(); AN(cli[0].sb); cli[0].result = CLIS_OK; clilim = 32768; cli[0].limit = &clilim; /* Various initializations */ VTAILQ_INIT(&heritage.socks); mgt_evb = vev_new_base(); AN(mgt_evb); init_params(cli); cli_check(cli); while ((o = getopt(argc, argv, "a:b:Cdf:Fh:i:j:l:M:n:P:p:r:S:s:T:t:VW:x:")) != -1) { /* * -j must be the first argument if specified, because * it (may) affect subsequent argument processing. */ if (!jailed) { jailed++; if (o == 'j') { VJ_Init(optarg); continue; } VJ_Init(NULL); } else { if (o == 'j') ARGV_ERR("\t-j must be the first argument\n"); } switch (o) { case 'a': MAC_Arg(optarg); break; case 'b': b_arg = optarg; break; case 'C': C_flag = 1 - C_flag; break; case 'd': d_flag++; break; case 'F': F_flag = 1 - F_flag; break; case 'f': f_arg = optarg; break; case 'h': h_arg = optarg; break; case 'i': i_arg = optarg; break; case 'l': av = VAV_Parse(optarg, NULL, ARGV_COMMA); AN(av); if (av[0] != NULL) ARGV_ERR("\t-l ...: %s", av[0]); if (av[1] != NULL) { MCF_ParamSet(cli, "vsl_space", av[1]); cli_check(cli); } if (av[1] != NULL && av[2] != NULL) { MCF_ParamSet(cli, "vsm_space", av[2]); cli_check(cli); } VAV_Free(av); break; case 'M': M_arg = optarg; break; case 'n': n_arg = optarg; break; case 'P': P_arg = optarg; break; case 'p': p = strchr(optarg, '='); if (p == NULL) usage(); AN(p); *p++ = '\0'; MCF_ParamSet(cli, optarg, p); *--p = '='; cli_check(cli); break; case 'r': MCF_ParamProtect(cli, optarg); cli_check(cli); break; case 'S': S_arg = optarg; break; case 's': s_arg_given = 1; STV_Config(optarg); break; case 'T': T_arg = optarg; break; case 't': MCF_ParamSet(cli, "default_ttl", optarg); break; case 'V': /* XXX: we should print the ident here */ VCS_Message("varnishd"); exit(0); case 'W': W_arg = optarg; break; case 'x': if (!strcmp(optarg, "dumprstparam")) { MCF_DumpRstParam(); exit(0); } if (!strcmp(optarg, "dumprstvsl")) { mgt_DumpRstVsl(); exit(0); } usage(); break; default: usage(); } } if (!jailed) VJ_Init(NULL); argc -= optind; argv += optind; if (argc != 0) ARGV_ERR("Too many arguments (%s...)\n", argv[0]); if (M_arg != NULL && *M_arg == '\0') M_arg = NULL; if (T_arg != NULL && *T_arg == '\0') T_arg = NULL; /* XXX: we can have multiple CLI actions above, is this enough ? */ if (cli[0].result != CLIS_OK) { AZ(VSB_finish(cli[0].sb)); ARGV_ERR("Failed parameter creation:\n%s\n", VSB_data(cli[0].sb)); } if (d_flag && F_flag) ARGV_ERR("Only one of -d or -F can be specified\n"); if (b_arg != NULL && f_arg != NULL) ARGV_ERR("Only one of -b or -f can be specified\n"); if (S_arg != NULL && *S_arg == '\0') { fprintf(stderr, "Warning: Empty -S argument, no CLI authentication.\n"); } else if (S_arg != NULL) { VJ_master(JAIL_MASTER_FILE); o = open(S_arg, O_RDONLY, 0); if (o < 0) ARGV_ERR("Cannot open -S file (%s): %s\n", S_arg, strerror(errno)); AZ(close(o)); VJ_master(JAIL_MASTER_LOW); } if (f_arg != NULL) { vcl = VFIL_readfile(NULL, f_arg, NULL); if (vcl == NULL) ARGV_ERR("Cannot read -f file (%s): %s\n", f_arg, strerror(errno)); } if (VIN_N_Arg(n_arg, &heritage.name, &dirname, NULL) != 0) ARGV_ERR("Invalid instance (-n) name: %s\n", strerror(errno)); identify(i_arg); VJ_make_workdir(dirname); /* XXX: should this be relative to the -n arg ? */ VJ_master(JAIL_MASTER_FILE); if (P_arg && (pfh = VPF_Open(P_arg, 0644, NULL)) == NULL) ARGV_ERR("Could not open pid/lock (-P) file (%s): %s\n", P_arg, strerror(errno)); VJ_master(JAIL_MASTER_LOW); mgt_vcc_init(); mgt_vcl_init(); if (b_arg != NULL || f_arg != NULL) { mgt_vcc_startup(cli, b_arg, f_arg, vcl, C_flag); if (C_flag && cli->result == CLIS_OK) { AZ(VSB_finish(cli->sb)); fprintf(stderr, "%s\n", VSB_data(cli->sb)); exit(0); } cli_check(cli); free(vcl); } else if (C_flag) ARGV_ERR("-C only good with -b or -f\n"); if (VTAILQ_EMPTY(&heritage.socks)) MAC_Arg(":80"); MAC_Validate(); assert(! VTAILQ_EMPTY(&heritage.socks)); if (!d_flag) { if (b_arg == NULL && f_arg == NULL) { fprintf(stderr, "Warning: Neither -b nor -f given," " won't start a worker child.\n" " Master process started," " use varnishadm to control it.\n"); } } /* If no -s argument specified, process default -s argument */ if (!s_arg_given) STV_Config(s_arg); /* Configure Transient storage, if user did not */ STV_Config_Transient(); HSH_config(h_arg); Wait_config(W_arg); mgt_SHM_Init(); AZ(VSB_finish(vident)); if (S_arg == NULL) S_arg = make_secret(dirname); AN(S_arg); if (!d_flag && !F_flag) AZ(varnish_daemon(1, 0)); /************************************************************** * After this point diagnostics will only be seen with -d */ assert(pfh == NULL || !VPF_Write(pfh)); MGT_complain(C_DEBUG, "Platform: %s\n", VSB_data(vident) + 1); mgt_pid = getpid(); /* daemon() changed this */ if (d_flag) mgt_cli_setup(0, 1, 1, "debug", cli_stdin_close, NULL); if (*S_arg != '\0') mgt_cli_secret(S_arg); if (M_arg != NULL) mgt_cli_master(M_arg); if (T_arg != NULL) mgt_cli_telnet(T_arg); /* Instantiate VSM */ mgt_SHM_Create(); MGT_Run(); if (pfh != NULL) (void)VPF_Remove(pfh); exit(exit_status); } varnish-4.1.1/bin/varnishd/mgt/mgt_pool.c0000644000201500234410000001615412652366721015266 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * We maintain a number of worker thread pools, to spread lock contention. * * Pools can be added on the fly, as a means to mitigate lock contention, * but can only be removed again by a restart. (XXX: we could fix that) * * Two threads herd the pools, one eliminates idle threads and aggregates * statistics for all the pools, the other thread creates new threads * on demand, subject to various numerical constraints. * * The algorithm for when to create threads needs to be reactive enough * to handle startup spikes, but sufficiently attenuated to not cause * thread pileups. This remains subject for improvement. */ #include "config.h" #include #include "mgt/mgt.h" #include "mgt/mgt_param.h" /*-------------------------------------------------------------------- * The min/max values automatically update the opposites appropriate * limit, so they don't end up crossing. */ static char min_val[20]; static char max_val[20]; static int tweak_thread_pool_min(struct vsb *vsb, const struct parspec *par, const char *arg) { struct vsb v2; if (tweak_generic_uint(vsb, par->priv, arg, par->min, par->max)) return (-1); AN(VSB_new(&v2, min_val, sizeof min_val, 0)); AZ(tweak_generic_uint(&v2, &mgt_param.wthread_min, NULL, NULL, NULL)); AZ(VSB_finish(&v2)); MCF_SetMinimum("thread_pool_max", min_val); return (0); } static int tweak_thread_pool_max(struct vsb *vsb, const struct parspec *par, const char *arg) { struct vsb v2; if (tweak_generic_uint(vsb, par->priv, arg, par->min, par->max)) return (-1); AN(VSB_new(&v2, max_val, sizeof max_val, 0)); AZ(tweak_generic_uint(&v2, &mgt_param.wthread_max, NULL, NULL, NULL)); AZ(VSB_finish(&v2)); MCF_SetMaximum("thread_pool_min", max_val); return (0); } /*--------------------------------------------------------------------*/ struct parspec WRK_parspec[] = { { "thread_pools", tweak_uint, &mgt_param.wthread_pools, "1", NULL, "Number of worker thread pools.\n" "\n" "Increasing number of worker pools decreases lock " "contention.\n" "\n" "Too many pools waste CPU and RAM resources, and more than " "one pool for each CPU is probably detrimal to performance.\n" "\n" "Can be increased on the fly, but decreases require a " "restart to take effect.", EXPERIMENTAL | DELAYED_EFFECT, "2", "pools" }, { "thread_pool_max", tweak_thread_pool_max, &mgt_param.wthread_max, NULL, NULL, "The maximum number of worker threads in each pool.\n" "\n" "Do not set this higher than you have to, since excess " "worker threads soak up RAM and CPU and generally just get " "in the way of getting work done.", DELAYED_EFFECT, "5000", "threads" }, { "thread_pool_min", tweak_thread_pool_min, &mgt_param.wthread_min, NULL, NULL, "The minimum number of worker threads in each pool.\n" "\n" "Increasing this may help ramp up faster from low load " "situations or when threads have expired.\n" "\n" "Minimum is 10 threads.", DELAYED_EFFECT, "100", "threads" }, { "thread_pool_timeout", tweak_timeout, &mgt_param.wthread_timeout, "10", NULL, "Thread idle threshold.\n" "\n" "Threads in excess of thread_pool_min, which have been idle " "for at least this long, will be destroyed.", EXPERIMENTAL | DELAYED_EFFECT, "300", "seconds" }, { "thread_pool_destroy_delay", tweak_timeout, &mgt_param.wthread_destroy_delay, "0.01", NULL, "Wait this long after destroying a thread.\n" "\n" "This controls the decay of thread pools when idle(-ish).", EXPERIMENTAL | DELAYED_EFFECT, "1", "seconds" }, { "thread_pool_add_delay", tweak_timeout, &mgt_param.wthread_add_delay, "0", NULL, "Wait at least this long after creating a thread.\n" "\n" "Some (buggy) systems may need a short (sub-second) " "delay between creating threads.\n" "Set this to a few milliseconds if you see the " "'threads_failed' counter grow too much.\n" "\n" "Setting this too high results in insuffient worker threads.", EXPERIMENTAL, "0", "seconds" }, { "thread_pool_fail_delay", tweak_timeout, &mgt_param.wthread_fail_delay, "10e-3", NULL, "Wait at least this long after a failed thread creation " "before trying to create another thread.\n" "\n" "Failure to create a worker thread is often a sign that " " the end is near, because the process is running out of " "some resource. " "This delay tries to not rush the end on needlessly.\n" "\n" "If thread creation failures are a problem, check that " "thread_pool_max is not too high.\n" "\n" "It may also help to increase thread_pool_timeout and " "thread_pool_min, to reduce the rate at which treads are " "destroyed and later recreated.", EXPERIMENTAL, "0.2", "seconds" }, { "thread_stats_rate", tweak_uint, &mgt_param.wthread_stats_rate, "0", NULL, "Worker threads accumulate statistics, and dump these into " "the global stats counters if the lock is free when they " "finish a job (request/fetch etc.)\n" "This parameters defines the maximum number of jobs " "a worker thread may handle, before it is forced to dump " "its accumulated stats into the global counters.", EXPERIMENTAL, "10", "requests" }, { "thread_queue_limit", tweak_uint, &mgt_param.wthread_queue_limit, "0", NULL, "Permitted queue length per thread-pool.\n" "\n" "This sets the number of requests we will queue, waiting " "for an available thread. Above this limit sessions will " "be dropped instead of queued.", EXPERIMENTAL, "20", "" }, { "thread_pool_stack", tweak_bytes, &mgt_param.wthread_stacksize, NULL, NULL, "Worker thread stack size.\n" "This will likely be rounded up to a multiple of 4k" " (or whatever the page_size might be) by the kernel.", EXPERIMENTAL, NULL, "bytes" }, // default set in mgt_main.c { NULL, NULL, NULL } }; varnish-4.1.1/bin/varnishd/mgt/mgt_jail_unix.c0000644000201500234410000001427112652366721016275 00000000000000/*- * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Jailing processes the UNIX way, using setuid(2) etc. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include "mgt/mgt.h" #ifdef __linux__ #include #endif static gid_t vju_mgr_gid; static uid_t vju_uid; static gid_t vju_gid; static const char *vju_user; static uid_t vju_wrkuid; static gid_t vju_wrkgid; static const char *vju_wrkuser; static gid_t vju_cc_gid; static int vju_cc_gid_set; #ifndef VARNISH_USER #define VARNISH_USER "varnish" #endif #ifndef VCACHE_USER #define VCACHE_USER "vcache" #endif #ifndef NGID #define NGID 2000 #endif static int vju_getuid(const char *arg) { struct passwd *pw; pw = getpwnam(arg); if (pw != NULL) { vju_user = strdup(arg); AN(vju_user); vju_uid = pw->pw_uid; vju_gid = pw->pw_gid; } endpwent(); return (pw == NULL ? -1 : 0); } static int vju_getwrkuid(const char *arg) { struct passwd *pw; pw = getpwnam(arg); if (pw != NULL) { vju_wrkuser = strdup(arg); AN(vju_wrkuser); vju_wrkuid = pw->pw_uid; vju_wrkgid = pw->pw_gid; } endpwent(); return (pw == NULL ? -1 : 0); } static int vju_getccgid(const char *arg) { struct group *gr; gr = getgrnam(arg); if (gr != NULL) { vju_cc_gid_set = 1; vju_cc_gid = gr->gr_gid; } endgrent(); return (gr == NULL ? -1 : 0); } /********************************************************************** */ static int __match_proto__(jail_init_f) vju_init(char **args) { if (args == NULL) { /* Autoconfig */ if (geteuid() != 0) return (1); if (vju_getuid(VARNISH_USER)) return (1); } else { if (geteuid() != 0) ARGV_ERR("Unix Jail: Must be root.\n"); for (;*args != NULL; args++) { if (!strncmp(*args, "user=", 5)) { if (vju_getuid((*args) + 5)) ARGV_ERR( "Unix jail: %s user not found.\n", (*args) + 5); continue; } if (!strncmp(*args, "workuser=", 9)) { if (vju_getwrkuid((*args) + 9)) ARGV_ERR( "Unix jail: %s user not found.\n", (*args) + 9); continue; } if (!strncmp(*args, "ccgroup=", 8)) { if (vju_getccgid((*args) + 8)) ARGV_ERR( "Unix jail: %s group not found.\n", (*args) + 8); continue; } ARGV_ERR("Unix jail: unknown sub-argument '%s'\n", *args); } if (vju_user == NULL && vju_getuid(VARNISH_USER)) ARGV_ERR("Unix jail: %s user not found.\n", VARNISH_USER); } AN(vju_user); vju_mgr_gid = getgid(); if (vju_wrkuser == NULL) (void)vju_getwrkuid(VCACHE_USER); if (vju_wrkuser != NULL && vju_wrkgid != vju_gid) ARGV_ERR("Unix jail: user %s and %s have " "different login groups\n", vju_user, vju_wrkuser); /* Do an explicit JAIL_MASTER_LOW */ AZ(setegid(vju_gid)); AZ(seteuid(vju_uid)); return (0); } static void __match_proto__(jail_master_f) vju_master(enum jail_master_e jme) { if (jme == JAIL_MASTER_LOW) { AZ(setegid(vju_gid)); AZ(seteuid(vju_uid)); } else { AZ(seteuid(0)); AZ(setegid(vju_mgr_gid)); } } static void __match_proto__(jail_subproc_f) vju_subproc(enum jail_subproc_e jse) { int i; gid_t gid_list[NGID]; AZ(seteuid(0)); if (vju_wrkuser != NULL && (jse == JAIL_SUBPROC_VCLLOAD || jse == JAIL_SUBPROC_WORKER)) { AZ(setgid(vju_wrkgid)); AZ(initgroups(vju_wrkuser, vju_wrkgid)); } else { AZ(setgid(vju_gid)); AZ(initgroups(vju_user, vju_gid)); } if (jse == JAIL_SUBPROC_CC && vju_cc_gid_set) { /* Add the optional extra group for the C-compiler access */ i = getgroups(NGID, gid_list); assert(i >= 0); gid_list[i++] = vju_cc_gid; AZ(setgroups(i, gid_list)); } if (vju_wrkuser != NULL && (jse == JAIL_SUBPROC_VCLLOAD || jse == JAIL_SUBPROC_WORKER)) { AZ(setuid(vju_wrkuid)); } else { AZ(setuid(vju_uid)); } #ifdef __linux__ /* * On linux mucking about with uid/gid disables core-dumps, * reenable them again. */ if (prctl(PR_SET_DUMPABLE, 1) != 0) { MGT_complain(C_INFO, "Could not set dumpable bit. Core dumps turned off\n"); } #endif } static void __match_proto__(jail_make_dir_f) vju_make_vcldir(const char *dname) { AZ(seteuid(0)); assert((mkdir(dname, 0755) == 0) || errno == EEXIST); AZ(chown(dname, vju_uid, vju_gid)); AZ(seteuid(vju_uid)); } static void __match_proto__(jail_fixfile_f) vju_vsm_file(int fd) { /* Called under JAIL_MASTER_FILE */ AZ(fchmod(fd, 0640)); AZ(fchown(fd, 0, vju_gid)); } static void __match_proto__(jail_fixfile_f) vju_storage_file(int fd) { /* Called under JAIL_MASTER_STORAGE */ AZ(fchmod(fd, 0600)); AZ(fchown(fd, vju_uid, vju_gid)); } const struct jail_tech jail_tech_unix = { .magic = JAIL_TECH_MAGIC, .name = "unix", .init = vju_init, .master = vju_master, .make_vcldir = vju_make_vcldir, .vsm_file = vju_vsm_file, .storage_file = vju_storage_file, .subproc = vju_subproc, }; varnish-4.1.1/bin/varnishd/mgt/mgt_param_tweak.c0000644000201500234410000002376412652366721016615 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Functions for tweaking parameters * */ #include "config.h" #include #include #include #include #include #include #include "mgt/mgt.h" #include "mgt/mgt_param.h" #include "vav.h" #include "vnum.h" /*-------------------------------------------------------------------- * Generic handling of double typed parameters */ static int tweak_generic_double(struct vsb *vsb, volatile double *dest, const char *arg, const char *min, const char *max, const char *fmt) { double u, minv = 0, maxv = 0; if (arg != NULL) { if (min != NULL) { minv = VNUM(min); if (isnan(minv)) { VSB_printf(vsb, "Illegal Min: %s\n", min); return (-1); } } if (max != NULL) { maxv = VNUM(max); if (isnan(maxv)) { VSB_printf(vsb, "Illegal Max: %s\n", max); return (-1); } } u = VNUM(arg); if (isnan(u)) { VSB_printf(vsb, "Not a number(%s)\n", arg); return (-1); } if (min != NULL && u < minv) { VSB_printf(vsb, "Must be greater or equal to %s\n", min); return (-1); } if (max != NULL && u > maxv) { VSB_printf(vsb, "Must be less than or equal to %s\n", max); return (-1); } *dest = u; } else VSB_printf(vsb, fmt, *dest); return (0); } /*--------------------------------------------------------------------*/ int tweak_timeout(struct vsb *vsb, const struct parspec *par, const char *arg) { volatile double *dest; dest = par->priv; return (tweak_generic_double(vsb, dest, arg, par->min, par->max, "%.3f")); } /*--------------------------------------------------------------------*/ int tweak_double(struct vsb *vsb, const struct parspec *par, const char *arg) { volatile double *dest; dest = par->priv; return (tweak_generic_double(vsb, dest, arg, par->min, par->max, "%g")); } /*--------------------------------------------------------------------*/ int tweak_bool(struct vsb *vsb, const struct parspec *par, const char *arg) { volatile unsigned *dest; dest = par->priv; if (arg != NULL) { if (!strcasecmp(arg, "off")) *dest = 0; else if (!strcasecmp(arg, "disable")) *dest = 0; else if (!strcasecmp(arg, "no")) *dest = 0; else if (!strcasecmp(arg, "false")) *dest = 0; else if (!strcasecmp(arg, "on")) *dest = 1; else if (!strcasecmp(arg, "enable")) *dest = 1; else if (!strcasecmp(arg, "yes")) *dest = 1; else if (!strcasecmp(arg, "true")) *dest = 1; else { VSB_printf(vsb, "use \"on\" or \"off\"\n"); return (-1); } } else { VSB_printf(vsb, "%s", *dest ? "on" : "off"); } return (0); } /*--------------------------------------------------------------------*/ int tweak_generic_uint(struct vsb *vsb, volatile unsigned *dest, const char *arg, const char *min, const char *max) { unsigned u, minv = 0, maxv = 0; char *p; if (arg != NULL) { if (min != NULL) { p = NULL; minv = strtoul(min, &p, 0); if (*arg == '\0' || *p != '\0') { VSB_printf(vsb, "Illegal Min: %s\n", min); return (-1); } } if (max != NULL) { p = NULL; maxv = strtoul(max, &p, 0); if (*arg == '\0' || *p != '\0') { VSB_printf(vsb, "Illegal Max: %s\n", max); return (-1); } } p = NULL; if (!strcasecmp(arg, "unlimited")) u = UINT_MAX; else { u = strtoul(arg, &p, 0); if (*arg == '\0' || *p != '\0') { VSB_printf(vsb, "Not a number (%s)\n", arg); return (-1); } } if (min != NULL && u < minv) { VSB_printf(vsb, "Must be at least %s\n", min); return (-1); } if (max != NULL && u > maxv) { VSB_printf(vsb, "Must be no more than %s\n", max); return (-1); } *dest = u; } else if (*dest == UINT_MAX) { VSB_printf(vsb, "unlimited"); } else { VSB_printf(vsb, "%u", *dest); } return (0); } /*--------------------------------------------------------------------*/ int tweak_uint(struct vsb *vsb, const struct parspec *par, const char *arg) { volatile unsigned *dest; dest = par->priv; return (tweak_generic_uint(vsb, dest, arg, par->min, par->max)); } /*--------------------------------------------------------------------*/ static void fmt_bytes(struct vsb *vsb, uintmax_t t) { const char *p; if (t & 0xff) { VSB_printf(vsb, "%jub", t); return; } for (p = "kMGTPEZY"; *p; p++) { if (t & 0x300) { VSB_printf(vsb, "%.2f%c", t / 1024.0, *p); return; } t /= 1024; if (t & 0x0ff) { VSB_printf(vsb, "%ju%c", t, *p); return; } } VSB_printf(vsb, "(bogus number)"); } static int tweak_generic_bytes(struct vsb *vsb, volatile ssize_t *dest, const char *arg, const char *min, const char *max) { uintmax_t r, rmin = 0, rmax = 0; const char *p; if (arg != NULL) { if (min != NULL) { p = VNUM_2bytes(min, &rmin, 0); if (p != NULL) { VSB_printf(vsb, "Invalid min-val: %s\n", min); return (-1); } } if (max != NULL) { p = VNUM_2bytes(max, &rmax, 0); if (p != NULL) { VSB_printf(vsb, "Invalid max-val: %s\n", max); return (-1); } } p = VNUM_2bytes(arg, &r, 0); if (p != NULL) { VSB_printf(vsb, "Could not convert to bytes.\n"); VSB_printf(vsb, "%s\n", p); VSB_printf(vsb, " Try something like '80k' or '120M'\n"); return (-1); } if ((uintmax_t)((ssize_t)r) != r) { fmt_bytes(vsb, r); VSB_printf(vsb, " is too large for this architecture.\n"); return (-1); } if (max != NULL && r > rmax) { VSB_printf(vsb, "Must be no more than %s\n", max); VSB_printf(vsb, "\n"); return (-1); } if (min != NULL && r < rmin) { VSB_printf(vsb, "Must be at least %s\n", min); return (-1); } *dest = r; } else { fmt_bytes(vsb, *dest); } return (0); } /*--------------------------------------------------------------------*/ int tweak_bytes(struct vsb *vsb, const struct parspec *par, const char *arg) { volatile ssize_t *dest; dest = par->priv; return (tweak_generic_bytes(vsb, dest, arg, par->min, par->max)); } /*--------------------------------------------------------------------*/ int tweak_bytes_u(struct vsb *vsb, const struct parspec *par, const char *arg) { volatile unsigned *d1; volatile ssize_t dest; d1 = par->priv; dest = *d1; if (tweak_generic_bytes(vsb, &dest, arg, par->min, par->max)) return (-1); *d1 = dest; return (0); } /*-------------------------------------------------------------------- * vsl_buffer and vsl_reclen have dependencies. */ int tweak_vsl_buffer(struct vsb *vsb, const struct parspec *par, const char *arg) { volatile unsigned *d1; volatile ssize_t dest; char buf[20]; d1 = par->priv; dest = *d1; if (tweak_generic_bytes(vsb, &dest, arg, par->min, par->max)) return (-1); *d1 = dest; bprintf(buf, "%u", *d1 - 12); MCF_SetMaximum("vsl_reclen", strdup(buf)); MCF_SetMaximum("shm_reclen", strdup(buf)); return (0); } int tweak_vsl_reclen(struct vsb *vsb, const struct parspec *par, const char *arg) { volatile unsigned *d1; volatile ssize_t dest; char buf[20]; d1 = par->priv; dest = *d1; if (tweak_generic_bytes(vsb, &dest, arg, par->min, par->max)) return (-1); *d1 = dest; bprintf(buf, "%u", *d1 + 12); MCF_SetMinimum("vsl_buffer", strdup(buf)); return (0); } /*--------------------------------------------------------------------*/ int tweak_string(struct vsb *vsb, const struct parspec *par, const char *arg) { char **p = TRUST_ME(par->priv); AN(p); /* XXX should have tweak_generic_string */ if (arg == NULL) { VSB_quote(vsb, *p, -1, 0); } else { REPLACE(*p, arg); } return (0); } /*--------------------------------------------------------------------*/ int tweak_poolparam(struct vsb *vsb, const struct parspec *par, const char *arg) { volatile struct poolparam *pp, px; char **av; int retval = 0; pp = par->priv; if (arg == NULL) { VSB_printf(vsb, "%u,%u,%g", pp->min_pool, pp->max_pool, pp->max_age); } else { av = VAV_Parse(arg, NULL, ARGV_COMMA); do { if (av[0] != NULL) { VSB_printf(vsb, "Parse error: %s", av[0]); retval = -1; break; } if (av[1] == NULL || av[2] == NULL || av[3] == NULL) { VSB_printf(vsb, "Three fields required:" " min_pool, max_pool and max_age\n"); retval = -1; break; } px = *pp; retval = tweak_generic_uint(vsb, &px.min_pool, av[1], par->min, par->max); if (retval) break; retval = tweak_generic_uint(vsb, &px.max_pool, av[2], par->min, par->max); if (retval) break; retval = tweak_generic_double(vsb, &px.max_age, av[3], "0", "1e6", "%.0f"); if (retval) break; if (px.min_pool > px.max_pool) { VSB_printf(vsb, "min_pool cannot be larger" " than max_pool\n"); retval = -1; break; } *pp = px; } while(0); VAV_Free(av); } return (retval); } varnish-4.1.1/bin/varnishd/Makefile.in0000644000201500234410000065320512652366726014571 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ sbin_PROGRAMS = varnishd$(EXEEXT) subdir = bin/varnishd DIST_COMMON = $(nobase_pkginclude_HEADERS) $(noinst_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(pkgincludedir)" PROGRAMS = $(sbin_PROGRAMS) am_varnishd_OBJECTS = varnishd-cache_acceptor.$(OBJEXT) \ varnishd-cache_backend.$(OBJEXT) \ varnishd-cache_backend_cfg.$(OBJEXT) \ varnishd-cache_backend_probe.$(OBJEXT) \ varnishd-cache_backend_tcp.$(OBJEXT) \ varnishd-cache_ban.$(OBJEXT) \ varnishd-cache_ban_build.$(OBJEXT) \ varnishd-cache_ban_lurker.$(OBJEXT) \ varnishd-cache_busyobj.$(OBJEXT) varnishd-cache_cli.$(OBJEXT) \ varnishd-cache_deliver_proc.$(OBJEXT) \ varnishd-cache_director.$(OBJEXT) \ varnishd-cache_esi_deliver.$(OBJEXT) \ varnishd-cache_esi_fetch.$(OBJEXT) \ varnishd-cache_esi_parse.$(OBJEXT) \ varnishd-cache_expire.$(OBJEXT) varnishd-cache_fetch.$(OBJEXT) \ varnishd-cache_fetch_proc.$(OBJEXT) \ varnishd-cache_gzip.$(OBJEXT) varnishd-cache_hash.$(OBJEXT) \ varnishd-cache_http.$(OBJEXT) varnishd-cache_lck.$(OBJEXT) \ varnishd-cache_main.$(OBJEXT) varnishd-cache_mempool.$(OBJEXT) \ varnishd-cache_obj.$(OBJEXT) varnishd-cache_panic.$(OBJEXT) \ varnishd-cache_pool.$(OBJEXT) varnishd-cache_req.$(OBJEXT) \ varnishd-cache_req_body.$(OBJEXT) \ varnishd-cache_req_fsm.$(OBJEXT) \ varnishd-cache_rfc2616.$(OBJEXT) \ varnishd-cache_range.$(OBJEXT) \ varnishd-cache_session.$(OBJEXT) \ varnishd-cache_shmlog.$(OBJEXT) varnishd-cache_vary.$(OBJEXT) \ varnishd-cache_vcl.$(OBJEXT) varnishd-cache_vrt.$(OBJEXT) \ varnishd-cache_vrt_priv.$(OBJEXT) \ varnishd-cache_vrt_re.$(OBJEXT) \ varnishd-cache_vrt_var.$(OBJEXT) \ varnishd-cache_vrt_vmod.$(OBJEXT) varnishd-cache_wrk.$(OBJEXT) \ varnishd-cache_ws.$(OBJEXT) varnishd-common_vsm.$(OBJEXT) \ varnishd-common_vsc.$(OBJEXT) varnishd-hash_classic.$(OBJEXT) \ varnishd-hash_critbit.$(OBJEXT) varnishd-mgt_hash.$(OBJEXT) \ varnishd-hash_simple_list.$(OBJEXT) \ varnishd-cache_http1_deliver.$(OBJEXT) \ varnishd-cache_http1_fetch.$(OBJEXT) \ varnishd-cache_http1_fsm.$(OBJEXT) \ varnishd-cache_http1_line.$(OBJEXT) \ varnishd-cache_http1_pipe.$(OBJEXT) \ varnishd-cache_http1_proto.$(OBJEXT) \ varnishd-cache_http1_vfp.$(OBJEXT) \ varnishd-mgt_acceptor.$(OBJEXT) varnishd-mgt_child.$(OBJEXT) \ varnishd-mgt_cli.$(OBJEXT) varnishd-mgt_jail.$(OBJEXT) \ varnishd-mgt_jail_unix.$(OBJEXT) \ varnishd-mgt_jail_solaris.$(OBJEXT) \ varnishd-mgt_main.$(OBJEXT) varnishd-mgt_param.$(OBJEXT) \ varnishd-mgt_param_tbl.$(OBJEXT) \ varnishd-mgt_param_bits.$(OBJEXT) \ varnishd-mgt_param_tcp.$(OBJEXT) \ varnishd-mgt_param_tweak.$(OBJEXT) varnishd-mgt_pool.$(OBJEXT) \ varnishd-mgt_shmem.$(OBJEXT) varnishd-mgt_vcc.$(OBJEXT) \ varnishd-mgt_vcl.$(OBJEXT) \ varnishd-cache_proxy_proto.$(OBJEXT) \ varnishd-stevedore.$(OBJEXT) varnishd-mgt_stevedore.$(OBJEXT) \ varnishd-stevedore_utils.$(OBJEXT) \ varnishd-storage_file.$(OBJEXT) \ varnishd-storage_malloc.$(OBJEXT) \ varnishd-storage_persistent.$(OBJEXT) \ varnishd-mgt_storage_persistent.$(OBJEXT) \ varnishd-storage_persistent_silo.$(OBJEXT) \ varnishd-storage_persistent_subr.$(OBJEXT) \ varnishd-storage_umem.$(OBJEXT) varnishd-mgt_waiter.$(OBJEXT) \ varnishd-cache_waiter.$(OBJEXT) \ varnishd-cache_waiter_epoll.$(OBJEXT) \ varnishd-cache_waiter_kqueue.$(OBJEXT) \ varnishd-cache_waiter_poll.$(OBJEXT) \ varnishd-cache_waiter_ports.$(OBJEXT) varnishd_OBJECTS = $(am_varnishd_OBJECTS) am__DEPENDENCIES_1 = varnishd_DEPENDENCIES = $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvcc/libvcc.la \ $(top_builddir)/lib/libvgz/libvgz.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent varnishd_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(varnishd_CFLAGS) \ $(CFLAGS) $(varnishd_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(varnishd_SOURCES) DIST_SOURCES = $(varnishd_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } HEADERS = $(nobase_pkginclude_HEADERS) $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/lib/libvgz \ -I$(top_builddir)/bin/varnishd \ -I$(top_builddir)/include varnishd_SOURCES = \ cache/cache_acceptor.c \ cache/cache_backend.c \ cache/cache_backend_cfg.c \ cache/cache_backend_probe.c \ cache/cache_backend_tcp.c \ cache/cache_ban.c \ cache/cache_ban_build.c \ cache/cache_ban_lurker.c \ cache/cache_busyobj.c \ cache/cache_cli.c \ cache/cache_deliver_proc.c \ cache/cache_director.c \ cache/cache_esi_deliver.c \ cache/cache_esi_fetch.c \ cache/cache_esi_parse.c \ cache/cache_expire.c \ cache/cache_fetch.c \ cache/cache_fetch_proc.c \ cache/cache_gzip.c \ cache/cache_hash.c \ cache/cache_http.c \ cache/cache_lck.c \ cache/cache_main.c \ cache/cache_mempool.c \ cache/cache_obj.c \ cache/cache_panic.c \ cache/cache_pool.c \ cache/cache_req.c \ cache/cache_req_body.c \ cache/cache_req_fsm.c \ cache/cache_rfc2616.c \ cache/cache_range.c \ cache/cache_session.c \ cache/cache_shmlog.c \ cache/cache_vary.c \ cache/cache_vcl.c \ cache/cache_vrt.c \ cache/cache_vrt_priv.c \ cache/cache_vrt_re.c \ cache/cache_vrt_var.c \ cache/cache_vrt_vmod.c \ cache/cache_wrk.c \ cache/cache_ws.c \ common/common_vsm.c \ common/common_vsc.c \ hash/hash_classic.c \ hash/hash_critbit.c \ hash/mgt_hash.c \ hash/hash_simple_list.c \ http1/cache_http1_deliver.c \ http1/cache_http1_fetch.c \ http1/cache_http1_fsm.c \ http1/cache_http1_line.c \ http1/cache_http1_pipe.c \ http1/cache_http1_proto.c \ http1/cache_http1_vfp.c \ mgt/mgt_acceptor.c \ mgt/mgt_child.c \ mgt/mgt_cli.c \ mgt/mgt_jail.c \ mgt/mgt_jail_unix.c \ mgt/mgt_jail_solaris.c \ mgt/mgt_main.c \ 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_shmem.c \ mgt/mgt_vcc.c \ mgt/mgt_vcl.c \ proxy/cache_proxy_proto.c \ storage/stevedore.c \ storage/mgt_stevedore.c \ storage/stevedore_utils.c \ storage/storage_file.c \ storage/storage_malloc.c \ storage/storage_persistent.c \ storage/mgt_storage_persistent.c \ storage/storage_persistent_silo.c \ storage/storage_persistent_subr.c \ storage/storage_umem.c \ waiter/mgt_waiter.c \ waiter/cache_waiter.c \ waiter/cache_waiter_epoll.c \ waiter/cache_waiter_kqueue.c \ waiter/cache_waiter_poll.c \ waiter/cache_waiter_ports.c noinst_HEADERS = \ builtin_vcl.h \ cache/cache_ban.h \ cache/cache_esi.h \ cache/cache_pool.h \ cache/cache_priv.h \ common/heritage.h \ hash/hash_slinger.h \ http1/cache_http1.h \ mgt/mgt.h \ mgt/mgt_cli.h \ mgt/mgt_param.h \ storage/storage.h \ storage/storage_persistent.h \ waiter/waiter_priv.h \ waiter/mgt_waiter.h # Headers for use with vmods nobase_pkginclude_HEADERS = \ cache/cache.h \ cache/cache_filter.h \ cache/cache_backend.h \ cache/cache_director.h \ common/common.h \ common/params.h \ waiter/waiter.h varnishd_CFLAGS = \ @PCRE_CFLAGS@ \ -DVARNISHD_IS_NOT_A_VMOD \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' \ -DVARNISH_VMOD_DIR='"${pkglibdir}/vmods"' \ -DVARNISH_VCL_DIR='"${varnishconfdir}"' varnishd_LDFLAGS = -export-dynamic varnishd_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvcc/libvcc.la \ $(top_builddir)/lib/libvgz/libvgz.la \ @JEMALLOC_LDADD@ \ @PCRE_LIBS@ \ ${DL_LIBS} ${PTHREAD_LIBS} ${NET_LIBS} ${LIBM} ${LIBUMEM} EXTRA_DIST = builtin.vcl DISTCLEANFILES = builtin_vcl.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/varnishd/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign bin/varnishd/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list varnishd$(EXEEXT): $(varnishd_OBJECTS) $(varnishd_DEPENDENCIES) $(EXTRA_varnishd_DEPENDENCIES) @rm -f varnishd$(EXEEXT) $(AM_V_CCLD)$(varnishd_LINK) $(varnishd_OBJECTS) $(varnishd_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_acceptor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_backend.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_backend_cfg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_backend_probe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_backend_tcp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_ban.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_ban_build.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_ban_lurker.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_busyobj.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_cli.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_deliver_proc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_director.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_esi_deliver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_esi_fetch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_esi_parse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_expire.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_fetch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_fetch_proc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_gzip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_http.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_http1_deliver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_http1_fetch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_http1_fsm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_http1_line.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_http1_pipe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_http1_proto.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_http1_vfp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_lck.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_mempool.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_obj.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_panic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_pool.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_proxy_proto.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_range.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_req.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_req_body.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_req_fsm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_rfc2616.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_session.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_shmlog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_vary.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_vcl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_vrt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_vrt_priv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_vrt_re.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_vrt_var.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_vrt_vmod.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_waiter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_waiter_epoll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_waiter_kqueue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_waiter_poll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_waiter_ports.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_wrk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-cache_ws.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-common_vsc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-common_vsm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-hash_classic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-hash_critbit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-hash_simple_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_acceptor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_child.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_cli.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_jail.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_jail_solaris.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_jail_unix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_param.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_param_bits.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_param_tbl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_param_tcp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_param_tweak.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_pool.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_shmem.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_stevedore.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_storage_persistent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_vcc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_vcl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-mgt_waiter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-stevedore.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-stevedore_utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-storage_file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-storage_malloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-storage_persistent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-storage_persistent_silo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-storage_persistent_subr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishd-storage_umem.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< varnishd-cache_acceptor.o: cache/cache_acceptor.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_acceptor.o -MD -MP -MF $(DEPDIR)/varnishd-cache_acceptor.Tpo -c -o varnishd-cache_acceptor.o `test -f 'cache/cache_acceptor.c' || echo '$(srcdir)/'`cache/cache_acceptor.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_acceptor.Tpo $(DEPDIR)/varnishd-cache_acceptor.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_acceptor.c' object='varnishd-cache_acceptor.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_acceptor.o `test -f 'cache/cache_acceptor.c' || echo '$(srcdir)/'`cache/cache_acceptor.c varnishd-cache_acceptor.obj: cache/cache_acceptor.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_acceptor.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_acceptor.Tpo -c -o varnishd-cache_acceptor.obj `if test -f 'cache/cache_acceptor.c'; then $(CYGPATH_W) 'cache/cache_acceptor.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_acceptor.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_acceptor.Tpo $(DEPDIR)/varnishd-cache_acceptor.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_acceptor.c' object='varnishd-cache_acceptor.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_acceptor.obj `if test -f 'cache/cache_acceptor.c'; then $(CYGPATH_W) 'cache/cache_acceptor.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_acceptor.c'; fi` varnishd-cache_backend.o: cache/cache_backend.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_backend.o -MD -MP -MF $(DEPDIR)/varnishd-cache_backend.Tpo -c -o varnishd-cache_backend.o `test -f 'cache/cache_backend.c' || echo '$(srcdir)/'`cache/cache_backend.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_backend.Tpo $(DEPDIR)/varnishd-cache_backend.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_backend.c' object='varnishd-cache_backend.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_backend.o `test -f 'cache/cache_backend.c' || echo '$(srcdir)/'`cache/cache_backend.c varnishd-cache_backend.obj: cache/cache_backend.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_backend.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_backend.Tpo -c -o varnishd-cache_backend.obj `if test -f 'cache/cache_backend.c'; then $(CYGPATH_W) 'cache/cache_backend.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_backend.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_backend.Tpo $(DEPDIR)/varnishd-cache_backend.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_backend.c' object='varnishd-cache_backend.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_backend.obj `if test -f 'cache/cache_backend.c'; then $(CYGPATH_W) 'cache/cache_backend.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_backend.c'; fi` varnishd-cache_backend_cfg.o: cache/cache_backend_cfg.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_backend_cfg.o -MD -MP -MF $(DEPDIR)/varnishd-cache_backend_cfg.Tpo -c -o varnishd-cache_backend_cfg.o `test -f 'cache/cache_backend_cfg.c' || echo '$(srcdir)/'`cache/cache_backend_cfg.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_backend_cfg.Tpo $(DEPDIR)/varnishd-cache_backend_cfg.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_backend_cfg.c' object='varnishd-cache_backend_cfg.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_backend_cfg.o `test -f 'cache/cache_backend_cfg.c' || echo '$(srcdir)/'`cache/cache_backend_cfg.c varnishd-cache_backend_cfg.obj: cache/cache_backend_cfg.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_backend_cfg.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_backend_cfg.Tpo -c -o varnishd-cache_backend_cfg.obj `if test -f 'cache/cache_backend_cfg.c'; then $(CYGPATH_W) 'cache/cache_backend_cfg.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_backend_cfg.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_backend_cfg.Tpo $(DEPDIR)/varnishd-cache_backend_cfg.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_backend_cfg.c' object='varnishd-cache_backend_cfg.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_backend_cfg.obj `if test -f 'cache/cache_backend_cfg.c'; then $(CYGPATH_W) 'cache/cache_backend_cfg.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_backend_cfg.c'; fi` varnishd-cache_backend_probe.o: cache/cache_backend_probe.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_backend_probe.o -MD -MP -MF $(DEPDIR)/varnishd-cache_backend_probe.Tpo -c -o varnishd-cache_backend_probe.o `test -f 'cache/cache_backend_probe.c' || echo '$(srcdir)/'`cache/cache_backend_probe.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_backend_probe.Tpo $(DEPDIR)/varnishd-cache_backend_probe.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_backend_probe.c' object='varnishd-cache_backend_probe.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_backend_probe.o `test -f 'cache/cache_backend_probe.c' || echo '$(srcdir)/'`cache/cache_backend_probe.c varnishd-cache_backend_probe.obj: cache/cache_backend_probe.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_backend_probe.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_backend_probe.Tpo -c -o varnishd-cache_backend_probe.obj `if test -f 'cache/cache_backend_probe.c'; then $(CYGPATH_W) 'cache/cache_backend_probe.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_backend_probe.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_backend_probe.Tpo $(DEPDIR)/varnishd-cache_backend_probe.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_backend_probe.c' object='varnishd-cache_backend_probe.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_backend_probe.obj `if test -f 'cache/cache_backend_probe.c'; then $(CYGPATH_W) 'cache/cache_backend_probe.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_backend_probe.c'; fi` varnishd-cache_backend_tcp.o: cache/cache_backend_tcp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_backend_tcp.o -MD -MP -MF $(DEPDIR)/varnishd-cache_backend_tcp.Tpo -c -o varnishd-cache_backend_tcp.o `test -f 'cache/cache_backend_tcp.c' || echo '$(srcdir)/'`cache/cache_backend_tcp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_backend_tcp.Tpo $(DEPDIR)/varnishd-cache_backend_tcp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_backend_tcp.c' object='varnishd-cache_backend_tcp.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_backend_tcp.o `test -f 'cache/cache_backend_tcp.c' || echo '$(srcdir)/'`cache/cache_backend_tcp.c varnishd-cache_backend_tcp.obj: cache/cache_backend_tcp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_backend_tcp.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_backend_tcp.Tpo -c -o varnishd-cache_backend_tcp.obj `if test -f 'cache/cache_backend_tcp.c'; then $(CYGPATH_W) 'cache/cache_backend_tcp.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_backend_tcp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_backend_tcp.Tpo $(DEPDIR)/varnishd-cache_backend_tcp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_backend_tcp.c' object='varnishd-cache_backend_tcp.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_backend_tcp.obj `if test -f 'cache/cache_backend_tcp.c'; then $(CYGPATH_W) 'cache/cache_backend_tcp.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_backend_tcp.c'; fi` varnishd-cache_ban.o: cache/cache_ban.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_ban.o -MD -MP -MF $(DEPDIR)/varnishd-cache_ban.Tpo -c -o varnishd-cache_ban.o `test -f 'cache/cache_ban.c' || echo '$(srcdir)/'`cache/cache_ban.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_ban.Tpo $(DEPDIR)/varnishd-cache_ban.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_ban.c' object='varnishd-cache_ban.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_ban.o `test -f 'cache/cache_ban.c' || echo '$(srcdir)/'`cache/cache_ban.c varnishd-cache_ban.obj: cache/cache_ban.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_ban.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_ban.Tpo -c -o varnishd-cache_ban.obj `if test -f 'cache/cache_ban.c'; then $(CYGPATH_W) 'cache/cache_ban.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_ban.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_ban.Tpo $(DEPDIR)/varnishd-cache_ban.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_ban.c' object='varnishd-cache_ban.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_ban.obj `if test -f 'cache/cache_ban.c'; then $(CYGPATH_W) 'cache/cache_ban.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_ban.c'; fi` varnishd-cache_ban_build.o: cache/cache_ban_build.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_ban_build.o -MD -MP -MF $(DEPDIR)/varnishd-cache_ban_build.Tpo -c -o varnishd-cache_ban_build.o `test -f 'cache/cache_ban_build.c' || echo '$(srcdir)/'`cache/cache_ban_build.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_ban_build.Tpo $(DEPDIR)/varnishd-cache_ban_build.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_ban_build.c' object='varnishd-cache_ban_build.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_ban_build.o `test -f 'cache/cache_ban_build.c' || echo '$(srcdir)/'`cache/cache_ban_build.c varnishd-cache_ban_build.obj: cache/cache_ban_build.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_ban_build.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_ban_build.Tpo -c -o varnishd-cache_ban_build.obj `if test -f 'cache/cache_ban_build.c'; then $(CYGPATH_W) 'cache/cache_ban_build.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_ban_build.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_ban_build.Tpo $(DEPDIR)/varnishd-cache_ban_build.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_ban_build.c' object='varnishd-cache_ban_build.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_ban_build.obj `if test -f 'cache/cache_ban_build.c'; then $(CYGPATH_W) 'cache/cache_ban_build.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_ban_build.c'; fi` varnishd-cache_ban_lurker.o: cache/cache_ban_lurker.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_ban_lurker.o -MD -MP -MF $(DEPDIR)/varnishd-cache_ban_lurker.Tpo -c -o varnishd-cache_ban_lurker.o `test -f 'cache/cache_ban_lurker.c' || echo '$(srcdir)/'`cache/cache_ban_lurker.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_ban_lurker.Tpo $(DEPDIR)/varnishd-cache_ban_lurker.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_ban_lurker.c' object='varnishd-cache_ban_lurker.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_ban_lurker.o `test -f 'cache/cache_ban_lurker.c' || echo '$(srcdir)/'`cache/cache_ban_lurker.c varnishd-cache_ban_lurker.obj: cache/cache_ban_lurker.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_ban_lurker.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_ban_lurker.Tpo -c -o varnishd-cache_ban_lurker.obj `if test -f 'cache/cache_ban_lurker.c'; then $(CYGPATH_W) 'cache/cache_ban_lurker.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_ban_lurker.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_ban_lurker.Tpo $(DEPDIR)/varnishd-cache_ban_lurker.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_ban_lurker.c' object='varnishd-cache_ban_lurker.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_ban_lurker.obj `if test -f 'cache/cache_ban_lurker.c'; then $(CYGPATH_W) 'cache/cache_ban_lurker.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_ban_lurker.c'; fi` varnishd-cache_busyobj.o: cache/cache_busyobj.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_busyobj.o -MD -MP -MF $(DEPDIR)/varnishd-cache_busyobj.Tpo -c -o varnishd-cache_busyobj.o `test -f 'cache/cache_busyobj.c' || echo '$(srcdir)/'`cache/cache_busyobj.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_busyobj.Tpo $(DEPDIR)/varnishd-cache_busyobj.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_busyobj.c' object='varnishd-cache_busyobj.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_busyobj.o `test -f 'cache/cache_busyobj.c' || echo '$(srcdir)/'`cache/cache_busyobj.c varnishd-cache_busyobj.obj: cache/cache_busyobj.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_busyobj.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_busyobj.Tpo -c -o varnishd-cache_busyobj.obj `if test -f 'cache/cache_busyobj.c'; then $(CYGPATH_W) 'cache/cache_busyobj.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_busyobj.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_busyobj.Tpo $(DEPDIR)/varnishd-cache_busyobj.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_busyobj.c' object='varnishd-cache_busyobj.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_busyobj.obj `if test -f 'cache/cache_busyobj.c'; then $(CYGPATH_W) 'cache/cache_busyobj.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_busyobj.c'; fi` varnishd-cache_cli.o: cache/cache_cli.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_cli.o -MD -MP -MF $(DEPDIR)/varnishd-cache_cli.Tpo -c -o varnishd-cache_cli.o `test -f 'cache/cache_cli.c' || echo '$(srcdir)/'`cache/cache_cli.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_cli.Tpo $(DEPDIR)/varnishd-cache_cli.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_cli.c' object='varnishd-cache_cli.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_cli.o `test -f 'cache/cache_cli.c' || echo '$(srcdir)/'`cache/cache_cli.c varnishd-cache_cli.obj: cache/cache_cli.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_cli.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_cli.Tpo -c -o varnishd-cache_cli.obj `if test -f 'cache/cache_cli.c'; then $(CYGPATH_W) 'cache/cache_cli.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_cli.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_cli.Tpo $(DEPDIR)/varnishd-cache_cli.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_cli.c' object='varnishd-cache_cli.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_cli.obj `if test -f 'cache/cache_cli.c'; then $(CYGPATH_W) 'cache/cache_cli.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_cli.c'; fi` varnishd-cache_deliver_proc.o: cache/cache_deliver_proc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_deliver_proc.o -MD -MP -MF $(DEPDIR)/varnishd-cache_deliver_proc.Tpo -c -o varnishd-cache_deliver_proc.o `test -f 'cache/cache_deliver_proc.c' || echo '$(srcdir)/'`cache/cache_deliver_proc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_deliver_proc.Tpo $(DEPDIR)/varnishd-cache_deliver_proc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_deliver_proc.c' object='varnishd-cache_deliver_proc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_deliver_proc.o `test -f 'cache/cache_deliver_proc.c' || echo '$(srcdir)/'`cache/cache_deliver_proc.c varnishd-cache_deliver_proc.obj: cache/cache_deliver_proc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_deliver_proc.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_deliver_proc.Tpo -c -o varnishd-cache_deliver_proc.obj `if test -f 'cache/cache_deliver_proc.c'; then $(CYGPATH_W) 'cache/cache_deliver_proc.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_deliver_proc.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_deliver_proc.Tpo $(DEPDIR)/varnishd-cache_deliver_proc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_deliver_proc.c' object='varnishd-cache_deliver_proc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_deliver_proc.obj `if test -f 'cache/cache_deliver_proc.c'; then $(CYGPATH_W) 'cache/cache_deliver_proc.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_deliver_proc.c'; fi` varnishd-cache_director.o: cache/cache_director.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_director.o -MD -MP -MF $(DEPDIR)/varnishd-cache_director.Tpo -c -o varnishd-cache_director.o `test -f 'cache/cache_director.c' || echo '$(srcdir)/'`cache/cache_director.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_director.Tpo $(DEPDIR)/varnishd-cache_director.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_director.c' object='varnishd-cache_director.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_director.o `test -f 'cache/cache_director.c' || echo '$(srcdir)/'`cache/cache_director.c varnishd-cache_director.obj: cache/cache_director.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_director.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_director.Tpo -c -o varnishd-cache_director.obj `if test -f 'cache/cache_director.c'; then $(CYGPATH_W) 'cache/cache_director.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_director.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_director.Tpo $(DEPDIR)/varnishd-cache_director.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_director.c' object='varnishd-cache_director.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_director.obj `if test -f 'cache/cache_director.c'; then $(CYGPATH_W) 'cache/cache_director.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_director.c'; fi` varnishd-cache_esi_deliver.o: cache/cache_esi_deliver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_esi_deliver.o -MD -MP -MF $(DEPDIR)/varnishd-cache_esi_deliver.Tpo -c -o varnishd-cache_esi_deliver.o `test -f 'cache/cache_esi_deliver.c' || echo '$(srcdir)/'`cache/cache_esi_deliver.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_esi_deliver.Tpo $(DEPDIR)/varnishd-cache_esi_deliver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_esi_deliver.c' object='varnishd-cache_esi_deliver.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_esi_deliver.o `test -f 'cache/cache_esi_deliver.c' || echo '$(srcdir)/'`cache/cache_esi_deliver.c varnishd-cache_esi_deliver.obj: cache/cache_esi_deliver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_esi_deliver.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_esi_deliver.Tpo -c -o varnishd-cache_esi_deliver.obj `if test -f 'cache/cache_esi_deliver.c'; then $(CYGPATH_W) 'cache/cache_esi_deliver.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_esi_deliver.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_esi_deliver.Tpo $(DEPDIR)/varnishd-cache_esi_deliver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_esi_deliver.c' object='varnishd-cache_esi_deliver.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_esi_deliver.obj `if test -f 'cache/cache_esi_deliver.c'; then $(CYGPATH_W) 'cache/cache_esi_deliver.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_esi_deliver.c'; fi` varnishd-cache_esi_fetch.o: cache/cache_esi_fetch.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_esi_fetch.o -MD -MP -MF $(DEPDIR)/varnishd-cache_esi_fetch.Tpo -c -o varnishd-cache_esi_fetch.o `test -f 'cache/cache_esi_fetch.c' || echo '$(srcdir)/'`cache/cache_esi_fetch.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_esi_fetch.Tpo $(DEPDIR)/varnishd-cache_esi_fetch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_esi_fetch.c' object='varnishd-cache_esi_fetch.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_esi_fetch.o `test -f 'cache/cache_esi_fetch.c' || echo '$(srcdir)/'`cache/cache_esi_fetch.c varnishd-cache_esi_fetch.obj: cache/cache_esi_fetch.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_esi_fetch.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_esi_fetch.Tpo -c -o varnishd-cache_esi_fetch.obj `if test -f 'cache/cache_esi_fetch.c'; then $(CYGPATH_W) 'cache/cache_esi_fetch.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_esi_fetch.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_esi_fetch.Tpo $(DEPDIR)/varnishd-cache_esi_fetch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_esi_fetch.c' object='varnishd-cache_esi_fetch.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_esi_fetch.obj `if test -f 'cache/cache_esi_fetch.c'; then $(CYGPATH_W) 'cache/cache_esi_fetch.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_esi_fetch.c'; fi` varnishd-cache_esi_parse.o: cache/cache_esi_parse.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_esi_parse.o -MD -MP -MF $(DEPDIR)/varnishd-cache_esi_parse.Tpo -c -o varnishd-cache_esi_parse.o `test -f 'cache/cache_esi_parse.c' || echo '$(srcdir)/'`cache/cache_esi_parse.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_esi_parse.Tpo $(DEPDIR)/varnishd-cache_esi_parse.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_esi_parse.c' object='varnishd-cache_esi_parse.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_esi_parse.o `test -f 'cache/cache_esi_parse.c' || echo '$(srcdir)/'`cache/cache_esi_parse.c varnishd-cache_esi_parse.obj: cache/cache_esi_parse.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_esi_parse.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_esi_parse.Tpo -c -o varnishd-cache_esi_parse.obj `if test -f 'cache/cache_esi_parse.c'; then $(CYGPATH_W) 'cache/cache_esi_parse.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_esi_parse.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_esi_parse.Tpo $(DEPDIR)/varnishd-cache_esi_parse.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_esi_parse.c' object='varnishd-cache_esi_parse.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_esi_parse.obj `if test -f 'cache/cache_esi_parse.c'; then $(CYGPATH_W) 'cache/cache_esi_parse.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_esi_parse.c'; fi` varnishd-cache_expire.o: cache/cache_expire.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_expire.o -MD -MP -MF $(DEPDIR)/varnishd-cache_expire.Tpo -c -o varnishd-cache_expire.o `test -f 'cache/cache_expire.c' || echo '$(srcdir)/'`cache/cache_expire.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_expire.Tpo $(DEPDIR)/varnishd-cache_expire.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_expire.c' object='varnishd-cache_expire.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_expire.o `test -f 'cache/cache_expire.c' || echo '$(srcdir)/'`cache/cache_expire.c varnishd-cache_expire.obj: cache/cache_expire.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_expire.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_expire.Tpo -c -o varnishd-cache_expire.obj `if test -f 'cache/cache_expire.c'; then $(CYGPATH_W) 'cache/cache_expire.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_expire.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_expire.Tpo $(DEPDIR)/varnishd-cache_expire.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_expire.c' object='varnishd-cache_expire.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_expire.obj `if test -f 'cache/cache_expire.c'; then $(CYGPATH_W) 'cache/cache_expire.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_expire.c'; fi` varnishd-cache_fetch.o: cache/cache_fetch.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_fetch.o -MD -MP -MF $(DEPDIR)/varnishd-cache_fetch.Tpo -c -o varnishd-cache_fetch.o `test -f 'cache/cache_fetch.c' || echo '$(srcdir)/'`cache/cache_fetch.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_fetch.Tpo $(DEPDIR)/varnishd-cache_fetch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_fetch.c' object='varnishd-cache_fetch.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_fetch.o `test -f 'cache/cache_fetch.c' || echo '$(srcdir)/'`cache/cache_fetch.c varnishd-cache_fetch.obj: cache/cache_fetch.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_fetch.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_fetch.Tpo -c -o varnishd-cache_fetch.obj `if test -f 'cache/cache_fetch.c'; then $(CYGPATH_W) 'cache/cache_fetch.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_fetch.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_fetch.Tpo $(DEPDIR)/varnishd-cache_fetch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_fetch.c' object='varnishd-cache_fetch.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_fetch.obj `if test -f 'cache/cache_fetch.c'; then $(CYGPATH_W) 'cache/cache_fetch.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_fetch.c'; fi` varnishd-cache_fetch_proc.o: cache/cache_fetch_proc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_fetch_proc.o -MD -MP -MF $(DEPDIR)/varnishd-cache_fetch_proc.Tpo -c -o varnishd-cache_fetch_proc.o `test -f 'cache/cache_fetch_proc.c' || echo '$(srcdir)/'`cache/cache_fetch_proc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_fetch_proc.Tpo $(DEPDIR)/varnishd-cache_fetch_proc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_fetch_proc.c' object='varnishd-cache_fetch_proc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_fetch_proc.o `test -f 'cache/cache_fetch_proc.c' || echo '$(srcdir)/'`cache/cache_fetch_proc.c varnishd-cache_fetch_proc.obj: cache/cache_fetch_proc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_fetch_proc.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_fetch_proc.Tpo -c -o varnishd-cache_fetch_proc.obj `if test -f 'cache/cache_fetch_proc.c'; then $(CYGPATH_W) 'cache/cache_fetch_proc.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_fetch_proc.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_fetch_proc.Tpo $(DEPDIR)/varnishd-cache_fetch_proc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_fetch_proc.c' object='varnishd-cache_fetch_proc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_fetch_proc.obj `if test -f 'cache/cache_fetch_proc.c'; then $(CYGPATH_W) 'cache/cache_fetch_proc.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_fetch_proc.c'; fi` varnishd-cache_gzip.o: cache/cache_gzip.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_gzip.o -MD -MP -MF $(DEPDIR)/varnishd-cache_gzip.Tpo -c -o varnishd-cache_gzip.o `test -f 'cache/cache_gzip.c' || echo '$(srcdir)/'`cache/cache_gzip.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_gzip.Tpo $(DEPDIR)/varnishd-cache_gzip.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_gzip.c' object='varnishd-cache_gzip.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_gzip.o `test -f 'cache/cache_gzip.c' || echo '$(srcdir)/'`cache/cache_gzip.c varnishd-cache_gzip.obj: cache/cache_gzip.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_gzip.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_gzip.Tpo -c -o varnishd-cache_gzip.obj `if test -f 'cache/cache_gzip.c'; then $(CYGPATH_W) 'cache/cache_gzip.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_gzip.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_gzip.Tpo $(DEPDIR)/varnishd-cache_gzip.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_gzip.c' object='varnishd-cache_gzip.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_gzip.obj `if test -f 'cache/cache_gzip.c'; then $(CYGPATH_W) 'cache/cache_gzip.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_gzip.c'; fi` varnishd-cache_hash.o: cache/cache_hash.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_hash.o -MD -MP -MF $(DEPDIR)/varnishd-cache_hash.Tpo -c -o varnishd-cache_hash.o `test -f 'cache/cache_hash.c' || echo '$(srcdir)/'`cache/cache_hash.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_hash.Tpo $(DEPDIR)/varnishd-cache_hash.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_hash.c' object='varnishd-cache_hash.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_hash.o `test -f 'cache/cache_hash.c' || echo '$(srcdir)/'`cache/cache_hash.c varnishd-cache_hash.obj: cache/cache_hash.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_hash.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_hash.Tpo -c -o varnishd-cache_hash.obj `if test -f 'cache/cache_hash.c'; then $(CYGPATH_W) 'cache/cache_hash.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_hash.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_hash.Tpo $(DEPDIR)/varnishd-cache_hash.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_hash.c' object='varnishd-cache_hash.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_hash.obj `if test -f 'cache/cache_hash.c'; then $(CYGPATH_W) 'cache/cache_hash.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_hash.c'; fi` varnishd-cache_http.o: cache/cache_http.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http.o -MD -MP -MF $(DEPDIR)/varnishd-cache_http.Tpo -c -o varnishd-cache_http.o `test -f 'cache/cache_http.c' || echo '$(srcdir)/'`cache/cache_http.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http.Tpo $(DEPDIR)/varnishd-cache_http.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_http.c' object='varnishd-cache_http.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http.o `test -f 'cache/cache_http.c' || echo '$(srcdir)/'`cache/cache_http.c varnishd-cache_http.obj: cache/cache_http.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_http.Tpo -c -o varnishd-cache_http.obj `if test -f 'cache/cache_http.c'; then $(CYGPATH_W) 'cache/cache_http.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_http.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http.Tpo $(DEPDIR)/varnishd-cache_http.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_http.c' object='varnishd-cache_http.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http.obj `if test -f 'cache/cache_http.c'; then $(CYGPATH_W) 'cache/cache_http.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_http.c'; fi` varnishd-cache_lck.o: cache/cache_lck.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_lck.o -MD -MP -MF $(DEPDIR)/varnishd-cache_lck.Tpo -c -o varnishd-cache_lck.o `test -f 'cache/cache_lck.c' || echo '$(srcdir)/'`cache/cache_lck.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_lck.Tpo $(DEPDIR)/varnishd-cache_lck.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_lck.c' object='varnishd-cache_lck.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_lck.o `test -f 'cache/cache_lck.c' || echo '$(srcdir)/'`cache/cache_lck.c varnishd-cache_lck.obj: cache/cache_lck.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_lck.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_lck.Tpo -c -o varnishd-cache_lck.obj `if test -f 'cache/cache_lck.c'; then $(CYGPATH_W) 'cache/cache_lck.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_lck.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_lck.Tpo $(DEPDIR)/varnishd-cache_lck.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_lck.c' object='varnishd-cache_lck.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_lck.obj `if test -f 'cache/cache_lck.c'; then $(CYGPATH_W) 'cache/cache_lck.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_lck.c'; fi` varnishd-cache_main.o: cache/cache_main.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_main.o -MD -MP -MF $(DEPDIR)/varnishd-cache_main.Tpo -c -o varnishd-cache_main.o `test -f 'cache/cache_main.c' || echo '$(srcdir)/'`cache/cache_main.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_main.Tpo $(DEPDIR)/varnishd-cache_main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_main.c' object='varnishd-cache_main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_main.o `test -f 'cache/cache_main.c' || echo '$(srcdir)/'`cache/cache_main.c varnishd-cache_main.obj: cache/cache_main.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_main.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_main.Tpo -c -o varnishd-cache_main.obj `if test -f 'cache/cache_main.c'; then $(CYGPATH_W) 'cache/cache_main.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_main.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_main.Tpo $(DEPDIR)/varnishd-cache_main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_main.c' object='varnishd-cache_main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_main.obj `if test -f 'cache/cache_main.c'; then $(CYGPATH_W) 'cache/cache_main.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_main.c'; fi` varnishd-cache_mempool.o: cache/cache_mempool.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_mempool.o -MD -MP -MF $(DEPDIR)/varnishd-cache_mempool.Tpo -c -o varnishd-cache_mempool.o `test -f 'cache/cache_mempool.c' || echo '$(srcdir)/'`cache/cache_mempool.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_mempool.Tpo $(DEPDIR)/varnishd-cache_mempool.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_mempool.c' object='varnishd-cache_mempool.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_mempool.o `test -f 'cache/cache_mempool.c' || echo '$(srcdir)/'`cache/cache_mempool.c varnishd-cache_mempool.obj: cache/cache_mempool.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_mempool.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_mempool.Tpo -c -o varnishd-cache_mempool.obj `if test -f 'cache/cache_mempool.c'; then $(CYGPATH_W) 'cache/cache_mempool.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_mempool.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_mempool.Tpo $(DEPDIR)/varnishd-cache_mempool.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_mempool.c' object='varnishd-cache_mempool.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_mempool.obj `if test -f 'cache/cache_mempool.c'; then $(CYGPATH_W) 'cache/cache_mempool.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_mempool.c'; fi` varnishd-cache_obj.o: cache/cache_obj.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_obj.o -MD -MP -MF $(DEPDIR)/varnishd-cache_obj.Tpo -c -o varnishd-cache_obj.o `test -f 'cache/cache_obj.c' || echo '$(srcdir)/'`cache/cache_obj.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_obj.Tpo $(DEPDIR)/varnishd-cache_obj.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_obj.c' object='varnishd-cache_obj.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_obj.o `test -f 'cache/cache_obj.c' || echo '$(srcdir)/'`cache/cache_obj.c varnishd-cache_obj.obj: cache/cache_obj.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_obj.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_obj.Tpo -c -o varnishd-cache_obj.obj `if test -f 'cache/cache_obj.c'; then $(CYGPATH_W) 'cache/cache_obj.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_obj.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_obj.Tpo $(DEPDIR)/varnishd-cache_obj.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_obj.c' object='varnishd-cache_obj.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_obj.obj `if test -f 'cache/cache_obj.c'; then $(CYGPATH_W) 'cache/cache_obj.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_obj.c'; fi` varnishd-cache_panic.o: cache/cache_panic.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_panic.o -MD -MP -MF $(DEPDIR)/varnishd-cache_panic.Tpo -c -o varnishd-cache_panic.o `test -f 'cache/cache_panic.c' || echo '$(srcdir)/'`cache/cache_panic.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_panic.Tpo $(DEPDIR)/varnishd-cache_panic.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_panic.c' object='varnishd-cache_panic.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_panic.o `test -f 'cache/cache_panic.c' || echo '$(srcdir)/'`cache/cache_panic.c varnishd-cache_panic.obj: cache/cache_panic.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_panic.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_panic.Tpo -c -o varnishd-cache_panic.obj `if test -f 'cache/cache_panic.c'; then $(CYGPATH_W) 'cache/cache_panic.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_panic.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_panic.Tpo $(DEPDIR)/varnishd-cache_panic.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_panic.c' object='varnishd-cache_panic.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_panic.obj `if test -f 'cache/cache_panic.c'; then $(CYGPATH_W) 'cache/cache_panic.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_panic.c'; fi` varnishd-cache_pool.o: cache/cache_pool.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_pool.o -MD -MP -MF $(DEPDIR)/varnishd-cache_pool.Tpo -c -o varnishd-cache_pool.o `test -f 'cache/cache_pool.c' || echo '$(srcdir)/'`cache/cache_pool.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_pool.Tpo $(DEPDIR)/varnishd-cache_pool.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_pool.c' object='varnishd-cache_pool.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_pool.o `test -f 'cache/cache_pool.c' || echo '$(srcdir)/'`cache/cache_pool.c varnishd-cache_pool.obj: cache/cache_pool.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_pool.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_pool.Tpo -c -o varnishd-cache_pool.obj `if test -f 'cache/cache_pool.c'; then $(CYGPATH_W) 'cache/cache_pool.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_pool.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_pool.Tpo $(DEPDIR)/varnishd-cache_pool.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_pool.c' object='varnishd-cache_pool.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_pool.obj `if test -f 'cache/cache_pool.c'; then $(CYGPATH_W) 'cache/cache_pool.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_pool.c'; fi` varnishd-cache_req.o: cache/cache_req.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_req.o -MD -MP -MF $(DEPDIR)/varnishd-cache_req.Tpo -c -o varnishd-cache_req.o `test -f 'cache/cache_req.c' || echo '$(srcdir)/'`cache/cache_req.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_req.Tpo $(DEPDIR)/varnishd-cache_req.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_req.c' object='varnishd-cache_req.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_req.o `test -f 'cache/cache_req.c' || echo '$(srcdir)/'`cache/cache_req.c varnishd-cache_req.obj: cache/cache_req.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_req.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_req.Tpo -c -o varnishd-cache_req.obj `if test -f 'cache/cache_req.c'; then $(CYGPATH_W) 'cache/cache_req.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_req.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_req.Tpo $(DEPDIR)/varnishd-cache_req.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_req.c' object='varnishd-cache_req.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_req.obj `if test -f 'cache/cache_req.c'; then $(CYGPATH_W) 'cache/cache_req.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_req.c'; fi` varnishd-cache_req_body.o: cache/cache_req_body.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_req_body.o -MD -MP -MF $(DEPDIR)/varnishd-cache_req_body.Tpo -c -o varnishd-cache_req_body.o `test -f 'cache/cache_req_body.c' || echo '$(srcdir)/'`cache/cache_req_body.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_req_body.Tpo $(DEPDIR)/varnishd-cache_req_body.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_req_body.c' object='varnishd-cache_req_body.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_req_body.o `test -f 'cache/cache_req_body.c' || echo '$(srcdir)/'`cache/cache_req_body.c varnishd-cache_req_body.obj: cache/cache_req_body.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_req_body.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_req_body.Tpo -c -o varnishd-cache_req_body.obj `if test -f 'cache/cache_req_body.c'; then $(CYGPATH_W) 'cache/cache_req_body.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_req_body.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_req_body.Tpo $(DEPDIR)/varnishd-cache_req_body.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_req_body.c' object='varnishd-cache_req_body.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_req_body.obj `if test -f 'cache/cache_req_body.c'; then $(CYGPATH_W) 'cache/cache_req_body.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_req_body.c'; fi` varnishd-cache_req_fsm.o: cache/cache_req_fsm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_req_fsm.o -MD -MP -MF $(DEPDIR)/varnishd-cache_req_fsm.Tpo -c -o varnishd-cache_req_fsm.o `test -f 'cache/cache_req_fsm.c' || echo '$(srcdir)/'`cache/cache_req_fsm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_req_fsm.Tpo $(DEPDIR)/varnishd-cache_req_fsm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_req_fsm.c' object='varnishd-cache_req_fsm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_req_fsm.o `test -f 'cache/cache_req_fsm.c' || echo '$(srcdir)/'`cache/cache_req_fsm.c varnishd-cache_req_fsm.obj: cache/cache_req_fsm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_req_fsm.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_req_fsm.Tpo -c -o varnishd-cache_req_fsm.obj `if test -f 'cache/cache_req_fsm.c'; then $(CYGPATH_W) 'cache/cache_req_fsm.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_req_fsm.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_req_fsm.Tpo $(DEPDIR)/varnishd-cache_req_fsm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_req_fsm.c' object='varnishd-cache_req_fsm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_req_fsm.obj `if test -f 'cache/cache_req_fsm.c'; then $(CYGPATH_W) 'cache/cache_req_fsm.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_req_fsm.c'; fi` varnishd-cache_rfc2616.o: cache/cache_rfc2616.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_rfc2616.o -MD -MP -MF $(DEPDIR)/varnishd-cache_rfc2616.Tpo -c -o varnishd-cache_rfc2616.o `test -f 'cache/cache_rfc2616.c' || echo '$(srcdir)/'`cache/cache_rfc2616.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_rfc2616.Tpo $(DEPDIR)/varnishd-cache_rfc2616.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_rfc2616.c' object='varnishd-cache_rfc2616.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_rfc2616.o `test -f 'cache/cache_rfc2616.c' || echo '$(srcdir)/'`cache/cache_rfc2616.c varnishd-cache_rfc2616.obj: cache/cache_rfc2616.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_rfc2616.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_rfc2616.Tpo -c -o varnishd-cache_rfc2616.obj `if test -f 'cache/cache_rfc2616.c'; then $(CYGPATH_W) 'cache/cache_rfc2616.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_rfc2616.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_rfc2616.Tpo $(DEPDIR)/varnishd-cache_rfc2616.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_rfc2616.c' object='varnishd-cache_rfc2616.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_rfc2616.obj `if test -f 'cache/cache_rfc2616.c'; then $(CYGPATH_W) 'cache/cache_rfc2616.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_rfc2616.c'; fi` varnishd-cache_range.o: cache/cache_range.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_range.o -MD -MP -MF $(DEPDIR)/varnishd-cache_range.Tpo -c -o varnishd-cache_range.o `test -f 'cache/cache_range.c' || echo '$(srcdir)/'`cache/cache_range.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_range.Tpo $(DEPDIR)/varnishd-cache_range.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_range.c' object='varnishd-cache_range.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_range.o `test -f 'cache/cache_range.c' || echo '$(srcdir)/'`cache/cache_range.c varnishd-cache_range.obj: cache/cache_range.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_range.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_range.Tpo -c -o varnishd-cache_range.obj `if test -f 'cache/cache_range.c'; then $(CYGPATH_W) 'cache/cache_range.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_range.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_range.Tpo $(DEPDIR)/varnishd-cache_range.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_range.c' object='varnishd-cache_range.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_range.obj `if test -f 'cache/cache_range.c'; then $(CYGPATH_W) 'cache/cache_range.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_range.c'; fi` varnishd-cache_session.o: cache/cache_session.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_session.o -MD -MP -MF $(DEPDIR)/varnishd-cache_session.Tpo -c -o varnishd-cache_session.o `test -f 'cache/cache_session.c' || echo '$(srcdir)/'`cache/cache_session.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_session.Tpo $(DEPDIR)/varnishd-cache_session.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_session.c' object='varnishd-cache_session.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_session.o `test -f 'cache/cache_session.c' || echo '$(srcdir)/'`cache/cache_session.c varnishd-cache_session.obj: cache/cache_session.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_session.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_session.Tpo -c -o varnishd-cache_session.obj `if test -f 'cache/cache_session.c'; then $(CYGPATH_W) 'cache/cache_session.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_session.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_session.Tpo $(DEPDIR)/varnishd-cache_session.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_session.c' object='varnishd-cache_session.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_session.obj `if test -f 'cache/cache_session.c'; then $(CYGPATH_W) 'cache/cache_session.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_session.c'; fi` varnishd-cache_shmlog.o: cache/cache_shmlog.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_shmlog.o -MD -MP -MF $(DEPDIR)/varnishd-cache_shmlog.Tpo -c -o varnishd-cache_shmlog.o `test -f 'cache/cache_shmlog.c' || echo '$(srcdir)/'`cache/cache_shmlog.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_shmlog.Tpo $(DEPDIR)/varnishd-cache_shmlog.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_shmlog.c' object='varnishd-cache_shmlog.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_shmlog.o `test -f 'cache/cache_shmlog.c' || echo '$(srcdir)/'`cache/cache_shmlog.c varnishd-cache_shmlog.obj: cache/cache_shmlog.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_shmlog.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_shmlog.Tpo -c -o varnishd-cache_shmlog.obj `if test -f 'cache/cache_shmlog.c'; then $(CYGPATH_W) 'cache/cache_shmlog.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_shmlog.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_shmlog.Tpo $(DEPDIR)/varnishd-cache_shmlog.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_shmlog.c' object='varnishd-cache_shmlog.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_shmlog.obj `if test -f 'cache/cache_shmlog.c'; then $(CYGPATH_W) 'cache/cache_shmlog.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_shmlog.c'; fi` varnishd-cache_vary.o: cache/cache_vary.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vary.o -MD -MP -MF $(DEPDIR)/varnishd-cache_vary.Tpo -c -o varnishd-cache_vary.o `test -f 'cache/cache_vary.c' || echo '$(srcdir)/'`cache/cache_vary.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vary.Tpo $(DEPDIR)/varnishd-cache_vary.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vary.c' object='varnishd-cache_vary.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vary.o `test -f 'cache/cache_vary.c' || echo '$(srcdir)/'`cache/cache_vary.c varnishd-cache_vary.obj: cache/cache_vary.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vary.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_vary.Tpo -c -o varnishd-cache_vary.obj `if test -f 'cache/cache_vary.c'; then $(CYGPATH_W) 'cache/cache_vary.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vary.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vary.Tpo $(DEPDIR)/varnishd-cache_vary.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vary.c' object='varnishd-cache_vary.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vary.obj `if test -f 'cache/cache_vary.c'; then $(CYGPATH_W) 'cache/cache_vary.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vary.c'; fi` varnishd-cache_vcl.o: cache/cache_vcl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vcl.o -MD -MP -MF $(DEPDIR)/varnishd-cache_vcl.Tpo -c -o varnishd-cache_vcl.o `test -f 'cache/cache_vcl.c' || echo '$(srcdir)/'`cache/cache_vcl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vcl.Tpo $(DEPDIR)/varnishd-cache_vcl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vcl.c' object='varnishd-cache_vcl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vcl.o `test -f 'cache/cache_vcl.c' || echo '$(srcdir)/'`cache/cache_vcl.c varnishd-cache_vcl.obj: cache/cache_vcl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vcl.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_vcl.Tpo -c -o varnishd-cache_vcl.obj `if test -f 'cache/cache_vcl.c'; then $(CYGPATH_W) 'cache/cache_vcl.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vcl.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vcl.Tpo $(DEPDIR)/varnishd-cache_vcl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vcl.c' object='varnishd-cache_vcl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vcl.obj `if test -f 'cache/cache_vcl.c'; then $(CYGPATH_W) 'cache/cache_vcl.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vcl.c'; fi` varnishd-cache_vrt.o: cache/cache_vrt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vrt.o -MD -MP -MF $(DEPDIR)/varnishd-cache_vrt.Tpo -c -o varnishd-cache_vrt.o `test -f 'cache/cache_vrt.c' || echo '$(srcdir)/'`cache/cache_vrt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vrt.Tpo $(DEPDIR)/varnishd-cache_vrt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vrt.c' object='varnishd-cache_vrt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vrt.o `test -f 'cache/cache_vrt.c' || echo '$(srcdir)/'`cache/cache_vrt.c varnishd-cache_vrt.obj: cache/cache_vrt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vrt.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_vrt.Tpo -c -o varnishd-cache_vrt.obj `if test -f 'cache/cache_vrt.c'; then $(CYGPATH_W) 'cache/cache_vrt.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vrt.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vrt.Tpo $(DEPDIR)/varnishd-cache_vrt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vrt.c' object='varnishd-cache_vrt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vrt.obj `if test -f 'cache/cache_vrt.c'; then $(CYGPATH_W) 'cache/cache_vrt.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vrt.c'; fi` varnishd-cache_vrt_priv.o: cache/cache_vrt_priv.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vrt_priv.o -MD -MP -MF $(DEPDIR)/varnishd-cache_vrt_priv.Tpo -c -o varnishd-cache_vrt_priv.o `test -f 'cache/cache_vrt_priv.c' || echo '$(srcdir)/'`cache/cache_vrt_priv.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vrt_priv.Tpo $(DEPDIR)/varnishd-cache_vrt_priv.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vrt_priv.c' object='varnishd-cache_vrt_priv.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vrt_priv.o `test -f 'cache/cache_vrt_priv.c' || echo '$(srcdir)/'`cache/cache_vrt_priv.c varnishd-cache_vrt_priv.obj: cache/cache_vrt_priv.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vrt_priv.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_vrt_priv.Tpo -c -o varnishd-cache_vrt_priv.obj `if test -f 'cache/cache_vrt_priv.c'; then $(CYGPATH_W) 'cache/cache_vrt_priv.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vrt_priv.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vrt_priv.Tpo $(DEPDIR)/varnishd-cache_vrt_priv.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vrt_priv.c' object='varnishd-cache_vrt_priv.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vrt_priv.obj `if test -f 'cache/cache_vrt_priv.c'; then $(CYGPATH_W) 'cache/cache_vrt_priv.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vrt_priv.c'; fi` varnishd-cache_vrt_re.o: cache/cache_vrt_re.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vrt_re.o -MD -MP -MF $(DEPDIR)/varnishd-cache_vrt_re.Tpo -c -o varnishd-cache_vrt_re.o `test -f 'cache/cache_vrt_re.c' || echo '$(srcdir)/'`cache/cache_vrt_re.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vrt_re.Tpo $(DEPDIR)/varnishd-cache_vrt_re.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vrt_re.c' object='varnishd-cache_vrt_re.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vrt_re.o `test -f 'cache/cache_vrt_re.c' || echo '$(srcdir)/'`cache/cache_vrt_re.c varnishd-cache_vrt_re.obj: cache/cache_vrt_re.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vrt_re.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_vrt_re.Tpo -c -o varnishd-cache_vrt_re.obj `if test -f 'cache/cache_vrt_re.c'; then $(CYGPATH_W) 'cache/cache_vrt_re.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vrt_re.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vrt_re.Tpo $(DEPDIR)/varnishd-cache_vrt_re.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vrt_re.c' object='varnishd-cache_vrt_re.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vrt_re.obj `if test -f 'cache/cache_vrt_re.c'; then $(CYGPATH_W) 'cache/cache_vrt_re.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vrt_re.c'; fi` varnishd-cache_vrt_var.o: cache/cache_vrt_var.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vrt_var.o -MD -MP -MF $(DEPDIR)/varnishd-cache_vrt_var.Tpo -c -o varnishd-cache_vrt_var.o `test -f 'cache/cache_vrt_var.c' || echo '$(srcdir)/'`cache/cache_vrt_var.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vrt_var.Tpo $(DEPDIR)/varnishd-cache_vrt_var.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vrt_var.c' object='varnishd-cache_vrt_var.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vrt_var.o `test -f 'cache/cache_vrt_var.c' || echo '$(srcdir)/'`cache/cache_vrt_var.c varnishd-cache_vrt_var.obj: cache/cache_vrt_var.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vrt_var.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_vrt_var.Tpo -c -o varnishd-cache_vrt_var.obj `if test -f 'cache/cache_vrt_var.c'; then $(CYGPATH_W) 'cache/cache_vrt_var.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vrt_var.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vrt_var.Tpo $(DEPDIR)/varnishd-cache_vrt_var.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vrt_var.c' object='varnishd-cache_vrt_var.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vrt_var.obj `if test -f 'cache/cache_vrt_var.c'; then $(CYGPATH_W) 'cache/cache_vrt_var.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vrt_var.c'; fi` varnishd-cache_vrt_vmod.o: cache/cache_vrt_vmod.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vrt_vmod.o -MD -MP -MF $(DEPDIR)/varnishd-cache_vrt_vmod.Tpo -c -o varnishd-cache_vrt_vmod.o `test -f 'cache/cache_vrt_vmod.c' || echo '$(srcdir)/'`cache/cache_vrt_vmod.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vrt_vmod.Tpo $(DEPDIR)/varnishd-cache_vrt_vmod.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vrt_vmod.c' object='varnishd-cache_vrt_vmod.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vrt_vmod.o `test -f 'cache/cache_vrt_vmod.c' || echo '$(srcdir)/'`cache/cache_vrt_vmod.c varnishd-cache_vrt_vmod.obj: cache/cache_vrt_vmod.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_vrt_vmod.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_vrt_vmod.Tpo -c -o varnishd-cache_vrt_vmod.obj `if test -f 'cache/cache_vrt_vmod.c'; then $(CYGPATH_W) 'cache/cache_vrt_vmod.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vrt_vmod.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_vrt_vmod.Tpo $(DEPDIR)/varnishd-cache_vrt_vmod.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_vrt_vmod.c' object='varnishd-cache_vrt_vmod.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_vrt_vmod.obj `if test -f 'cache/cache_vrt_vmod.c'; then $(CYGPATH_W) 'cache/cache_vrt_vmod.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_vrt_vmod.c'; fi` varnishd-cache_wrk.o: cache/cache_wrk.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_wrk.o -MD -MP -MF $(DEPDIR)/varnishd-cache_wrk.Tpo -c -o varnishd-cache_wrk.o `test -f 'cache/cache_wrk.c' || echo '$(srcdir)/'`cache/cache_wrk.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_wrk.Tpo $(DEPDIR)/varnishd-cache_wrk.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_wrk.c' object='varnishd-cache_wrk.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_wrk.o `test -f 'cache/cache_wrk.c' || echo '$(srcdir)/'`cache/cache_wrk.c varnishd-cache_wrk.obj: cache/cache_wrk.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_wrk.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_wrk.Tpo -c -o varnishd-cache_wrk.obj `if test -f 'cache/cache_wrk.c'; then $(CYGPATH_W) 'cache/cache_wrk.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_wrk.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_wrk.Tpo $(DEPDIR)/varnishd-cache_wrk.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_wrk.c' object='varnishd-cache_wrk.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_wrk.obj `if test -f 'cache/cache_wrk.c'; then $(CYGPATH_W) 'cache/cache_wrk.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_wrk.c'; fi` varnishd-cache_ws.o: cache/cache_ws.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_ws.o -MD -MP -MF $(DEPDIR)/varnishd-cache_ws.Tpo -c -o varnishd-cache_ws.o `test -f 'cache/cache_ws.c' || echo '$(srcdir)/'`cache/cache_ws.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_ws.Tpo $(DEPDIR)/varnishd-cache_ws.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_ws.c' object='varnishd-cache_ws.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_ws.o `test -f 'cache/cache_ws.c' || echo '$(srcdir)/'`cache/cache_ws.c varnishd-cache_ws.obj: cache/cache_ws.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_ws.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_ws.Tpo -c -o varnishd-cache_ws.obj `if test -f 'cache/cache_ws.c'; then $(CYGPATH_W) 'cache/cache_ws.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_ws.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_ws.Tpo $(DEPDIR)/varnishd-cache_ws.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache/cache_ws.c' object='varnishd-cache_ws.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_ws.obj `if test -f 'cache/cache_ws.c'; then $(CYGPATH_W) 'cache/cache_ws.c'; else $(CYGPATH_W) '$(srcdir)/cache/cache_ws.c'; fi` varnishd-common_vsm.o: common/common_vsm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-common_vsm.o -MD -MP -MF $(DEPDIR)/varnishd-common_vsm.Tpo -c -o varnishd-common_vsm.o `test -f 'common/common_vsm.c' || echo '$(srcdir)/'`common/common_vsm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-common_vsm.Tpo $(DEPDIR)/varnishd-common_vsm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common/common_vsm.c' object='varnishd-common_vsm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-common_vsm.o `test -f 'common/common_vsm.c' || echo '$(srcdir)/'`common/common_vsm.c varnishd-common_vsm.obj: common/common_vsm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-common_vsm.obj -MD -MP -MF $(DEPDIR)/varnishd-common_vsm.Tpo -c -o varnishd-common_vsm.obj `if test -f 'common/common_vsm.c'; then $(CYGPATH_W) 'common/common_vsm.c'; else $(CYGPATH_W) '$(srcdir)/common/common_vsm.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-common_vsm.Tpo $(DEPDIR)/varnishd-common_vsm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common/common_vsm.c' object='varnishd-common_vsm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-common_vsm.obj `if test -f 'common/common_vsm.c'; then $(CYGPATH_W) 'common/common_vsm.c'; else $(CYGPATH_W) '$(srcdir)/common/common_vsm.c'; fi` varnishd-common_vsc.o: common/common_vsc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-common_vsc.o -MD -MP -MF $(DEPDIR)/varnishd-common_vsc.Tpo -c -o varnishd-common_vsc.o `test -f 'common/common_vsc.c' || echo '$(srcdir)/'`common/common_vsc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-common_vsc.Tpo $(DEPDIR)/varnishd-common_vsc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common/common_vsc.c' object='varnishd-common_vsc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-common_vsc.o `test -f 'common/common_vsc.c' || echo '$(srcdir)/'`common/common_vsc.c varnishd-common_vsc.obj: common/common_vsc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-common_vsc.obj -MD -MP -MF $(DEPDIR)/varnishd-common_vsc.Tpo -c -o varnishd-common_vsc.obj `if test -f 'common/common_vsc.c'; then $(CYGPATH_W) 'common/common_vsc.c'; else $(CYGPATH_W) '$(srcdir)/common/common_vsc.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-common_vsc.Tpo $(DEPDIR)/varnishd-common_vsc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common/common_vsc.c' object='varnishd-common_vsc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-common_vsc.obj `if test -f 'common/common_vsc.c'; then $(CYGPATH_W) 'common/common_vsc.c'; else $(CYGPATH_W) '$(srcdir)/common/common_vsc.c'; fi` varnishd-hash_classic.o: hash/hash_classic.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-hash_classic.o -MD -MP -MF $(DEPDIR)/varnishd-hash_classic.Tpo -c -o varnishd-hash_classic.o `test -f 'hash/hash_classic.c' || echo '$(srcdir)/'`hash/hash_classic.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-hash_classic.Tpo $(DEPDIR)/varnishd-hash_classic.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hash/hash_classic.c' object='varnishd-hash_classic.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-hash_classic.o `test -f 'hash/hash_classic.c' || echo '$(srcdir)/'`hash/hash_classic.c varnishd-hash_classic.obj: hash/hash_classic.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-hash_classic.obj -MD -MP -MF $(DEPDIR)/varnishd-hash_classic.Tpo -c -o varnishd-hash_classic.obj `if test -f 'hash/hash_classic.c'; then $(CYGPATH_W) 'hash/hash_classic.c'; else $(CYGPATH_W) '$(srcdir)/hash/hash_classic.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-hash_classic.Tpo $(DEPDIR)/varnishd-hash_classic.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hash/hash_classic.c' object='varnishd-hash_classic.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-hash_classic.obj `if test -f 'hash/hash_classic.c'; then $(CYGPATH_W) 'hash/hash_classic.c'; else $(CYGPATH_W) '$(srcdir)/hash/hash_classic.c'; fi` varnishd-hash_critbit.o: hash/hash_critbit.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-hash_critbit.o -MD -MP -MF $(DEPDIR)/varnishd-hash_critbit.Tpo -c -o varnishd-hash_critbit.o `test -f 'hash/hash_critbit.c' || echo '$(srcdir)/'`hash/hash_critbit.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-hash_critbit.Tpo $(DEPDIR)/varnishd-hash_critbit.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hash/hash_critbit.c' object='varnishd-hash_critbit.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-hash_critbit.o `test -f 'hash/hash_critbit.c' || echo '$(srcdir)/'`hash/hash_critbit.c varnishd-hash_critbit.obj: hash/hash_critbit.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-hash_critbit.obj -MD -MP -MF $(DEPDIR)/varnishd-hash_critbit.Tpo -c -o varnishd-hash_critbit.obj `if test -f 'hash/hash_critbit.c'; then $(CYGPATH_W) 'hash/hash_critbit.c'; else $(CYGPATH_W) '$(srcdir)/hash/hash_critbit.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-hash_critbit.Tpo $(DEPDIR)/varnishd-hash_critbit.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hash/hash_critbit.c' object='varnishd-hash_critbit.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-hash_critbit.obj `if test -f 'hash/hash_critbit.c'; then $(CYGPATH_W) 'hash/hash_critbit.c'; else $(CYGPATH_W) '$(srcdir)/hash/hash_critbit.c'; fi` varnishd-mgt_hash.o: hash/mgt_hash.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_hash.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_hash.Tpo -c -o varnishd-mgt_hash.o `test -f 'hash/mgt_hash.c' || echo '$(srcdir)/'`hash/mgt_hash.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_hash.Tpo $(DEPDIR)/varnishd-mgt_hash.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hash/mgt_hash.c' object='varnishd-mgt_hash.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_hash.o `test -f 'hash/mgt_hash.c' || echo '$(srcdir)/'`hash/mgt_hash.c varnishd-mgt_hash.obj: hash/mgt_hash.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_hash.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_hash.Tpo -c -o varnishd-mgt_hash.obj `if test -f 'hash/mgt_hash.c'; then $(CYGPATH_W) 'hash/mgt_hash.c'; else $(CYGPATH_W) '$(srcdir)/hash/mgt_hash.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_hash.Tpo $(DEPDIR)/varnishd-mgt_hash.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hash/mgt_hash.c' object='varnishd-mgt_hash.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_hash.obj `if test -f 'hash/mgt_hash.c'; then $(CYGPATH_W) 'hash/mgt_hash.c'; else $(CYGPATH_W) '$(srcdir)/hash/mgt_hash.c'; fi` varnishd-hash_simple_list.o: hash/hash_simple_list.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-hash_simple_list.o -MD -MP -MF $(DEPDIR)/varnishd-hash_simple_list.Tpo -c -o varnishd-hash_simple_list.o `test -f 'hash/hash_simple_list.c' || echo '$(srcdir)/'`hash/hash_simple_list.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-hash_simple_list.Tpo $(DEPDIR)/varnishd-hash_simple_list.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hash/hash_simple_list.c' object='varnishd-hash_simple_list.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-hash_simple_list.o `test -f 'hash/hash_simple_list.c' || echo '$(srcdir)/'`hash/hash_simple_list.c varnishd-hash_simple_list.obj: hash/hash_simple_list.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-hash_simple_list.obj -MD -MP -MF $(DEPDIR)/varnishd-hash_simple_list.Tpo -c -o varnishd-hash_simple_list.obj `if test -f 'hash/hash_simple_list.c'; then $(CYGPATH_W) 'hash/hash_simple_list.c'; else $(CYGPATH_W) '$(srcdir)/hash/hash_simple_list.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-hash_simple_list.Tpo $(DEPDIR)/varnishd-hash_simple_list.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hash/hash_simple_list.c' object='varnishd-hash_simple_list.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-hash_simple_list.obj `if test -f 'hash/hash_simple_list.c'; then $(CYGPATH_W) 'hash/hash_simple_list.c'; else $(CYGPATH_W) '$(srcdir)/hash/hash_simple_list.c'; fi` varnishd-cache_http1_deliver.o: http1/cache_http1_deliver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_deliver.o -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_deliver.Tpo -c -o varnishd-cache_http1_deliver.o `test -f 'http1/cache_http1_deliver.c' || echo '$(srcdir)/'`http1/cache_http1_deliver.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_deliver.Tpo $(DEPDIR)/varnishd-cache_http1_deliver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_deliver.c' object='varnishd-cache_http1_deliver.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_deliver.o `test -f 'http1/cache_http1_deliver.c' || echo '$(srcdir)/'`http1/cache_http1_deliver.c varnishd-cache_http1_deliver.obj: http1/cache_http1_deliver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_deliver.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_deliver.Tpo -c -o varnishd-cache_http1_deliver.obj `if test -f 'http1/cache_http1_deliver.c'; then $(CYGPATH_W) 'http1/cache_http1_deliver.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_deliver.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_deliver.Tpo $(DEPDIR)/varnishd-cache_http1_deliver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_deliver.c' object='varnishd-cache_http1_deliver.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_deliver.obj `if test -f 'http1/cache_http1_deliver.c'; then $(CYGPATH_W) 'http1/cache_http1_deliver.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_deliver.c'; fi` varnishd-cache_http1_fetch.o: http1/cache_http1_fetch.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_fetch.o -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_fetch.Tpo -c -o varnishd-cache_http1_fetch.o `test -f 'http1/cache_http1_fetch.c' || echo '$(srcdir)/'`http1/cache_http1_fetch.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_fetch.Tpo $(DEPDIR)/varnishd-cache_http1_fetch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_fetch.c' object='varnishd-cache_http1_fetch.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_fetch.o `test -f 'http1/cache_http1_fetch.c' || echo '$(srcdir)/'`http1/cache_http1_fetch.c varnishd-cache_http1_fetch.obj: http1/cache_http1_fetch.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_fetch.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_fetch.Tpo -c -o varnishd-cache_http1_fetch.obj `if test -f 'http1/cache_http1_fetch.c'; then $(CYGPATH_W) 'http1/cache_http1_fetch.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_fetch.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_fetch.Tpo $(DEPDIR)/varnishd-cache_http1_fetch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_fetch.c' object='varnishd-cache_http1_fetch.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_fetch.obj `if test -f 'http1/cache_http1_fetch.c'; then $(CYGPATH_W) 'http1/cache_http1_fetch.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_fetch.c'; fi` varnishd-cache_http1_fsm.o: http1/cache_http1_fsm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_fsm.o -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_fsm.Tpo -c -o varnishd-cache_http1_fsm.o `test -f 'http1/cache_http1_fsm.c' || echo '$(srcdir)/'`http1/cache_http1_fsm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_fsm.Tpo $(DEPDIR)/varnishd-cache_http1_fsm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_fsm.c' object='varnishd-cache_http1_fsm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_fsm.o `test -f 'http1/cache_http1_fsm.c' || echo '$(srcdir)/'`http1/cache_http1_fsm.c varnishd-cache_http1_fsm.obj: http1/cache_http1_fsm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_fsm.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_fsm.Tpo -c -o varnishd-cache_http1_fsm.obj `if test -f 'http1/cache_http1_fsm.c'; then $(CYGPATH_W) 'http1/cache_http1_fsm.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_fsm.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_fsm.Tpo $(DEPDIR)/varnishd-cache_http1_fsm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_fsm.c' object='varnishd-cache_http1_fsm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_fsm.obj `if test -f 'http1/cache_http1_fsm.c'; then $(CYGPATH_W) 'http1/cache_http1_fsm.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_fsm.c'; fi` varnishd-cache_http1_line.o: http1/cache_http1_line.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_line.o -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_line.Tpo -c -o varnishd-cache_http1_line.o `test -f 'http1/cache_http1_line.c' || echo '$(srcdir)/'`http1/cache_http1_line.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_line.Tpo $(DEPDIR)/varnishd-cache_http1_line.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_line.c' object='varnishd-cache_http1_line.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_line.o `test -f 'http1/cache_http1_line.c' || echo '$(srcdir)/'`http1/cache_http1_line.c varnishd-cache_http1_line.obj: http1/cache_http1_line.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_line.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_line.Tpo -c -o varnishd-cache_http1_line.obj `if test -f 'http1/cache_http1_line.c'; then $(CYGPATH_W) 'http1/cache_http1_line.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_line.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_line.Tpo $(DEPDIR)/varnishd-cache_http1_line.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_line.c' object='varnishd-cache_http1_line.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_line.obj `if test -f 'http1/cache_http1_line.c'; then $(CYGPATH_W) 'http1/cache_http1_line.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_line.c'; fi` varnishd-cache_http1_pipe.o: http1/cache_http1_pipe.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_pipe.o -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_pipe.Tpo -c -o varnishd-cache_http1_pipe.o `test -f 'http1/cache_http1_pipe.c' || echo '$(srcdir)/'`http1/cache_http1_pipe.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_pipe.Tpo $(DEPDIR)/varnishd-cache_http1_pipe.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_pipe.c' object='varnishd-cache_http1_pipe.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_pipe.o `test -f 'http1/cache_http1_pipe.c' || echo '$(srcdir)/'`http1/cache_http1_pipe.c varnishd-cache_http1_pipe.obj: http1/cache_http1_pipe.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_pipe.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_pipe.Tpo -c -o varnishd-cache_http1_pipe.obj `if test -f 'http1/cache_http1_pipe.c'; then $(CYGPATH_W) 'http1/cache_http1_pipe.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_pipe.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_pipe.Tpo $(DEPDIR)/varnishd-cache_http1_pipe.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_pipe.c' object='varnishd-cache_http1_pipe.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_pipe.obj `if test -f 'http1/cache_http1_pipe.c'; then $(CYGPATH_W) 'http1/cache_http1_pipe.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_pipe.c'; fi` varnishd-cache_http1_proto.o: http1/cache_http1_proto.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_proto.o -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_proto.Tpo -c -o varnishd-cache_http1_proto.o `test -f 'http1/cache_http1_proto.c' || echo '$(srcdir)/'`http1/cache_http1_proto.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_proto.Tpo $(DEPDIR)/varnishd-cache_http1_proto.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_proto.c' object='varnishd-cache_http1_proto.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_proto.o `test -f 'http1/cache_http1_proto.c' || echo '$(srcdir)/'`http1/cache_http1_proto.c varnishd-cache_http1_proto.obj: http1/cache_http1_proto.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_proto.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_proto.Tpo -c -o varnishd-cache_http1_proto.obj `if test -f 'http1/cache_http1_proto.c'; then $(CYGPATH_W) 'http1/cache_http1_proto.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_proto.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_proto.Tpo $(DEPDIR)/varnishd-cache_http1_proto.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_proto.c' object='varnishd-cache_http1_proto.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_proto.obj `if test -f 'http1/cache_http1_proto.c'; then $(CYGPATH_W) 'http1/cache_http1_proto.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_proto.c'; fi` varnishd-cache_http1_vfp.o: http1/cache_http1_vfp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_vfp.o -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_vfp.Tpo -c -o varnishd-cache_http1_vfp.o `test -f 'http1/cache_http1_vfp.c' || echo '$(srcdir)/'`http1/cache_http1_vfp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_vfp.Tpo $(DEPDIR)/varnishd-cache_http1_vfp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_vfp.c' object='varnishd-cache_http1_vfp.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_vfp.o `test -f 'http1/cache_http1_vfp.c' || echo '$(srcdir)/'`http1/cache_http1_vfp.c varnishd-cache_http1_vfp.obj: http1/cache_http1_vfp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_http1_vfp.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_http1_vfp.Tpo -c -o varnishd-cache_http1_vfp.obj `if test -f 'http1/cache_http1_vfp.c'; then $(CYGPATH_W) 'http1/cache_http1_vfp.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_vfp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_http1_vfp.Tpo $(DEPDIR)/varnishd-cache_http1_vfp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http1/cache_http1_vfp.c' object='varnishd-cache_http1_vfp.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_http1_vfp.obj `if test -f 'http1/cache_http1_vfp.c'; then $(CYGPATH_W) 'http1/cache_http1_vfp.c'; else $(CYGPATH_W) '$(srcdir)/http1/cache_http1_vfp.c'; fi` varnishd-mgt_acceptor.o: mgt/mgt_acceptor.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_acceptor.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_acceptor.Tpo -c -o varnishd-mgt_acceptor.o `test -f 'mgt/mgt_acceptor.c' || echo '$(srcdir)/'`mgt/mgt_acceptor.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_acceptor.Tpo $(DEPDIR)/varnishd-mgt_acceptor.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_acceptor.c' object='varnishd-mgt_acceptor.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_acceptor.o `test -f 'mgt/mgt_acceptor.c' || echo '$(srcdir)/'`mgt/mgt_acceptor.c varnishd-mgt_acceptor.obj: mgt/mgt_acceptor.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_acceptor.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_acceptor.Tpo -c -o varnishd-mgt_acceptor.obj `if test -f 'mgt/mgt_acceptor.c'; then $(CYGPATH_W) 'mgt/mgt_acceptor.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_acceptor.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_acceptor.Tpo $(DEPDIR)/varnishd-mgt_acceptor.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_acceptor.c' object='varnishd-mgt_acceptor.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_acceptor.obj `if test -f 'mgt/mgt_acceptor.c'; then $(CYGPATH_W) 'mgt/mgt_acceptor.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_acceptor.c'; fi` varnishd-mgt_child.o: mgt/mgt_child.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_child.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_child.Tpo -c -o varnishd-mgt_child.o `test -f 'mgt/mgt_child.c' || echo '$(srcdir)/'`mgt/mgt_child.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_child.Tpo $(DEPDIR)/varnishd-mgt_child.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_child.c' object='varnishd-mgt_child.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_child.o `test -f 'mgt/mgt_child.c' || echo '$(srcdir)/'`mgt/mgt_child.c varnishd-mgt_child.obj: mgt/mgt_child.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_child.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_child.Tpo -c -o varnishd-mgt_child.obj `if test -f 'mgt/mgt_child.c'; then $(CYGPATH_W) 'mgt/mgt_child.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_child.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_child.Tpo $(DEPDIR)/varnishd-mgt_child.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_child.c' object='varnishd-mgt_child.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_child.obj `if test -f 'mgt/mgt_child.c'; then $(CYGPATH_W) 'mgt/mgt_child.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_child.c'; fi` varnishd-mgt_cli.o: mgt/mgt_cli.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_cli.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_cli.Tpo -c -o varnishd-mgt_cli.o `test -f 'mgt/mgt_cli.c' || echo '$(srcdir)/'`mgt/mgt_cli.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_cli.Tpo $(DEPDIR)/varnishd-mgt_cli.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_cli.c' object='varnishd-mgt_cli.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_cli.o `test -f 'mgt/mgt_cli.c' || echo '$(srcdir)/'`mgt/mgt_cli.c varnishd-mgt_cli.obj: mgt/mgt_cli.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_cli.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_cli.Tpo -c -o varnishd-mgt_cli.obj `if test -f 'mgt/mgt_cli.c'; then $(CYGPATH_W) 'mgt/mgt_cli.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_cli.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_cli.Tpo $(DEPDIR)/varnishd-mgt_cli.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_cli.c' object='varnishd-mgt_cli.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_cli.obj `if test -f 'mgt/mgt_cli.c'; then $(CYGPATH_W) 'mgt/mgt_cli.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_cli.c'; fi` varnishd-mgt_jail.o: mgt/mgt_jail.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_jail.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_jail.Tpo -c -o varnishd-mgt_jail.o `test -f 'mgt/mgt_jail.c' || echo '$(srcdir)/'`mgt/mgt_jail.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_jail.Tpo $(DEPDIR)/varnishd-mgt_jail.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_jail.c' object='varnishd-mgt_jail.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_jail.o `test -f 'mgt/mgt_jail.c' || echo '$(srcdir)/'`mgt/mgt_jail.c varnishd-mgt_jail.obj: mgt/mgt_jail.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_jail.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_jail.Tpo -c -o varnishd-mgt_jail.obj `if test -f 'mgt/mgt_jail.c'; then $(CYGPATH_W) 'mgt/mgt_jail.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_jail.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_jail.Tpo $(DEPDIR)/varnishd-mgt_jail.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_jail.c' object='varnishd-mgt_jail.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_jail.obj `if test -f 'mgt/mgt_jail.c'; then $(CYGPATH_W) 'mgt/mgt_jail.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_jail.c'; fi` varnishd-mgt_jail_unix.o: mgt/mgt_jail_unix.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_jail_unix.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_jail_unix.Tpo -c -o varnishd-mgt_jail_unix.o `test -f 'mgt/mgt_jail_unix.c' || echo '$(srcdir)/'`mgt/mgt_jail_unix.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_jail_unix.Tpo $(DEPDIR)/varnishd-mgt_jail_unix.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_jail_unix.c' object='varnishd-mgt_jail_unix.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_jail_unix.o `test -f 'mgt/mgt_jail_unix.c' || echo '$(srcdir)/'`mgt/mgt_jail_unix.c varnishd-mgt_jail_unix.obj: mgt/mgt_jail_unix.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_jail_unix.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_jail_unix.Tpo -c -o varnishd-mgt_jail_unix.obj `if test -f 'mgt/mgt_jail_unix.c'; then $(CYGPATH_W) 'mgt/mgt_jail_unix.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_jail_unix.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_jail_unix.Tpo $(DEPDIR)/varnishd-mgt_jail_unix.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_jail_unix.c' object='varnishd-mgt_jail_unix.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_jail_unix.obj `if test -f 'mgt/mgt_jail_unix.c'; then $(CYGPATH_W) 'mgt/mgt_jail_unix.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_jail_unix.c'; fi` varnishd-mgt_jail_solaris.o: mgt/mgt_jail_solaris.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_jail_solaris.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_jail_solaris.Tpo -c -o varnishd-mgt_jail_solaris.o `test -f 'mgt/mgt_jail_solaris.c' || echo '$(srcdir)/'`mgt/mgt_jail_solaris.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_jail_solaris.Tpo $(DEPDIR)/varnishd-mgt_jail_solaris.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_jail_solaris.c' object='varnishd-mgt_jail_solaris.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_jail_solaris.o `test -f 'mgt/mgt_jail_solaris.c' || echo '$(srcdir)/'`mgt/mgt_jail_solaris.c varnishd-mgt_jail_solaris.obj: mgt/mgt_jail_solaris.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_jail_solaris.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_jail_solaris.Tpo -c -o varnishd-mgt_jail_solaris.obj `if test -f 'mgt/mgt_jail_solaris.c'; then $(CYGPATH_W) 'mgt/mgt_jail_solaris.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_jail_solaris.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_jail_solaris.Tpo $(DEPDIR)/varnishd-mgt_jail_solaris.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_jail_solaris.c' object='varnishd-mgt_jail_solaris.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_jail_solaris.obj `if test -f 'mgt/mgt_jail_solaris.c'; then $(CYGPATH_W) 'mgt/mgt_jail_solaris.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_jail_solaris.c'; fi` varnishd-mgt_main.o: mgt/mgt_main.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_main.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_main.Tpo -c -o varnishd-mgt_main.o `test -f 'mgt/mgt_main.c' || echo '$(srcdir)/'`mgt/mgt_main.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_main.Tpo $(DEPDIR)/varnishd-mgt_main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_main.c' object='varnishd-mgt_main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_main.o `test -f 'mgt/mgt_main.c' || echo '$(srcdir)/'`mgt/mgt_main.c varnishd-mgt_main.obj: mgt/mgt_main.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_main.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_main.Tpo -c -o varnishd-mgt_main.obj `if test -f 'mgt/mgt_main.c'; then $(CYGPATH_W) 'mgt/mgt_main.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_main.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_main.Tpo $(DEPDIR)/varnishd-mgt_main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_main.c' object='varnishd-mgt_main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_main.obj `if test -f 'mgt/mgt_main.c'; then $(CYGPATH_W) 'mgt/mgt_main.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_main.c'; fi` varnishd-mgt_param.o: mgt/mgt_param.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_param.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_param.Tpo -c -o varnishd-mgt_param.o `test -f 'mgt/mgt_param.c' || echo '$(srcdir)/'`mgt/mgt_param.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_param.Tpo $(DEPDIR)/varnishd-mgt_param.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_param.c' object='varnishd-mgt_param.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_param.o `test -f 'mgt/mgt_param.c' || echo '$(srcdir)/'`mgt/mgt_param.c varnishd-mgt_param.obj: mgt/mgt_param.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_param.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_param.Tpo -c -o varnishd-mgt_param.obj `if test -f 'mgt/mgt_param.c'; then $(CYGPATH_W) 'mgt/mgt_param.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_param.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_param.Tpo $(DEPDIR)/varnishd-mgt_param.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_param.c' object='varnishd-mgt_param.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_param.obj `if test -f 'mgt/mgt_param.c'; then $(CYGPATH_W) 'mgt/mgt_param.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_param.c'; fi` varnishd-mgt_param_tbl.o: mgt/mgt_param_tbl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_param_tbl.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_param_tbl.Tpo -c -o varnishd-mgt_param_tbl.o `test -f 'mgt/mgt_param_tbl.c' || echo '$(srcdir)/'`mgt/mgt_param_tbl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_param_tbl.Tpo $(DEPDIR)/varnishd-mgt_param_tbl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_param_tbl.c' object='varnishd-mgt_param_tbl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_param_tbl.o `test -f 'mgt/mgt_param_tbl.c' || echo '$(srcdir)/'`mgt/mgt_param_tbl.c varnishd-mgt_param_tbl.obj: mgt/mgt_param_tbl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_param_tbl.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_param_tbl.Tpo -c -o varnishd-mgt_param_tbl.obj `if test -f 'mgt/mgt_param_tbl.c'; then $(CYGPATH_W) 'mgt/mgt_param_tbl.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_param_tbl.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_param_tbl.Tpo $(DEPDIR)/varnishd-mgt_param_tbl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_param_tbl.c' object='varnishd-mgt_param_tbl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_param_tbl.obj `if test -f 'mgt/mgt_param_tbl.c'; then $(CYGPATH_W) 'mgt/mgt_param_tbl.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_param_tbl.c'; fi` varnishd-mgt_param_bits.o: mgt/mgt_param_bits.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_param_bits.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_param_bits.Tpo -c -o varnishd-mgt_param_bits.o `test -f 'mgt/mgt_param_bits.c' || echo '$(srcdir)/'`mgt/mgt_param_bits.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_param_bits.Tpo $(DEPDIR)/varnishd-mgt_param_bits.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_param_bits.c' object='varnishd-mgt_param_bits.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_param_bits.o `test -f 'mgt/mgt_param_bits.c' || echo '$(srcdir)/'`mgt/mgt_param_bits.c varnishd-mgt_param_bits.obj: mgt/mgt_param_bits.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_param_bits.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_param_bits.Tpo -c -o varnishd-mgt_param_bits.obj `if test -f 'mgt/mgt_param_bits.c'; then $(CYGPATH_W) 'mgt/mgt_param_bits.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_param_bits.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_param_bits.Tpo $(DEPDIR)/varnishd-mgt_param_bits.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_param_bits.c' object='varnishd-mgt_param_bits.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_param_bits.obj `if test -f 'mgt/mgt_param_bits.c'; then $(CYGPATH_W) 'mgt/mgt_param_bits.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_param_bits.c'; fi` varnishd-mgt_param_tcp.o: mgt/mgt_param_tcp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_param_tcp.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_param_tcp.Tpo -c -o varnishd-mgt_param_tcp.o `test -f 'mgt/mgt_param_tcp.c' || echo '$(srcdir)/'`mgt/mgt_param_tcp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_param_tcp.Tpo $(DEPDIR)/varnishd-mgt_param_tcp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_param_tcp.c' object='varnishd-mgt_param_tcp.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_param_tcp.o `test -f 'mgt/mgt_param_tcp.c' || echo '$(srcdir)/'`mgt/mgt_param_tcp.c varnishd-mgt_param_tcp.obj: mgt/mgt_param_tcp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_param_tcp.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_param_tcp.Tpo -c -o varnishd-mgt_param_tcp.obj `if test -f 'mgt/mgt_param_tcp.c'; then $(CYGPATH_W) 'mgt/mgt_param_tcp.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_param_tcp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_param_tcp.Tpo $(DEPDIR)/varnishd-mgt_param_tcp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_param_tcp.c' object='varnishd-mgt_param_tcp.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_param_tcp.obj `if test -f 'mgt/mgt_param_tcp.c'; then $(CYGPATH_W) 'mgt/mgt_param_tcp.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_param_tcp.c'; fi` varnishd-mgt_param_tweak.o: mgt/mgt_param_tweak.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_param_tweak.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_param_tweak.Tpo -c -o varnishd-mgt_param_tweak.o `test -f 'mgt/mgt_param_tweak.c' || echo '$(srcdir)/'`mgt/mgt_param_tweak.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_param_tweak.Tpo $(DEPDIR)/varnishd-mgt_param_tweak.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_param_tweak.c' object='varnishd-mgt_param_tweak.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_param_tweak.o `test -f 'mgt/mgt_param_tweak.c' || echo '$(srcdir)/'`mgt/mgt_param_tweak.c varnishd-mgt_param_tweak.obj: mgt/mgt_param_tweak.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_param_tweak.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_param_tweak.Tpo -c -o varnishd-mgt_param_tweak.obj `if test -f 'mgt/mgt_param_tweak.c'; then $(CYGPATH_W) 'mgt/mgt_param_tweak.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_param_tweak.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_param_tweak.Tpo $(DEPDIR)/varnishd-mgt_param_tweak.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_param_tweak.c' object='varnishd-mgt_param_tweak.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_param_tweak.obj `if test -f 'mgt/mgt_param_tweak.c'; then $(CYGPATH_W) 'mgt/mgt_param_tweak.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_param_tweak.c'; fi` varnishd-mgt_pool.o: mgt/mgt_pool.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_pool.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_pool.Tpo -c -o varnishd-mgt_pool.o `test -f 'mgt/mgt_pool.c' || echo '$(srcdir)/'`mgt/mgt_pool.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_pool.Tpo $(DEPDIR)/varnishd-mgt_pool.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_pool.c' object='varnishd-mgt_pool.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_pool.o `test -f 'mgt/mgt_pool.c' || echo '$(srcdir)/'`mgt/mgt_pool.c varnishd-mgt_pool.obj: mgt/mgt_pool.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_pool.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_pool.Tpo -c -o varnishd-mgt_pool.obj `if test -f 'mgt/mgt_pool.c'; then $(CYGPATH_W) 'mgt/mgt_pool.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_pool.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_pool.Tpo $(DEPDIR)/varnishd-mgt_pool.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_pool.c' object='varnishd-mgt_pool.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_pool.obj `if test -f 'mgt/mgt_pool.c'; then $(CYGPATH_W) 'mgt/mgt_pool.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_pool.c'; fi` varnishd-mgt_shmem.o: mgt/mgt_shmem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_shmem.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_shmem.Tpo -c -o varnishd-mgt_shmem.o `test -f 'mgt/mgt_shmem.c' || echo '$(srcdir)/'`mgt/mgt_shmem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_shmem.Tpo $(DEPDIR)/varnishd-mgt_shmem.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_shmem.c' object='varnishd-mgt_shmem.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_shmem.o `test -f 'mgt/mgt_shmem.c' || echo '$(srcdir)/'`mgt/mgt_shmem.c varnishd-mgt_shmem.obj: mgt/mgt_shmem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_shmem.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_shmem.Tpo -c -o varnishd-mgt_shmem.obj `if test -f 'mgt/mgt_shmem.c'; then $(CYGPATH_W) 'mgt/mgt_shmem.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_shmem.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_shmem.Tpo $(DEPDIR)/varnishd-mgt_shmem.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_shmem.c' object='varnishd-mgt_shmem.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_shmem.obj `if test -f 'mgt/mgt_shmem.c'; then $(CYGPATH_W) 'mgt/mgt_shmem.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_shmem.c'; fi` varnishd-mgt_vcc.o: mgt/mgt_vcc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_vcc.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_vcc.Tpo -c -o varnishd-mgt_vcc.o `test -f 'mgt/mgt_vcc.c' || echo '$(srcdir)/'`mgt/mgt_vcc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_vcc.Tpo $(DEPDIR)/varnishd-mgt_vcc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_vcc.c' object='varnishd-mgt_vcc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_vcc.o `test -f 'mgt/mgt_vcc.c' || echo '$(srcdir)/'`mgt/mgt_vcc.c varnishd-mgt_vcc.obj: mgt/mgt_vcc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_vcc.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_vcc.Tpo -c -o varnishd-mgt_vcc.obj `if test -f 'mgt/mgt_vcc.c'; then $(CYGPATH_W) 'mgt/mgt_vcc.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_vcc.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_vcc.Tpo $(DEPDIR)/varnishd-mgt_vcc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_vcc.c' object='varnishd-mgt_vcc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_vcc.obj `if test -f 'mgt/mgt_vcc.c'; then $(CYGPATH_W) 'mgt/mgt_vcc.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_vcc.c'; fi` varnishd-mgt_vcl.o: mgt/mgt_vcl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_vcl.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_vcl.Tpo -c -o varnishd-mgt_vcl.o `test -f 'mgt/mgt_vcl.c' || echo '$(srcdir)/'`mgt/mgt_vcl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_vcl.Tpo $(DEPDIR)/varnishd-mgt_vcl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_vcl.c' object='varnishd-mgt_vcl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_vcl.o `test -f 'mgt/mgt_vcl.c' || echo '$(srcdir)/'`mgt/mgt_vcl.c varnishd-mgt_vcl.obj: mgt/mgt_vcl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_vcl.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_vcl.Tpo -c -o varnishd-mgt_vcl.obj `if test -f 'mgt/mgt_vcl.c'; then $(CYGPATH_W) 'mgt/mgt_vcl.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_vcl.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_vcl.Tpo $(DEPDIR)/varnishd-mgt_vcl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mgt/mgt_vcl.c' object='varnishd-mgt_vcl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_vcl.obj `if test -f 'mgt/mgt_vcl.c'; then $(CYGPATH_W) 'mgt/mgt_vcl.c'; else $(CYGPATH_W) '$(srcdir)/mgt/mgt_vcl.c'; fi` varnishd-cache_proxy_proto.o: proxy/cache_proxy_proto.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_proxy_proto.o -MD -MP -MF $(DEPDIR)/varnishd-cache_proxy_proto.Tpo -c -o varnishd-cache_proxy_proto.o `test -f 'proxy/cache_proxy_proto.c' || echo '$(srcdir)/'`proxy/cache_proxy_proto.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_proxy_proto.Tpo $(DEPDIR)/varnishd-cache_proxy_proto.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='proxy/cache_proxy_proto.c' object='varnishd-cache_proxy_proto.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_proxy_proto.o `test -f 'proxy/cache_proxy_proto.c' || echo '$(srcdir)/'`proxy/cache_proxy_proto.c varnishd-cache_proxy_proto.obj: proxy/cache_proxy_proto.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_proxy_proto.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_proxy_proto.Tpo -c -o varnishd-cache_proxy_proto.obj `if test -f 'proxy/cache_proxy_proto.c'; then $(CYGPATH_W) 'proxy/cache_proxy_proto.c'; else $(CYGPATH_W) '$(srcdir)/proxy/cache_proxy_proto.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_proxy_proto.Tpo $(DEPDIR)/varnishd-cache_proxy_proto.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='proxy/cache_proxy_proto.c' object='varnishd-cache_proxy_proto.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_proxy_proto.obj `if test -f 'proxy/cache_proxy_proto.c'; then $(CYGPATH_W) 'proxy/cache_proxy_proto.c'; else $(CYGPATH_W) '$(srcdir)/proxy/cache_proxy_proto.c'; fi` varnishd-stevedore.o: storage/stevedore.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-stevedore.o -MD -MP -MF $(DEPDIR)/varnishd-stevedore.Tpo -c -o varnishd-stevedore.o `test -f 'storage/stevedore.c' || echo '$(srcdir)/'`storage/stevedore.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-stevedore.Tpo $(DEPDIR)/varnishd-stevedore.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/stevedore.c' object='varnishd-stevedore.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-stevedore.o `test -f 'storage/stevedore.c' || echo '$(srcdir)/'`storage/stevedore.c varnishd-stevedore.obj: storage/stevedore.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-stevedore.obj -MD -MP -MF $(DEPDIR)/varnishd-stevedore.Tpo -c -o varnishd-stevedore.obj `if test -f 'storage/stevedore.c'; then $(CYGPATH_W) 'storage/stevedore.c'; else $(CYGPATH_W) '$(srcdir)/storage/stevedore.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-stevedore.Tpo $(DEPDIR)/varnishd-stevedore.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/stevedore.c' object='varnishd-stevedore.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-stevedore.obj `if test -f 'storage/stevedore.c'; then $(CYGPATH_W) 'storage/stevedore.c'; else $(CYGPATH_W) '$(srcdir)/storage/stevedore.c'; fi` varnishd-mgt_stevedore.o: storage/mgt_stevedore.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_stevedore.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_stevedore.Tpo -c -o varnishd-mgt_stevedore.o `test -f 'storage/mgt_stevedore.c' || echo '$(srcdir)/'`storage/mgt_stevedore.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_stevedore.Tpo $(DEPDIR)/varnishd-mgt_stevedore.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/mgt_stevedore.c' object='varnishd-mgt_stevedore.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_stevedore.o `test -f 'storage/mgt_stevedore.c' || echo '$(srcdir)/'`storage/mgt_stevedore.c varnishd-mgt_stevedore.obj: storage/mgt_stevedore.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_stevedore.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_stevedore.Tpo -c -o varnishd-mgt_stevedore.obj `if test -f 'storage/mgt_stevedore.c'; then $(CYGPATH_W) 'storage/mgt_stevedore.c'; else $(CYGPATH_W) '$(srcdir)/storage/mgt_stevedore.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_stevedore.Tpo $(DEPDIR)/varnishd-mgt_stevedore.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/mgt_stevedore.c' object='varnishd-mgt_stevedore.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_stevedore.obj `if test -f 'storage/mgt_stevedore.c'; then $(CYGPATH_W) 'storage/mgt_stevedore.c'; else $(CYGPATH_W) '$(srcdir)/storage/mgt_stevedore.c'; fi` varnishd-stevedore_utils.o: storage/stevedore_utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-stevedore_utils.o -MD -MP -MF $(DEPDIR)/varnishd-stevedore_utils.Tpo -c -o varnishd-stevedore_utils.o `test -f 'storage/stevedore_utils.c' || echo '$(srcdir)/'`storage/stevedore_utils.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-stevedore_utils.Tpo $(DEPDIR)/varnishd-stevedore_utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/stevedore_utils.c' object='varnishd-stevedore_utils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-stevedore_utils.o `test -f 'storage/stevedore_utils.c' || echo '$(srcdir)/'`storage/stevedore_utils.c varnishd-stevedore_utils.obj: storage/stevedore_utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-stevedore_utils.obj -MD -MP -MF $(DEPDIR)/varnishd-stevedore_utils.Tpo -c -o varnishd-stevedore_utils.obj `if test -f 'storage/stevedore_utils.c'; then $(CYGPATH_W) 'storage/stevedore_utils.c'; else $(CYGPATH_W) '$(srcdir)/storage/stevedore_utils.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-stevedore_utils.Tpo $(DEPDIR)/varnishd-stevedore_utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/stevedore_utils.c' object='varnishd-stevedore_utils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-stevedore_utils.obj `if test -f 'storage/stevedore_utils.c'; then $(CYGPATH_W) 'storage/stevedore_utils.c'; else $(CYGPATH_W) '$(srcdir)/storage/stevedore_utils.c'; fi` varnishd-storage_file.o: storage/storage_file.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-storage_file.o -MD -MP -MF $(DEPDIR)/varnishd-storage_file.Tpo -c -o varnishd-storage_file.o `test -f 'storage/storage_file.c' || echo '$(srcdir)/'`storage/storage_file.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-storage_file.Tpo $(DEPDIR)/varnishd-storage_file.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/storage_file.c' object='varnishd-storage_file.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-storage_file.o `test -f 'storage/storage_file.c' || echo '$(srcdir)/'`storage/storage_file.c varnishd-storage_file.obj: storage/storage_file.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-storage_file.obj -MD -MP -MF $(DEPDIR)/varnishd-storage_file.Tpo -c -o varnishd-storage_file.obj `if test -f 'storage/storage_file.c'; then $(CYGPATH_W) 'storage/storage_file.c'; else $(CYGPATH_W) '$(srcdir)/storage/storage_file.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-storage_file.Tpo $(DEPDIR)/varnishd-storage_file.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/storage_file.c' object='varnishd-storage_file.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-storage_file.obj `if test -f 'storage/storage_file.c'; then $(CYGPATH_W) 'storage/storage_file.c'; else $(CYGPATH_W) '$(srcdir)/storage/storage_file.c'; fi` varnishd-storage_malloc.o: storage/storage_malloc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-storage_malloc.o -MD -MP -MF $(DEPDIR)/varnishd-storage_malloc.Tpo -c -o varnishd-storage_malloc.o `test -f 'storage/storage_malloc.c' || echo '$(srcdir)/'`storage/storage_malloc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-storage_malloc.Tpo $(DEPDIR)/varnishd-storage_malloc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/storage_malloc.c' object='varnishd-storage_malloc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-storage_malloc.o `test -f 'storage/storage_malloc.c' || echo '$(srcdir)/'`storage/storage_malloc.c varnishd-storage_malloc.obj: storage/storage_malloc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-storage_malloc.obj -MD -MP -MF $(DEPDIR)/varnishd-storage_malloc.Tpo -c -o varnishd-storage_malloc.obj `if test -f 'storage/storage_malloc.c'; then $(CYGPATH_W) 'storage/storage_malloc.c'; else $(CYGPATH_W) '$(srcdir)/storage/storage_malloc.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-storage_malloc.Tpo $(DEPDIR)/varnishd-storage_malloc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/storage_malloc.c' object='varnishd-storage_malloc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-storage_malloc.obj `if test -f 'storage/storage_malloc.c'; then $(CYGPATH_W) 'storage/storage_malloc.c'; else $(CYGPATH_W) '$(srcdir)/storage/storage_malloc.c'; fi` varnishd-storage_persistent.o: storage/storage_persistent.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-storage_persistent.o -MD -MP -MF $(DEPDIR)/varnishd-storage_persistent.Tpo -c -o varnishd-storage_persistent.o `test -f 'storage/storage_persistent.c' || echo '$(srcdir)/'`storage/storage_persistent.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-storage_persistent.Tpo $(DEPDIR)/varnishd-storage_persistent.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/storage_persistent.c' object='varnishd-storage_persistent.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-storage_persistent.o `test -f 'storage/storage_persistent.c' || echo '$(srcdir)/'`storage/storage_persistent.c varnishd-storage_persistent.obj: storage/storage_persistent.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-storage_persistent.obj -MD -MP -MF $(DEPDIR)/varnishd-storage_persistent.Tpo -c -o varnishd-storage_persistent.obj `if test -f 'storage/storage_persistent.c'; then $(CYGPATH_W) 'storage/storage_persistent.c'; else $(CYGPATH_W) '$(srcdir)/storage/storage_persistent.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-storage_persistent.Tpo $(DEPDIR)/varnishd-storage_persistent.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/storage_persistent.c' object='varnishd-storage_persistent.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-storage_persistent.obj `if test -f 'storage/storage_persistent.c'; then $(CYGPATH_W) 'storage/storage_persistent.c'; else $(CYGPATH_W) '$(srcdir)/storage/storage_persistent.c'; fi` varnishd-mgt_storage_persistent.o: storage/mgt_storage_persistent.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_storage_persistent.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_storage_persistent.Tpo -c -o varnishd-mgt_storage_persistent.o `test -f 'storage/mgt_storage_persistent.c' || echo '$(srcdir)/'`storage/mgt_storage_persistent.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_storage_persistent.Tpo $(DEPDIR)/varnishd-mgt_storage_persistent.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/mgt_storage_persistent.c' object='varnishd-mgt_storage_persistent.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_storage_persistent.o `test -f 'storage/mgt_storage_persistent.c' || echo '$(srcdir)/'`storage/mgt_storage_persistent.c varnishd-mgt_storage_persistent.obj: storage/mgt_storage_persistent.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_storage_persistent.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_storage_persistent.Tpo -c -o varnishd-mgt_storage_persistent.obj `if test -f 'storage/mgt_storage_persistent.c'; then $(CYGPATH_W) 'storage/mgt_storage_persistent.c'; else $(CYGPATH_W) '$(srcdir)/storage/mgt_storage_persistent.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_storage_persistent.Tpo $(DEPDIR)/varnishd-mgt_storage_persistent.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/mgt_storage_persistent.c' object='varnishd-mgt_storage_persistent.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_storage_persistent.obj `if test -f 'storage/mgt_storage_persistent.c'; then $(CYGPATH_W) 'storage/mgt_storage_persistent.c'; else $(CYGPATH_W) '$(srcdir)/storage/mgt_storage_persistent.c'; fi` varnishd-storage_persistent_silo.o: storage/storage_persistent_silo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-storage_persistent_silo.o -MD -MP -MF $(DEPDIR)/varnishd-storage_persistent_silo.Tpo -c -o varnishd-storage_persistent_silo.o `test -f 'storage/storage_persistent_silo.c' || echo '$(srcdir)/'`storage/storage_persistent_silo.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-storage_persistent_silo.Tpo $(DEPDIR)/varnishd-storage_persistent_silo.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/storage_persistent_silo.c' object='varnishd-storage_persistent_silo.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-storage_persistent_silo.o `test -f 'storage/storage_persistent_silo.c' || echo '$(srcdir)/'`storage/storage_persistent_silo.c varnishd-storage_persistent_silo.obj: storage/storage_persistent_silo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-storage_persistent_silo.obj -MD -MP -MF $(DEPDIR)/varnishd-storage_persistent_silo.Tpo -c -o varnishd-storage_persistent_silo.obj `if test -f 'storage/storage_persistent_silo.c'; then $(CYGPATH_W) 'storage/storage_persistent_silo.c'; else $(CYGPATH_W) '$(srcdir)/storage/storage_persistent_silo.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-storage_persistent_silo.Tpo $(DEPDIR)/varnishd-storage_persistent_silo.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/storage_persistent_silo.c' object='varnishd-storage_persistent_silo.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-storage_persistent_silo.obj `if test -f 'storage/storage_persistent_silo.c'; then $(CYGPATH_W) 'storage/storage_persistent_silo.c'; else $(CYGPATH_W) '$(srcdir)/storage/storage_persistent_silo.c'; fi` varnishd-storage_persistent_subr.o: storage/storage_persistent_subr.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-storage_persistent_subr.o -MD -MP -MF $(DEPDIR)/varnishd-storage_persistent_subr.Tpo -c -o varnishd-storage_persistent_subr.o `test -f 'storage/storage_persistent_subr.c' || echo '$(srcdir)/'`storage/storage_persistent_subr.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-storage_persistent_subr.Tpo $(DEPDIR)/varnishd-storage_persistent_subr.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/storage_persistent_subr.c' object='varnishd-storage_persistent_subr.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-storage_persistent_subr.o `test -f 'storage/storage_persistent_subr.c' || echo '$(srcdir)/'`storage/storage_persistent_subr.c varnishd-storage_persistent_subr.obj: storage/storage_persistent_subr.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-storage_persistent_subr.obj -MD -MP -MF $(DEPDIR)/varnishd-storage_persistent_subr.Tpo -c -o varnishd-storage_persistent_subr.obj `if test -f 'storage/storage_persistent_subr.c'; then $(CYGPATH_W) 'storage/storage_persistent_subr.c'; else $(CYGPATH_W) '$(srcdir)/storage/storage_persistent_subr.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-storage_persistent_subr.Tpo $(DEPDIR)/varnishd-storage_persistent_subr.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/storage_persistent_subr.c' object='varnishd-storage_persistent_subr.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-storage_persistent_subr.obj `if test -f 'storage/storage_persistent_subr.c'; then $(CYGPATH_W) 'storage/storage_persistent_subr.c'; else $(CYGPATH_W) '$(srcdir)/storage/storage_persistent_subr.c'; fi` varnishd-storage_umem.o: storage/storage_umem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-storage_umem.o -MD -MP -MF $(DEPDIR)/varnishd-storage_umem.Tpo -c -o varnishd-storage_umem.o `test -f 'storage/storage_umem.c' || echo '$(srcdir)/'`storage/storage_umem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-storage_umem.Tpo $(DEPDIR)/varnishd-storage_umem.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/storage_umem.c' object='varnishd-storage_umem.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-storage_umem.o `test -f 'storage/storage_umem.c' || echo '$(srcdir)/'`storage/storage_umem.c varnishd-storage_umem.obj: storage/storage_umem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-storage_umem.obj -MD -MP -MF $(DEPDIR)/varnishd-storage_umem.Tpo -c -o varnishd-storage_umem.obj `if test -f 'storage/storage_umem.c'; then $(CYGPATH_W) 'storage/storage_umem.c'; else $(CYGPATH_W) '$(srcdir)/storage/storage_umem.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-storage_umem.Tpo $(DEPDIR)/varnishd-storage_umem.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='storage/storage_umem.c' object='varnishd-storage_umem.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-storage_umem.obj `if test -f 'storage/storage_umem.c'; then $(CYGPATH_W) 'storage/storage_umem.c'; else $(CYGPATH_W) '$(srcdir)/storage/storage_umem.c'; fi` varnishd-mgt_waiter.o: waiter/mgt_waiter.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_waiter.o -MD -MP -MF $(DEPDIR)/varnishd-mgt_waiter.Tpo -c -o varnishd-mgt_waiter.o `test -f 'waiter/mgt_waiter.c' || echo '$(srcdir)/'`waiter/mgt_waiter.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_waiter.Tpo $(DEPDIR)/varnishd-mgt_waiter.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waiter/mgt_waiter.c' object='varnishd-mgt_waiter.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_waiter.o `test -f 'waiter/mgt_waiter.c' || echo '$(srcdir)/'`waiter/mgt_waiter.c varnishd-mgt_waiter.obj: waiter/mgt_waiter.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-mgt_waiter.obj -MD -MP -MF $(DEPDIR)/varnishd-mgt_waiter.Tpo -c -o varnishd-mgt_waiter.obj `if test -f 'waiter/mgt_waiter.c'; then $(CYGPATH_W) 'waiter/mgt_waiter.c'; else $(CYGPATH_W) '$(srcdir)/waiter/mgt_waiter.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-mgt_waiter.Tpo $(DEPDIR)/varnishd-mgt_waiter.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waiter/mgt_waiter.c' object='varnishd-mgt_waiter.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-mgt_waiter.obj `if test -f 'waiter/mgt_waiter.c'; then $(CYGPATH_W) 'waiter/mgt_waiter.c'; else $(CYGPATH_W) '$(srcdir)/waiter/mgt_waiter.c'; fi` varnishd-cache_waiter.o: waiter/cache_waiter.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_waiter.o -MD -MP -MF $(DEPDIR)/varnishd-cache_waiter.Tpo -c -o varnishd-cache_waiter.o `test -f 'waiter/cache_waiter.c' || echo '$(srcdir)/'`waiter/cache_waiter.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_waiter.Tpo $(DEPDIR)/varnishd-cache_waiter.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waiter/cache_waiter.c' object='varnishd-cache_waiter.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_waiter.o `test -f 'waiter/cache_waiter.c' || echo '$(srcdir)/'`waiter/cache_waiter.c varnishd-cache_waiter.obj: waiter/cache_waiter.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_waiter.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_waiter.Tpo -c -o varnishd-cache_waiter.obj `if test -f 'waiter/cache_waiter.c'; then $(CYGPATH_W) 'waiter/cache_waiter.c'; else $(CYGPATH_W) '$(srcdir)/waiter/cache_waiter.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_waiter.Tpo $(DEPDIR)/varnishd-cache_waiter.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waiter/cache_waiter.c' object='varnishd-cache_waiter.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_waiter.obj `if test -f 'waiter/cache_waiter.c'; then $(CYGPATH_W) 'waiter/cache_waiter.c'; else $(CYGPATH_W) '$(srcdir)/waiter/cache_waiter.c'; fi` varnishd-cache_waiter_epoll.o: waiter/cache_waiter_epoll.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_waiter_epoll.o -MD -MP -MF $(DEPDIR)/varnishd-cache_waiter_epoll.Tpo -c -o varnishd-cache_waiter_epoll.o `test -f 'waiter/cache_waiter_epoll.c' || echo '$(srcdir)/'`waiter/cache_waiter_epoll.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_waiter_epoll.Tpo $(DEPDIR)/varnishd-cache_waiter_epoll.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waiter/cache_waiter_epoll.c' object='varnishd-cache_waiter_epoll.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_waiter_epoll.o `test -f 'waiter/cache_waiter_epoll.c' || echo '$(srcdir)/'`waiter/cache_waiter_epoll.c varnishd-cache_waiter_epoll.obj: waiter/cache_waiter_epoll.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_waiter_epoll.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_waiter_epoll.Tpo -c -o varnishd-cache_waiter_epoll.obj `if test -f 'waiter/cache_waiter_epoll.c'; then $(CYGPATH_W) 'waiter/cache_waiter_epoll.c'; else $(CYGPATH_W) '$(srcdir)/waiter/cache_waiter_epoll.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_waiter_epoll.Tpo $(DEPDIR)/varnishd-cache_waiter_epoll.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waiter/cache_waiter_epoll.c' object='varnishd-cache_waiter_epoll.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_waiter_epoll.obj `if test -f 'waiter/cache_waiter_epoll.c'; then $(CYGPATH_W) 'waiter/cache_waiter_epoll.c'; else $(CYGPATH_W) '$(srcdir)/waiter/cache_waiter_epoll.c'; fi` varnishd-cache_waiter_kqueue.o: waiter/cache_waiter_kqueue.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_waiter_kqueue.o -MD -MP -MF $(DEPDIR)/varnishd-cache_waiter_kqueue.Tpo -c -o varnishd-cache_waiter_kqueue.o `test -f 'waiter/cache_waiter_kqueue.c' || echo '$(srcdir)/'`waiter/cache_waiter_kqueue.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_waiter_kqueue.Tpo $(DEPDIR)/varnishd-cache_waiter_kqueue.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waiter/cache_waiter_kqueue.c' object='varnishd-cache_waiter_kqueue.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_waiter_kqueue.o `test -f 'waiter/cache_waiter_kqueue.c' || echo '$(srcdir)/'`waiter/cache_waiter_kqueue.c varnishd-cache_waiter_kqueue.obj: waiter/cache_waiter_kqueue.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_waiter_kqueue.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_waiter_kqueue.Tpo -c -o varnishd-cache_waiter_kqueue.obj `if test -f 'waiter/cache_waiter_kqueue.c'; then $(CYGPATH_W) 'waiter/cache_waiter_kqueue.c'; else $(CYGPATH_W) '$(srcdir)/waiter/cache_waiter_kqueue.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_waiter_kqueue.Tpo $(DEPDIR)/varnishd-cache_waiter_kqueue.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waiter/cache_waiter_kqueue.c' object='varnishd-cache_waiter_kqueue.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_waiter_kqueue.obj `if test -f 'waiter/cache_waiter_kqueue.c'; then $(CYGPATH_W) 'waiter/cache_waiter_kqueue.c'; else $(CYGPATH_W) '$(srcdir)/waiter/cache_waiter_kqueue.c'; fi` varnishd-cache_waiter_poll.o: waiter/cache_waiter_poll.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_waiter_poll.o -MD -MP -MF $(DEPDIR)/varnishd-cache_waiter_poll.Tpo -c -o varnishd-cache_waiter_poll.o `test -f 'waiter/cache_waiter_poll.c' || echo '$(srcdir)/'`waiter/cache_waiter_poll.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_waiter_poll.Tpo $(DEPDIR)/varnishd-cache_waiter_poll.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waiter/cache_waiter_poll.c' object='varnishd-cache_waiter_poll.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_waiter_poll.o `test -f 'waiter/cache_waiter_poll.c' || echo '$(srcdir)/'`waiter/cache_waiter_poll.c varnishd-cache_waiter_poll.obj: waiter/cache_waiter_poll.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_waiter_poll.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_waiter_poll.Tpo -c -o varnishd-cache_waiter_poll.obj `if test -f 'waiter/cache_waiter_poll.c'; then $(CYGPATH_W) 'waiter/cache_waiter_poll.c'; else $(CYGPATH_W) '$(srcdir)/waiter/cache_waiter_poll.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_waiter_poll.Tpo $(DEPDIR)/varnishd-cache_waiter_poll.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waiter/cache_waiter_poll.c' object='varnishd-cache_waiter_poll.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_waiter_poll.obj `if test -f 'waiter/cache_waiter_poll.c'; then $(CYGPATH_W) 'waiter/cache_waiter_poll.c'; else $(CYGPATH_W) '$(srcdir)/waiter/cache_waiter_poll.c'; fi` varnishd-cache_waiter_ports.o: waiter/cache_waiter_ports.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_waiter_ports.o -MD -MP -MF $(DEPDIR)/varnishd-cache_waiter_ports.Tpo -c -o varnishd-cache_waiter_ports.o `test -f 'waiter/cache_waiter_ports.c' || echo '$(srcdir)/'`waiter/cache_waiter_ports.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_waiter_ports.Tpo $(DEPDIR)/varnishd-cache_waiter_ports.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waiter/cache_waiter_ports.c' object='varnishd-cache_waiter_ports.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_waiter_ports.o `test -f 'waiter/cache_waiter_ports.c' || echo '$(srcdir)/'`waiter/cache_waiter_ports.c varnishd-cache_waiter_ports.obj: waiter/cache_waiter_ports.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -MT varnishd-cache_waiter_ports.obj -MD -MP -MF $(DEPDIR)/varnishd-cache_waiter_ports.Tpo -c -o varnishd-cache_waiter_ports.obj `if test -f 'waiter/cache_waiter_ports.c'; then $(CYGPATH_W) 'waiter/cache_waiter_ports.c'; else $(CYGPATH_W) '$(srcdir)/waiter/cache_waiter_ports.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishd-cache_waiter_ports.Tpo $(DEPDIR)/varnishd-cache_waiter_ports.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waiter/cache_waiter_ports.c' object='varnishd-cache_waiter_ports.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishd_CFLAGS) $(CFLAGS) -c -o varnishd-cache_waiter_ports.obj `if test -f 'waiter/cache_waiter_ports.c'; then $(CYGPATH_W) 'waiter/cache_waiter_ports.c'; else $(CYGPATH_W) '$(srcdir)/waiter/cache_waiter_ports.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-nobase_pkgincludeHEADERS: $(nobase_pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(nobase_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ $(am__nobase_list) | while read dir files; do \ xfiles=; for file in $$files; do \ if test -f "$$file"; then xfiles="$$xfiles $$file"; \ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ test -z "$$xfiles" || { \ test "x$$dir" = x. || { \ echo "$(MKDIR_P) '$(DESTDIR)$(pkgincludedir)/$$dir'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)/$$dir"; }; \ echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(pkgincludedir)/$$dir'"; \ $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(pkgincludedir)/$$dir" || exit $$?; }; \ done uninstall-nobase_pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(nobase_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-sbinPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-nobase_pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-sbinPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-nobase_pkgincludeHEADERS \ uninstall-sbinPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-sbinPROGRAMS ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-nobase_pkgincludeHEADERS install-pdf install-pdf-am \ install-ps install-ps-am install-sbinPROGRAMS install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-nobase_pkgincludeHEADERS \ uninstall-sbinPROGRAMS # # Turn the builtin.vcl file into a C-string we can include in the program. # builtin_vcl.h: builtin.vcl echo '/*' > $@ echo ' * NB: This file is machine generated, DO NOT EDIT!' >> $@ echo ' *' >> $@ echo ' * Edit builtin.vcl instead and run make' >> $@ echo ' *' >> $@ echo ' */' >> $@ echo '' >> $@ sed -e 's/"/\\"/g' \ -e 's/$$/\\n"/' \ -e 's/^/ "/' $(srcdir)/builtin.vcl >> $@ # Explicitly record dependency mgt/mgt_vcc.c: builtin_vcl.h # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/bin/varnishd/builtin.vcl0000644000201500234410000001252512652366721014665 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * 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; ####################################################################### # Client side sub vcl_recv { if (req.method == "PRI") { /* We do not support SPDY or HTTP/2.0 */ return (synth(405)); } 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 { # By default Connection: close is set on all piped requests, to stop # connection reuse from sending future requests directly to the # (potentially) wrong backend. If you do want this to happen, you can undo # it here. # unset bereq.http.connection; 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 (synth(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, deliver it // Automatically triggers a background fetch return (deliver); } // fetch & deliver once we get the result return (miss); } sub vcl_miss { return (fetch); } sub vcl_deliver { return (deliver); } /* * We can come here "invisibly" with the following errors: 413, 417 & 503 */ sub vcl_synth { set resp.http.Content-Type = "text/html; charset=utf-8"; set resp.http.Retry-After = "5"; synthetic( {" "} + resp.status + " " + resp.reason + {"

Error "} + resp.status + " " + resp.reason + {"

"} + resp.reason + {"

Guru Meditation:

XID: "} + req.xid + {"


Varnish cache server

"} ); return (deliver); } ####################################################################### # Backend 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 = 120s; set beresp.uncacheable = true; } return (deliver); } sub vcl_backend_error { set beresp.http.Content-Type = "text/html; charset=utf-8"; set beresp.http.Retry-After = "5"; synthetic( {" "} + beresp.status + " " + beresp.reason + {"

Error "} + beresp.status + " " + beresp.reason + {"

"} + beresp.reason + {"

Guru Meditation:

XID: "} + bereq.xid + {"


Varnish cache server

"} ); return (deliver); } ####################################################################### # Housekeeping sub vcl_init { } sub vcl_fini { return (ok); } varnish-4.1.1/bin/varnishd/common/0000755000201500234410000000000012652366757014065 500000000000000varnish-4.1.1/bin/varnishd/common/common_vsm.c0000644000201500234410000002270412652366721016322 00000000000000/*- * Copyright (c) 2010-2011 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. * * VSM stuff common to manager and child. * * Please see comments in for details of protocols and * data consistency. * */ #include "config.h" #include #include #include #include #include #include "common.h" #include "vsm_priv.h" #include "vmb.h" #include "vtim.h" /*--------------------------------------------------------------------*/ struct vsm_range { unsigned magic; #define VSM_RANGE_MAGIC 0x8d30f14 VTAILQ_ENTRY(vsm_range) list; ssize_t off; ssize_t len; double cool; struct VSM_chunk *chunk; void *ptr; }; struct vsm_sc { unsigned magic; #define VSM_SC_MAGIC 0x8b83270d char *b; ssize_t len; struct VSM_head *head; double t0; VTAILQ_HEAD(,vsm_range) r_used; VTAILQ_HEAD(,vsm_range) r_cooling; VTAILQ_HEAD(,vsm_range) r_free; VTAILQ_HEAD(,vsm_range) r_bogus; uint64_t g_free; uint64_t g_used; uint64_t g_cooling; uint64_t g_overflow; uint64_t c_overflow; }; /*-------------------------------------------------------------------- * The free list is sorted by size, which means that collapsing ranges * on free becomes a multi-pass operation. */ static void vsm_common_insert_free(struct vsm_sc *sc, struct vsm_range *vr) { struct vsm_range *vr2; CHECK_OBJ_NOTNULL(sc, VSM_SC_MAGIC); CHECK_OBJ_NOTNULL(vr, VSM_RANGE_MAGIC); /* First try to see if we can collapse anything */ VTAILQ_FOREACH(vr2, &sc->r_free, list) { if (vr2->off == vr->off + vr->len) { vr2->off = vr->off; vr2->len += vr->len; FREE_OBJ(vr); VTAILQ_REMOVE(&sc->r_free, vr2, list); vsm_common_insert_free(sc, vr2); return; } if (vr->off == vr2->off + vr2->len) { vr2->len += vr->len; FREE_OBJ(vr); VTAILQ_REMOVE(&sc->r_free, vr2, list); vsm_common_insert_free(sc, vr2); return; } } /* Insert in size order */ VTAILQ_FOREACH(vr2, &sc->r_free, list) { if (vr2->len > vr->len) { VTAILQ_INSERT_BEFORE(vr2, vr, list); return; } } /* At tail, if everything in the list is smaller */ VTAILQ_INSERT_TAIL(&sc->r_free, vr, list); } /*-------------------------------------------------------------------- * Initialize a new VSM segment */ struct vsm_sc * VSM_common_new(void *p, ssize_t l) { struct vsm_sc *sc; struct vsm_range *vr; assert(PAOK(sizeof(struct VSM_chunk))); assert(PAOK(p)); ALLOC_OBJ(sc, VSM_SC_MAGIC); AN(sc); VTAILQ_INIT(&sc->r_used); VTAILQ_INIT(&sc->r_cooling); VTAILQ_INIT(&sc->r_free); VTAILQ_INIT(&sc->r_bogus); sc->b = p; sc->len = l; sc->t0 = VTIM_mono(); sc->head = (void *)sc->b; /* This should not be necessary, but just in case...*/ memset(sc->head, 0, sizeof *sc->head); memcpy(sc->head->marker, VSM_HEAD_MARKER, sizeof sc->head->marker); sc->head->hdrsize = sizeof *sc->head; sc->head->shm_size = l; sc->head->alloc_seq = random() | 1; VWMB(); ALLOC_OBJ(vr, VSM_RANGE_MAGIC); AN(vr); vr->off = RUP2(sizeof(*sc->head), 16); vr->len = RDN2(l - vr->off, 16); VTAILQ_INSERT_TAIL(&sc->r_free, vr, list); sc->g_free = vr->len; return (sc); } /*-------------------------------------------------------------------- * Move from cooling list to free list */ void VSM_common_cleaner(struct vsm_sc *sc, struct VSC_C_main *stats) { double now = VTIM_real(); struct vsm_range *vr, *vr2; CHECK_OBJ_NOTNULL(sc, VSM_SC_MAGIC); /* Move cooled off stuff to free list */ VTAILQ_FOREACH_SAFE(vr, &sc->r_cooling, list, vr2) { if (vr->cool > now) break; VTAILQ_REMOVE(&sc->r_cooling, vr, list); vsm_common_insert_free(sc, vr); } stats->vsm_free = sc->g_free; stats->vsm_used = sc->g_used; stats->vsm_cooling = sc->g_cooling; stats->vsm_overflow = sc->g_overflow; stats->vsm_overflowed = sc->c_overflow; } /*-------------------------------------------------------------------- * Allocate a chunk from VSM */ void * VSM_common_alloc(struct vsm_sc *sc, ssize_t size, const char *class, const char *type, const char *ident) { struct vsm_range *vr, *vr2, *vr3; unsigned l1, l2; CHECK_OBJ_NOTNULL(sc, VSM_SC_MAGIC); AN(size); /* XXX: silent truncation instead of assert ? */ AN(class); assert(strlen(class) < sizeof(vr->chunk->class)); AN(type); assert(strlen(type) < sizeof(vr->chunk->type)); AN(ident); assert(strlen(ident) < sizeof(vr->chunk->ident)); l1 = RUP2(size + sizeof(struct VSM_chunk), 16); l2 = RUP2(size + 2 * sizeof(struct VSM_chunk), 16); /* Find space in free-list */ VTAILQ_FOREACH_SAFE(vr, &sc->r_free, list, vr2) { if (vr->len < l1) continue; if (vr->len <= l2) { VTAILQ_REMOVE(&sc->r_free, vr, list); } else { ALLOC_OBJ(vr3, VSM_RANGE_MAGIC); AN(vr3); vr3->off = vr->off; vr3->len = l1; vr->off += l1; vr->len -= l1; VTAILQ_REMOVE(&sc->r_free, vr, list); vsm_common_insert_free(sc, vr); vr = vr3; } break; } if (vr == NULL) { /* * No space in VSM, return malloc'd space */ ALLOC_OBJ(vr, VSM_RANGE_MAGIC); AN(vr); vr->ptr = malloc(size); AN(vr->ptr); vr->len = size; VTAILQ_INSERT_TAIL(&sc->r_bogus, vr, list); sc->g_overflow += vr->len; sc->c_overflow += vr->len; return (vr->ptr); } sc->g_free -= vr->len; sc->g_used += vr->len; /* Zero the entire allocation, to avoid garbage confusing readers */ memset(sc->b + vr->off, 0, vr->len); vr->chunk = (void *)(sc->b + vr->off); vr->ptr = (vr->chunk + 1); memcpy(vr->chunk->marker, VSM_CHUNK_MARKER, sizeof vr->chunk->marker); vr->chunk->len = vr->len; strcpy(vr->chunk->class, class); strcpy(vr->chunk->type, type); strcpy(vr->chunk->ident, ident); VWMB(); vr3 = VTAILQ_FIRST(&sc->r_used); VTAILQ_INSERT_HEAD(&sc->r_used, vr, list); if (vr3 != NULL) { AZ(vr3->chunk->next); vr3->chunk->next = vr->off; } else { sc->head->first = vr->off; } sc->head->alloc_seq += 2; VWMB(); return (vr->ptr); } /*-------------------------------------------------------------------- * Free a chunk */ void VSM_common_free(struct vsm_sc *sc, void *ptr) { struct vsm_range *vr, *vr2; CHECK_OBJ_NOTNULL(sc, VSM_SC_MAGIC); AN(ptr); /* Look in used list, move to cooling list */ VTAILQ_FOREACH(vr, &sc->r_used, list) { if (vr->ptr != ptr) continue; sc->g_used -= vr->len; sc->g_cooling += vr->len; vr2 = VTAILQ_NEXT(vr, list); VTAILQ_REMOVE(&sc->r_used, vr, list); VTAILQ_INSERT_TAIL(&sc->r_cooling, vr, list); vr->cool = VTIM_real() + 60; /* XXX: param ? */ if (vr2 != NULL) vr2->chunk->next = vr->chunk->next; else sc->head->first = vr->chunk->next; VWMB(); vr->chunk->len = 0; sc->head->alloc_seq += 2; VWMB(); return; } /* Look in bogus list, free */ VTAILQ_FOREACH(vr, &sc->r_bogus, list) { if (vr->ptr != ptr) continue; sc->g_overflow -= vr->len; VTAILQ_REMOVE(&sc->r_bogus, vr, list); FREE_OBJ(vr); free(ptr); return; } /* Panic */ assert(ptr == NULL); } /*-------------------------------------------------------------------- * Delete a VSM segment */ void VSM_common_delete(struct vsm_sc **scp) { struct vsm_range *vr, *vr2; struct vsm_sc *sc; AN(scp); sc =*scp; *scp = NULL; CHECK_OBJ_NOTNULL(sc, VSM_SC_MAGIC); VTAILQ_FOREACH_SAFE(vr, &sc->r_free, list, vr2) FREE_OBJ(vr); VTAILQ_FOREACH_SAFE(vr, &sc->r_used, list, vr2) FREE_OBJ(vr); VTAILQ_FOREACH_SAFE(vr, &sc->r_cooling, list, vr2) FREE_OBJ(vr); VTAILQ_FOREACH_SAFE(vr, &sc->r_bogus, list, vr2) { free(vr->ptr); FREE_OBJ(vr); } /* Mark VSM as abandoned */ sc->head->alloc_seq = 0; VWMB(); FREE_OBJ(sc); } /*-------------------------------------------------------------------- * Copy all chunks in one VSM segment to another VSM segment */ void VSM_common_copy(struct vsm_sc *to, const struct vsm_sc *from) { struct vsm_range *vr; void *p; CHECK_OBJ_NOTNULL(to, VSM_SC_MAGIC); CHECK_OBJ_NOTNULL(from, VSM_SC_MAGIC); VTAILQ_FOREACH(vr, &from->r_used, list) { p = VSM_common_alloc(to, vr->chunk->len, vr->chunk->class, vr->chunk->type, vr->chunk->ident); AN(p); memcpy(p, vr->chunk + 1, vr->chunk->len); } } /*-------------------------------------------------------------------- * Update age */ void VSM_common_ageupdate(const struct vsm_sc *sc) { CHECK_OBJ_NOTNULL(sc, VSM_SC_MAGIC); sc->head->age = (uint64_t)(VTIM_mono() - sc->t0); } varnish-4.1.1/bin/varnishd/common/params.h0000644000201500234410000000644512652366721015441 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * This file contains the heritage passed when mgt forks cache */ #ifdef COMMON_PARAMS_H #error "Multiple includes of common/params.h" #endif #define COMMON_PARAMS_H #include #include "vre.h" #define VSM_CLASS_PARAM "Params" enum debug_bits { #define DEBUG_BIT(U, l, d) DBG_##U, #include "tbl/debug_bits.h" #undef DEBUG_BIT DBG_Reserved }; enum feature_bits { #define FEATURE_BIT(U, l, d, ld) FEATURE_##U, #include "tbl/feature_bits.h" #undef FEATURE_BIT FEATURE_Reserved }; struct poolparam { unsigned min_pool; unsigned max_pool; double max_age; }; struct params { #define ptyp_bool unsigned #define ptyp_bytes ssize_t #define ptyp_bytes_u unsigned #define ptyp_double double #define ptyp_poolparam struct poolparam #define ptyp_timeout double #define ptyp_uint unsigned #define ptyp_vsl_buffer unsigned #define ptyp_vsl_reclen unsigned #define PARAM(nm, ty, mi, ma, de, un, fl, st, lt, fn) ptyp_##ty nm; #include #undef PARAM #undef ptyp_bool #undef ptyp_bytes #undef ptyp_bytes_u #undef ptyp_double #undef ptyp_poolparam #undef ptyp_timeout #undef ptyp_uint #undef ptyp_vsl_buffer #undef ptyp_vsl_reclen /* Unprivileged user / group */ uid_t uid; gid_t gid; /* Worker threads and pool */ unsigned wthread_min; unsigned wthread_max; double wthread_timeout; unsigned wthread_pools; double wthread_add_delay; double wthread_fail_delay; double wthread_destroy_delay; double wthread_stats_rate; ssize_t wthread_stacksize; unsigned wthread_queue_limit; #ifdef HAVE_TCP_KEEP double tcp_keepalive_time; unsigned tcp_keepalive_probes; double tcp_keepalive_intvl; #endif struct vre_limits vre_limits; struct poolparam req_pool; struct poolparam sess_pool; struct poolparam vbo_pool; uint8_t vsl_mask[256>>3]; uint8_t debug_bits[(DBG_Reserved+7)>>3]; uint8_t feature_bits[(FEATURE_Reserved+7)>>3]; }; varnish-4.1.1/bin/varnishd/common/heritage.h0000644000201500234410000000444212652366721015741 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * This file contains the heritage passed when mgt forks cache */ struct vsm_sc; struct suckaddr; struct listen_sock { unsigned magic; #define LISTEN_SOCK_MAGIC 0x999e4b57 VTAILQ_ENTRY(listen_sock) list; int sock; char *name; struct suckaddr *addr; enum sess_step first_step; const char *proto_name; }; VTAILQ_HEAD(listen_sock_head, listen_sock); struct heritage { /* Two pipe(2)'s for CLI connection between cache and mgt. */ int cli_in; int cli_out; /* File descriptor for stdout/stderr */ int std_fd; /* Sockets from which to accept connections */ struct listen_sock_head socks; /* Hash method */ const struct hash_slinger *hash; struct vsm_sc *vsm; struct params *param; char *name; const char *identity; char *panic_str; ssize_t panic_str_len; }; extern struct heritage heritage; void child_main(void); varnish-4.1.1/bin/varnishd/common/common.h0000644000201500234410000001073112652366721015437 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ #include #include #include "miniobj.h" #include "vas.h" #include "vcs.h" #include "vdef.h" #include "vqueue.h" #include "vsb.h" #include "vapi/vsc_int.h" /* * Enums cannot be forward declared (any more...) so put it here * to make everybody see it. */ enum baninfo { BI_NEW, BI_DROP }; enum obj_attr { #define OBJ_ATTR(U, l) OA_##U, #include "tbl/obj_attr.h" #undef OBJ_ATTR }; enum obj_flags { #define OBJ_FLAG(U, l, v) OF_##U = v, #include "tbl/obj_attr.h" #undef OBJ_FLAG }; enum sess_step { #define SESS_STEP(l, u) S_STP_##u, #include "tbl/steps.h" #undef SESS_STEP }; struct cli; /********************************************************************** * FlexeLint and compiler shutuppery */ /* * State variables may change value before we use the last value we * set them to. * Pass no argument. */ #define __state_variable__(xxx) /*lint -esym(838,xxx) */ /**********************************************************************/ /* Name of transient storage */ #define TRANSIENT_STORAGE "Transient" extern pid_t mgt_pid; #define ASSERT_MGT() do { assert(getpid() == mgt_pid);} while (0) /* varnishd.c */ extern struct vsb *vident; // XXX: -> heritage ? int Symbol_Lookup(struct vsb *vsb, void *ptr); /* Really belongs in mgt.h, but storage_file chokes on both */ void mgt_child_inherit(int fd, const char *what); #define ARGV_ERR(...) \ do { \ fprintf(stderr, "Error: " __VA_ARGS__); \ exit(2); \ } while (0) /* cache/cache_vcl.c */ int VCL_TestLoad(const char *); /* vsm.c */ struct vsm_sc; struct VSC_C_main; struct vsm_sc *VSM_common_new(void *ptr, ssize_t len); void *VSM_common_alloc(struct vsm_sc *sc, ssize_t size, const char *class, const char *type, const char *ident); void VSM_common_free(struct vsm_sc *sc, void *ptr); void VSM_common_delete(struct vsm_sc **sc); void VSM_common_copy(struct vsm_sc *to, const struct vsm_sc *from); void VSM_common_cleaner(struct vsm_sc *sc, struct VSC_C_main *stats); void VSM_common_ageupdate(const struct vsm_sc *sc); /*--------------------------------------------------------------------- * Generic power-2 rounding macros */ #define PWR2(x) ((((x)-1UL)&(x))==0) /* Is a power of two */ #define RDN2(x, y) ((x)&(~((uintptr_t)(y)-1UL))) /* PWR2(y) true */ #define RUP2(x, y) (((x)+((y)-1))&(~((uintptr_t)(y)-1UL))) /* PWR2(y) true */ /*-------------------------------------------------------------------- * Pointer alignment magic */ #if defined(__sparc__) /* NB: Overbroad test for 32bit userland on 64bit SPARC cpus. */ # define PALGN (sizeof(double) - 1) /* size of alignment */ #else # define PALGN (sizeof(void *) - 1) /* size of alignment */ #endif #define PAOK(p) (((uintptr_t)(p) & PALGN) == 0) /* is aligned */ #define PRNDDN(p) ((uintptr_t)(p) & ~PALGN) /* Round down */ #define PRNDUP(p) (((uintptr_t)(p) + PALGN) & ~PALGN) /* Round up */ /*-------------------------------------------------------------------- * To be used as little as possible to wash off const/volatile etc. */ #define TRUST_ME(ptr) ((void*)(uintptr_t)(ptr)) varnish-4.1.1/bin/varnishd/common/common_vsc.c0000644000201500234410000000314212652366721016303 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-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. * */ #include "common.h" /* Build the static vsc type names */ #define VSC_TYPE_F(n,t,l,e,d) const char *VSC_type_##n = t; #include "tbl/vsc_types.h" #undef VSC_TYPE_F varnish-4.1.1/bin/varnishd/storage/0000755000201500234410000000000012652366757014241 500000000000000varnish-4.1.1/bin/varnishd/storage/storage_persistent_subr.c0000644000201500234410000002723412652366721021303 00000000000000/*- * Copyright (c) 2008-2011 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. * * Persistent storage method * * XXX: Before we start the client or maybe after it stops, we should give the * XXX: stevedores a chance to examine their storage for consistency. * * XXX: Do we ever free the LRU-lists ? */ #include "config.h" #include #include #include #include #include "cache/cache.h" #include "storage/storage.h" #include "vsha256.h" #include "storage/storage_persistent.h" /*-------------------------------------------------------------------- * SIGNATURE functions * The signature is SHA256 over: * 1. The smp_sign struct up to but not including the length field. * 2. smp_sign->length bytes, starting after the smp_sign structure * 3. The smp-sign->length field. * The signature is stored after the byte-range from step 2. */ /*-------------------------------------------------------------------- * Define a signature by location and identifier. */ void smp_def_sign(const struct smp_sc *sc, struct smp_signctx *ctx, uint64_t off, const char *id) { AZ(off & 7); /* Alignment */ assert(strlen(id) < sizeof ctx->ss->ident); memset(ctx, 0, sizeof *ctx); ctx->ss = (void*)(sc->base + off); ctx->unique = sc->unique; ctx->id = id; } /*-------------------------------------------------------------------- * Check that a signature is good, leave state ready for append */ int smp_chk_sign(struct smp_signctx *ctx) { struct SHA256Context cx; unsigned char sign[SHA256_LEN]; int r = 0; if (strncmp(ctx->id, ctx->ss->ident, sizeof ctx->ss->ident)) r = 1; else if (ctx->unique != ctx->ss->unique) r = 2; else if ((uintptr_t)ctx->ss != ctx->ss->mapped) r = 3; else { SHA256_Init(&ctx->ctx); SHA256_Update(&ctx->ctx, ctx->ss, offsetof(struct smp_sign, length)); SHA256_Update(&ctx->ctx, SIGN_DATA(ctx), ctx->ss->length); cx = ctx->ctx; SHA256_Update(&cx, &ctx->ss->length, sizeof(ctx->ss->length)); SHA256_Final(sign, &cx); if (memcmp(sign, SIGN_END(ctx), sizeof sign)) r = 4; } if (r) { fprintf(stderr, "CHK(%p %s %p %s) = %d\n", ctx, ctx->id, ctx->ss, r > 1 ? ctx->ss->ident : "", r); } return (r); } /*-------------------------------------------------------------------- * Append data to a signature */ void smp_append_sign(struct smp_signctx *ctx, const void *ptr, uint32_t len) { struct SHA256Context cx; unsigned char sign[SHA256_LEN]; if (len != 0) { SHA256_Update(&ctx->ctx, ptr, len); ctx->ss->length += len; } cx = ctx->ctx; SHA256_Update(&cx, &ctx->ss->length, sizeof(ctx->ss->length)); SHA256_Final(sign, &cx); memcpy(SIGN_END(ctx), sign, sizeof sign); } /*-------------------------------------------------------------------- * Reset a signature to empty, prepare for appending. */ void smp_reset_sign(struct smp_signctx *ctx) { memset(ctx->ss, 0, sizeof *ctx->ss); assert(strlen(ctx->id) < sizeof *ctx->ss); strcpy(ctx->ss->ident, ctx->id); ctx->ss->unique = ctx->unique; ctx->ss->mapped = (uintptr_t)ctx->ss; SHA256_Init(&ctx->ctx); SHA256_Update(&ctx->ctx, ctx->ss, offsetof(struct smp_sign, length)); smp_append_sign(ctx, NULL, 0); } /*-------------------------------------------------------------------- * Force a write of a signature block to the backing store. */ void smp_sync_sign(const struct smp_signctx *ctx) { smp_msync(ctx->ss, SMP_SIGN_SPACE + ctx->ss->length); } /*-------------------------------------------------------------------- * Create and force a new signature to backing store */ static void smp_new_sign(const struct smp_sc *sc, struct smp_signctx *ctx, uint64_t off, const char *id) { smp_def_sign(sc, ctx, off, id); smp_reset_sign(ctx); smp_sync_sign(ctx); } /*-------------------------------------------------------------------- * Define a signature space by location, size and identifier */ void smp_def_signspace(const struct smp_sc *sc, struct smp_signspace *spc, uint64_t off, uint64_t size, const char *id) { smp_def_sign(sc, &spc->ctx, off, id); spc->start = SIGN_DATA(&spc->ctx); spc->size = size - SMP_SIGN_SPACE; } /*-------------------------------------------------------------------- * Check that a signspace's signature space is good, leave state ready * for append */ int smp_chk_signspace(struct smp_signspace *spc) { return (smp_chk_sign(&spc->ctx)); } /*-------------------------------------------------------------------- * Append data to a signature space */ void smp_append_signspace(struct smp_signspace *spc, uint32_t len) { assert(len <= SIGNSPACE_FREE(spc)); smp_append_sign(&spc->ctx, SIGNSPACE_FRONT(spc), len); } /*-------------------------------------------------------------------- * Reset a signature space to empty, prepare for appending. */ void smp_reset_signspace(struct smp_signspace *spc) { smp_reset_sign(&spc->ctx); } /*-------------------------------------------------------------------- * Copy the contents of one signspace to another. Prepare for * appending. */ void smp_copy_signspace(struct smp_signspace *dst, const struct smp_signspace *src) { assert(SIGNSPACE_LEN(src) <= dst->size); smp_reset_signspace(dst); memcpy(SIGNSPACE_DATA(dst), SIGNSPACE_DATA(src), SIGNSPACE_LEN(src)); smp_append_signspace(dst, SIGNSPACE_LEN(src)); assert(SIGNSPACE_LEN(src) == SIGNSPACE_LEN(dst)); } /*-------------------------------------------------------------------- * Reapplies the sign over the len first bytes of the * signspace. Prepares for appending. */ void smp_trunc_signspace(struct smp_signspace *spc, uint32_t len) { assert(len <= SIGNSPACE_LEN(spc)); spc->ctx.ss->length = 0; SHA256_Init(&spc->ctx.ctx); SHA256_Update(&spc->ctx.ctx, spc->ctx.ss, offsetof(struct smp_sign, length)); smp_append_signspace(spc, len); } /*-------------------------------------------------------------------- * Create a new signature space and force the signature to backing store. */ static void smp_new_signspace(const struct smp_sc *sc, struct smp_signspace *spc, uint64_t off, uint64_t size, const char *id) { smp_new_sign(sc, &spc->ctx, off, id); spc->start = SIGN_DATA(&spc->ctx); spc->size = size - SMP_SIGN_SPACE; } /*-------------------------------------------------------------------- * Force a write of a memory block (rounded to nearest pages) to * the backing store. */ void smp_msync(void *addr, size_t length) { uintptr_t start, end, pagesize; pagesize = getpagesize(); assert(pagesize > 0 && PWR2(pagesize)); start = RDN2((uintptr_t)addr, pagesize); end = RUP2((uintptr_t)addr + length, pagesize); assert(start < end); AZ(msync((void *)start, end - start, MS_SYNC)); } /*-------------------------------------------------------------------- * Initialize a Silo with a valid but empty structure. * * XXX: more intelligent sizing of things. */ void smp_newsilo(struct smp_sc *sc) { struct smp_ident *si; ASSERT_MGT(); assert(strlen(SMP_IDENT_STRING) < sizeof si->ident); /* Choose a new random number */ sc->unique = random(); smp_reset_sign(&sc->idn); si = sc->ident; memset(si, 0, sizeof *si); strcpy(si->ident, SMP_IDENT_STRING); si->byte_order = 0x12345678; si->size = sizeof *si; si->major_version = 2; si->unique = sc->unique; si->mediasize = sc->mediasize; si->granularity = sc->granularity; /* * Aim for cache-line-width */ si->align = sizeof(void*) * 2; sc->align = si->align; si->stuff[SMP_BAN1_STUFF] = sc->granularity; si->stuff[SMP_BAN2_STUFF] = si->stuff[SMP_BAN1_STUFF] + 1024*1024; si->stuff[SMP_SEG1_STUFF] = si->stuff[SMP_BAN2_STUFF] + 1024*1024; si->stuff[SMP_SEG2_STUFF] = si->stuff[SMP_SEG1_STUFF] + 1024*1024; si->stuff[SMP_SPC_STUFF] = si->stuff[SMP_SEG2_STUFF] + 1024*1024; si->stuff[SMP_END_STUFF] = si->mediasize; assert(si->stuff[SMP_SPC_STUFF] < si->stuff[SMP_END_STUFF]); smp_new_signspace(sc, &sc->ban1, si->stuff[SMP_BAN1_STUFF], smp_stuff_len(sc, SMP_BAN1_STUFF), "BAN 1"); smp_new_signspace(sc, &sc->ban2, si->stuff[SMP_BAN2_STUFF], smp_stuff_len(sc, SMP_BAN2_STUFF), "BAN 2"); smp_new_signspace(sc, &sc->seg1, si->stuff[SMP_SEG1_STUFF], smp_stuff_len(sc, SMP_SEG1_STUFF), "SEG 1"); smp_new_signspace(sc, &sc->seg2, si->stuff[SMP_SEG2_STUFF], smp_stuff_len(sc, SMP_SEG2_STUFF), "SEG 2"); smp_append_sign(&sc->idn, si, sizeof *si); smp_sync_sign(&sc->idn); } /*-------------------------------------------------------------------- * Check if a silo is valid. */ int smp_valid_silo(struct smp_sc *sc) { struct smp_ident *si; int i, j; assert(strlen(SMP_IDENT_STRING) < sizeof si->ident); i = smp_chk_sign(&sc->idn); if (i) return (i); si = sc->ident; if (strcmp(si->ident, SMP_IDENT_STRING)) return (12); if (si->byte_order != 0x12345678) return (13); if (si->size != sizeof *si) return (14); if (si->major_version != 2) return (15); if (si->mediasize != sc->mediasize) return (17); if (si->granularity != sc->granularity) return (18); if (si->align < sizeof(void*)) return (19); if (!PWR2(si->align)) return (20); sc->align = si->align; sc->unique = si->unique; /* XXX: Sanity check stuff[6] */ assert(si->stuff[SMP_BAN1_STUFF] > sizeof *si + SHA256_LEN); assert(si->stuff[SMP_BAN2_STUFF] > si->stuff[SMP_BAN1_STUFF]); assert(si->stuff[SMP_SEG1_STUFF] > si->stuff[SMP_BAN2_STUFF]); assert(si->stuff[SMP_SEG2_STUFF] > si->stuff[SMP_SEG1_STUFF]); assert(si->stuff[SMP_SPC_STUFF] > si->stuff[SMP_SEG2_STUFF]); assert(si->stuff[SMP_END_STUFF] == sc->mediasize); assert(smp_stuff_len(sc, SMP_SEG1_STUFF) > 65536); assert(smp_stuff_len(sc, SMP_SEG1_STUFF) == smp_stuff_len(sc, SMP_SEG2_STUFF)); assert(smp_stuff_len(sc, SMP_BAN1_STUFF) > 65536); assert(smp_stuff_len(sc, SMP_BAN1_STUFF) == smp_stuff_len(sc, SMP_BAN2_STUFF)); smp_def_signspace(sc, &sc->ban1, si->stuff[SMP_BAN1_STUFF], smp_stuff_len(sc, SMP_BAN1_STUFF), "BAN 1"); smp_def_signspace(sc, &sc->ban2, si->stuff[SMP_BAN2_STUFF], smp_stuff_len(sc, SMP_BAN2_STUFF), "BAN 2"); smp_def_signspace(sc, &sc->seg1, si->stuff[SMP_SEG1_STUFF], smp_stuff_len(sc, SMP_SEG1_STUFF), "SEG 1"); smp_def_signspace(sc, &sc->seg2, si->stuff[SMP_SEG2_STUFF], smp_stuff_len(sc, SMP_SEG2_STUFF), "SEG 2"); /* We must have one valid BAN table */ i = smp_chk_signspace(&sc->ban1); j = smp_chk_signspace(&sc->ban2); if (i && j) return (100 + i * 10 + j); /* We must have one valid SEG table */ i = smp_chk_signspace(&sc->seg1); j = smp_chk_signspace(&sc->seg2); if (i && j) return (200 + i * 10 + j); return (0); } varnish-4.1.1/bin/varnishd/storage/storage_persistent.c0000644000201500234410000004057312652366721020251 00000000000000/*- * Copyright (c) 2008-2011 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. * * Persistent storage method * * XXX: Before we start the client or maybe after it stops, we should give the * XXX: stevedores a chance to examine their storage for consistency. * * XXX: Do we ever free the LRU-lists ? */ #include "config.h" #include #include #include #include #include #include "cache/cache.h" #include "storage/storage.h" #include "hash/hash_slinger.h" #include "vcli.h" #include "vcli_priv.h" #include "vsha256.h" #include "vtim.h" #include "storage/storage_persistent.h" /*--------------------------------------------------------------------*/ /* * silos is unlocked, it only changes during startup when we are * single-threaded */ static VTAILQ_HEAD(,smp_sc) silos = VTAILQ_HEAD_INITIALIZER(silos); /*-------------------------------------------------------------------- * Add bans to silos */ static int smp_appendban(struct smp_sc *sc, struct smp_signspace *spc, uint32_t len, const uint8_t *ban) { (void)sc; if (SIGNSPACE_FREE(spc) < len) return (-1); memcpy(SIGNSPACE_FRONT(spc), ban, len); smp_append_signspace(spc, len); return (0); } /* Trust that cache_ban.c takes care of locking */ static int smp_baninfo(const struct stevedore *stv, enum baninfo event, const uint8_t *ban, unsigned len) { struct smp_sc *sc; int r = 0; CAST_OBJ_NOTNULL(sc, stv->priv, SMP_SC_MAGIC); switch (event) { case BI_NEW: r |= smp_appendban(sc, &sc->ban1, len, ban); r |= smp_appendban(sc, &sc->ban2, len, ban); break; default: /* Ignored */ break; } return (r); } static void smp_banexport_spc(struct smp_signspace *spc, const uint8_t *bans, unsigned len) { smp_reset_signspace(spc); assert(SIGNSPACE_FREE(spc) >= len); memcpy(SIGNSPACE_DATA(spc), bans, len); smp_append_signspace(spc, len); smp_sync_sign(&spc->ctx); } static void smp_banexport(const struct stevedore *stv, const uint8_t *bans, unsigned len) { struct smp_sc *sc; CAST_OBJ_NOTNULL(sc, stv->priv, SMP_SC_MAGIC); smp_banexport_spc(&sc->ban1, bans, len); smp_banexport_spc(&sc->ban2, bans, len); } /*-------------------------------------------------------------------- * Attempt to open and read in a ban list */ static int smp_open_bans(struct smp_sc *sc, struct smp_signspace *spc) { uint8_t *ptr, *pe; int i; ASSERT_CLI(); (void)sc; i = smp_chk_signspace(spc); if (i) return (i); ptr = SIGNSPACE_DATA(spc); pe = SIGNSPACE_FRONT(spc); BAN_Reload(ptr, pe - ptr); return (0); } /*-------------------------------------------------------------------- * Attempt to open and read in a segment list */ static int smp_open_segs(struct smp_sc *sc, struct smp_signspace *spc) { uint64_t length, l; struct smp_segptr *ss, *se; struct smp_seg *sg, *sg1, *sg2; int i, n = 0; ASSERT_CLI(); i = smp_chk_signspace(spc); if (i) return (i); ss = SIGNSPACE_DATA(spc); length = SIGNSPACE_LEN(spc); if (length == 0) { /* No segments */ sc->free_offset = sc->ident->stuff[SMP_SPC_STUFF]; return (0); } se = ss + length / sizeof *ss; se--; assert(ss <= se); /* * Locate the free reserve, there are only two basic cases, * but once we start dropping segments, things gets more complicated. */ sc->free_offset = se->offset + se->length; l = sc->mediasize - sc->free_offset; if (se->offset > ss->offset && l >= sc->free_reserve) { /* * [__xxxxyyyyzzzz___] * Plenty of space at tail, do nothing. */ } else if (ss->offset > se->offset) { /* * [zzzz____xxxxyyyy_] * (make) space between ends * We might nuke the entire tail end without getting * enough space, in which case we fall through to the * last check. */ while (ss < se && ss->offset > se->offset) { l = ss->offset - (se->offset + se->length); if (l > sc->free_reserve) break; ss++; n++; } } if (l < sc->free_reserve) { /* * [__xxxxyyyyzzzz___] * (make) space at front */ sc->free_offset = sc->ident->stuff[SMP_SPC_STUFF]; while (ss < se) { l = ss->offset - sc->free_offset; if (l > sc->free_reserve) break; ss++; n++; } } assert(l >= sc->free_reserve); sg1 = NULL; sg2 = NULL; for(; ss <= se; ss++) { ALLOC_OBJ(sg, SMP_SEG_MAGIC); AN(sg); sg->lru = LRU_Alloc(); CHECK_OBJ_NOTNULL(sg->lru, LRU_MAGIC); sg->p = *ss; sg->flags |= SMP_SEG_MUSTLOAD; /* * HACK: prevent save_segs from nuking segment until we have * HACK: loaded it. */ sg->nobj = 1; if (sg1 != NULL) { assert(sg1->p.offset != sg->p.offset); if (sg1->p.offset < sg->p.offset) assert(smp_segend(sg1) <= sg->p.offset); else assert(smp_segend(sg) <= sg1->p.offset); } if (sg2 != NULL) { assert(sg2->p.offset != sg->p.offset); if (sg2->p.offset < sg->p.offset) assert(smp_segend(sg2) <= sg->p.offset); else assert(smp_segend(sg) <= sg2->p.offset); } /* XXX: check that they are inside silo */ /* XXX: check that they don't overlap */ /* XXX: check that they are serial */ sg->sc = sc; VTAILQ_INSERT_TAIL(&sc->segments, sg, list); sg2 = sg; if (sg1 == NULL) sg1 = sg; } printf("Dropped %d segments to make free_reserve\n", n); return (0); } /*-------------------------------------------------------------------- * Silo worker thread */ static void * __match_proto__(bgthread_t) smp_thread(struct worker *wrk, void *priv) { struct smp_sc *sc; struct smp_seg *sg; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CAST_OBJ_NOTNULL(sc, priv, SMP_SC_MAGIC); sc->thread = pthread_self(); /* First, load all the objects from all segments */ VTAILQ_FOREACH(sg, &sc->segments, list) if (sg->flags & SMP_SEG_MUSTLOAD) smp_load_seg(wrk, sc, sg); sc->flags |= SMP_SC_LOADED; BAN_Release(); printf("Silo completely loaded\n"); /* Housekeeping loop */ Lck_Lock(&sc->mtx); while (!(sc->flags & SMP_SC_STOP)) { sg = VTAILQ_FIRST(&sc->segments); if (sg != NULL && sg != sc->cur_seg && sg->nobj == 0) smp_save_segs(sc); Lck_Unlock(&sc->mtx); VTIM_sleep(3.14159265359 - 2); Lck_Lock(&sc->mtx); } smp_save_segs(sc); Lck_Unlock(&sc->mtx); pthread_exit(0); NEEDLESS_RETURN(NULL); } /*-------------------------------------------------------------------- * Open a silo in the worker process */ static void smp_open(const struct stevedore *st) { struct smp_sc *sc; ASSERT_CLI(); CAST_OBJ_NOTNULL(sc, st->priv, SMP_SC_MAGIC); Lck_New(&sc->mtx, lck_smp); Lck_Lock(&sc->mtx); sc->stevedore = st; /* We trust the parent to give us a valid silo, for good measure: */ AZ(smp_valid_silo(sc)); AZ(mprotect((void*)sc->base, 4096, PROT_READ)); sc->ident = SIGN_DATA(&sc->idn); /* Check ban lists */ if (smp_chk_signspace(&sc->ban1)) { /* Ban list 1 is broken, use ban2 */ AZ(smp_chk_signspace(&sc->ban2)); smp_copy_signspace(&sc->ban1, &sc->ban2); smp_sync_sign(&sc->ban1.ctx); } else { /* Ban1 is OK, copy to ban2 for consistency */ smp_copy_signspace(&sc->ban2, &sc->ban1); smp_sync_sign(&sc->ban2.ctx); } AZ(smp_open_bans(sc, &sc->ban1)); /* We attempt seg1 first, and if that fails, try seg2 */ if (smp_open_segs(sc, &sc->seg1)) AZ(smp_open_segs(sc, &sc->seg2)); /* * Grap a reference to the tail of the ban list, until the thread * has loaded all objects, so we can be sure that all of our * proto-bans survive until then. */ BAN_Hold(); /* XXX: save segments to ensure consistency between seg1 & seg2 ? */ /* XXX: abandon early segments to make sure we have free space ? */ /* Open a new segment, so we are ready to write */ smp_new_seg(sc); /* Start the worker silo worker thread, it will load the objects */ WRK_BgThread(&sc->bgthread, "persistence", smp_thread, sc); VTAILQ_INSERT_TAIL(&silos, sc, list); Lck_Unlock(&sc->mtx); } /*-------------------------------------------------------------------- * Close a silo */ static void smp_signal_close(const struct stevedore *st) { struct smp_sc *sc; ASSERT_CLI(); CAST_OBJ_NOTNULL(sc, st->priv, SMP_SC_MAGIC); Lck_Lock(&sc->mtx); if (sc->cur_seg != NULL) smp_close_seg(sc, sc->cur_seg); AZ(sc->cur_seg); sc->flags |= SMP_SC_STOP; Lck_Unlock(&sc->mtx); } static void smp_close(const struct stevedore *st) { struct smp_sc *sc; void *status; ASSERT_CLI(); CAST_OBJ_NOTNULL(sc, st->priv, SMP_SC_MAGIC); AZ(pthread_join(sc->bgthread, &status)); AZ(status); } /*-------------------------------------------------------------------- * Allocate a bite. * * Allocate [min_size...max_size] space from the bottom of the segment, * as is convenient. * * If 'so' + 'idx' is given, also allocate a smp_object from the top * of the segment. * * Return the segment in 'ssg' if given. */ static struct storage * smp_allocx(const struct stevedore *st, size_t min_size, size_t max_size, struct smp_object **so, unsigned *idx, struct smp_seg **ssg) { struct smp_sc *sc; struct storage *ss; struct smp_seg *sg; uint64_t left, extra; CAST_OBJ_NOTNULL(sc, st->priv, SMP_SC_MAGIC); assert(min_size <= max_size); max_size = IRNUP(sc, max_size); min_size = IRNUP(sc, min_size); extra = IRNUP(sc, sizeof(*ss)); if (so != NULL) { extra += sizeof(**so); AN(idx); } Lck_Lock(&sc->mtx); sg = NULL; ss = NULL; left = 0; if (sc->cur_seg != NULL) left = smp_spaceleft(sc, sc->cur_seg); if (left < extra + min_size) { if (sc->cur_seg != NULL) smp_close_seg(sc, sc->cur_seg); smp_new_seg(sc); if (sc->cur_seg != NULL) left = smp_spaceleft(sc, sc->cur_seg); else left = 0; } if (left >= extra + min_size) { AN(sc->cur_seg); if (left < extra + max_size) max_size = IRNDN(sc, left - extra); sg = sc->cur_seg; ss = (void*)(sc->base + sc->next_bot); sc->next_bot += max_size + IRNUP(sc, sizeof(*ss)); sg->nalloc++; if (so != NULL) { sc->next_top -= sizeof(**so); *so = (void*)(sc->base + sc->next_top); /* Render this smp_object mostly harmless */ EXP_Clr(&(*so)->exp); (*so)->ban = 0.; (*so)->ptr = 0; sg->objs = *so; *idx = ++sg->p.lobjlist; } (void)smp_spaceleft(sc, sg); /* for the assert */ } Lck_Unlock(&sc->mtx); if (ss == NULL) return (ss); AN(sg); assert(max_size >= min_size); /* Fill the storage structure */ INIT_OBJ(ss, STORAGE_MAGIC); ss->ptr = PRNUP(sc, ss + 1); ss->space = max_size; ss->priv = sc; if (ssg != NULL) *ssg = sg; return (ss); } /*-------------------------------------------------------------------- * Allocate an object */ static int smp_allocobj(const struct stevedore *stv, struct objcore *oc, unsigned wsl) { struct object *o; struct storage *st; struct smp_sc *sc; struct smp_seg *sg; struct smp_object *so; unsigned objidx; unsigned ltot; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CAST_OBJ_NOTNULL(sc, stv->priv, SMP_SC_MAGIC); /* Don't entertain already dead objects */ if ((oc->exp.ttl + oc->exp.grace + oc->exp.keep) <= 0.) return (0); ltot = sizeof(struct object) + PRNDUP(wsl); ltot = IRNUP(sc, ltot); st = smp_allocx(stv, ltot, ltot, &so, &objidx, &sg); if (st == NULL) return (0); assert(st->space >= ltot); o = STV_MkObject(stv, oc, st->ptr); AN(oc->stobj->stevedore); assert(oc->stobj->stevedore == stv); CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); o->objstore = st; st->len = sizeof(*o); Lck_Lock(&sc->mtx); sg->nfixed++; sg->nobj++; /* We have to do this somewhere, might as well be here... */ assert(sizeof so->hash == DIGEST_LEN); memcpy(so->hash, oc->objhead->digest, DIGEST_LEN); so->exp = oc->exp; so->ptr = (uint8_t*)o - sc->base; so->ban = BAN_Time(oc->ban); smp_init_oc(oc, sg, objidx); Lck_Unlock(&sc->mtx); return (1); } /*-------------------------------------------------------------------- * Allocate a bite */ static struct storage * smp_alloc(const struct stevedore *st, size_t size) { return (smp_allocx(st, size > 4096 ? 4096 : size, size, NULL, NULL, NULL)); } /*-------------------------------------------------------------------- * We don't track frees of storage, we track the objects which own the * storage and when there are no more objects in in the first segment, * it can be reclaimed. * XXX: We could free the last allocation, but does that happen ? */ static void __match_proto__(storage_free_f) smp_free(struct storage *st) { /* XXX */ (void)st; } /*--------------------------------------------------------------------*/ const struct stevedore smp_stevedore = { .magic = STEVEDORE_MAGIC, .name = "deprecated_persistent", .init = smp_mgt_init, .open = smp_open, .close = smp_close, .alloc = smp_alloc, .allocobj = smp_allocobj, .free = smp_free, .signal_close = smp_signal_close, .baninfo = smp_baninfo, .banexport = smp_banexport, .methods = &smp_oc_methods, }; /*-------------------------------------------------------------------- * Persistence is a bear to test unadultered, so we cheat by adding * a cli command we can use to make it do tricks for us. */ static void debug_report_silo(struct cli *cli, const struct smp_sc *sc, int objs) { struct smp_seg *sg; struct objcore *oc; VCLI_Out(cli, "Silo: %s (%s)\n", sc->stevedore->ident, sc->filename); VTAILQ_FOREACH(sg, &sc->segments, list) { VCLI_Out(cli, " Seg: [0x%jx ... +0x%jx]\n", (uintmax_t)sg->p.offset, (uintmax_t)sg->p.length); if (sg == sc->cur_seg) VCLI_Out(cli, " Alloc: [0x%jx ... 0x%jx] = 0x%jx free\n", (uintmax_t)(sc->next_bot), (uintmax_t)(sc->next_top), (uintmax_t)(sc->next_top - sc->next_bot)); VCLI_Out(cli, " %u nobj, %u alloc, %u lobjlist, %u fixed\n", sg->nobj, sg->nalloc, sg->p.lobjlist, sg->nfixed); if (objs) { VTAILQ_FOREACH(oc, &sg->lru->lru_head, lru_list) VCLI_Out(cli, " OC %p\n", oc); } } } static void debug_persistent(struct cli *cli, const char * const * av, void *priv) { struct smp_sc *sc; (void)priv; if (av[2] == NULL) { VTAILQ_FOREACH(sc, &silos, list) debug_report_silo(cli, sc, 0); return; } VTAILQ_FOREACH(sc, &silos, list) if (!strcmp(av[2], sc->stevedore->ident)) break; if (sc == NULL) { VCLI_Out(cli, "Silo <%s> not found\n", av[2]); VCLI_SetResult(cli, CLIS_PARAM); return; } if (av[3] == NULL) { debug_report_silo(cli, sc, 0); return; } Lck_Lock(&sc->mtx); if (!strcmp(av[3], "sync")) { if (sc->cur_seg != NULL) smp_close_seg(sc, sc->cur_seg); smp_new_seg(sc); } else if (!strcmp(av[3], "dump")) { debug_report_silo(cli, sc, 1); } else { VCLI_Out(cli, "Unknown operation\n"); VCLI_SetResult(cli, CLIS_PARAM); } Lck_Unlock(&sc->mtx); } static struct cli_proto debug_cmds[] = { { "debug.persistent", "debug.persistent", "Persistent debugging magic:\n" "\tdebug.persistent [ []]\n" "With no cmd arg, a summary of the silo is returned.\n" "Possible commands:\n" "\tsync\tClose current segment, open a new one\n" "\tdump\tinclude objcores in silo summary", 0, 2, "d", debug_persistent }, { NULL } }; /*--------------------------------------------------------------------*/ void SMP_Init(void) { CLI_AddFuncs(debug_cmds); } /*-------------------------------------------------------------------- * Pause until all silos have loaded. */ void SMP_Ready(void) { struct smp_sc *sc; ASSERT_CLI(); do { VTAILQ_FOREACH(sc, &silos, list) if (!(sc->flags & SMP_SC_LOADED)) break; if (sc != NULL) (void)sleep(1); } while (sc != NULL); } varnish-4.1.1/bin/varnishd/storage/mgt_storage_persistent.c0000644000201500234410000001361712652366721021117 00000000000000/*- * Copyright (c) 2008-2011 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. * * Persistent storage method * * XXX: Before we start the client or maybe after it stops, we should give the * XXX: stevedores a chance to examine their storage for consistency. * * XXX: Do we ever free the LRU-lists ? */ #include "config.h" #include #include #include #include #include #include "cache/cache.h" #include "storage/storage.h" #include "vsha256.h" #include "storage/storage_persistent.h" #ifndef MAP_NOCORE #define MAP_NOCORE 0 /* XXX Linux */ #endif #ifndef MAP_NOSYNC #define MAP_NOSYNC 0 /* XXX Linux */ #endif /*-------------------------------------------------------------------- * Calculate cleaner metrics from silo dimensions */ static void smp_metrics(struct smp_sc *sc) { /* * We do not want to loose too big chunks of the silos * content when we are forced to clean a segment. * * For now insist that a segment covers no more than 1% of the silo. * * XXX: This should possibly depend on the size of the silo so * XXX: trivially small silos do not run into trouble along * XXX: the lines of "one object per segment". */ sc->min_nseg = 10; sc->max_segl = smp_stuff_len(sc, SMP_SPC_STUFF) / sc->min_nseg; fprintf(stderr, "min_nseg = %u, max_segl = %ju\n", sc->min_nseg, (uintmax_t)sc->max_segl); /* * The number of segments are limited by the size of the segment * table(s) and from that follows the minimum size of a segmement. */ sc->max_nseg = smp_stuff_len(sc, SMP_SEG1_STUFF) / sc->min_nseg; sc->min_segl = smp_stuff_len(sc, SMP_SPC_STUFF) / sc->max_nseg; while (sc->min_segl < sizeof(struct object)) { sc->max_nseg /= 2; sc->min_segl = smp_stuff_len(sc, SMP_SPC_STUFF) / sc->max_nseg; } fprintf(stderr, "max_nseg = %u, min_segl = %ju\n", sc->max_nseg, (uintmax_t)sc->min_segl); /* * Set our initial aim point at the exponential average of the * two extremes. * * XXX: This is a pretty arbitrary choice, but having no idea * XXX: object count, size distribution or ttl pattern at this * XXX: point, we have to do something. */ sc->aim_nseg = (unsigned) exp((log(sc->min_nseg) + log(sc->max_nseg))*.5); sc->aim_segl = smp_stuff_len(sc, SMP_SPC_STUFF) / sc->aim_nseg; fprintf(stderr, "aim_nseg = %u, aim_segl = %ju\n", sc->aim_nseg, (uintmax_t)sc->aim_segl); /* * How much space in the free reserve pool ? */ sc->free_reserve = sc->aim_segl * 10; fprintf(stderr, "free_reserve = %ju\n", (uintmax_t)sc->free_reserve); } /*-------------------------------------------------------------------- * Set up persistent storage silo in the master process. */ void smp_mgt_init(struct stevedore *parent, int ac, char * const *av) { struct smp_sc *sc; struct smp_sign sgn; void *target; int i; ASSERT_MGT(); AZ(av[ac]); /* Necessary alignment. See also smp_object::__filler__ */ assert(sizeof(struct smp_object) % 8 == 0); #define SIZOF(foo) fprintf(stderr, \ "sizeof(%s) = %zu = 0x%zx\n", #foo, sizeof(foo), sizeof(foo)); SIZOF(struct smp_ident); SIZOF(struct smp_sign); SIZOF(struct smp_segptr); SIZOF(struct smp_object); #undef SIZOF /* See comments in storage_persistent.h */ assert(sizeof(struct smp_ident) == SMP_IDENT_SIZE); /* Allocate softc */ ALLOC_OBJ(sc, SMP_SC_MAGIC); XXXAN(sc); sc->parent = parent; sc->fd = -1; VTAILQ_INIT(&sc->segments); /* Argument processing */ if (ac != 2) ARGV_ERR("(-spersistent) wrong number of arguments\n"); i = STV_GetFile(av[0], &sc->fd, &sc->filename, "-spersistent"); if (i == 2) ARGV_ERR("(-spersistent) need filename (not directory)\n"); sc->align = sizeof(void*) * 2; sc->granularity = getpagesize(); sc->mediasize = STV_FileSize(sc->fd, av[1], &sc->granularity, "-spersistent"); AZ(ftruncate(sc->fd, sc->mediasize)); /* Try to determine correct mmap address */ i = read(sc->fd, &sgn, sizeof sgn); assert(i == sizeof sgn); if (!strcmp(sgn.ident, "SILO")) target = (void*)(uintptr_t)sgn.mapped; else target = NULL; sc->base = (void*)mmap(target, sc->mediasize, PROT_READ|PROT_WRITE, MAP_NOCORE | MAP_NOSYNC | MAP_SHARED, sc->fd, 0); if (sc->base == MAP_FAILED) ARGV_ERR("(-spersistent) failed to mmap (%s)\n", strerror(errno)); smp_def_sign(sc, &sc->idn, 0, "SILO"); sc->ident = SIGN_DATA(&sc->idn); i = smp_valid_silo(sc); if (i) { printf("Warning SILO (%s) not reloaded (reason=%d)\n", sc->filename, i); smp_newsilo(sc); } AZ(smp_valid_silo(sc)); smp_metrics(sc); parent->priv = sc; /* XXX: only for sendfile I guess... */ mgt_child_inherit(sc->fd, "storage_persistent"); } varnish-4.1.1/bin/varnishd/storage/storage_umem.c0000644000201500234410000001004712652366721017005 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Storage method based on umem_alloc(3MALLOC) */ #include "config.h" #ifdef HAVE_LIBUMEM #include #include #include #include #include "cache/cache.h" #include "storage/storage.h" static size_t smu_max = SIZE_MAX; static MTX smu_mtx; struct smu { struct storage s; size_t sz; }; static struct storage * smu_alloc(const struct stevedore *st, size_t size) { struct smu *smu; Lck_Lock(&smu_mtx); VSC_C_main->sma_nreq++; if (VSC_C_main->sma_nbytes + size > smu_max) size = 0; else { VSC_C_main->sma_nobj++; VSC_C_main->sma_nbytes += size; VSC_C_main->sma_balloc += size; } Lck_Unlock(&smu_mtx); if (size == 0) return (NULL); smu = umem_zalloc(sizeof *smu, UMEM_DEFAULT); if (smu == NULL) return (NULL); smu->sz = size; smu->s.priv = smu; smu->s.ptr = umem_alloc(size, UMEM_DEFAULT); XXXAN(smu->s.ptr); smu->s.len = 0; smu->s.space = size; smu->s.fd = -1; smu->s.stevedore = st; smu->s.magic = STORAGE_MAGIC; return (&smu->s); } static void smu_free(struct storage *s) { struct smu *smu; CHECK_OBJ_NOTNULL(s, STORAGE_MAGIC); smu = s->priv; assert(smu->sz == smu->s.space); Lck_Lock(&smu_mtx); VSC_C_main->sma_nobj--; VSC_C_main->sma_nbytes -= smu->sz; VSC_C_main->sma_bfree += smu->sz; Lck_Unlock(&smu_mtx); umem_free(smu->s.ptr, smu->s.space); umem_free(smu, sizeof *smu); } static void smu_trim(const struct storage *s, size_t size) { struct smu *smu; void *p; CHECK_OBJ_NOTNULL(s, STORAGE_MAGIC); smu = s->priv; assert(smu->sz == smu->s.space); if ((p = umem_alloc(size, UMEM_DEFAULT)) != NULL) { memcpy(p, smu->s.ptr, size); umem_free(smu->s.ptr, smu->s.space); Lck_Lock(&smu_mtx); VSC_C_main->sma_nbytes -= (smu->sz - size); VSC_C_main->sma_bfree += smu->sz - size; smu->sz = size; Lck_Unlock(&smu_mtx); smu->s.ptr = p; smu->s.space = size; } } static void smu_init(struct stevedore *parent, int ac, char * const *av) { const char *e; uintmax_t u; (void)parent; AZ(av[ac]); if (ac > 1) ARGV_ERR("(-sumem) too many arguments\n"); if (ac == 0 || *av[0] == '\0') return; e = VNUM_2bytes(av[0], &u, 0); if (e != NULL) ARGV_ERR("(-sumem) size \"%s\": %s\n", av[0], e); if ((u != (uintmax_t)(size_t)u)) ARGV_ERR("(-sumem) size \"%s\": too big\n", av[0]); smu_max = u; } static void smu_open(const struct stevedore *st) { (void)st; AZ(pthread_mutex_init(&smu_mtx, NULL)); } const struct stevedore smu_stevedore = { .magic = STEVEDORE_MAGIC, .name = "umem", .init = smu_init, .open = smu_open, .alloc = smu_alloc, .free = smu_free, .trim = smu_trim, .methods = &default_oc_methods, }; #endif /* HAVE_UMEM_H */ varnish-4.1.1/bin/varnishd/storage/storage.h0000644000201500234410000001537512652366721016000 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * This defines the backend interface between the stevedore and the * pluggable storage implementations. * */ struct stevedore; struct sess; struct busyobj; struct objcore; struct worker; struct lru; struct vsl_log; struct vfp_ctx; /* Storage -----------------------------------------------------------*/ struct storage { unsigned magic; #define STORAGE_MAGIC 0x1a4e51c0 VTAILQ_ENTRY(storage) list; void *priv; unsigned char *ptr; unsigned len; unsigned space; }; /* Object ------------------------------------------------------------*/ VTAILQ_HEAD(storagehead, storage); struct object { unsigned magic; #define OBJECT_MAGIC 0x32851d42 struct storage *objstore; char oa_vxid[4]; uint8_t *oa_vary; uint8_t *oa_http; uint8_t oa_flags[1]; char oa_gzipbits[32]; char oa_lastmodified[8]; struct storagehead list; ssize_t len; struct storage *esidata; }; /* Methods on objcore ------------------------------------------------*/ typedef void updatemeta_f(struct worker *, struct objcore *oc); typedef void freeobj_f(struct worker *, struct objcore *oc); typedef struct lru *getlru_f(const struct objcore *oc); /* * Stevedores can either be simple, and provide just this method: */ typedef struct object *getobj_f(struct worker *, struct objcore *oc); /* * Or the can be "complex" and provide all of these methods: * (Described in comments in cache_obj.c) */ typedef void *objiterbegin_f(struct worker *, struct objcore *oc); typedef enum objiter_status objiter_f(struct objcore *oc, void *oix, void **p, ssize_t *l); typedef void objiterend_f(struct objcore *, void **oix); typedef int objgetspace_f(struct worker *, struct objcore *, ssize_t *sz, uint8_t **ptr); typedef void objextend_f(struct worker *, struct objcore *, ssize_t l); typedef void objtrimstore_f(struct worker *, struct objcore *); typedef void objslim_f(struct worker *, struct objcore *); typedef void *objgetattr_f(struct worker *, struct objcore *, enum obj_attr attr, ssize_t *len); typedef void *objsetattr_f(struct worker *, struct objcore *, enum obj_attr attr, ssize_t len, const void *ptr); typedef uint64_t objgetlen_f(struct worker *, struct objcore *); struct storeobj_methods { freeobj_f *freeobj; getlru_f *getlru; updatemeta_f *updatemeta; getobj_f *getobj; objiterbegin_f *objiterbegin; objiter_f *objiter; objiterend_f *objiterend; objgetspace_f *objgetspace; objextend_f *objextend; objgetlen_f *objgetlen; objtrimstore_f *objtrimstore; objslim_f *objslim; objgetattr_f *objgetattr; objsetattr_f *objsetattr; }; /* Prototypes --------------------------------------------------------*/ typedef void storage_init_f(struct stevedore *, int ac, char * const *av); typedef void storage_open_f(const struct stevedore *); typedef struct storage *storage_alloc_f(const struct stevedore *, size_t size); typedef void storage_trim_f(struct storage *, size_t size, int move_ok); typedef void storage_free_f(struct storage *); typedef int storage_allocobj_f(const struct stevedore *, struct objcore *, unsigned ltot); typedef void storage_close_f(const struct stevedore *); typedef void storage_signal_close_f(const struct stevedore *); typedef int storage_baninfo_f(const struct stevedore *, enum baninfo event, const uint8_t *ban, unsigned len); typedef void storage_banexport_f(const struct stevedore *, const uint8_t *bans, unsigned len); /* Prototypes for VCL variable responders */ #define VRTSTVTYPE(ct) typedef ct storage_var_##ct(const struct stevedore *); #include "tbl/vrt_stv_var.h" #undef VRTSTVTYPE extern storage_allocobj_f stv_default_allocobj; extern const struct storeobj_methods default_oc_methods; /*--------------------------------------------------------------------*/ struct stevedore { unsigned magic; #define STEVEDORE_MAGIC 0x4baf43db const char *name; unsigned transient; storage_init_f *init; /* called by mgt process */ storage_open_f *open; /* called by cache process */ storage_alloc_f *alloc; /* --//-- */ storage_trim_f *trim; /* --//-- */ storage_free_f *free; /* --//-- */ storage_close_f *close; /* --//-- */ storage_allocobj_f *allocobj; /* --//-- */ storage_signal_close_f *signal_close; /* --//-- */ storage_baninfo_f *baninfo; /* --//-- */ storage_banexport_f *banexport; /* --//-- */ const struct storeobj_methods *methods; struct lru *lru; #define VRTSTVVAR(nm, vtype, ctype, dval) storage_var_##ctype *var_##nm; #include "tbl/vrt_stv_var.h" #undef VRTSTVVAR /* private fields */ void *priv; VTAILQ_ENTRY(stevedore) list; char ident[16]; /* XXX: match VSM_chunk.ident */ }; VTAILQ_HEAD(stevedore_head, stevedore); extern struct stevedore_head stv_stevedores; extern struct stevedore *stv_transient; /*--------------------------------------------------------------------*/ int STV_GetFile(const char *fn, int *fdp, const char **fnp, const char *ctx); uintmax_t STV_FileSize(int fd, const char *size, unsigned *granularity, const char *ctx); struct object *STV_MkObject(const struct stevedore *, struct objcore *, void *ptr); struct lru *LRU_Alloc(void); void LRU_Free(struct lru *lru); /*--------------------------------------------------------------------*/ extern const struct stevedore sma_stevedore; extern const struct stevedore smf_stevedore; extern const struct stevedore smp_stevedore; #ifdef HAVE_LIBUMEM extern const struct stevedore smu_stevedore; #endif varnish-4.1.1/bin/varnishd/storage/stevedore_utils.c0000644000201500234410000001320312652366721017533 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Utility functions for stevedores and storage modules */ #include "config.h" #include #include #ifdef HAVE_SYS_MOUNT_H # include # include #endif #ifdef HAVE_SYS_STATVFS_H # include #endif #ifdef HAVE_SYS_VFS_H # include #endif #include #include #include #include #include #include #include "mgt/mgt.h" #include "storage/storage.h" #include "vnum.h" #include "vfil.h" #ifndef O_LARGEFILE #define O_LARGEFILE 0 #endif /*-------------------------------------------------------------------- * Get a storage file. * * The fn argument can be an existing file, an existing directory or * a nonexistent filename in an existing directory. * * If a directory is specified, the file will be anonymous (unlinked) * * Return: * 0 if the file was preexisting. * 1 if the file was created. * 2 if the file is anonymous. * * Uses ARGV_ERR to exit in case of trouble. */ int STV_GetFile(const char *fn, int *fdp, const char **fnp, const char *ctx) { int fd; struct stat st; int retval = 1; char buf[FILENAME_MAX]; AN(fn); AN(fnp); AN(fdp); *fnp = NULL; *fdp = -1; /* try to create a new file of this name */ VJ_master(JAIL_MASTER_STORAGE); fd = open(fn, O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE, 0600); if (fd >= 0) { VJ_fix_storage_file(fd); *fdp = fd; *fnp = fn; VJ_master(JAIL_MASTER_LOW); return (retval); } if (stat(fn, &st)) ARGV_ERR( "(%s) \"%s\" does not exist and could not be created\n", ctx, fn); if (S_ISDIR(st.st_mode)) { bprintf(buf, "%s/varnish.XXXXXX", fn); fd = mkstemp(buf); if (fd < 0) ARGV_ERR("(%s) \"%s\" mkstemp(%s) failed (%s)\n", ctx, fn, buf, strerror(errno)); AZ(unlink(buf)); *fnp = strdup(buf); AN(*fnp); retval = 2; } else if (S_ISREG(st.st_mode)) { fd = open(fn, O_RDWR | O_LARGEFILE); if (fd < 0) ARGV_ERR("(%s) \"%s\" could not open (%s)\n", ctx, fn, strerror(errno)); *fnp = fn; retval = 0; } else ARGV_ERR( "(%s) \"%s\" is neither file nor directory\n", ctx, fn); AZ(fstat(fd, &st)); if (!S_ISREG(st.st_mode)) ARGV_ERR("(%s) \"%s\" was not a file after opening\n", ctx, fn); *fdp = fd; VJ_fix_storage_file(fd); VJ_master(JAIL_MASTER_LOW); return (retval); } /*-------------------------------------------------------------------- * Decide file size. * * If the size specification is empty and the file exists with non-zero * size, use that, otherwise, interpret the specification. * * Handle off_t sizes and pointer width limitations. */ uintmax_t STV_FileSize(int fd, const char *size, unsigned *granularity, const char *ctx) { uintmax_t l, fssize; unsigned bs; const char *q; int i; off_t o; struct stat st; AN(granularity); AN(ctx); AZ(fstat(fd, &st)); xxxassert(S_ISREG(st.st_mode)); AZ(VFIL_fsinfo(fd, &bs, &fssize, NULL)); /* Increase granularity if it is lower than the filesystem block size */ if (*granularity < bs) *granularity = bs; if ((size == NULL || *size == '\0') && st.st_size != 0) { /* * We have no size specification, but an existing file, * use its existing size. */ l = st.st_size; } else if (size == NULL || *size == '\0') { ARGV_ERR("(%s) no size specified\n", ctx); } else { AN(size); q = VNUM_2bytes(size, &l, 0); if (q != NULL) ARGV_ERR("(%s) size \"%s\": %s\n", ctx, size, q); if (l < 1024*1024) ARGV_ERR("(%s) size \"%s\": too small, " "did you forget to specify M or G?\n", ctx, size); if (l > fssize) ARGV_ERR("(%s) size \"%s\": larger than file system\n", ctx, size); } /* * This trickery wouldn't be necessary if X/Open would * just add OFF_MAX to ... */ i = 0; while(1) { o = l; if (o == l && o > 0) break; l >>= 1; i++; } if (i) fprintf(stderr, "WARNING: (%s) file size reduced" " to %ju due to system \"off_t\" limitations\n", ctx, l); if (sizeof(void *) == 4 && l > INT32_MAX) { /*lint !e506 !e774 !e845 */ fprintf(stderr, "NB: Storage size limited to 2GB on 32 bit architecture,\n" "NB: otherwise we could run out of address space.\n" ); l = INT32_MAX; } /* Round down */ l -= (l % *granularity); return(l); } varnish-4.1.1/bin/varnishd/storage/storage_persistent_silo.c0000644000201500234410000003405312652366721021273 00000000000000/*- * Copyright (c) 2008-2011 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. * * Persistent storage method * * XXX: Before we start the client or maybe after it stops, we should give the * XXX: stevedores a chance to examine their storage for consistency. * */ #include "config.h" #include #include #include #include "cache/cache.h" #include "storage/storage.h" #include "hash/hash_slinger.h" #include "vsha256.h" #include "vtim.h" #include "storage/storage_persistent.h" /* * We use the low bit to mark objects still needing fixup * In theory this may need to be platform dependent */ #define NEED_FIXUP (1U << 31) /*-------------------------------------------------------------------- * Write the segmentlist back to the silo. * * We write the first copy, sync it synchronously, then write the * second copy and sync it synchronously. * * Provided the kernel doesn't lie, that means we will always have * at least one valid copy on in the silo. */ static void smp_save_seg(const struct smp_sc *sc, struct smp_signspace *spc) { struct smp_segptr *ss; struct smp_seg *sg; uint64_t length; Lck_AssertHeld(&sc->mtx); smp_reset_signspace(spc); ss = SIGNSPACE_DATA(spc); length = 0; VTAILQ_FOREACH(sg, &sc->segments, list) { assert(sg->p.offset < sc->mediasize); assert(sg->p.offset + sg->p.length <= sc->mediasize); *ss = sg->p; ss++; length += sizeof *ss; } smp_append_signspace(spc, length); smp_sync_sign(&spc->ctx); } void smp_save_segs(struct smp_sc *sc) { struct smp_seg *sg, *sg2; Lck_AssertHeld(&sc->mtx); /* * Remove empty segments from the front of the list * before we write the segments to disk. */ VTAILQ_FOREACH_SAFE(sg, &sc->segments, list, sg2) { if (sg->nobj > 0) break; if (sg == sc->cur_seg) continue; VTAILQ_REMOVE(&sc->segments, sg, list); LRU_Free(sg->lru); FREE_OBJ(sg); } smp_save_seg(sc, &sc->seg1); smp_save_seg(sc, &sc->seg2); } /*-------------------------------------------------------------------- * Load segments * * The overall objective is to register the existence of an object, based * only on the minimally sized struct smp_object, without causing the * main object to be faulted in. * * XXX: We can test this by mprotecting the main body of the segment * XXX: until the first fixup happens, or even just over this loop, * XXX: However: the requires that the smp_objects starter further * XXX: into the segment than a page so that they do not get hit * XXX: by the protection. */ void smp_load_seg(struct worker *wrk, const struct smp_sc *sc, struct smp_seg *sg) { struct smp_object *so; struct objcore *oc; uint32_t no; double t_now = VTIM_real(); struct smp_signctx ctx[1]; ASSERT_SILO_THREAD(sc); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(sg, SMP_SEG_MAGIC); CHECK_OBJ_NOTNULL(sg->lru, LRU_MAGIC); assert(sg->flags & SMP_SEG_MUSTLOAD); sg->flags &= ~SMP_SEG_MUSTLOAD; AN(sg->p.offset); if (sg->p.objlist == 0) return; smp_def_sign(sc, ctx, sg->p.offset, "SEGHEAD"); if (smp_chk_sign(ctx)) return; /* test SEGTAIL */ /* test OBJIDX */ so = (void*)(sc->base + sg->p.objlist); sg->objs = so; no = sg->p.lobjlist; /* Clear the bogus "hold" count */ sg->nobj = 0; for (;no > 0; so++,no--) { if (EXP_When(&so->exp) < t_now) continue; ALLOC_OBJ(oc, OBJCORE_MAGIC); AN(oc); oc->flags &= ~OC_F_BUSY; oc->stobj->stevedore = sc->parent; smp_init_oc(oc, sg, no); oc->stobj->priv2 |= NEED_FIXUP; oc->ban = BAN_RefBan(oc, so->ban); HSH_Insert(wrk, so->hash, oc); oc->exp = so->exp; sg->nobj++; EXP_Inject(wrk, oc, sg->lru); } Pool_Sumstat(wrk); sg->flags |= SMP_SEG_LOADED; } /*-------------------------------------------------------------------- * Create a new segment */ void smp_new_seg(struct smp_sc *sc) { struct smp_seg tmpsg; struct smp_seg *sg; AZ(sc->cur_seg); Lck_AssertHeld(&sc->mtx); /* XXX: find where it goes in silo */ INIT_OBJ(&tmpsg, SMP_SEG_MAGIC); tmpsg.sc = sc; tmpsg.p.offset = sc->free_offset; /* XXX: align */ assert(tmpsg.p.offset >= sc->ident->stuff[SMP_SPC_STUFF]); assert(tmpsg.p.offset < sc->mediasize); tmpsg.p.length = sc->aim_segl; tmpsg.p.length = RDN2(tmpsg.p.length, 8); if (smp_segend(&tmpsg) > sc->mediasize) /* XXX: Consider truncation in this case */ tmpsg.p.offset = sc->ident->stuff[SMP_SPC_STUFF]; assert(smp_segend(&tmpsg) <= sc->mediasize); sg = VTAILQ_FIRST(&sc->segments); if (sg != NULL && tmpsg.p.offset <= sg->p.offset) { if (smp_segend(&tmpsg) > sg->p.offset) /* No more space, return (cur_seg will be NULL) */ /* XXX: Consider truncation instead of failing */ return; assert(smp_segend(&tmpsg) <= sg->p.offset); } if (tmpsg.p.offset == sc->ident->stuff[SMP_SPC_STUFF]) printf("Wrapped silo\n"); ALLOC_OBJ(sg, SMP_SEG_MAGIC); if (sg == NULL) /* Failed allocation */ return; *sg = tmpsg; sg->lru = LRU_Alloc(); CHECK_OBJ_NOTNULL(sg->lru, LRU_MAGIC); sg->lru->flags |= LRU_F_DONTMOVE; sg->p.offset = IRNUP(sc, sg->p.offset); sg->p.length -= sg->p.offset - tmpsg.p.offset; sg->p.length = IRNDN(sc, sg->p.length); assert(sg->p.offset + sg->p.length <= tmpsg.p.offset + tmpsg.p.length); sc->free_offset = sg->p.offset + sg->p.length; VTAILQ_INSERT_TAIL(&sc->segments, sg, list); /* Neuter the new segment in case there is an old one there */ AN(sg->p.offset); smp_def_sign(sc, sg->ctx, sg->p.offset, "SEGHEAD"); smp_reset_sign(sg->ctx); smp_sync_sign(sg->ctx); /* Set up our allocation points */ sc->cur_seg = sg; sc->next_bot = sg->p.offset + IRNUP(sc, SMP_SIGN_SPACE); sc->next_top = smp_segend(sg); sc->next_top -= IRNUP(sc, SMP_SIGN_SPACE); IASSERTALIGN(sc, sc->next_bot); IASSERTALIGN(sc, sc->next_top); sg->objs = (void*)(sc->base + sc->next_top); } /*-------------------------------------------------------------------- * Close a segment */ void smp_close_seg(struct smp_sc *sc, struct smp_seg *sg) { uint64_t left, dst, len; void *dp; Lck_AssertHeld(&sc->mtx); CHECK_OBJ_NOTNULL(sg, SMP_SEG_MAGIC); assert(sg == sc->cur_seg); AN(sg->p.offset); sc->cur_seg = NULL; if (sg->nalloc == 0) { /* If segment is empty, delete instead */ VTAILQ_REMOVE(&sc->segments, sg, list); assert(sg->p.offset >= sc->ident->stuff[SMP_SPC_STUFF]); assert(sg->p.offset < sc->mediasize); sc->free_offset = sg->p.offset; LRU_Free(sg->lru); FREE_OBJ(sg); return; } /* * If there is enough space left, that we can move the smp_objects * down without overwriting the present copy, we will do so to * compact the segment. */ left = smp_spaceleft(sc, sg); len = sizeof(struct smp_object) * sg->p.lobjlist; if (len < left) { dst = sc->next_bot + IRNUP(sc, SMP_SIGN_SPACE); dp = sc->base + dst; assert((uintptr_t)dp + len < (uintptr_t)sg->objs); memcpy(dp, sg->objs, len); sc->next_top = dst; sg->objs = dp; sg->p.length = (sc->next_top - sg->p.offset) + len + IRNUP(sc, SMP_SIGN_SPACE); (void)smp_spaceleft(sc, sg); /* for the asserts */ } /* Update the segment header */ sg->p.objlist = sc->next_top; /* Write the (empty) OBJIDX signature */ sc->next_top -= IRNUP(sc, SMP_SIGN_SPACE); assert(sc->next_top >= sc->next_bot); smp_def_sign(sc, sg->ctx, sc->next_top, "OBJIDX"); smp_reset_sign(sg->ctx); smp_sync_sign(sg->ctx); /* Write the (empty) SEGTAIL signature */ smp_def_sign(sc, sg->ctx, sg->p.offset + sg->p.length - IRNUP(sc, SMP_SIGN_SPACE), "SEGTAIL"); smp_reset_sign(sg->ctx); smp_sync_sign(sg->ctx); /* Save segment list */ smp_save_segs(sc); sc->free_offset = smp_segend(sg); } /*--------------------------------------------------------------------- */ static struct smp_object * smp_find_so(const struct smp_seg *sg, unsigned priv2) { struct smp_object *so; priv2 &= ~NEED_FIXUP; assert(priv2 > 0); assert(priv2 <= sg->p.lobjlist); so = &sg->objs[sg->p.lobjlist - priv2]; return (so); } /*--------------------------------------------------------------------- * Check if a given storage structure is valid to use */ static int smp_loaded_st(const struct smp_sc *sc, const struct smp_seg *sg, const struct storage *st) { struct smp_seg *sg2; const uint8_t *pst; uint64_t o; (void)sg; /* XXX: faster: Start search from here */ pst = (const void *)st; if (pst < (sc->base + sc->ident->stuff[SMP_SPC_STUFF])) return (0x01); /* Before silo payload start */ if (pst > (sc->base + sc->ident->stuff[SMP_END_STUFF])) return (0x02); /* After silo end */ o = pst - sc->base; /* Find which segment contains the storage structure */ VTAILQ_FOREACH(sg2, &sc->segments, list) if (o > sg2->p.offset && (o + sizeof(*st)) < sg2->p.objlist) break; if (sg2 == NULL) return (0x04); /* No claiming segment */ if (!(sg2->flags & SMP_SEG_LOADED)) return (0x08); /* Claiming segment not loaded */ /* It is now safe to access the storage structure */ if (st->magic != STORAGE_MAGIC) return (0x10); /* Not enough magic */ if (o + st->space >= sg2->p.objlist) return (0x20); /* Allocation not inside segment */ if (st->len > st->space) return (0x40); /* Plain bad... */ /* * XXX: We could patch up st->stevedore and st->priv here * XXX: but if things go right, we will never need them. */ return (0); } /*--------------------------------------------------------------------- * objcore methods for persistent objects */ static struct object * smp_oc_getobj(struct worker *wrk, struct objcore *oc) { struct object *o; struct smp_seg *sg; struct smp_object *so; struct storage *st; uint64_t l; int bad; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AN(oc->stobj->stevedore); /* Some calls are direct, but they should match anyway */ assert(oc->stobj->stevedore->methods->getobj == smp_oc_getobj); CAST_OBJ_NOTNULL(sg, oc->stobj->priv, SMP_SEG_MAGIC); so = smp_find_so(sg, oc->stobj->priv2); o = (void*)(sg->sc->base + so->ptr); /* * The object may not be in this segment since we allocate it * In a separate operation than the smp_object. We could check * that it is in a later segment, but that would be complicated. * XXX: For now, be happy if it is inside th silo */ ASSERT_PTR_IN_SILO(sg->sc, o); CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); /* * If this flag is not set, it will not be, and the lock is not * needed to test it. */ if (!(oc->stobj->priv2 & NEED_FIXUP)) return (o); Lck_Lock(&sg->sc->mtx); /* Check again, we might have raced. */ if (oc->stobj->priv2 & NEED_FIXUP) { /* We trust caller to have a refcnt for us */ bad = 0; l = 0; VTAILQ_FOREACH(st, &o->list, list) { bad |= smp_loaded_st(sg->sc, sg, st); if (bad) break; l += st->len; } if (l != o->len) bad |= 0x100; if(bad) { EXP_Clr(&oc->exp); EXP_Clr(&so->exp); } sg->nfixed++; wrk->stats->n_object++; wrk->stats->n_vampireobject--; oc->stobj->priv2 &= ~NEED_FIXUP; } Lck_Unlock(&sg->sc->mtx); EXP_Rearm(oc, NAN, NAN, NAN, NAN); // XXX: Shouldn't be needed return (o); } static void smp_oc_updatemeta(struct worker *wrk, struct objcore *oc) { struct object *o; struct smp_seg *sg; struct smp_object *so; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); o = smp_oc_getobj(wrk, oc); AN(o); CAST_OBJ_NOTNULL(sg, oc->stobj->priv, SMP_SEG_MAGIC); CHECK_OBJ_NOTNULL(sg->sc, SMP_SC_MAGIC); so = smp_find_so(sg, oc->stobj->priv2); if (sg == sg->sc->cur_seg) { /* Lock necessary, we might race close_seg */ Lck_Lock(&sg->sc->mtx); so->ban = BAN_Time(oc->ban); so->exp = oc->exp; Lck_Unlock(&sg->sc->mtx); } else { so->ban = BAN_Time(oc->ban); so->exp = oc->exp; } } static void __match_proto__(freeobj_f) smp_oc_freeobj(struct worker *wrk, struct objcore *oc) { struct smp_seg *sg; struct smp_object *so; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CAST_OBJ_NOTNULL(sg, oc->stobj->priv, SMP_SEG_MAGIC); so = smp_find_so(sg, oc->stobj->priv2); Lck_Lock(&sg->sc->mtx); EXP_Clr(&so->exp); so->ptr = 0; assert(sg->nobj > 0); sg->nobj--; if (oc->stobj->priv2 & NEED_FIXUP) { wrk->stats->n_vampireobject--; } else { assert(sg->nfixed > 0); sg->nfixed--; wrk->stats->n_object--; } Lck_Unlock(&sg->sc->mtx); memset(oc->stobj, 0, sizeof oc->stobj); } /*-------------------------------------------------------------------- * Find the per-segment lru list for this object */ static struct lru * __match_proto__(getlru_f) smp_oc_getlru(const struct objcore *oc) { struct smp_seg *sg; CAST_OBJ_NOTNULL(sg, oc->stobj->priv, SMP_SEG_MAGIC); return (sg->lru); } const struct storeobj_methods smp_oc_methods = { .getobj = smp_oc_getobj, .updatemeta = smp_oc_updatemeta, .freeobj = smp_oc_freeobj, .getlru = smp_oc_getlru, }; /*--------------------------------------------------------------------*/ void smp_init_oc(struct objcore *oc, struct smp_seg *sg, unsigned objidx) { AZ(objidx & NEED_FIXUP); oc->stobj->priv = sg; oc->stobj->priv2 = objidx; } varnish-4.1.1/bin/varnishd/storage/storage_file.c0000644000201500234410000003305412652366721016764 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Storage method based on mmap'ed file */ #include "config.h" #include #include #include #include #include "cache/cache.h" #include "storage/storage.h" #include "vnum.h" #include "vfil.h" #ifndef MAP_NOCORE #define MAP_NOCORE 0 /* XXX Linux */ #endif #ifndef MAP_NOSYNC #define MAP_NOSYNC 0 /* XXX Linux */ #endif #define MINPAGES 128 /* * Number of buckets on free-list. * * Last bucket is "larger than" so choose number so that the second * to last bucket matches the 128k CHUNKSIZE in cache_fetch.c when * using the a 4K minimal page size */ #define NBUCKET (128 / 4 + 1) static struct VSC_C_lck *lck_smf; /*--------------------------------------------------------------------*/ VTAILQ_HEAD(smfhead, smf); struct smf { unsigned magic; #define SMF_MAGIC 0x0927a8a0 struct storage s; struct smf_sc *sc; int alloc; off_t size; off_t offset; unsigned char *ptr; VTAILQ_ENTRY(smf) order; VTAILQ_ENTRY(smf) status; struct smfhead *flist; }; struct smf_sc { unsigned magic; #define SMF_SC_MAGIC 0x52962ee7 struct lock mtx; struct VSC_C_smf *stats; const char *filename; int fd; unsigned pagesize; uintmax_t filesize; struct smfhead order; struct smfhead free[NBUCKET]; struct smfhead used; }; /*--------------------------------------------------------------------*/ static void smf_init(struct stevedore *parent, int ac, char * const *av) { const char *size, *fn, *r; struct smf_sc *sc; unsigned u; uintmax_t page_size; AZ(av[ac]); size = NULL; page_size = getpagesize(); if (ac > 3) ARGV_ERR("(-sfile) too many arguments\n"); if (ac < 1 || *av[0] == '\0') ARGV_ERR("(-sfile) path is mandatory\n"); fn = av[0]; if (ac > 1 && *av[1] != '\0') size = av[1]; if (ac > 2 && *av[2] != '\0') { r = VNUM_2bytes(av[2], &page_size, 0); if (r != NULL) ARGV_ERR("(-sfile) granularity \"%s\": %s\n", av[2], r); } AN(fn); ALLOC_OBJ(sc, SMF_SC_MAGIC); XXXAN(sc); VTAILQ_INIT(&sc->order); for (u = 0; u < NBUCKET; u++) VTAILQ_INIT(&sc->free[u]); VTAILQ_INIT(&sc->used); sc->pagesize = page_size; parent->priv = sc; (void)STV_GetFile(fn, &sc->fd, &sc->filename, "-sfile"); mgt_child_inherit(sc->fd, "storage_file"); sc->filesize = STV_FileSize(sc->fd, size, &sc->pagesize, "-sfile"); if (VFIL_allocate(sc->fd, (off_t)sc->filesize, 0)) ARGV_ERR("(-sfile) allocation error: %s\n", strerror(errno)); } /*-------------------------------------------------------------------- * Insert/Remove from correct freelist */ static void insfree(struct smf_sc *sc, struct smf *sp) { size_t b; struct smf *sp2; size_t ns; AZ(sp->alloc); assert(sp->flist == NULL); Lck_AssertHeld(&sc->mtx); b = sp->size / sc->pagesize; if (b >= NBUCKET) { b = NBUCKET - 1; sc->stats->g_smf_large++; } else { sc->stats->g_smf_frag++; } sp->flist = &sc->free[b]; ns = b * sc->pagesize; VTAILQ_FOREACH(sp2, sp->flist, status) { assert(sp2->size >= ns); AZ(sp2->alloc); assert(sp2->flist == sp->flist); if (sp->offset < sp2->offset) break; } if (sp2 == NULL) VTAILQ_INSERT_TAIL(sp->flist, sp, status); else VTAILQ_INSERT_BEFORE(sp2, sp, status); } static void remfree(const struct smf_sc *sc, struct smf *sp) { size_t b; AZ(sp->alloc); assert(sp->flist != NULL); Lck_AssertHeld(&sc->mtx); b = sp->size / sc->pagesize; if (b >= NBUCKET) { b = NBUCKET - 1; sc->stats->g_smf_large--; } else { sc->stats->g_smf_frag--; } assert(sp->flist == &sc->free[b]); VTAILQ_REMOVE(sp->flist, sp, status); sp->flist = NULL; } /*-------------------------------------------------------------------- * Allocate a range from the first free range that is large enough. */ static struct smf * alloc_smf(struct smf_sc *sc, size_t bytes) { struct smf *sp, *sp2; size_t b; AZ(bytes % sc->pagesize); b = bytes / sc->pagesize; if (b >= NBUCKET) b = NBUCKET - 1; sp = NULL; for (; b < NBUCKET - 1; b++) { sp = VTAILQ_FIRST(&sc->free[b]); if (sp != NULL) break; } if (sp == NULL) { VTAILQ_FOREACH(sp, &sc->free[NBUCKET -1], status) if (sp->size >= bytes) break; } if (sp == NULL) return (sp); assert(sp->size >= bytes); remfree(sc, sp); if (sp->size == bytes) { sp->alloc = 1; VTAILQ_INSERT_TAIL(&sc->used, sp, status); return (sp); } /* Split from front */ sp2 = malloc(sizeof *sp2); XXXAN(sp2); sc->stats->g_smf++; *sp2 = *sp; sp->offset += bytes; sp->ptr += bytes; sp->size -= bytes; sp2->size = bytes; sp2->alloc = 1; VTAILQ_INSERT_BEFORE(sp, sp2, order); VTAILQ_INSERT_TAIL(&sc->used, sp2, status); insfree(sc, sp); return (sp2); } /*-------------------------------------------------------------------- * Free a range. Attempt merge forward and backward, then sort into * free list according to age. */ static void free_smf(struct smf *sp) { struct smf *sp2; struct smf_sc *sc = sp->sc; CHECK_OBJ_NOTNULL(sp, SMF_MAGIC); AN(sp->alloc); assert(sp->size > 0); AZ(sp->size % sc->pagesize); VTAILQ_REMOVE(&sc->used, sp, status); sp->alloc = 0; sp2 = VTAILQ_NEXT(sp, order); if (sp2 != NULL && sp2->alloc == 0 && (sp2->ptr == sp->ptr + sp->size) && (sp2->offset == sp->offset + sp->size)) { sp->size += sp2->size; VTAILQ_REMOVE(&sc->order, sp2, order); remfree(sc, sp2); free(sp2); sc->stats->g_smf--; } sp2 = VTAILQ_PREV(sp, smfhead, order); if (sp2 != NULL && sp2->alloc == 0 && (sp->ptr == sp2->ptr + sp2->size) && (sp->offset == sp2->offset + sp2->size)) { remfree(sc, sp2); sp2->size += sp->size; VTAILQ_REMOVE(&sc->order, sp, order); free(sp); sc->stats->g_smf--; sp = sp2; } insfree(sc, sp); } /*-------------------------------------------------------------------- * Trim the tail of a range. */ static void trim_smf(struct smf *sp, size_t bytes) { struct smf *sp2; struct smf_sc *sc = sp->sc; AN(sp->alloc); assert(bytes > 0); assert(bytes < sp->size); AZ(bytes % sc->pagesize); AZ(sp->size % sc->pagesize); CHECK_OBJ_NOTNULL(sp, SMF_MAGIC); sp2 = malloc(sizeof *sp2); XXXAN(sp2); sc->stats->g_smf++; *sp2 = *sp; sp2->size -= bytes; sp->size = bytes; sp2->ptr += bytes; sp2->offset += bytes; VTAILQ_INSERT_AFTER(&sc->order, sp, sp2, order); VTAILQ_INSERT_TAIL(&sc->used, sp2, status); free_smf(sp2); } /*-------------------------------------------------------------------- * Insert a newly created range as busy, then free it to do any collapses */ static void new_smf(struct smf_sc *sc, unsigned char *ptr, off_t off, size_t len) { struct smf *sp, *sp2; AZ(len % sc->pagesize); ALLOC_OBJ(sp, SMF_MAGIC); XXXAN(sp); sp->s.magic = STORAGE_MAGIC; sc->stats->g_smf++; sp->sc = sc; sp->size = len; sp->ptr = ptr; sp->offset = off; sp->alloc = 1; VTAILQ_FOREACH(sp2, &sc->order, order) { if (sp->ptr < sp2->ptr) { VTAILQ_INSERT_BEFORE(sp2, sp, order); break; } } if (sp2 == NULL) VTAILQ_INSERT_TAIL(&sc->order, sp, order); VTAILQ_INSERT_HEAD(&sc->used, sp, status); free_smf(sp); } /*--------------------------------------------------------------------*/ /* * XXX: This may be too aggressive and soak up too much address room. * XXX: On the other hand, the user, directly or implicitly asked us to * XXX: use this much storage, so we should make a decent effort. * XXX: worst case (I think), malloc will fail. */ static void smf_open_chunk(struct smf_sc *sc, off_t sz, off_t off, off_t *fail, off_t *sum) { void *p; off_t h; AN(sz); AZ(sz % sc->pagesize); if (*fail < (uintmax_t)sc->pagesize * MINPAGES) return; if (sz > 0 && sz < *fail && sz < SSIZE_MAX) { p = mmap(NULL, sz, PROT_READ|PROT_WRITE, MAP_NOCORE | MAP_NOSYNC | MAP_SHARED, sc->fd, off); if (p != MAP_FAILED) { (void) madvise(p, sz, MADV_RANDOM); (*sum) += sz; new_smf(sc, p, off, sz); return; } } if (sz < *fail) *fail = sz; h = sz / 2; if (h > SSIZE_MAX) h = SSIZE_MAX; h -= (h % sc->pagesize); smf_open_chunk(sc, h, off, fail, sum); smf_open_chunk(sc, sz - h, off + h, fail, sum); } static void smf_open(const struct stevedore *st) { struct smf_sc *sc; off_t fail = 1 << 30; /* XXX: where is OFF_T_MAX ? */ off_t sum = 0; ASSERT_CLI(); if (lck_smf == NULL) lck_smf = Lck_CreateClass("smf"); CAST_OBJ_NOTNULL(sc, st->priv, SMF_SC_MAGIC); sc->stats = VSM_Alloc(sizeof *sc->stats, VSC_CLASS, VSC_type_smf, st->ident); Lck_New(&sc->mtx, lck_smf); Lck_Lock(&sc->mtx); smf_open_chunk(sc, sc->filesize, 0, &fail, &sum); Lck_Unlock(&sc->mtx); printf("SMF.%s mmap'ed %ju bytes of %ju\n", st->ident, (uintmax_t)sum, sc->filesize); /* XXX */ if (sum < MINPAGES * (off_t)getpagesize()) exit(4); sc->stats->g_space += sc->filesize; } /*--------------------------------------------------------------------*/ static struct storage * smf_alloc(const struct stevedore *st, size_t size) { struct smf *smf; struct smf_sc *sc; CAST_OBJ_NOTNULL(sc, st->priv, SMF_SC_MAGIC); assert(size > 0); size += (sc->pagesize - 1L); size &= ~(sc->pagesize - 1L); Lck_Lock(&sc->mtx); sc->stats->c_req++; smf = alloc_smf(sc, size); if (smf == NULL) { sc->stats->c_fail++; Lck_Unlock(&sc->mtx); return (NULL); } CHECK_OBJ_NOTNULL(smf, SMF_MAGIC); sc->stats->g_alloc++; sc->stats->c_bytes += smf->size; sc->stats->g_bytes += smf->size; sc->stats->g_space -= smf->size; Lck_Unlock(&sc->mtx); CHECK_OBJ_NOTNULL(&smf->s, STORAGE_MAGIC); /*lint !e774 */ XXXAN(smf); assert(smf->size == size); smf->s.space = size; smf->s.priv = smf; smf->s.ptr = smf->ptr; smf->s.len = 0; return (&smf->s); } /*--------------------------------------------------------------------*/ static void smf_trim(struct storage *s, size_t size, int move_ok) { struct smf *smf; struct smf_sc *sc; CHECK_OBJ_NOTNULL(s, STORAGE_MAGIC); assert(size > 0); assert(size <= s->space); xxxassert(size > 0); /* XXX: seen */ CAST_OBJ_NOTNULL(smf, s->priv, SMF_MAGIC); assert(size <= smf->size); if (!move_ok) return; /* XXX: trim_smf needs fixed */ sc = smf->sc; size += (sc->pagesize - 1); size &= ~(sc->pagesize - 1); if (smf->size > size) { Lck_Lock(&sc->mtx); sc->stats->c_freed += (smf->size - size); sc->stats->g_bytes -= (smf->size - size); sc->stats->g_space += (smf->size - size); trim_smf(smf, size); assert(smf->size == size); Lck_Unlock(&sc->mtx); s->space = size; } } /*--------------------------------------------------------------------*/ static void __match_proto__(storage_free_f) smf_free(struct storage *s) { struct smf *smf; struct smf_sc *sc; CHECK_OBJ_NOTNULL(s, STORAGE_MAGIC); CAST_OBJ_NOTNULL(smf, s->priv, SMF_MAGIC); sc = smf->sc; Lck_Lock(&sc->mtx); sc->stats->g_alloc--; sc->stats->c_freed += smf->size; sc->stats->g_bytes -= smf->size; sc->stats->g_space += smf->size; free_smf(smf); Lck_Unlock(&sc->mtx); } /*--------------------------------------------------------------------*/ const struct stevedore smf_stevedore = { .magic = STEVEDORE_MAGIC, .name = "file", .init = smf_init, .open = smf_open, .alloc = smf_alloc, .trim = smf_trim, .free = smf_free, .methods = &default_oc_methods, }; #ifdef INCLUDE_TEST_DRIVER void vca_flush(struct sess *sp) {} #define N 100 #define M (128*1024) struct storage *s[N]; static void dumpit(void) { struct smf_sc *sc = smf_stevedore.priv; struct smf *s; return (0); printf("----------------\n"); printf("Order:\n"); VTAILQ_FOREACH(s, &sc->order, order) { printf("%10p %12ju %12ju %12ju\n", s, s->offset, s->size, s->offset + s->size); } printf("Used:\n"); VTAILQ_FOREACH(s, &sc->used, status) { printf("%10p %12ju %12ju %12ju\n", s, s->offset, s->size, s->offset + s->size); } printf("Free:\n"); VTAILQ_FOREACH(s, &sc->free, status) { printf("%10p %12ju %12ju %12ju\n", s, s->offset, s->size, s->offset + s->size); } printf("================\n"); } int main(int argc, char **argv) { int i, j; setbuf(stdout, NULL); smf_init(&smf_stevedore, ""); smf_open(&smf_stevedore); while (1) { dumpit(); i = random() % N; do j = random() % M; while (j == 0); if (s[i] == NULL) { s[i] = smf_alloc(&smf_stevedore, j); printf("A %10p %12d\n", s[i], j); } else if (j < s[i]->space) { smf_trim(s[i], j); printf("T %10p %12d\n", s[i], j); } else { smf_free(s[i]); printf("D %10p\n", s[i]); s[i] = NULL; } } } #endif /* INCLUDE_TEST_DRIVER */ varnish-4.1.1/bin/varnishd/storage/mgt_stevedore.c0000644000201500234410000001263312652366721017170 00000000000000/*- * Copyright (c) 2007-2011 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Smørgav * * 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. * * STEVEDORE: one who works at or is responsible for loading and * unloading ships in port. Example: "on the wharves, stevedores were * unloading cargo from the far corners of the world." Origin: Spanish * estibador, from estibar to pack. First Known Use: 1788 */ #include "config.h" #include #include #include #include #include "mgt/mgt.h" #include "vcli_priv.h" #include "mgt/mgt_cli.h" #include "storage/storage.h" #include "vav.h" struct stevedore_head stv_stevedores = VTAILQ_HEAD_INITIALIZER(stv_stevedores); struct stevedore *stv_transient; /*--------------------------------------------------------------------*/ static void stv_cli_list(struct cli *cli, const char * const *av, void *priv) { struct stevedore *stv; ASSERT_MGT(); (void)av; (void)priv; VCLI_Out(cli, "Storage devices:\n"); stv = stv_transient; VCLI_Out(cli, "\tstorage.%s = %s\n", stv->ident, stv->name); VTAILQ_FOREACH(stv, &stv_stevedores, list) VCLI_Out(cli, "\tstorage.%s = %s\n", stv->ident, stv->name); } /*--------------------------------------------------------------------*/ struct cli_proto cli_stv[] = { { "storage.list", "storage.list", "\tList storage devices.", 0, 0, "", stv_cli_list }, { NULL} }; /*-------------------------------------------------------------------- */ static void smp_fake_init(struct stevedore *parent, int ac, char * const *av) { (void)parent; (void)ac; (void)av; ARGV_ERR( "-spersistent has been deprecated, please see:\n" " https://www.varnish-cache.org/docs/trunk/phk/persistent.html\n" "for details.\n" ); } static const struct stevedore smp_fake_stevedore = { .magic = STEVEDORE_MAGIC, .name = "deprecated_persistent", .init = smp_fake_init, }; /*-------------------------------------------------------------------- * Parse a stevedore argument on the form: * [ name '=' ] strategy [ ',' arg ] * */ static const struct choice STV_choice[] = { { "file", &smf_stevedore }, { "malloc", &sma_stevedore }, { "deprecated_persistent", &smp_stevedore }, { "persistent", &smp_fake_stevedore }, #ifdef HAVE_LIBUMEM { "umem", &smu_stevedore }, #endif { NULL, NULL } }; void STV_Config(const char *spec) { char **av; const char *p, *q; struct stevedore *stv; const struct stevedore *stv2; int ac, l; static unsigned seq = 0; ASSERT_MGT(); p = strchr(spec, '='); q = strchr(spec, ','); if (p != NULL && (q == NULL || q > p)) { av = VAV_Parse(p + 1, NULL, ARGV_COMMA); } else { av = VAV_Parse(spec, NULL, ARGV_COMMA); p = NULL; } AN(av); if (av[0] != NULL) ARGV_ERR("%s\n", av[0]); if (av[1] == NULL) ARGV_ERR("-s argument lacks strategy {malloc, file, ...}\n"); for (ac = 0; av[ac + 2] != NULL; ac++) continue; stv2 = pick(STV_choice, av[1], "storage"); AN(stv2); /* Append strategy to ident string */ VSB_printf(vident, ",-s%s", av[1]); av += 2; CHECK_OBJ_NOTNULL(stv2, STEVEDORE_MAGIC); ALLOC_OBJ(stv, STEVEDORE_MAGIC); AN(stv); *stv = *stv2; AN(stv->name); if (p == NULL) bprintf(stv->ident, "s%u", seq++); else { l = p - spec; if (l > sizeof stv->ident - 1) l = sizeof stv->ident - 1; bprintf(stv->ident, "%.*s", l, spec); } VTAILQ_FOREACH(stv2, &stv_stevedores, list) { if (strcmp(stv2->ident, stv->ident)) continue; ARGV_ERR("(-s%s=%s) already defined once\n", stv->ident, stv->name); } if (stv->init != NULL) stv->init(stv, ac, av); else if (ac != 0) ARGV_ERR("(-s%s) too many arguments\n", stv->name); AN(stv->alloc); if (stv->allocobj == NULL) stv->allocobj = stv_default_allocobj; if (!strcmp(stv->ident, TRANSIENT_STORAGE)) { stv->transient = 1; AZ(stv_transient); stv_transient = stv; } else { VTAILQ_INSERT_TAIL(&stv_stevedores, stv, list); } /* NB: Do not free av, stevedore gets to keep it */ } /*--------------------------------------------------------------------*/ void STV_Config_Transient(void) { ASSERT_MGT(); if (stv_transient == NULL) STV_Config(TRANSIENT_STORAGE "=malloc"); } /*--------------------------------------------------------------------*/ varnish-4.1.1/bin/varnishd/storage/stevedore.c0000644000201500234410000002435312652366721016323 00000000000000/*- * Copyright (c) 2007-2015 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Smørgav * * 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. * * STEVEDORE: one who works at or is responsible for loading and * unloading ships in port. Example: "on the wharves, stevedores were * unloading cargo from the far corners of the world." Origin: Spanish * estibador, from estibar to pack. First Known Use: 1788 */ #include "config.h" #include #include #include "cache/cache.h" #include "storage/storage.h" #include "vrt.h" #include "vrt_obj.h" static const struct stevedore * volatile stv_next; /*--------------------------------------------------------------------- * Default objcore methods */ static struct object * __match_proto__(getobj_f) default_oc_getobj(struct worker *wrk, struct objcore *oc) { struct object *o; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); if (oc->stobj->priv == NULL) return (NULL); CAST_OBJ_NOTNULL(o, oc->stobj->priv, OBJECT_MAGIC); return (o); } static void __match_proto__(freeobj_f) default_oc_freeobj(struct worker *wrk, struct objcore *oc) { struct object *o; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(oc->stobj, STOREOBJ_MAGIC); ObjSlim(wrk, oc); CAST_OBJ_NOTNULL(o, oc->stobj->priv, OBJECT_MAGIC); o->magic = 0; STV_free(oc->stobj->stevedore, o->objstore); memset(oc->stobj, 0, sizeof oc->stobj); wrk->stats->n_object--; } static struct lru * __match_proto__(getlru_f) default_oc_getlru(const struct objcore *oc) { const struct stevedore *stv; stv = oc->stobj->stevedore; CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC); return (stv->lru); } const struct storeobj_methods default_oc_methods = { .getobj = default_oc_getobj, .freeobj = default_oc_freeobj, .getlru = default_oc_getlru, }; /*-------------------------------------------------------------------- */ struct lru * LRU_Alloc(void) { struct lru *l; ALLOC_OBJ(l, LRU_MAGIC); AN(l); VTAILQ_INIT(&l->lru_head); Lck_New(&l->mtx, lck_lru); return (l); } void LRU_Free(struct lru *lru) { CHECK_OBJ_NOTNULL(lru, LRU_MAGIC); Lck_Delete(&lru->mtx); FREE_OBJ(lru); } /*-------------------------------------------------------------------- * XXX: trust pointer writes to be atomic */ static struct stevedore * stv_pick_stevedore(struct vsl_log *vsl, const char **hint) { struct stevedore *stv; AN(hint); if (*hint != NULL && **hint != '\0') { VTAILQ_FOREACH(stv, &stv_stevedores, list) { if (!strcmp(stv->ident, *hint)) return (stv); } if (!strcmp(TRANSIENT_STORAGE, *hint)) return (stv_transient); /* Hint was not valid, nuke it */ VSLb(vsl, SLT_Debug, "Storage hint not usable"); *hint = NULL; } if (stv_next == NULL) return (stv_transient); /* pick a stevedore and bump the head along */ stv = VTAILQ_NEXT(stv_next, list); if (stv == NULL) stv = VTAILQ_FIRST(&stv_stevedores); AN(stv); AN(stv->name); stv_next = stv; return (stv); } /*-------------------------------------------------------------------*/ struct storage * STV_alloc(const struct stevedore *stv, size_t size) { struct storage *st; CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC); if (size > cache_param->fetch_maxchunksize) size = cache_param->fetch_maxchunksize; assert(size <= UINT_MAX); /* field limit in struct storage */ for (;;) { /* try to allocate from it */ AN(stv->alloc); st = stv->alloc(stv, size); if (st != NULL) break; if (size <= cache_param->fetch_chunksize) break; size >>= 1; } CHECK_OBJ_ORNULL(st, STORAGE_MAGIC); return (st); } /*-------------------------------------------------------------------- * This function is called by stevedores ->allocobj() method, which * very often will be stv_default_allocobj() below, to convert a slab * of storage into object which the stevedore can then register in its * internal state, before returning it to STV_NewObject(). * As you probably guessed: All this for persistence. */ struct object * STV_MkObject(const struct stevedore *stv, struct objcore *oc, void *ptr) { struct object *o; CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); assert(PAOK(ptr)); o = ptr; INIT_OBJ(o, OBJECT_MAGIC); VTAILQ_INIT(&o->list); oc->stobj->magic = STOREOBJ_MAGIC; oc->stobj->stevedore = stv; AN(stv->methods); oc->stobj->priv = o; return (o); } /*-------------------------------------------------------------------- * This is the default ->allocobj() which all stevedores who do not * implement persistent storage can rely on. */ int stv_default_allocobj(const struct stevedore *stv, struct objcore *oc, unsigned wsl) { struct object *o; struct storage *st; unsigned ltot; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); ltot = sizeof(struct object) + PRNDUP(wsl); st = stv->alloc(stv, ltot); if (st == NULL) return (0); if (st->space < ltot) { stv->free(st); return (0); } o = STV_MkObject(stv, oc, st->ptr); CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); st->len = sizeof(*o); o->objstore = st; return (1); } /*------------------------------------------------------------------- * Allocate storage for an object, based on the header information. * XXX: If we know (a hint of) the length, we could allocate space * XXX: for the body in the same allocation while we are at it. */ int STV_NewObject(struct objcore *oc, struct worker *wrk, const char *hint, unsigned wsl) { struct stevedore *stv, *stv0; int i, j; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); assert(wsl > 0); stv = stv0 = stv_pick_stevedore(wrk->vsl, &hint); AN(stv->allocobj); j = stv->allocobj(stv, oc, wsl); if (j == 0 && hint == NULL) { do { stv = stv_pick_stevedore(wrk->vsl, &hint); AN(stv->allocobj); j = stv->allocobj(stv, oc, wsl); } while (j == 0 && stv != stv0); } if (j == 0) { /* no luck; try to free some space and keep trying */ for (i = 0; j == 0 && i < cache_param->nuke_limit; i++) { if (EXP_NukeOne(wrk, stv->lru) == -1) break; j = stv->allocobj(stv, oc, wsl); } } if (j == 0) return (0); wrk->stats->n_object++; VSLb(wrk->vsl, SLT_Storage, "%s %s", oc->stobj->stevedore->name, oc->stobj->stevedore->ident); return (1); } /*-------------------------------------------------------------------*/ void STV_trim(const struct stevedore *stv, struct storage *st, size_t size, int move_ok) { CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC); CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); if (stv->trim) stv->trim(st, size, move_ok); } void STV_free(const struct stevedore *stv, struct storage *st) { CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC); CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); AN(stv->free); stv->free(st); } void STV_open(void) { struct stevedore *stv; VTAILQ_FOREACH(stv, &stv_stevedores, list) { stv->lru = LRU_Alloc(); if (stv->open != NULL) stv->open(stv); } stv = stv_transient; if (stv->open != NULL) { stv->lru = LRU_Alloc(); stv->open(stv); } stv_next = VTAILQ_FIRST(&stv_stevedores); } void STV_close(void) { struct stevedore *stv; /* Signal intent to close */ VTAILQ_FOREACH(stv, &stv_stevedores, list) if (stv->signal_close != NULL) stv->signal_close(stv); stv = stv_transient; if (stv->signal_close != NULL) stv->signal_close(stv); /* Close each in turn */ VTAILQ_FOREACH(stv, &stv_stevedores, list) if (stv->close != NULL) stv->close(stv); stv = stv_transient; if (stv->close != NULL) stv->close(stv); } /*------------------------------------------------------------------- * Notify the stevedores of BAN related events. A non-zero return * value indicates that the stevedore is unable to persist the * event. */ int STV_BanInfo(enum baninfo event, const uint8_t *ban, unsigned len) { struct stevedore *stv; int r = 0; VTAILQ_FOREACH(stv, &stv_stevedores, list) if (stv->baninfo != NULL) r |= stv->baninfo(stv, event, ban, len); return (r); } /*------------------------------------------------------------------- * Export a complete ban list to the stevedores for persistence. * The stevedores should clear any previous ban lists and replace * them with this list. */ void STV_BanExport(const uint8_t *bans, unsigned len) { struct stevedore *stv; VTAILQ_FOREACH(stv, &stv_stevedores, list) if (stv->banexport != NULL) stv->banexport(stv, bans, len); } /*-------------------------------------------------------------------- * VRT functions for stevedores */ static const struct stevedore * stv_find(const char *nm) { const struct stevedore *stv; VTAILQ_FOREACH(stv, &stv_stevedores, list) if (!strcmp(stv->ident, nm)) return (stv); if (!strcmp(TRANSIENT_STORAGE, nm)) return (stv_transient); return (NULL); } int VRT_Stv(const char *nm) { if (stv_find(nm) != NULL) return (1); return (0); } #define VRTSTVVAR(nm, vtype, ctype, dval) \ ctype \ VRT_Stv_##nm(const char *nm) \ { \ const struct stevedore *stv; \ \ stv = stv_find(nm); \ if (stv == NULL) \ return (dval); \ if (stv->var_##nm == NULL) \ return (dval); \ return (stv->var_##nm(stv)); \ } #include "tbl/vrt_stv_var.h" #undef VRTSTVVAR varnish-4.1.1/bin/varnishd/storage/storage_persistent.h0000644000201500234410000002336412652366721020255 00000000000000/*- * Copyright (c) 2008-2011 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. * * Persistent storage method * * XXX: Before we start the client or maybe after it stops, we should give the * XXX: stevedores a chance to examine their storage for consistency. * * XXX: Do we ever free the LRU-lists ? */ /* * * Overall layout: * * struct smp_ident; Identification and geometry * sha256[...] checksum of same * * struct smp_sign; * banspace_1; First ban-space * sha256[...] checksum of same * * struct smp_sign; * banspace_2; Second ban-space * sha256[...] checksum of same * * struct smp_sign; * struct smp_segment_1[N]; First Segment table * sha256[...] checksum of same * * struct smp_sign; * struct smp_segment_2[N]; Second Segment table * sha256[...] checksum of same * * N segments { * struct smp_sign; * struct smp_object[M] Objects in segment * sha256[...] checksum of same * objspace * } * */ /* * The identblock is located in the first sector of the storage space. * This is written once and not subsequently modified in normal operation. * It is immediately followed by a SHA256sum of the structure, as stored. */ struct smp_ident { char ident[32]; /* Human readable ident * so people and programs * can tell what the file * or device contains. */ uint32_t byte_order; /* 0x12345678 */ uint32_t size; /* sizeof(struct smp_ident) */ uint32_t major_version; uint32_t unique; uint32_t align; /* alignment in silo */ uint32_t granularity; /* smallest ... in bytes */ uint64_t mediasize; /* ... in bytes */ uint64_t stuff[6]; /* pointers to stuff */ #define SMP_BAN1_STUFF 0 #define SMP_BAN2_STUFF 1 #define SMP_SEG1_STUFF 2 #define SMP_SEG2_STUFF 3 #define SMP_SPC_STUFF 4 #define SMP_END_STUFF 5 }; /* * The size of smp_ident should be fixed and constant across all platforms. * We enforce that with the following #define and an assert in smp_init() */ #define SMP_IDENT_SIZE 112 #define SMP_IDENT_STRING "Varnish Persistent Storage Silo" /* * This is used to sign various bits on the disk. */ struct smp_sign { char ident[8]; uint32_t unique; uint64_t mapped; /* The length field is the length of the signed data only * (does not include struct smp_sign) */ uint64_t length; /* NB: Must be last */ }; #define SMP_SIGN_SPACE (sizeof(struct smp_sign) + SHA256_LEN) /* * A segment pointer. */ struct smp_segptr { uint64_t offset; /* rel to silo */ uint64_t length; /* rel to offset */ uint64_t objlist; /* rel to silo */ uint32_t lobjlist; /* len of objlist */ }; /* * An object descriptor * * A positive ttl is obj.ttl with obj.grace being NAN * A negative ttl is - (obj.ttl + obj.grace) */ struct smp_object { uint8_t hash[32]; /* really: DIGEST_LEN */ struct exp exp; uint32_t __filler__; /* -> align/8 on 32bit */ double ban; uint64_t ptr; /* rel to silo */ }; #define ASSERT_SILO_THREAD(sc) \ do {assert(pthread_equal(pthread_self(), (sc)->thread));} while (0) /* * Context for a signature. * * A signature is a sequence of bytes in the silo, signed by a SHA256 hash * which follows the bytes. * * The context structure allows us to append to a signature without * recalculating the entire SHA256 hash. */ struct smp_signctx { struct smp_sign *ss; struct SHA256Context ctx; uint32_t unique; const char *id; }; /* * A space wrapped by a signature * * A signspace is a chunk of the silo that is wrapped by a * signature. It has attributes for size, so range checking can be * performed. * */ struct smp_signspace { struct smp_signctx ctx; uint8_t *start; uint64_t size; }; struct smp_sc; /* XXX: name confusion with on-media version ? */ struct smp_seg { unsigned magic; #define SMP_SEG_MAGIC 0x45c61895 struct smp_sc *sc; struct lru *lru; VTAILQ_ENTRY(smp_seg) list; /* on smp_sc.smp_segments */ struct smp_segptr p; unsigned flags; #define SMP_SEG_MUSTLOAD (1 << 0) #define SMP_SEG_LOADED (1 << 1) uint32_t nobj; /* Number of objects */ uint32_t nalloc; /* Allocations */ uint32_t nfixed; /* How many fixed objects */ /* Only for open segment */ struct smp_object *objs; /* objdesc array */ struct smp_signctx ctx[1]; }; VTAILQ_HEAD(smp_seghead, smp_seg); struct smp_sc { unsigned magic; #define SMP_SC_MAGIC 0x7b73af0a struct stevedore *parent; pthread_t bgthread; unsigned flags; #define SMP_SC_LOADED (1 << 0) #define SMP_SC_STOP (1 << 1) const struct stevedore *stevedore; int fd; const char *filename; off_t mediasize; uintptr_t align; uint32_t granularity; uint32_t unique; uint8_t *base; struct smp_ident *ident; struct smp_seghead segments; struct smp_seg *cur_seg; uint64_t next_bot; /* next alloc address bottom */ uint64_t next_top; /* next alloc address top */ uint64_t free_offset; pthread_t thread; VTAILQ_ENTRY(smp_sc) list; struct smp_signctx idn; struct smp_signspace ban1; struct smp_signspace ban2; struct smp_signspace seg1; struct smp_signspace seg2; struct lock mtx; /* Cleaner metrics */ unsigned min_nseg; unsigned aim_nseg; unsigned max_nseg; uint64_t min_segl; uint64_t aim_segl; uint64_t max_segl; uint64_t free_reserve; }; /*--------------------------------------------------------------------*/ /* Pointer round up/down & assert */ #define PRNDN(sc, x) ((void*)RDN2((uintptr_t)(x), sc->align)) #define PRNUP(sc, x) ((void*)RUP2((uintptr_t)(x), sc->align)) #define PASSERTALIGN(sc, x) assert(PRNDN(sc, x) == (x)) /* Integer round up/down & assert */ #define IRNDN(sc, x) RDN2(x, sc->align) #define IRNUP(sc, x) RUP2(x, sc->align) #define IASSERTALIGN(sc, x) assert(IRNDN(sc, x) == (x)) /*--------------------------------------------------------------------*/ #define ASSERT_PTR_IN_SILO(sc, ptr) \ assert((const void*)(ptr) >= (const void*)((sc)->base) && \ (const void*)(ptr) < (const void *)((sc)->base + (sc)->mediasize)) /*--------------------------------------------------------------------*/ #define SIGN_DATA(ctx) ((void *)((ctx)->ss + 1)) #define SIGN_END(ctx) ((void *)((int8_t *)SIGN_DATA(ctx) + (ctx)->ss->length)) #define SIGNSPACE_DATA(spc) (SIGN_DATA(&(spc)->ctx)) #define SIGNSPACE_FRONT(spc) (SIGN_END(&(spc)->ctx)) #define SIGNSPACE_LEN(spc) ((spc)->ctx.ss->length) #define SIGNSPACE_FREE(spc) ((spc)->size - SIGNSPACE_LEN(spc)) /* storage_persistent_mgt.c */ void smp_mgt_init(struct stevedore *parent, int ac, char * const *av); /* storage_persistent_silo.c */ void smp_load_seg(struct worker *, const struct smp_sc *sc, struct smp_seg *sg); void smp_new_seg(struct smp_sc *sc); void smp_close_seg(struct smp_sc *sc, struct smp_seg *sg); void smp_init_oc(struct objcore *oc, struct smp_seg *sg, unsigned objidx); void smp_save_segs(struct smp_sc *sc); extern const struct storeobj_methods smp_oc_methods; /* storage_persistent_subr.c */ void smp_def_sign(const struct smp_sc *sc, struct smp_signctx *ctx, uint64_t off, const char *id); int smp_chk_sign(struct smp_signctx *ctx); void smp_append_sign(struct smp_signctx *ctx, const void *ptr, uint32_t len); void smp_reset_sign(struct smp_signctx *ctx); void smp_sync_sign(const struct smp_signctx *ctx); void smp_def_signspace(const struct smp_sc *sc, struct smp_signspace *spc, uint64_t off, uint64_t size, const char *id); int smp_chk_signspace(struct smp_signspace *spc); void smp_append_signspace(struct smp_signspace *spc, uint32_t len); void smp_reset_signspace(struct smp_signspace *spc); void smp_copy_signspace(struct smp_signspace *dst, const struct smp_signspace *src); void smp_trunc_signspace(struct smp_signspace *spc, uint32_t len); void smp_msync(void *addr, size_t length); void smp_newsilo(struct smp_sc *sc); int smp_valid_silo(struct smp_sc *sc); /*-------------------------------------------------------------------- * Caculate payload of some stuff */ static inline uint64_t smp_stuff_len(const struct smp_sc *sc, unsigned stuff) { uint64_t l; assert(stuff < SMP_END_STUFF); l = sc->ident->stuff[stuff + 1] - sc->ident->stuff[stuff]; l -= SMP_SIGN_SPACE; return (l); } static inline uint64_t smp_segend(const struct smp_seg *sg) { return (sg->p.offset + sg->p.length); } static inline uint64_t smp_spaceleft(const struct smp_sc *sc, const struct smp_seg *sg) { IASSERTALIGN(sc, sc->next_bot); assert(sc->next_bot <= sc->next_top - IRNUP(sc, SMP_SIGN_SPACE)); assert(sc->next_bot >= sg->p.offset); assert(sc->next_top < sg->p.offset + sg->p.length); return ((sc->next_top - sc->next_bot) - IRNUP(sc, SMP_SIGN_SPACE)); } varnish-4.1.1/bin/varnishd/storage/storage_malloc.c0000644000201500234410000001475412652366721017322 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Storage method based on malloc(3) */ #include "config.h" #include #include #include "cache/cache.h" #include "storage/storage.h" #include "vnum.h" struct sma_sc { unsigned magic; #define SMA_SC_MAGIC 0x1ac8a345 struct lock sma_mtx; size_t sma_max; size_t sma_alloc; struct VSC_C_sma *stats; }; struct sma { unsigned magic; #define SMA_MAGIC 0x69ae9bb9 struct storage s; size_t sz; struct sma_sc *sc; }; static struct VSC_C_lck *lck_sma; static struct storage * sma_alloc(const struct stevedore *st, size_t size) { struct sma_sc *sma_sc; struct sma *sma = NULL; void *p; CAST_OBJ_NOTNULL(sma_sc, st->priv, SMA_SC_MAGIC); Lck_Lock(&sma_sc->sma_mtx); sma_sc->stats->c_req++; if (sma_sc->sma_alloc + size > sma_sc->sma_max) { sma_sc->stats->c_fail++; size = 0; } else { sma_sc->sma_alloc += size; sma_sc->stats->c_bytes += size; sma_sc->stats->g_alloc++; sma_sc->stats->g_bytes += size; if (sma_sc->sma_max != SIZE_MAX) sma_sc->stats->g_space -= size; } Lck_Unlock(&sma_sc->sma_mtx); if (size == 0) return (NULL); /* * Do not collaps the sma allocation with sma->s.ptr: it is not * a good idea. Not only would it make ->trim impossible, * performance-wise it would be a catastropy with chunksized * allocations growing another full page, just to accommodate the sma. */ p = malloc(size); if (p != NULL) { ALLOC_OBJ(sma, SMA_MAGIC); if (sma != NULL) sma->s.ptr = p; else free(p); } if (sma == NULL) { Lck_Lock(&sma_sc->sma_mtx); /* * XXX: Not nice to have counters go backwards, but we do * XXX: Not want to pick up the lock twice just for stats. */ sma_sc->stats->c_fail++; sma_sc->sma_alloc -= size; sma_sc->stats->c_bytes -= size; sma_sc->stats->g_alloc--; sma_sc->stats->g_bytes -= size; if (sma_sc->sma_max != SIZE_MAX) sma_sc->stats->g_space += size; Lck_Unlock(&sma_sc->sma_mtx); return (NULL); } sma->sc = sma_sc; sma->sz = size; sma->s.priv = sma; sma->s.len = 0; sma->s.space = size; sma->s.magic = STORAGE_MAGIC; return (&sma->s); } static void __match_proto__(storage_free_f) sma_free(struct storage *s) { struct sma_sc *sma_sc; struct sma *sma; CHECK_OBJ_NOTNULL(s, STORAGE_MAGIC); CAST_OBJ_NOTNULL(sma, s->priv, SMA_MAGIC); sma_sc = sma->sc; assert(sma->sz == sma->s.space); Lck_Lock(&sma_sc->sma_mtx); sma_sc->sma_alloc -= sma->sz; sma_sc->stats->g_alloc--; sma_sc->stats->g_bytes -= sma->sz; sma_sc->stats->c_freed += sma->sz; if (sma_sc->sma_max != SIZE_MAX) sma_sc->stats->g_space += sma->sz; Lck_Unlock(&sma_sc->sma_mtx); free(sma->s.ptr); free(sma); } static void sma_trim(struct storage *s, size_t size, int move_ok) { struct sma_sc *sma_sc; struct sma *sma; void *p; size_t delta; CHECK_OBJ_NOTNULL(s, STORAGE_MAGIC); CAST_OBJ_NOTNULL(sma, s->priv, SMA_MAGIC); sma_sc = sma->sc; assert(sma->sz == sma->s.space); assert(size < sma->sz); if (!move_ok) return; delta = sma->sz - size; if (delta < 256) return; if ((p = realloc(sma->s.ptr, size)) != NULL) { Lck_Lock(&sma_sc->sma_mtx); sma_sc->sma_alloc -= delta; sma_sc->stats->g_bytes -= delta; sma_sc->stats->c_freed += delta; if (sma_sc->sma_max != SIZE_MAX) sma_sc->stats->g_space += delta; sma->sz = size; Lck_Unlock(&sma_sc->sma_mtx); sma->s.ptr = p; s->space = size; } } static double sma_used_space(const struct stevedore *st) { struct sma_sc *sma_sc; CAST_OBJ_NOTNULL(sma_sc, st->priv, SMA_SC_MAGIC); return (sma_sc->sma_alloc); } static double sma_free_space(const struct stevedore *st) { struct sma_sc *sma_sc; CAST_OBJ_NOTNULL(sma_sc, st->priv, SMA_SC_MAGIC); return (sma_sc->sma_max - sma_sc->sma_alloc); } static void sma_init(struct stevedore *parent, int ac, char * const *av) { const char *e; uintmax_t u; struct sma_sc *sc; ASSERT_MGT(); ALLOC_OBJ(sc, SMA_SC_MAGIC); AN(sc); sc->sma_max = SIZE_MAX; assert(sc->sma_max == SIZE_MAX); parent->priv = sc; AZ(av[ac]); if (ac > 1) ARGV_ERR("(-smalloc) too many arguments\n"); if (ac == 0 || *av[0] == '\0') return; e = VNUM_2bytes(av[0], &u, 0); if (e != NULL) ARGV_ERR("(-smalloc) size \"%s\": %s\n", av[0], e); if ((u != (uintmax_t)(size_t)u)) ARGV_ERR("(-smalloc) size \"%s\": too big\n", av[0]); if (u < 1024*1024) ARGV_ERR("(-smalloc) size \"%s\": too small, " "did you forget to specify M or G?\n", av[0]); sc->sma_max = u; } static void sma_open(const struct stevedore *st) { struct sma_sc *sma_sc; ASSERT_CLI(); if (lck_sma == NULL) lck_sma = Lck_CreateClass("sma"); CAST_OBJ_NOTNULL(sma_sc, st->priv, SMA_SC_MAGIC); Lck_New(&sma_sc->sma_mtx, lck_sma); sma_sc->stats = VSM_Alloc(sizeof *sma_sc->stats, VSC_CLASS, VSC_type_sma, st->ident); memset(sma_sc->stats, 0, sizeof *sma_sc->stats); if (sma_sc->sma_max != SIZE_MAX) sma_sc->stats->g_space = sma_sc->sma_max; } const struct stevedore sma_stevedore = { .magic = STEVEDORE_MAGIC, .name = "malloc", .init = sma_init, .open = sma_open, .alloc = sma_alloc, .free = sma_free, .trim = sma_trim, .methods = &default_oc_methods, .var_free_space = sma_free_space, .var_used_space = sma_used_space, }; varnish-4.1.1/bin/varnishd/builtin_vcl.h0000644000201500234410000001475012652366751015201 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit builtin.vcl instead and run make * */ "/*-\n" " * Copyright (c) 2006 Verdens Gang AS\n" " * Copyright (c) 2006-2015 Varnish Software AS\n" " * All rights reserved.\n" " *\n" " * Author: Poul-Henning Kamp \n" " *\n" " * Redistribution and use in source and binary forms, with or without\n" " * modification, are permitted provided that the following conditions\n" " * are met:\n" " * 1. Redistributions of source code must retain the above copyright\n" " * notice, this list of conditions and the following disclaimer.\n" " * 2. Redistributions in binary form must reproduce the above copyright\n" " * notice, this list of conditions and the following disclaimer in the\n" " * documentation and/or other materials provided with the distribution.\n" " *\n" " * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" " * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" " * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n" " * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" " * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" " * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" " * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" " * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" " * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" " * SUCH DAMAGE.\n" " *\n" "\n" " *\n" " * The built-in (previously called default) VCL code.\n" " *\n" " * NB! You do NOT need to copy & paste all of these functions into your\n" " * own vcl code, if you do not provide a definition of one of these\n" " * functions, the compiler will automatically fall back to the default\n" " * code from this file.\n" " *\n" " * This code will be prefixed with a backend declaration built from the\n" " * -b argument.\n" " */\n" "\n" "vcl 4.0;\n" "\n" "#######################################################################\n" "# Client side\n" "\n" "sub vcl_recv {\n" " if (req.method == \"PRI\") {\n" " /* We do not support SPDY or HTTP/2.0 */\n" " return (synth(405));\n" " }\n" " if (req.method != \"GET\" &&\n" " req.method != \"HEAD\" &&\n" " req.method != \"PUT\" &&\n" " req.method != \"POST\" &&\n" " req.method != \"TRACE\" &&\n" " req.method != \"OPTIONS\" &&\n" " req.method != \"DELETE\") {\n" " /* Non-RFC2616 or CONNECT which is weird. */\n" " return (pipe);\n" " }\n" "\n" " if (req.method != \"GET\" && req.method != \"HEAD\") {\n" " /* We only deal with GET and HEAD by default */\n" " return (pass);\n" " }\n" " if (req.http.Authorization || req.http.Cookie) {\n" " /* Not cacheable by default */\n" " return (pass);\n" " }\n" " return (hash);\n" "}\n" "\n" "sub vcl_pipe {\n" " # By default Connection: close is set on all piped requests, to stop\n" " # connection reuse from sending future requests directly to the\n" " # (potentially) wrong backend. If you do want this to happen, you can undo\n" " # it here.\n" " # unset bereq.http.connection;\n" " return (pipe);\n" "}\n" "\n" "sub vcl_pass {\n" " return (fetch);\n" "}\n" "\n" "sub vcl_hash {\n" " hash_data(req.url);\n" " if (req.http.host) {\n" " hash_data(req.http.host);\n" " } else {\n" " hash_data(server.ip);\n" " }\n" " return (lookup);\n" "}\n" "\n" "sub vcl_purge {\n" " return (synth(200, \"Purged\"));\n" "}\n" "\n" "sub vcl_hit {\n" " if (obj.ttl >= 0s) {\n" " // A pure unadultered hit, deliver it\n" " return (deliver);\n" " }\n" " if (obj.ttl + obj.grace > 0s) {\n" " // Object is in grace, deliver it\n" " // Automatically triggers a background fetch\n" " return (deliver);\n" " }\n" " // fetch & deliver once we get the result\n" " return (miss);\n" "}\n" "\n" "sub vcl_miss {\n" " return (fetch);\n" "}\n" "\n" "sub vcl_deliver {\n" " return (deliver);\n" "}\n" "\n" "/*\n" " * We can come here \"invisibly\" with the following errors: 413, 417 & 503\n" " */\n" "sub vcl_synth {\n" " set resp.http.Content-Type = \"text/html; charset=utf-8\";\n" " set resp.http.Retry-After = \"5\";\n" " synthetic( {\"\n" "\n" " \n" " \"} + resp.status + \" \" + resp.reason + {\"\n" " \n" " \n" "

Error \"} + resp.status + \" \" + resp.reason + {\"

\n" "

\"} + resp.reason + {\"

\n" "

Guru Meditation:

\n" "

XID: \"} + req.xid + {\"

\n" "
\n" "

Varnish cache server

\n" " \n" "\n" "\"} );\n" " return (deliver);\n" "}\n" "\n" "#######################################################################\n" "# Backend Fetch\n" "\n" "sub vcl_backend_fetch {\n" " return (fetch);\n" "}\n" "\n" "sub vcl_backend_response {\n" " if (beresp.ttl <= 0s ||\n" " beresp.http.Set-Cookie ||\n" " beresp.http.Surrogate-control ~ \"no-store\" ||\n" " (!beresp.http.Surrogate-Control &&\n" " beresp.http.Cache-Control ~ \"no-cache|no-store|private\") ||\n" " beresp.http.Vary == \"*\") {\n" " /*\n" " * Mark as \"Hit-For-Pass\" for the next 2 minutes\n" " */\n" " set beresp.ttl = 120s;\n" " set beresp.uncacheable = true;\n" " }\n" " return (deliver);\n" "}\n" "\n" "sub vcl_backend_error {\n" " set beresp.http.Content-Type = \"text/html; charset=utf-8\";\n" " set beresp.http.Retry-After = \"5\";\n" " synthetic( {\"\n" "\n" " \n" " \"} + beresp.status + \" \" + beresp.reason + {\"\n" " \n" " \n" "

Error \"} + beresp.status + \" \" + beresp.reason + {\"

\n" "

\"} + beresp.reason + {\"

\n" "

Guru Meditation:

\n" "

XID: \"} + bereq.xid + {\"

\n" "
\n" "

Varnish cache server

\n" " \n" "\n" "\"} );\n" " return (deliver);\n" "}\n" "\n" "#######################################################################\n" "# Housekeeping\n" "\n" "sub vcl_init {\n" "}\n" "\n" "sub vcl_fini {\n" " return (ok);\n" "}\n" varnish-4.1.1/bin/varnishd/cache/0000755000201500234410000000000012652366757013640 500000000000000varnish-4.1.1/bin/varnishd/cache/cache_backend_probe.c0000644000201500234410000003317212652366721017622 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Poll backends for collection of health statistics * * We co-opt threads from the worker pool for probing the backends, * but we want to avoid a potentially messy cleanup operation when we * retire the backend, so the thread owns the health information, which * the backend references, rather than the other way around. * */ #include "config.h" #include #include #include #include "cache.h" #include "binary_heap.h" #include "vcli_priv.h" #include "vrt.h" #include "vsa.h" #include "vtcp.h" #include "vtim.h" #include "cache_director.h" #include "cache_backend.h" /* Default averaging rate, we want something pretty responsive */ #define AVG_RATE 4 struct vbp_target { unsigned magic; #define VBP_TARGET_MAGIC 0x6b7cb656 VRT_BACKEND_PROBE_FIELDS() struct backend *backend; struct tcp_pool *tcp_pool; char *req; int req_len; char resp_buf[128]; unsigned good; /* Collected statistics */ #define BITMAP(n, c, t, b) uint64_t n; #include "tbl/backend_poll.h" #undef BITMAP double last; double avg; double rate; double due; int running; int heap_idx; struct pool_task task; }; static struct lock vbp_mtx; static pthread_cond_t vbp_cond; static struct binheap *vbp_heap; /*--------------------------------------------------------------------*/ static void vbp_delete(struct vbp_target *vt) { #define DN(x) /**/ VRT_BACKEND_PROBE_HANDLE(); #undef DN VBT_Rel(&vt->tcp_pool); free(vt->req); FREE_OBJ(vt); } /*-------------------------------------------------------------------- * Record pokings... */ static void vbp_start_poke(struct vbp_target *vt) { CHECK_OBJ_NOTNULL(vt, VBP_TARGET_MAGIC); #define BITMAP(n, c, t, b) \ vt->n <<= 1; #include "tbl/backend_poll.h" #undef BITMAP vt->last = 0; vt->resp_buf[0] = '\0'; } static void vbp_has_poked(struct vbp_target *vt) { unsigned i, j; uint64_t u; CHECK_OBJ_NOTNULL(vt, VBP_TARGET_MAGIC); /* Calculate exponential average */ if (vt->happy & 1) { if (vt->rate < AVG_RATE) vt->rate += 1.0; vt->avg += (vt->last - vt->avg) / vt->rate; } u = vt->happy; for (i = j = 0; i < vt->window; i++) { if (u & 1) j++; u >>= 1; } vt->good = j; } static void vbp_update_backend(struct vbp_target *vt) { unsigned i; char bits[10]; const char *logmsg; CHECK_OBJ_NOTNULL(vt, VBP_TARGET_MAGIC); Lck_Lock(&vbp_mtx); if (vt->backend != NULL) { i = 0; #define BITMAP(n, c, t, b) \ bits[i++] = (vt->n & 1) ? c : '-'; #include "tbl/backend_poll.h" #undef BITMAP bits[i] = '\0'; if (vt->good >= vt->threshold) { if (vt->backend->healthy) logmsg = "Still healthy"; else { logmsg = "Back healthy"; vt->backend->health_changed = VTIM_real(); } vt->backend->healthy = 1; } else { if (vt->backend->healthy) { logmsg = "Went sick"; vt->backend->health_changed = VTIM_real(); } else logmsg = "Still sick"; vt->backend->healthy = 0; } VSL(SLT_Backend_health, 0, "%s %s %s %u %u %u %.6f %.6f %s", vt->backend->display_name, logmsg, bits, vt->good, vt->threshold, vt->window, vt->last, vt->avg, vt->resp_buf); if (vt->backend != NULL && vt->backend->vsc != NULL) vt->backend->vsc->happy = vt->happy; } Lck_Unlock(&vbp_mtx); } static void vbp_reset(struct vbp_target *vt) { unsigned u; CHECK_OBJ_NOTNULL(vt, VBP_TARGET_MAGIC); vt->avg = 0.0; vt->rate = 0.0; #define BITMAP(n, c, t, b) \ vt->n = 0; #include "tbl/backend_poll.h" #undef BITMAP for (u = 0; u < vt->initial; u++) { vbp_start_poke(vt); vt->happy |= 1; vbp_has_poked(vt); } } /*-------------------------------------------------------------------- * Poke one backend, once, but possibly at both IPv4 and IPv6 addresses. * * We do deliberately not use the stuff in cache_backend.c, because we * want to measure the backends response without local distractions. */ static void vbp_poke(struct vbp_target *vt) { int s, tmo, i; double t_start, t_now, t_end; unsigned rlen, resp; char buf[8192], *p; struct pollfd pfda[1], *pfd = pfda; const struct suckaddr *sa; t_start = t_now = VTIM_real(); t_end = t_start + vt->timeout; s = VBT_Open(vt->tcp_pool, t_end - t_now, &sa); if (s < 0) { /* Got no connection: failed */ return; } i = VSA_Get_Proto(sa); if (i == AF_INET) vt->good_ipv4 |= 1; else if(i == AF_INET6) vt->good_ipv6 |= 1; else WRONG("Wrong probe protocol family"); t_now = VTIM_real(); tmo = (int)round((t_end - t_now) * 1e3); if (tmo <= 0) { /* Spent too long time getting it */ VTCP_close(&s); return; } /* Send the request */ i = write(s, vt->req, vt->req_len); if (i != vt->req_len) { if (i < 0) vt->err_xmit |= 1; VTCP_close(&s); return; } vt->good_xmit |= 1; pfd->fd = s; rlen = 0; do { pfd->events = POLLIN; pfd->revents = 0; tmo = (int)round((t_end - t_now) * 1e3); if (tmo > 0) i = poll(pfd, 1, tmo); if (i == 0 || tmo <= 0) { VTCP_close(&s); return; } if (rlen < sizeof vt->resp_buf) i = read(s, vt->resp_buf + rlen, sizeof vt->resp_buf - rlen); else i = read(s, buf, sizeof buf); rlen += i; } while (i > 0); VTCP_close(&s); if (i < 0) { vt->err_recv |= 1; return; } if (rlen == 0) return; /* So we have a good receive ... */ t_now = VTIM_real(); vt->last = t_now - t_start; vt->good_recv |= 1; /* Now find out if we like the response */ vt->resp_buf[sizeof vt->resp_buf - 1] = '\0'; p = strchr(vt->resp_buf, '\r'); if (p != NULL) *p = '\0'; p = strchr(vt->resp_buf, '\n'); if (p != NULL) *p = '\0'; i = sscanf(vt->resp_buf, "HTTP/%*f %u %s", &resp, buf); if ((i == 1 || i == 2) && resp == vt->exp_status) vt->happy |= 1; } /*-------------------------------------------------------------------- */ static void __match_proto__(task_func_t) vbp_task(struct worker *wrk, void *priv) { struct vbp_target *vt; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CAST_OBJ_NOTNULL(vt, priv, VBP_TARGET_MAGIC); AN(vt->running); AN(vt->req); assert(vt->req_len > 0); vbp_start_poke(vt); vbp_poke(vt); vbp_has_poked(vt); vbp_update_backend(vt); Lck_Lock(&vbp_mtx); if (vt->running < 0) { assert(vt->heap_idx == BINHEAP_NOIDX); vbp_delete(vt); } else { vt->running = 0; if (vt->heap_idx != BINHEAP_NOIDX) { vt->due = VTIM_real() + vt->interval; binheap_delete(vbp_heap, vt->heap_idx); binheap_insert(vbp_heap, vt); } } Lck_Unlock(&vbp_mtx); } /*-------------------------------------------------------------------- */ static void * __match_proto__() vbp_thread(struct worker *wrk, void *priv) { double now, nxt; struct vbp_target *vt; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AZ(priv); Lck_Lock(&vbp_mtx); while (1) { now = VTIM_real(); vt = binheap_root(vbp_heap); if (vt == NULL) { nxt = 8.192 + now; (void)Lck_CondWait(&vbp_cond, &vbp_mtx, nxt); } else if (vt->due > now) { nxt = vt->due; vt = NULL; (void)Lck_CondWait(&vbp_cond, &vbp_mtx, nxt); } else { binheap_delete(vbp_heap, vt->heap_idx); vt->due = now + vt->interval; if (!vt->running) { vt->running = 1; vt->task.func = vbp_task; vt->task.priv = vt; if (Pool_Task_Any(&vt->task, TASK_QUEUE_REQ)) vt->running = 0; } binheap_insert(vbp_heap, vt); } } Lck_Unlock(&vbp_mtx); NEEDLESS_RETURN(NULL); } /*-------------------------------------------------------------------- * Cli functions */ static void vbp_bitmap(struct cli *cli, char c, uint64_t map, const char *lbl) { int i; uint64_t u = (1ULL << 63); VCLI_Out(cli, " "); for (i = 0; i < 64; i++) { if (map & u) VCLI_Out(cli, "%c", c); else VCLI_Out(cli, "-"); map <<= 1; } VCLI_Out(cli, " %s\n", lbl); } /*lint -e{506} constant value boolean */ /*lint -e{774} constant value boolean */ static void vbp_health_one(struct cli *cli, const struct vbp_target *vt) { VCLI_Out(cli, " Current states good: %2u threshold: %2u window: %2u\n", vt->good, vt->threshold, vt->window); VCLI_Out(cli, " Average response time of good probes: %.6f\n", vt->avg); VCLI_Out(cli, " Oldest ======================" "============================ Newest\n"); #define BITMAP(n, c, t, b) \ if ((vt->n != 0) || (b)) \ vbp_bitmap(cli, (c), vt->n, (t)); #include "tbl/backend_poll.h" #undef BITMAP } void VBP_Status(struct cli *cli, const struct backend *be, int details) { struct vbp_target *vt; CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); vt = be->probe; CHECK_OBJ_NOTNULL(vt, VBP_TARGET_MAGIC); VCLI_Out(cli, "%d/%d", vt->good, vt->window); if (details) { VCLI_Out(cli, "\n"); vbp_health_one(cli, vt); } } /*-------------------------------------------------------------------- * Build request from probe spec */ static void vbp_build_req(struct vbp_target *vt, const struct vrt_backend_probe *vbp, const struct backend *be) { struct vsb *vsb; vsb = VSB_new_auto(); AN(vsb); VSB_clear(vsb); if(vbp->request != NULL) { VSB_cat(vsb, vbp->request); } else { VSB_printf(vsb, "GET %s HTTP/1.1\r\n", vbp->url != NULL ? vbp->url : "/"); if (be->hosthdr != NULL) VSB_printf(vsb, "Host: %s\r\n", be->hosthdr); VSB_printf(vsb, "Connection: close\r\n"); VSB_printf(vsb, "\r\n"); } AZ(VSB_finish(vsb)); vt->req = strdup(VSB_data(vsb)); AN(vt->req); vt->req_len = VSB_len(vsb); VSB_delete(vsb); } /*-------------------------------------------------------------------- * Sanitize and set defaults * XXX: we could make these defaults parameters */ static void vbp_set_defaults(struct vbp_target *vt, const struct vrt_backend_probe *vp) { #define DN(x) do { vt->x = vp->x; } while (0) VRT_BACKEND_PROBE_HANDLE(); #undef DN if (vt->timeout == 0.0) vt->timeout = 2.0; if (vt->interval == 0.0) vt->interval = 5.0; if (vt->window == 0) vt->window = 8; if (vt->threshold == 0) vt->threshold = 3; if (vt->exp_status == 0) vt->exp_status = 200; if (vt->initial == ~0U) vt->initial = vt->threshold - 1; if (vt->initial > vt->threshold) vt->initial = vt->threshold; } /*-------------------------------------------------------------------- */ void VBP_Control(const struct backend *be, int enable) { struct vbp_target *vt; CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); vt = be->probe; CHECK_OBJ_NOTNULL(vt, VBP_TARGET_MAGIC); vbp_reset(vt); vbp_update_backend(vt); Lck_Lock(&vbp_mtx); if (enable) { assert(vt->heap_idx == BINHEAP_NOIDX); vt->due = VTIM_real(); binheap_insert(vbp_heap, vt); AZ(pthread_cond_signal(&vbp_cond)); } else { assert(vt->heap_idx != BINHEAP_NOIDX); binheap_delete(vbp_heap, vt->heap_idx); } Lck_Unlock(&vbp_mtx); } /*-------------------------------------------------------------------- * Insert/Remove/Use called from cache_backend.c */ void VBP_Insert(struct backend *b, const struct vrt_backend_probe *vp, struct tcp_pool *tp) { struct vbp_target *vt; CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); CHECK_OBJ_NOTNULL(vp, VRT_BACKEND_PROBE_MAGIC); AZ(b->probe); ALLOC_OBJ(vt, VBP_TARGET_MAGIC); XXXAN(vt); vt->tcp_pool = tp; vt->backend = b; b->probe = vt; vbp_set_defaults(vt, vp); vbp_build_req(vt, vp, b); vbp_reset(vt); vbp_update_backend(vt); } void VBP_Remove(struct backend *be) { struct vbp_target *vt; CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); vt = be->probe; CHECK_OBJ_NOTNULL(vt, VBP_TARGET_MAGIC); Lck_Lock(&vbp_mtx); be->healthy = 1; be->probe = NULL; vt->backend = NULL; if (vt->running) { vt->running = -1; vt = NULL; } Lck_Unlock(&vbp_mtx); if (vt != NULL) { assert(vt->heap_idx == BINHEAP_NOIDX); vbp_delete(vt); } } /*-------------------------------------------------------------------*/ static int __match_proto__(binheap_cmp_t) vbp_cmp(void *priv, const void *a, const void *b) { const struct vbp_target *aa, *bb; AZ(priv); CAST_OBJ_NOTNULL(aa, a, VBP_TARGET_MAGIC); CAST_OBJ_NOTNULL(bb, b, VBP_TARGET_MAGIC); if (aa->running && !bb->running) return (0); return (aa->due < bb->due); } static void __match_proto__(binheap_update_t) vbp_update(void *priv, void *p, unsigned u) { struct vbp_target *vt; AZ(priv); CAST_OBJ_NOTNULL(vt, p, VBP_TARGET_MAGIC); vt->heap_idx = u; } /*-------------------------------------------------------------------*/ void VBP_Init(void) { pthread_t thr; Lck_New(&vbp_mtx, lck_backend); vbp_heap = binheap_new(NULL, vbp_cmp, vbp_update); AN(vbp_heap); AZ(pthread_cond_init(&vbp_cond, NULL)); WRK_BgThread(&thr, "Backend poller", vbp_thread, NULL); } varnish-4.1.1/bin/varnishd/cache/cache_obj.c0000644000201500234410000004321412652366721015614 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Primary API: * ObjNew Associate stevedore with oc * ObjGetSpace Add space * ObjExtend Commit space * ObjDone Object completed * ObjGetLen Len of committed space * ObjIter Iterate over committed space * ObjReserveAttr Attr will be set later * ObjSetAttr Set attr now * ObjGetAttr Get attr no * ObjRelease Done with attr ptr */ #include "config.h" #include #include "cache.h" #include "vend.h" #include "storage/storage.h" #include "hash/hash_slinger.h" static const struct storeobj_methods * obj_getmethods(const struct objcore *oc) { CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(oc->stobj->stevedore, STEVEDORE_MAGIC); AN(oc->stobj->stevedore->methods); return (oc->stobj->stevedore->methods); } static struct object * obj_getobj(struct worker *wrk, struct objcore *oc) { const struct storeobj_methods *m; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); m = obj_getmethods(oc); AN(m->getobj); return (m->getobj(wrk, oc)); } /*==================================================================== * ObjIterBegin() * ObjIter() * ObjIterEnd() * * These three allow iteration over the body of an object. * The ObjIterBegin() returns a magic cookie which must be passed to * ObjIter() and which ObjIterEnd() will obliterate again. * * These functions get slightly complicated due to unbusy but not * yet completed objects (ie: when streaming). Exactly how they * interact with ObjExtend(), especially with respect to locking, * is entirely up to the implementation. */ struct objiter { unsigned magic; #define OBJITER_MAGIC 0x745fb151 struct busyobj *bo; struct objcore *oc; struct object *obj; struct storage *st; struct worker *wrk; ssize_t len; struct storage *checkpoint; ssize_t checkpoint_len; }; void * ObjIterBegin(struct worker *wrk, struct objcore *oc) { struct objiter *oi; struct object *obj; const struct storeobj_methods *om = obj_getmethods(oc); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); if (om->objiterbegin != NULL) return (om->objiterbegin(wrk, oc)); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); obj = obj_getobj(wrk, oc); CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC); ALLOC_OBJ(oi, OBJITER_MAGIC); if (oi == NULL) return (oi); oi->oc = oc; oi->obj = obj; oi->wrk = wrk; oi->bo = HSH_RefBusy(oc); return (oi); } enum objiter_status ObjIter(struct objcore *oc, void *oix, void **p, ssize_t *l) { struct objiter *oi; ssize_t ol; ssize_t nl; ssize_t sl; const struct storeobj_methods *om = obj_getmethods(oc); AN(oix); AN(p); AN(l); if (om->objiter != NULL) return (om->objiter(oc, oix, p, l)); CAST_OBJ_NOTNULL(oi, oix, OBJITER_MAGIC); CHECK_OBJ_NOTNULL(oi->obj, OBJECT_MAGIC); *p = NULL; *l = 0; if (oi->bo == NULL) { if (oi->st == NULL) oi->st = VTAILQ_FIRST(&oi->obj->list); else oi->st = VTAILQ_NEXT(oi->st, list); while(oi->st != NULL && oi->st->len == 0) oi->st = VTAILQ_NEXT(oi->st, list); if (oi->st != NULL) { *p = oi->st->ptr; *l = oi->st->len; assert(*l > 0); return (OIS_DATA); } return (OIS_DONE); } else { ol = oi->len; while (1) { nl = VBO_waitlen(oi->wrk, oi->bo, ol); if (nl != ol) break; if (oi->bo->state == BOS_FINISHED) return (OIS_DONE); if (oi->bo->state == BOS_FAILED) return (OIS_ERROR); } Lck_Lock(&oi->bo->mtx); AZ(VTAILQ_EMPTY(&oi->obj->list)); if (oi->checkpoint == NULL) { oi->st = VTAILQ_FIRST(&oi->obj->list); sl = 0; } else { oi->st = oi->checkpoint; sl = oi->checkpoint_len; ol -= oi->checkpoint_len; } while (oi->st != NULL) { if (oi->st->len > ol) { *p = oi->st->ptr + ol; *l = oi->st->len - ol; oi->len += *l; break; } ol -= oi->st->len; assert(ol >= 0); nl -= oi->st->len; assert(nl > 0); sl += oi->st->len; oi->st = VTAILQ_NEXT(oi->st, list); if (VTAILQ_NEXT(oi->st, list) != NULL) { oi->checkpoint = oi->st; oi->checkpoint_len = sl; } } CHECK_OBJ_NOTNULL(oi->obj, OBJECT_MAGIC); CHECK_OBJ_NOTNULL(oi->st, STORAGE_MAGIC); oi->st = VTAILQ_NEXT(oi->st, list); if (oi->st != NULL && oi->st->len == 0) oi->st = NULL; Lck_Unlock(&oi->bo->mtx); assert(*l > 0 || oi->bo->state == BOS_FINISHED); return (oi->st != NULL ? OIS_DATA : OIS_STREAM); } } void ObjIterEnd(struct objcore *oc, void **oix) { struct objiter *oi; const struct storeobj_methods *om = obj_getmethods(oc); AN(oix); if (om->objiterend != NULL) { om->objiterend(oc, oix); return; } CAST_OBJ_NOTNULL(oi, (*oix), OBJITER_MAGIC); *oix = NULL; CHECK_OBJ_NOTNULL(oi->obj, OBJECT_MAGIC); if (oi->bo != NULL) { if (oi->oc->flags & OC_F_PASS) oi->bo->abandon = 1; VBO_DerefBusyObj(oi->wrk, &oi->bo); } FREE_OBJ(oi); } /*-------------------------------------------------------------------- */ static struct storage * objallocwithnuke(struct worker *wrk, const struct stevedore *stv, size_t size) { struct storage *st = NULL; unsigned fail; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC); if (size > cache_param->fetch_maxchunksize) size = cache_param->fetch_maxchunksize; assert(size <= UINT_MAX); /* field limit in struct storage */ for (fail = 0; fail <= cache_param->nuke_limit; fail++) { /* try to allocate from it */ AN(stv->alloc); st = STV_alloc(stv, size); if (st != NULL) break; /* no luck; try to free some space and keep trying */ if (fail < cache_param->nuke_limit && EXP_NukeOne(wrk, stv->lru) == -1) break; } CHECK_OBJ_ORNULL(st, STORAGE_MAGIC); return (st); } /*==================================================================== * ObjGetSpace() * * This function returns a pointer and length of free space. If there * is no free space, some will be added first. * * The "sz" argument is an input hint of how much space is desired. */ int ObjGetSpace(struct worker *wrk, struct objcore *oc, ssize_t *sz, uint8_t **ptr) { struct object *o; struct storage *st; const struct storeobj_methods *om = obj_getmethods(oc); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AN(sz); AN(ptr); assert(*sz > 0); if (om->objgetspace != NULL) return (om->objgetspace(wrk, oc, sz, ptr)); o = obj_getobj(wrk, oc); CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); st = VTAILQ_LAST(&o->list, storagehead); if (st != NULL && st->len < st->space) { *sz = st->space - st->len; *ptr = st->ptr + st->len; assert (*sz > 0); return (1); } st = objallocwithnuke(wrk, oc->stobj->stevedore, *sz); if (st == NULL) return (0); if (oc->busyobj != NULL) { CHECK_OBJ_NOTNULL(oc->busyobj, BUSYOBJ_MAGIC); Lck_Lock(&oc->busyobj->mtx); VTAILQ_INSERT_TAIL(&o->list, st, list); Lck_Unlock(&oc->busyobj->mtx); } else { AN(oc->flags & (OC_F_PRIVATE)); VTAILQ_INSERT_TAIL(&o->list, st, list); } *sz = st->space - st->len; assert (*sz > 0); *ptr = st->ptr + st->len; return (1); } /*==================================================================== * ObjExtend() * * This function extends the used part of the object a number of bytes * into the last space returned by ObjGetSpace() */ void ObjExtend(struct worker *wrk, struct objcore *oc, ssize_t l) { struct object *o; struct storage *st; const struct storeobj_methods *om = obj_getmethods(oc); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); assert(l > 0); if (om->objextend != NULL) { om->objextend(wrk, oc, l); return; } o = obj_getobj(wrk, oc); CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); st = VTAILQ_LAST(&o->list, storagehead); CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); assert(st->len + l <= st->space); st->len += l; o->len += l; } /*==================================================================== * ObjGetlen() * * This is a separate function because it may need locking */ uint64_t ObjGetLen(struct worker *wrk, struct objcore *oc) { struct object *o; const struct storeobj_methods *om = obj_getmethods(oc); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); if (om->objgetlen != NULL) return (om->objgetlen(wrk, oc)); o = obj_getobj(wrk, oc); CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); return (o->len); } /*==================================================================== * ObjTrimStore() * * Release any surplus space allocated, we promise not to call ObjExtend() * any more. */ void ObjTrimStore(struct worker *wrk, struct objcore *oc) { const struct stevedore *stv; struct storage *st; struct object *o; const struct storeobj_methods *om = obj_getmethods(oc); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); if (om->objtrimstore != NULL) { om->objtrimstore(wrk, oc); return; } stv = oc->stobj->stevedore; CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC); o = obj_getobj(wrk, oc); CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); st = VTAILQ_LAST(&o->list, storagehead); if (st == NULL) return; if (st->len == 0) { VTAILQ_REMOVE(&o->list, st, list); STV_free(stv, st); } else if (st->len < st->space) { STV_trim(stv, st, st->len, 1); } } /*==================================================================== * ObjSlim() * * Free the whatever storage can be freed, without freeing the actual * object yet. */ void ObjSlim(struct worker *wrk, struct objcore *oc) { const struct stevedore *stv; struct object *o; struct storage *st, *stn; const struct storeobj_methods *om = obj_getmethods(oc); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); if (om->objslim != NULL) { om->objslim(wrk, oc); return; } stv = oc->stobj->stevedore; CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC); o = obj_getobj(wrk, oc); CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); if (o->esidata != NULL) { STV_free(stv, o->esidata); o->esidata = NULL; } VTAILQ_FOREACH_SAFE(st, &o->list, list, stn) { CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); VTAILQ_REMOVE(&o->list, st, list); STV_free(stv, st); } } /*==================================================================== */ void ObjUpdateMeta(struct worker *wrk, struct objcore *oc) { const struct storeobj_methods *m = obj_getmethods(oc); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); if (m->updatemeta != NULL) m->updatemeta(wrk, oc); } /*==================================================================== */ void ObjFreeObj(struct worker *wrk, struct objcore *oc) { const struct storeobj_methods *m = obj_getmethods(oc); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AN(m->freeobj); m->freeobj(wrk, oc); AZ(oc->stobj->stevedore); } /*==================================================================== */ struct lru * ObjGetLRU(const struct objcore *oc) { const struct storeobj_methods *m = obj_getmethods(oc); AN(m->getlru); return (m->getlru(oc)); } /*==================================================================== * ObjGetattr() * * Get an attribute of the object. */ void * ObjGetattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr, ssize_t *len) { struct object *o; ssize_t dummy; const struct storeobj_methods *om = obj_getmethods(oc); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); if (om->objgetattr != NULL) return (om->objgetattr(wrk, oc, attr, len)); if (len == NULL) len = &dummy; o = obj_getobj(wrk, oc); CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); switch (attr) { case OA_ESIDATA: if (o->esidata == NULL) return (NULL); *len = o->esidata->len; return (o->esidata->ptr); case OA_FLAGS: *len = sizeof o->oa_flags; return (o->oa_flags); case OA_GZIPBITS: *len = sizeof o->oa_gzipbits; return (o->oa_gzipbits); case OA_HEADERS: *len = 0; // XXX: hack return (o->oa_http); case OA_LASTMODIFIED: *len = sizeof o->oa_lastmodified; return (o->oa_lastmodified); case OA_VARY: *len = 4; // XXX: hack return (o->oa_vary); case OA_VXID: *len = sizeof o->oa_vxid; return (o->oa_vxid); default: break; } WRONG("Unsupported OBJ_ATTR"); } /*==================================================================== * ObjSetattr() * * If ptr is Non-NULL, it points to the new content which is copied into * the attribute. Otherwise the caller will have to do the copying. */ void * ObjSetattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr, ssize_t len, const void *ptr) { struct object *o; void *retval = NULL; struct storage *st; const struct storeobj_methods *om = obj_getmethods(oc); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); if (om->objsetattr != NULL) return (om->objsetattr(wrk, oc, attr, len, ptr)); o = obj_getobj(wrk, oc); CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); st = o->objstore; switch (attr) { case OA_ESIDATA: o->esidata = objallocwithnuke(wrk, oc->stobj->stevedore, len); if (o->esidata == NULL) return (NULL); o->esidata->len = len; retval = o->esidata->ptr; break; case OA_FLAGS: assert(len == sizeof o->oa_flags); retval = o->oa_flags; break; case OA_GZIPBITS: assert(len == sizeof o->oa_gzipbits); retval = o->oa_gzipbits; break; case OA_HEADERS: len = PRNDUP(len); assert(st->len + len <= st->space); o->oa_http = (void*)(st->ptr + st->len); st->len += len; retval = o->oa_http; break; case OA_LASTMODIFIED: assert(len == sizeof o->oa_lastmodified); retval = o->oa_lastmodified; break; case OA_VARY: len = PRNDUP(len); assert(st->len + len <= st->space); o->oa_vary = (void*)(st->ptr + st->len); st->len += len; retval = o->oa_vary; break; case OA_VXID: assert(len == sizeof o->oa_vxid); retval = o->oa_vxid; break; default: WRONG("Unsupported OBJ_ATTR"); break; } if (ptr != NULL) memcpy(retval, ptr, len); return (retval); } /*==================================================================== * Utility functions which work on top of the previous ones */ int ObjCopyAttr(struct worker *wrk, struct objcore *oc, struct objcore *ocs, enum obj_attr attr) { void *vps, *vpd; ssize_t l; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(ocs, OBJCORE_MAGIC); vps = ObjGetattr(wrk, ocs, attr, &l); // XXX: later we want to have zero-length OA's too if (vps == NULL || l <= 0) return (-1); vpd = ObjSetattr(wrk, oc, attr, l, vps); if (vpd == NULL) return (-1); return (0); } unsigned ObjGetXID(struct worker *wrk, struct objcore *oc) { uint32_t u; AZ(ObjGetU32(wrk, oc, OA_VXID, &u)); return (u); } /*-------------------------------------------------------------------- * There is no well-defined byteorder for IEEE-754 double and the * correct solution (frexp(3) and manual encoding) is more work * than our (weak) goal of being endian-agnostic requires at this point. * We give it a shot by memcpy'ing doubles over a uint64_t and then * BE encode that. */ int ObjSetDouble(struct worker *wrk, struct objcore *oc, enum obj_attr a, double t) { void *vp; uint64_t u; assert(sizeof t == sizeof u); memcpy(&u, &t, sizeof u); vp = ObjSetattr(wrk, oc, a, sizeof u, NULL); if (vp == NULL) return (-1); vbe64enc(vp, u); return (0); } int ObjGetDouble(struct worker *wrk, struct objcore *oc, enum obj_attr a, double *d) { void *vp; uint64_t u; ssize_t l; assert(sizeof *d == sizeof u); vp = ObjGetattr(wrk, oc, a, &l); if (vp == NULL) return (-1); if (d != NULL) { assert(l == sizeof u); u = vbe64dec(vp); memcpy(d, &u, sizeof *d); } return (0); } /*-------------------------------------------------------------------- */ int ObjSetU64(struct worker *wrk, struct objcore *oc, enum obj_attr a, uint64_t t) { void *vp; vp = ObjSetattr(wrk, oc, a, sizeof t, NULL); if (vp == NULL) return (-1); vbe64enc(vp, t); return (0); } int ObjGetU64(struct worker *wrk, struct objcore *oc, enum obj_attr a, uint64_t *d) { void *vp; ssize_t l; vp = ObjGetattr(wrk, oc, a, &l); if (vp == NULL || l != sizeof *d) return (-1); if (d != NULL) *d = vbe64dec(vp); return (0); } int ObjSetU32(struct worker *wrk, struct objcore *oc, enum obj_attr a, uint32_t t) { void *vp; vp = ObjSetattr(wrk, oc, a, sizeof t, NULL); if (vp == NULL) return (-1); vbe32enc(vp, t); return (0); } int ObjGetU32(struct worker *wrk, struct objcore *oc, enum obj_attr a, uint32_t *d) { void *vp; ssize_t l; vp = ObjGetattr(wrk, oc, a, &l); if (vp == NULL || l != sizeof *d) return (-1); if (d != NULL) *d = vbe32dec(vp); return (0); } /*-------------------------------------------------------------------- */ int ObjCheckFlag(struct worker *wrk, struct objcore *oc, enum obj_flags of) { uint8_t *fp; fp = ObjGetattr(wrk, oc, OA_FLAGS, NULL); AN(fp); return ((*fp) & of); } void ObjSetFlag(struct worker *wrk, struct objcore *oc, enum obj_flags of, int val) { uint8_t *fp; fp = ObjSetattr(wrk, oc, OA_FLAGS, 1, NULL); AN(fp); if (val) (*fp) |= of; else (*fp) &= ~of; } varnish-4.1.1/bin/varnishd/cache/cache_filter.h0000644000201500234410000000712012652366721016330 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ struct busyobj; struct req; struct vfp_entry; struct vfp_ctx; /* Fetch processors --------------------------------------------------*/ enum vfp_status { VFP_ERROR = -1, VFP_OK = 0, VFP_END = 1, VFP_NULL = 2, }; typedef enum vfp_status vfp_init_f(struct vfp_ctx *, struct vfp_entry *); typedef enum vfp_status vfp_pull_f(struct vfp_ctx *, struct vfp_entry *, void *ptr, ssize_t *len); typedef void vfp_fini_f(struct vfp_ctx *, struct vfp_entry *); struct vfp { const char *name; vfp_init_f *init; vfp_pull_f *pull; vfp_fini_f *fini; const void *priv1; intptr_t priv2; }; struct vfp_entry { unsigned magic; #define VFP_ENTRY_MAGIC 0xbe32a027 const struct vfp *vfp; void *priv1; intptr_t priv2; enum vfp_status closed; VTAILQ_ENTRY(vfp_entry) list; uint64_t calls; uint64_t bytes_out; }; extern const struct vfp vfp_gunzip; extern const struct vfp vfp_gzip; extern const struct vfp vfp_testgunzip; extern const struct vfp vfp_esi; extern const struct vfp vfp_esi_gzip; struct vfp_entry *VFP_Push(struct vfp_ctx *, const struct vfp *, int top); void VFP_Setup(struct vfp_ctx *vc); int VFP_Open(struct vfp_ctx *bo); void VFP_Close(struct vfp_ctx *bo); enum vfp_status VFP_Suck(struct vfp_ctx *, void *p, ssize_t *lp); enum vfp_status VFP_Error(struct vfp_ctx *, const char *fmt, ...) __v_printflike(2, 3); /* cache_fetch_proc.c */ enum vfp_status VFP_GetStorage(struct vfp_ctx *, ssize_t *sz, uint8_t **ptr); /* Deliver processors ------------------------------------------------*/ enum vdp_action { VDP_INIT, /* Happens on VDP_push() */ VDP_FINI, /* Happens on VDP_pop() */ VDP_NULL, /* Input buffer valid after call */ VDP_FLUSH, /* Input buffer will be invalidated */ }; typedef int vdp_bytes(struct req *, enum vdp_action, void **priv, const void *ptr, ssize_t len); struct vdp_entry { unsigned magic; #define VDP_ENTRY_MAGIC 0x353eb781 vdp_bytes *func; void *priv; VTAILQ_ENTRY(vdp_entry) list; }; int VDP_bytes(struct req *, enum vdp_action act, const void *ptr, ssize_t len); void VDP_push(struct req *, vdp_bytes *func, void *priv, int bottom); void VDP_close(struct req *req); enum objiter_status VDP_DeliverObj(struct req *req); vdp_bytes VDP_gunzip; vdp_bytes VDP_ESI; varnish-4.1.1/bin/varnishd/cache/cache_shmlog.c0000644000201500234410000002703512652366721016336 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include "cache.h" #include "common/heritage.h" #include "vsl_priv.h" #include "vmb.h" #include "vtim.h" /* These cannot be struct lock, which depends on vsm/vsl working */ static pthread_mutex_t vsl_mtx; static pthread_mutex_t vsm_mtx; static struct VSL_head *vsl_head; static const uint32_t *vsl_end; static uint32_t *vsl_ptr; static unsigned vsl_segment_n; static ssize_t vsl_segsize; struct VSC_C_main *VSC_C_main; static void vsl_sanity(const struct vsl_log *vsl) { AN(vsl); AN(vsl->wlp); AN(vsl->wlb); AN(vsl->wle); } /*-------------------------------------------------------------------- * Check if the VSL_tag is masked by parameter bitmap */ static inline int vsl_tag_is_masked(enum VSL_tag_e tag) { volatile uint8_t *bm = &cache_param->vsl_mask[0]; uint8_t b; assert(tag > SLT__Bogus); assert(tag < SLT__Reserved); bm += ((unsigned)tag >> 3); b = (0x80 >> ((unsigned)tag & 7)); return (*bm & b); } /*-------------------------------------------------------------------- * Lay down a header fields, and return pointer to the next record */ static inline uint32_t * vsl_hdr(enum VSL_tag_e tag, uint32_t *p, unsigned len, uint32_t vxid) { AZ((uintptr_t)p & 0x3); assert(tag > SLT__Bogus); assert(tag < SLT__Reserved); AZ(len & ~VSL_LENMASK); p[1] = vxid; p[0] = ((((unsigned)tag & 0xff) << 24) | len); return (VSL_END(p, len)); } /*-------------------------------------------------------------------- * Wrap the VSL buffer */ static void vsl_wrap(void) { assert(vsl_ptr >= vsl_head->log); assert(vsl_ptr < vsl_end); vsl_segment_n += VSL_SEGMENTS - (vsl_segment_n % VSL_SEGMENTS); assert(vsl_segment_n % VSL_SEGMENTS == 0); vsl_head->offset[0] = 0; vsl_head->log[0] = VSL_ENDMARKER; VWMB(); if (vsl_ptr != vsl_head->log) { *vsl_ptr = VSL_WRAPMARKER; vsl_ptr = vsl_head->log; } vsl_head->segment_n = vsl_segment_n; VSC_C_main->shm_cycles++; } /*-------------------------------------------------------------------- * Reserve bytes for a record, wrap if necessary */ static uint32_t * vsl_get(unsigned len, unsigned records, unsigned flushes) { uint32_t *p; int err; err = pthread_mutex_trylock(&vsl_mtx); if (err == EBUSY) { AZ(pthread_mutex_lock(&vsl_mtx)); VSC_C_main->shm_cont++; } else { AZ(err); } assert(vsl_ptr < vsl_end); AZ((uintptr_t)vsl_ptr & 0x3); VSC_C_main->shm_writes++; VSC_C_main->shm_flushes += flushes; VSC_C_main->shm_records += records; /* Wrap if necessary */ if (VSL_END(vsl_ptr, len) >= vsl_end) vsl_wrap(); p = vsl_ptr; vsl_ptr = VSL_END(vsl_ptr, len); assert(vsl_ptr < vsl_end); AZ((uintptr_t)vsl_ptr & 0x3); *vsl_ptr = VSL_ENDMARKER; while ((vsl_ptr - vsl_head->log) / vsl_segsize > vsl_segment_n % VSL_SEGMENTS) { vsl_segment_n++; vsl_head->offset[vsl_segment_n % VSL_SEGMENTS] = vsl_ptr - vsl_head->log; } AZ(pthread_mutex_unlock(&vsl_mtx)); /* Implicit VWMB() in mutex op ensures ENDMARKER and new table values are seen before new segment number */ vsl_head->segment_n = vsl_segment_n; return (p); } /*-------------------------------------------------------------------- * Stick a finished record into VSL. */ static void vslr(enum VSL_tag_e tag, uint32_t vxid, const char *b, unsigned len) { uint32_t *p; unsigned mlen; mlen = cache_param->vsl_reclen; /* Truncate */ if (len > mlen) len = mlen; p = vsl_get(len, 1, 0); memcpy(p + 2, b, len); /* * vsl_hdr() writes p[1] again, but we want to make sure it * has hit memory because we work on the live buffer here. */ p[1] = vxid; VWMB(); (void)vsl_hdr(tag, p, len, vxid); } /*-------------------------------------------------------------------- * Add a unbuffered record to VSL * * NB: This variant should be used sparingly and only for low volume * NB: since it significantly adds to the mutex load on the VSL. */ void VSL(enum VSL_tag_e tag, uint32_t vxid, const char *fmt, ...) { va_list ap; unsigned n, mlen = cache_param->vsl_reclen; char buf[mlen]; AN(fmt); if (vsl_tag_is_masked(tag)) return; if (strchr(fmt, '%') == NULL) { vslr(tag, vxid, fmt, strlen(fmt) + 1); } else { va_start(ap, fmt); n = vsnprintf(buf, mlen, fmt, ap); va_end(ap); if (n > mlen - 1) n = mlen - 1; buf[n++] = '\0'; /* NUL-terminated */ vslr(tag, vxid, buf, n); } } /*--------------------------------------------------------------------*/ void VSL_Flush(struct vsl_log *vsl, int overflow) { uint32_t *p; unsigned l; vsl_sanity(vsl); l = pdiff(vsl->wlb, vsl->wlp); if (l == 0) return; assert(l >= 8); p = vsl_get(l, vsl->wlr, overflow); memcpy(p + 2, vsl->wlb, l); p[1] = l; VWMB(); p[0] = ((((unsigned)SLT__Batch & 0xff) << 24) | 0); vsl->wlp = vsl->wlb; vsl->wlr = 0; } /*-------------------------------------------------------------------- * VSL-buffered-txt */ void VSLbt(struct vsl_log *vsl, enum VSL_tag_e tag, txt t) { unsigned l, mlen; char *p; vsl_sanity(vsl); Tcheck(t); if (vsl_tag_is_masked(tag)) return; mlen = cache_param->vsl_reclen; /* Truncate */ l = Tlen(t); if (l > mlen - 1) l = mlen - 1; assert(vsl->wlp < vsl->wle); /* Flush if necessary */ if (VSL_END(vsl->wlp, l + 1) >= vsl->wle) VSL_Flush(vsl, 1); assert(VSL_END(vsl->wlp, l + 1) < vsl->wle); p = VSL_DATA(vsl->wlp); memcpy(p, t.b, l); p[l++] = '\0'; /* NUL-terminated */ vsl->wlp = vsl_hdr(tag, vsl->wlp, l, vsl->wid); assert(vsl->wlp < vsl->wle); vsl->wlr++; if (DO_DEBUG(DBG_SYNCVSL)) VSL_Flush(vsl, 0); } /*-------------------------------------------------------------------- * VSL-buffered */ void VSLbv(struct vsl_log *vsl, enum VSL_tag_e tag, const char *fmt, va_list ap) { char *p; const char *u, *f; unsigned n, mlen; txt t; vsl_sanity(vsl); AN(fmt); if (vsl_tag_is_masked(tag)) return; /* * If there are no printf-expansions, don't waste time expanding them */ f = NULL; for (u = fmt; *u != '\0'; u++) if (*u == '%') f = u; if (f == NULL) { t.b = TRUST_ME(fmt); t.e = TRUST_ME(u); VSLbt(vsl, tag, t); return; } mlen = cache_param->vsl_reclen; /* Flush if we cannot fit a full size record */ if (VSL_END(vsl->wlp, mlen + 1) >= vsl->wle) VSL_Flush(vsl, 1); p = VSL_DATA(vsl->wlp); n = vsnprintf(p, mlen, fmt, ap); if (n > mlen - 1) n = mlen - 1; /* we truncate long fields */ p[n++] = '\0'; /* NUL-terminated */ vsl->wlp = vsl_hdr(tag, vsl->wlp, n, vsl->wid); assert(vsl->wlp < vsl->wle); vsl->wlr++; if (DO_DEBUG(DBG_SYNCVSL)) VSL_Flush(vsl, 0); } void VSLb(struct vsl_log *vsl, enum VSL_tag_e tag, const char *fmt, ...) { va_list ap; vsl_sanity(vsl); va_start(ap, fmt); VSLbv(vsl, tag, fmt, ap); va_end(ap); } void VSLb_ts(struct vsl_log *vsl, const char *event, double first, double *pprev, double now) { /* XXX: Make an option to turn off some unnecessary timestamp logging. This must be done carefully because some functions (e.g. V1L_Reserve) takes the last timestamp as its initial value for timeout calculation. */ vsl_sanity(vsl); assert(!isnan(now) && now != 0.); VSLb(vsl, SLT_Timestamp, "%s: %.6f %.6f %.6f", event, now, now - first, now - *pprev); *pprev = now; } /*-------------------------------------------------------------------- * Setup a VSL buffer, allocate space if none provided. */ void VSL_Setup(struct vsl_log *vsl, void *ptr, size_t len) { if (ptr == NULL) { len = cache_param->vsl_buffer; ptr = malloc(len); AN(ptr); } vsl->wlp = ptr; vsl->wlb = ptr; vsl->wle = ptr; vsl->wle += len / sizeof(*vsl->wle); vsl->wlr = 0; vsl->wid = 0; vsl_sanity(vsl); } /*--------------------------------------------------------------------*/ void VSL_ChgId(struct vsl_log *vsl, const char *typ, const char *why, uint32_t vxid) { uint32_t ovxid; vsl_sanity(vsl); ovxid = vsl->wid; VSLb(vsl, SLT_Link, "%s %u %s", typ, VXID(vxid), why); VSL_End(vsl); vsl->wid = vxid; VSLb(vsl, SLT_Begin, "%s %u %s", typ, VXID(ovxid), why); } /*--------------------------------------------------------------------*/ void VSL_End(struct vsl_log *vsl) { txt t; char p[] = ""; vsl_sanity(vsl); AN(vsl->wid); t.b = p; t.e = p; VSLbt(vsl, SLT_End, t); VSL_Flush(vsl, 0); vsl->wid = 0; } /*--------------------------------------------------------------------*/ static void * vsm_cleaner(void *priv) { (void)priv; THR_SetName("vsm_cleaner"); while (1) { AZ(pthread_mutex_lock(&vsm_mtx)); VSM_common_cleaner(heritage.vsm, VSC_C_main); AZ(pthread_mutex_unlock(&vsm_mtx)); VTIM_sleep(1.1); } NEEDLESS_RETURN(NULL); } /*--------------------------------------------------------------------*/ void VSM_Init(void) { int i; pthread_t tp; assert(UINT_MAX % VSL_SEGMENTS == VSL_SEGMENTS - 1); AZ(pthread_mutex_init(&vsl_mtx, NULL)); AZ(pthread_mutex_init(&vsm_mtx, NULL)); vsl_head = VSM_Alloc(cache_param->vsl_space, VSL_CLASS, "", ""); AN(vsl_head); vsl_segsize = ((cache_param->vsl_space - sizeof *vsl_head) / sizeof *vsl_end) / VSL_SEGMENTS; vsl_end = vsl_head->log + vsl_segsize * VSL_SEGMENTS; /* Make segment_n always overflow on first log wrap to make any problems with regard to readers on that event visible */ vsl_segment_n = UINT_MAX - VSL_SEGMENTS + 1; AZ(vsl_segment_n % VSL_SEGMENTS); vsl_head->segment_n = vsl_segment_n; vsl_ptr = vsl_head->log; *vsl_ptr = VSL_ENDMARKER; memset(vsl_head, 0, sizeof *vsl_head); vsl_head->segsize = vsl_segsize; vsl_head->offset[0] = 0; for (i = 1; i < VSL_SEGMENTS; i++) vsl_head->offset[i] = -1; VWMB(); memcpy(vsl_head->marker, VSL_HEAD_MARKER, sizeof vsl_head->marker); VSC_C_main = VSM_Alloc(sizeof *VSC_C_main, VSC_CLASS, VSC_type_main, ""); AN(VSC_C_main); memset(VSC_C_main, 0, sizeof *VSC_C_main); AZ(pthread_create(&tp, NULL, vsm_cleaner, NULL)); } /*--------------------------------------------------------------------*/ void * VSM_Alloc(unsigned size, const char *class, const char *type, const char *ident) { volatile void *p; AZ(pthread_mutex_lock(&vsm_mtx)); p = VSM_common_alloc(heritage.vsm, size, class, type, ident); AZ(pthread_mutex_unlock(&vsm_mtx)); return (TRUST_ME(p)); } void VSM_Free(void *ptr) { AZ(pthread_mutex_lock(&vsm_mtx)); VSM_common_free(heritage.vsm, ptr); AZ(pthread_mutex_unlock(&vsm_mtx)); } varnish-4.1.1/bin/varnishd/cache/cache_gzip.c0000644000201500234410000003674612652366721016027 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Interaction with the linvgz (zlib) library. * * The zlib library pollutes namespace a LOT when you include the "vgz.h" * (aka (zlib.h") file so we contain the damage by vectoring all access * to libz through this source file. * * The API defined by this file, will also insulate the rest of the code, * should we find a better gzip library at a later date. * */ #include "config.h" #include #include "cache.h" #include "cache_filter.h" #include "vend.h" #include "vgz.h" struct vgz { unsigned magic; #define VGZ_MAGIC 0x162df0cb enum {VGZ_GZ,VGZ_UN} dir; struct vsl_log *vsl; const char *id; int last_i; enum vgz_flag flag; char *m_buf; ssize_t m_sz; ssize_t m_len; intmax_t bits; z_stream vz; }; static const char * vgz_msg(const struct vgz *vg) { CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); return vg->vz.msg ? vg->vz.msg : "(null)"; } /*-------------------------------------------------------------------- * Set up a gunzip instance */ static struct vgz * vgz_alloc_vgz(struct vsl_log *vsl, const char *id) { struct vgz *vg; ALLOC_OBJ(vg, VGZ_MAGIC); AN(vg); vg->vsl = vsl; vg->id = id; return (vg); } static struct vgz * VGZ_NewUngzip(struct vsl_log *vsl, const char *id) { struct vgz *vg; vg = vgz_alloc_vgz(vsl, id); vg->dir = VGZ_UN; VSC_C_main->n_gunzip++; /* * Max memory usage according to zonf.h: * mem_needed = "a few kb" + (1 << (windowBits)) * Since we don't control windowBits, we have to assume * it is 15, so 34-35KB or so. */ assert(Z_OK == inflateInit2(&vg->vz, 31)); return (vg); } struct vgz * VGZ_NewGzip(struct vsl_log *vsl, const char *id) { struct vgz *vg; int i; vg = vgz_alloc_vgz(vsl, id); vg->dir = VGZ_GZ; VSC_C_main->n_gzip++; /* * From zconf.h: * * mem_needed = "a few kb" * + (1 << (windowBits+2)) * + (1 << (memLevel+9)) * * windowBits [8..15] (-> 1K..128K) * memLevel [1..9] (-> 1K->256K) */ i = deflateInit2(&vg->vz, cache_param->gzip_level, /* Level */ Z_DEFLATED, /* Method */ 16 + 15, /* Window bits (16=gzip) */ cache_param->gzip_memlevel, /* memLevel */ Z_DEFAULT_STRATEGY); assert(Z_OK == i); return (vg); } /*-------------------------------------------------------------------- */ static int vgz_getmbuf(struct vgz *vg) { CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); AZ(vg->m_sz); AZ(vg->m_len); AZ(vg->m_buf); vg->m_sz = cache_param->gzip_buffer; vg->m_buf = malloc(vg->m_sz); if (vg->m_buf == NULL) { vg->m_sz = 0; return (-1); } return (0); } /*--------------------------------------------------------------------*/ void VGZ_Ibuf(struct vgz *vg, const void *ptr, ssize_t len) { CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); AZ(vg->vz.avail_in); vg->vz.next_in = TRUST_ME(ptr); vg->vz.avail_in = len; } int VGZ_IbufEmpty(const struct vgz *vg) { CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); return (vg->vz.avail_in == 0); } /*--------------------------------------------------------------------*/ void VGZ_Obuf(struct vgz *vg, void *ptr, ssize_t len) { CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); vg->vz.next_out = TRUST_ME(ptr); vg->vz.avail_out = len; } int VGZ_ObufFull(const struct vgz *vg) { CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); return (vg->vz.avail_out == 0); } /*--------------------------------------------------------------------*/ static enum vgzret_e VGZ_Gunzip(struct vgz *vg, const void **pptr, ssize_t *plen) { int i; ssize_t l; const uint8_t *before; CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); *pptr = NULL; *plen = 0; AN(vg->vz.next_out); AN(vg->vz.avail_out); before = vg->vz.next_out; i = inflate(&vg->vz, 0); if (i == Z_OK || i == Z_STREAM_END) { *pptr = before; l = (const uint8_t *)vg->vz.next_out - before; *plen = l; } vg->last_i = i; if (i == Z_OK) return (VGZ_OK); if (i == Z_STREAM_END) return (VGZ_END); if (i == Z_BUF_ERROR) return (VGZ_STUCK); VSLb(vg->vsl, SLT_Gzip, "Gunzip error: %d (%s)", i, vgz_msg(vg)); return (VGZ_ERROR); } /*--------------------------------------------------------------------*/ enum vgzret_e VGZ_Gzip(struct vgz *vg, const void **pptr, ssize_t *plen, enum vgz_flag flags) { int i; int zflg; ssize_t l; const uint8_t *before; CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); *pptr = NULL; *plen = 0; AN(vg->vz.next_out); AN(vg->vz.avail_out); before = vg->vz.next_out; switch(flags) { case VGZ_NORMAL: zflg = Z_NO_FLUSH; break; case VGZ_ALIGN: zflg = Z_SYNC_FLUSH; break; case VGZ_RESET: zflg = Z_FULL_FLUSH; break; case VGZ_FINISH: zflg = Z_FINISH; break; default: INCOMPL(); } i = deflate(&vg->vz, zflg); if (i == Z_OK || i == Z_STREAM_END) { *pptr = before; l = (const uint8_t *)vg->vz.next_out - before; *plen = l; } vg->last_i = i; if (i == Z_OK) return (VGZ_OK); if (i == Z_STREAM_END) return (VGZ_END); if (i == Z_BUF_ERROR) return (VGZ_STUCK); VSLb(vg->vsl, SLT_Gzip, "Gzip error: %d (%s)", i, vgz_msg(vg)); return (VGZ_ERROR); } /*-------------------------------------------------------------------- * VDP for gunzip'ing */ int __match_proto__(vdp_bytes) VDP_gunzip(struct req *req, enum vdp_action act, void **priv, const void *ptr, ssize_t len) { enum vgzret_e vr; ssize_t dl; const void *dp; struct worker *wrk; struct vgz *vg; char *p; uint64_t u; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); wrk = req->wrk; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); if (act == VDP_INIT) { vg = VGZ_NewUngzip(req->vsl, "U D -"); AN(vg); if (vgz_getmbuf(vg)) { (void)VGZ_Destroy(&vg); return (-1); } req->res_mode |= RES_GUNZIP; VGZ_Obuf(vg, vg->m_buf, vg->m_sz); *priv = vg; http_Unset(req->resp, H_Content_Encoding); req->resp_len = -1; if (req->objcore->flags & OC_F_INCOMPLETE) return (0); /* No idea about length */ p = ObjGetattr(req->wrk, req->objcore, OA_GZIPBITS, &dl); if (p == NULL || dl != 32) return (0); /* No OA_GZIPBITS yet */ u = vbe64dec(p + 24); /* * If the size is non-zero AND we are the top * VDP (ie: no ESI), we know what size the output will be. */ if (u != 0 && VTAILQ_FIRST(&req->vdp)->func == VDP_gunzip) req->resp_len = u; return (0); } CAST_OBJ_NOTNULL(vg, *priv, VGZ_MAGIC); AN(vg->m_buf); if (act == VDP_FINI) { /* NB: Gunzip'ing may or may not have completed successfully. */ AZ(len); (void)VGZ_Destroy(&vg); *priv = NULL; return (0); } if (len == 0) return (0); VGZ_Ibuf(vg, ptr, len); do { vr = VGZ_Gunzip(vg, &dp, &dl); vg->m_len += dl; if (vr < VGZ_OK) return (-1); if (vg->m_len == vg->m_sz || vr != VGZ_OK) { if (VDP_bytes(req, VDP_FLUSH, vg->m_buf, vg->m_len)) return (-1); vg->m_len = 0; VGZ_Obuf(vg, vg->m_buf, vg->m_sz); } } while (!VGZ_IbufEmpty(vg)); assert(vr == VGZ_STUCK || vr == VGZ_OK || vr == VGZ_END); return (0); } /*--------------------------------------------------------------------*/ void VGZ_UpdateObj(const struct vfp_ctx *vc, struct vgz *vg, enum vgz_ua_e e) { char *p; intmax_t ii; CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); ii = vg->vz.start_bit + vg->vz.last_bit + vg->vz.stop_bit; if (e == VUA_UPDATE && ii == vg->bits) return; vg->bits = ii; p = ObjSetattr(vc->wrk, vc->oc, OA_GZIPBITS, 32, NULL); AN(p); vbe64enc(p, vg->vz.start_bit); vbe64enc(p + 8, vg->vz.last_bit); vbe64enc(p + 16, vg->vz.stop_bit); if (e == VUA_END_GZIP) vbe64enc(p + 24, vg->vz.total_in); if (e == VUA_END_GUNZIP) vbe64enc(p + 24, vg->vz.total_out); } /*-------------------------------------------------------------------- */ enum vgzret_e VGZ_Destroy(struct vgz **vgp) { struct vgz *vg; enum vgzret_e vr; int i; vg = *vgp; CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); *vgp = NULL; AN(vg->id); VSLb(vg->vsl, SLT_Gzip, "%s %jd %jd %jd %jd %jd", vg->id, (intmax_t)vg->vz.total_in, (intmax_t)vg->vz.total_out, (intmax_t)vg->vz.start_bit, (intmax_t)vg->vz.last_bit, (intmax_t)vg->vz.stop_bit); if (vg->dir == VGZ_GZ) i = deflateEnd(&vg->vz); else i = inflateEnd(&vg->vz); if (vg->last_i == Z_STREAM_END && i == Z_OK) i = Z_STREAM_END; if (vg->m_buf) free(vg->m_buf); if (i == Z_OK) vr = VGZ_OK; else if (i == Z_STREAM_END) vr = VGZ_END; else if (i == Z_BUF_ERROR) vr = VGZ_STUCK; else { VSLb(vg->vsl, SLT_Gzip, "G(un)zip error: %d (%s)", i, vgz_msg(vg)); vr = VGZ_ERROR; } FREE_OBJ(vg); return (vr); } /*--------------------------------------------------------------------*/ #define VFP_GUNZIP 0 #define VFP_GZIP 1 #define VFP_TESTGUNZIP 2 static enum vfp_status __match_proto__(vfp_init_f) vfp_gzip_init(struct vfp_ctx *vc, struct vfp_entry *vfe) { struct vgz *vg; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); if (http_HdrIs(vc->http, H_Content_Length, "0")) { http_Unset(vc->http, H_Content_Encoding); return (VFP_NULL); } if (vfe->vfp->priv2 == VFP_GZIP) { if (http_GetHdr(vc->http, H_Content_Encoding, NULL)) return (VFP_NULL); vg = VGZ_NewGzip(vc->wrk->vsl, vfe->vfp->priv1); } else { if (!http_HdrIs(vc->http, H_Content_Encoding, "gzip")) return (VFP_NULL); vg = VGZ_NewUngzip(vc->wrk->vsl, vfe->vfp->priv1); } if (vg == NULL) return (VFP_ERROR); vfe->priv1 = vg; if (vgz_getmbuf(vg)) return (VFP_ERROR); VGZ_Ibuf(vg, vg->m_buf, 0); AZ(vg->m_len); if (vfe->vfp->priv2 == VFP_GUNZIP || vfe->vfp->priv2 == VFP_GZIP) { http_Unset(vc->http, H_Content_Encoding); http_Unset(vc->http, H_Content_Length); RFC2616_Weaken_Etag(vc->http); } if (vfe->vfp->priv2 == VFP_GZIP) http_SetHeader(vc->http, "Content-Encoding: gzip"); if (vfe->vfp->priv2 == VFP_GZIP || vfe->vfp->priv2 == VFP_TESTGUNZIP) RFC2616_Vary_AE(vc->http); return (VFP_OK); } /*-------------------------------------------------------------------- * VFP_GUNZIP * * A VFP for gunzip'ing an object as we receive it from the backend */ static enum vfp_status __match_proto__(vfp_pull_f) vfp_gunzip_pull(struct vfp_ctx *vc, struct vfp_entry *vfe, void *p, ssize_t *lp) { ssize_t l; struct vgz *vg; enum vgzret_e vr = VGZ_ERROR; const void *dp; ssize_t dl; enum vfp_status vp = VFP_OK; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); CAST_OBJ_NOTNULL(vg, vfe->priv1, VGZ_MAGIC); AN(p); AN(lp); l = *lp; *lp = 0; VGZ_Obuf(vg, p, l); do { if (VGZ_IbufEmpty(vg)) { l = vg->m_sz; vp = VFP_Suck(vc, vg->m_buf, &l); if (vp == VFP_ERROR) return (vp); VGZ_Ibuf(vg, vg->m_buf, l); } if (!VGZ_IbufEmpty(vg) || vp == VFP_END) { vr = VGZ_Gunzip(vg, &dp, &dl); if (vr == VGZ_END && !VGZ_IbufEmpty(vg)) return(VFP_Error(vc, "Junk after gzip data")); if (vr < VGZ_OK) return (VFP_Error(vc, "Invalid Gzip data: %s", vgz_msg(vg))); if (dl > 0) { *lp = dl; assert(dp == p); return (VFP_OK); } } AN(VGZ_IbufEmpty(vg)); } while (vp == VFP_OK); if (vr != VGZ_END) return(VFP_Error(vc, "Gunzip error at the very end")); return (vp); } /*-------------------------------------------------------------------- * VFP_GZIP * * A VFP for gzip'ing an object as we receive it from the backend */ static enum vfp_status __match_proto__(vfp_pull_f) vfp_gzip_pull(struct vfp_ctx *vc, struct vfp_entry *vfe, void *p, ssize_t *lp) { ssize_t l; struct vgz *vg; enum vgzret_e vr = VGZ_ERROR; const void *dp; ssize_t dl; enum vfp_status vp = VFP_ERROR; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); CAST_OBJ_NOTNULL(vg, vfe->priv1, VGZ_MAGIC); AN(p); AN(lp); l = *lp; *lp = 0; VGZ_Obuf(vg, p, l); do { if (VGZ_IbufEmpty(vg)) { l = vg->m_sz; vp = VFP_Suck(vc, vg->m_buf, &l); if (vp == VFP_ERROR) break; if (vp == VFP_END) vg->flag = VGZ_FINISH; VGZ_Ibuf(vg, vg->m_buf, l); } if (!VGZ_IbufEmpty(vg) || vg->flag == VGZ_FINISH) { vr = VGZ_Gzip(vg, &dp, &dl, vg->flag); if (vr < VGZ_OK) return (VFP_Error(vc, "Gzip failed")); if (dl > 0) { VGZ_UpdateObj(vc, vg, VUA_UPDATE); *lp = dl; assert(dp == p); return (VFP_OK); } } AN(VGZ_IbufEmpty(vg)); } while (vg->flag != VGZ_FINISH); if (vr != VGZ_END) return (VFP_Error(vc, "Gzip failed")); VGZ_UpdateObj(vc, vg, VUA_END_GZIP); return (VFP_END); } /*-------------------------------------------------------------------- * VFP_TESTGZIP * * A VFP for testing that received gzip data is valid, and for * collecting the magic bits while we're at it. */ static enum vfp_status __match_proto__(vfp_pull_f) vfp_testgunzip_pull(struct vfp_ctx *vc, struct vfp_entry *vfe, void *p, ssize_t *lp) { struct vgz *vg; enum vgzret_e vr = VGZ_ERROR; const void *dp; ssize_t dl; enum vfp_status vp; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); CAST_OBJ_NOTNULL(vg, vfe->priv1, VGZ_MAGIC); AN(p); AN(lp); CAST_OBJ_NOTNULL(vg, vfe->priv1, VGZ_MAGIC); vp = VFP_Suck(vc, p, lp); if (vp == VFP_ERROR) return (vp); if (*lp > 0 || vp == VFP_END) { VGZ_Ibuf(vg, p, *lp); do { VGZ_Obuf(vg, vg->m_buf, vg->m_sz); vr = VGZ_Gunzip(vg, &dp, &dl); if (vr == VGZ_END && !VGZ_IbufEmpty(vg)) return(VFP_Error(vc, "Junk after gzip data")); if (vr < VGZ_OK) return (VFP_Error(vc, "Invalid Gzip data: %s", vgz_msg(vg))); } while (!VGZ_IbufEmpty(vg)); } VGZ_UpdateObj(vc, vg, VUA_UPDATE); if (vp == VFP_END) { if (vr != VGZ_END) return (VFP_Error(vc, "tGunzip failed")); VGZ_UpdateObj(vc, vg, VUA_END_GUNZIP); } return (vp); } /*--------------------------------------------------------------------*/ static void __match_proto__(vfp_fini_f) vfp_gzip_fini(struct vfp_ctx *vc, struct vfp_entry *vfe) { struct vgz *vg; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); if (vfe->priv1 != NULL) { CAST_OBJ_NOTNULL(vg, vfe->priv1, VGZ_MAGIC); vfe->priv1 = NULL; (void)VGZ_Destroy(&vg); } } /*--------------------------------------------------------------------*/ const struct vfp vfp_gunzip = { .name = "GUNZIP", .init = vfp_gzip_init, .pull = vfp_gunzip_pull, .fini = vfp_gzip_fini, .priv1 = "U F -", .priv2 = VFP_GUNZIP, }; const struct vfp vfp_gzip = { .name = "GZIP", .init = vfp_gzip_init, .pull = vfp_gzip_pull, .fini = vfp_gzip_fini, .priv1 = "G F -", .priv2 = VFP_GZIP, }; const struct vfp vfp_testgunzip = { .name = "TESTGUNZIP", .init = vfp_gzip_init, .pull = vfp_testgunzip_pull, .fini = vfp_gzip_fini, .priv1 = "u F -", .priv2 = VFP_TESTGUNZIP, }; varnish-4.1.1/bin/varnishd/cache/cache_range.c0000644000201500234410000001266312652366721016142 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include "cache/cache.h" #include "cache/cache_filter.h" #include "vct.h" /*--------------------------------------------------------------------*/ struct vrg_priv { unsigned magic; #define VRG_PRIV_MAGIC 0xb886e711 ssize_t range_low; ssize_t range_high; ssize_t range_off; }; static int __match_proto__(vdp_bytes) vrg_range_bytes(struct req *req, enum vdp_action act, void **priv, const void *ptr, ssize_t len) { int retval = 0; ssize_t l; const char *p = ptr; struct vrg_priv *vrg_priv; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); if (act == VDP_INIT) return (0); CAST_OBJ_NOTNULL(vrg_priv, *priv, VRG_PRIV_MAGIC); if (act == VDP_FINI) { if (vrg_priv->range_off < vrg_priv->range_high) Req_Fail(req, SC_RANGE_SHORT); *priv = NULL; /* struct on ws, no need to free */ return (0); } l = vrg_priv->range_low - vrg_priv->range_off; if (l > 0) { if (l > len) l = len; vrg_priv->range_off += l; p += l; len -= l; } l = vrg_priv->range_high - vrg_priv->range_off; if (l > len) l = len; if (l > 0) retval = VDP_bytes(req, act, p, l); else if (act > VDP_NULL) retval = VDP_bytes(req, act, p, 0); vrg_priv->range_off += len; return (retval); } /*--------------------------------------------------------------------*/ static const char * vrg_dorange(struct req *req, const char *r) { ssize_t low, high, has_low, has_high, t; struct vrg_priv *vrg_priv; if (strncasecmp(r, "bytes=", 6)) return ("Not Bytes"); r += 6; /* The low end of range */ has_low = low = 0; while (vct_isdigit(*r)) { has_low = 1; t = low; low *= 10; low += *r++ - '0'; if (low < t) return ("Low number too big"); } if (*r++ != '-') return ("Missing hyphen"); /* The high end of range */ has_high = high = 0; while (vct_isdigit(*r)) { has_high = 1; t = high; high *= 10; high += *r++ - '0'; if (high < t) return ("High number too big"); } if (*r != '\0') return ("Trailing stuff"); if (has_high + has_low == 0) return ("Neither high nor low"); if (!has_low) { if (req->resp_len < 0) return (NULL); // Allow 200 response if (high == 0) return ("No low, high is zero"); low = req->resp_len - high; if (low < 0) low = 0; high = req->resp_len - 1; } else if (req->resp_len >= 0 && (high >= req->resp_len || !has_high)) high = req->resp_len - 1; else if (!has_high || req->resp_len < 0) return (NULL); // Allow 200 response /* * else (bo != NULL) { * We assume that the client knows what it's doing and trust * that both low and high make sense. * } */ if (high < low) return ("high smaller than low"); if (req->resp_len >= 0 && low >= req->resp_len) return ("low range beyond object"); if (req->resp_len >= 0) http_PrintfHeader(req->resp, "Content-Range: bytes %jd-%jd/%jd", (intmax_t)low, (intmax_t)high, (intmax_t)req->resp_len); else http_PrintfHeader(req->resp, "Content-Range: bytes %jd-%jd/*", (intmax_t)low, (intmax_t)high); req->resp_len = (intmax_t)(1 + high - low); vrg_priv = WS_Alloc(req->ws, sizeof *vrg_priv); if (vrg_priv == NULL) return ("WS too small"); XXXAN(vrg_priv); INIT_OBJ(vrg_priv, VRG_PRIV_MAGIC); vrg_priv->range_off = 0; vrg_priv->range_low = low; vrg_priv->range_high = high + 1; VDP_push(req, vrg_range_bytes, vrg_priv, 1); http_PutResponse(req->resp, "HTTP/1.1", 206, NULL); return (NULL); } void VRG_dorange(struct req *req, const char *r) { const char *err; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); assert(http_IsStatus(req->resp, 200)); /* We must snapshot the length if we're streaming from the backend */ err = vrg_dorange(req, r); if (err != NULL) { VSLb(req->vsl, SLT_Debug, "RANGE_FAIL %s", err); if (req->resp_len >= 0) http_PrintfHeader(req->resp, "Content-Range: bytes */%jd", (intmax_t)req->resp_len); http_PutResponse(req->resp, "HTTP/1.1", 416, NULL); /* * XXX: We ought to produce a body explaining things. * XXX: That really calls for us to hit vcl_synth{} */ req->resp_len = 0; } } varnish-4.1.1/bin/varnishd/cache/cache_fetch.c0000644000201500234410000006526012652366721016140 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include "cache.h" #include "cache_director.h" #include "cache_filter.h" #include "hash/hash_slinger.h" #include "vcl.h" #include "vtim.h" /*-------------------------------------------------------------------- * Allocate an object, with fall-back to Transient. * XXX: This somewhat overlaps the stuff in stevedore.c * XXX: Should this be merged over there ? */ static int vbf_allocobj(struct busyobj *bo, unsigned l) { struct objcore *oc; const char *storage_hint; double lifetime; CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); oc = bo->fetch_objcore; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); lifetime = oc->exp.ttl + oc->exp.grace + oc->exp.keep; if (bo->uncacheable || lifetime < cache_param->shortlived) storage_hint = TRANSIENT_STORAGE; else storage_hint = bo->storage_hint; bo->storage_hint = NULL; if (STV_NewObject(bo->fetch_objcore, bo->wrk, storage_hint, l)) return (1); if (storage_hint != NULL && !strcmp(storage_hint, TRANSIENT_STORAGE)) return (0); /* * Try to salvage the transaction by allocating a shortlived object * on Transient storage. */ if (oc->exp.ttl > cache_param->shortlived) oc->exp.ttl = cache_param->shortlived; oc->exp.grace = 0.0; oc->exp.keep = 0.0; return (STV_NewObject(bo->fetch_objcore, bo->wrk, TRANSIENT_STORAGE, l)); } /*-------------------------------------------------------------------- * Turn the beresp into a obj */ static int vbf_beresp2obj(struct busyobj *bo) { unsigned l, l2; const char *b; uint8_t *bp; struct vsb *vary = NULL; int varyl = 0; l = 0; /* Create Vary instructions */ if (!(bo->fetch_objcore->flags & OC_F_PRIVATE)) { varyl = VRY_Create(bo, &vary); if (varyl > 0) { AN(vary); assert(varyl == VSB_len(vary)); l += PRNDUP((intptr_t)varyl); } else if (varyl < 0) { /* * Vary parse error * Complain about it, and make this a pass. */ VSLb(bo->vsl, SLT_Error, "Illegal 'Vary' header from backend, " "making this a pass."); bo->uncacheable = 1; AZ(vary); } else /* No vary */ AZ(vary); } l2 = http_EstimateWS(bo->beresp, bo->uncacheable ? HTTPH_R_PASS : HTTPH_A_INS); l += l2; if (bo->uncacheable) bo->fetch_objcore->flags |= OC_F_PASS; if (!vbf_allocobj(bo, l)) return (-1); if (vary != NULL) { b = ObjSetattr(bo->wrk, bo->fetch_objcore, OA_VARY, varyl, VSB_data(vary)); VSB_delete(vary); } AZ(ObjSetU32(bo->wrk, bo->fetch_objcore, OA_VXID, VXID(bo->vsl->wid))); /* for HTTP_Encode() VSLH call */ bo->beresp->logtag = SLT_ObjMethod; /* Filter into object */ bp = ObjSetattr(bo->wrk, bo->fetch_objcore, OA_HEADERS, l2, NULL); AN(bp); HTTP_Encode(bo->beresp, bp, l2, bo->uncacheable ? HTTPH_R_PASS : HTTPH_A_INS); if (http_GetHdr(bo->beresp, H_Last_Modified, &b)) AZ(ObjSetDouble(bo->wrk, bo->fetch_objcore, OA_LASTMODIFIED, VTIM_parse(b))); else AZ(ObjSetDouble(bo->wrk, bo->fetch_objcore, OA_LASTMODIFIED, floor(bo->fetch_objcore->exp.t_origin))); return (0); } /*-------------------------------------------------------------------- * Copy req->bereq and release req if not pass fetch */ static enum fetch_step vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo) { const char *q; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo->req, REQ_MAGIC); assert(bo->state == BOS_INVALID); AZ(bo->storage_hint); 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) { http_ForceField(bo->bereq0, HTTP_HDR_METHOD, "GET"); http_ForceField(bo->bereq0, HTTP_HDR_PROTO, "HTTP/1.1"); if (cache_param->http_gzip_support) http_ForceHeader(bo->bereq0, H_Accept_Encoding, "gzip"); AN(bo->req); bo->req = NULL; http_CopyHome(bo->bereq0); } else AZ(bo->stale_oc); if (bo->stale_oc != NULL && ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) { q = HTTP_GetHdrPack(bo->wrk, bo->stale_oc, H_Last_Modified); if (q != NULL) http_PrintfHeader(bo->bereq0, "If-Modified-Since: %s", q); q = HTTP_GetHdrPack(bo->wrk, bo->stale_oc, H_ETag); if (q != NULL) http_PrintfHeader(bo->bereq0, "If-None-Match: %s", q); } HTTP_Setup(bo->bereq, bo->ws, bo->vsl, SLT_BereqMethod); bo->ws_bo = WS_Snapshot(bo->ws); HTTP_Copy(bo->bereq, bo->bereq0); VBO_setstate(bo, BOS_REQ_DONE); return (F_STP_STARTFETCH); } /*-------------------------------------------------------------------- * Start a new VSL transaction and try again * Prepare the busyobj and fetch processors */ static enum fetch_step vbf_stp_retry(struct worker *wrk, struct busyobj *bo) { struct vfp_ctx *vfc; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); vfc = bo->vfc; CHECK_OBJ_NOTNULL(vfc, VFP_CTX_MAGIC); assert(bo->state == BOS_REQ_DONE); VSLb_ts_busyobj(bo, "Retry", W_TIM_real(wrk)); /* VDI_Finish must have been called before */ assert(bo->director_state == DIR_S_NULL); /* reset other bo attributes - See VBO_GetBusyObj */ bo->storage_hint = NULL; bo->do_esi = 0; bo->do_stream = 1; /* reset fetch processors */ vfc->failed = 0; VFP_Close(vfc); VFP_Setup(vfc); // XXX: BereqEnd + BereqAcct ? VSL_ChgId(bo->vsl, "bereq", "retry", VXID_Get(wrk, VSL_BACKENDMARKER)); VSLb_ts_busyobj(bo, "Start", bo->t_prev); http_VSL_log(bo->bereq); return (F_STP_STARTFETCH); } /*-------------------------------------------------------------------- * Setup bereq from bereq0, run vcl_backend_fetch */ static enum fetch_step vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) { int i; double now; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); AZ(bo->storage_hint); if (bo->do_pass) AN(bo->req); else AZ(bo->req); if (bo->retries > 0) http_Unset(bo->bereq, "\012X-Varnish:"); http_PrintfHeader(bo->bereq, "X-Varnish: %u", VXID(bo->vsl->wid)); VCL_backend_fetch_method(bo->vcl, wrk, NULL, bo, NULL); bo->uncacheable = bo->do_pass; if (wrk->handling == VCL_RET_ABANDON) return (F_STP_FAIL); assert (wrk->handling == VCL_RET_FETCH); HTTP_Setup(bo->beresp, bo->ws, bo->vsl, SLT_BerespMethod); assert(bo->state <= BOS_REQ_DONE); AZ(bo->htc); i = VDI_GetHdr(wrk, bo); now = W_TIM_real(wrk); VSLb_ts_busyobj(bo, "Beresp", now); if (i) { assert(bo->director_state == DIR_S_NULL); return (F_STP_ERROR); } http_VSL_log(bo->beresp); if (!http_GetHdr(bo->beresp, H_Date, NULL)) { /* * RFC 2616 14.18 Date: The Date general-header field * represents the date and time at which the message was * originated, having the same semantics as orig-date in * RFC 822. ... A received message that does not have a * Date header field MUST be assigned one by the recipient * if the message will be cached by that recipient or * gatewayed via a protocol which requires a Date. * * If we didn't get a Date header, we assign one here. */ http_TimeHeader(bo->beresp, "Date: ", now); } /* * These two headers can be spread over multiple actual headers * and we rely on their content outside of VCL, so collect them * into one line here. */ http_CollectHdr(bo->beresp, H_Cache_Control); http_CollectHdr(bo->beresp, H_Vary); /* * Figure out how the fetch is supposed to happen, before the * headers are adultered by VCL */ if (!strcasecmp(http_GetMethod(bo->bereq), "head")) { /* * A HEAD request can never have a body in the reply, * no matter what the headers might say. * [RFC7231 4.3.2 p25] */ wrk->stats->fetch_head++; bo->htc->body_status = BS_NONE; } else if (http_GetStatus(bo->beresp) <= 199) { /* * 1xx responses never have a body. * [RFC7230 3.3.2 p31] * ... but we should never see them. */ wrk->stats->fetch_1xx++; bo->htc->body_status = BS_ERROR; } else if (http_IsStatus(bo->beresp, 204)) { /* * 204 is "No Content", obviously don't expect a body. * [RFC7230 3.3.1 p29 and 3.3.2 p31] */ wrk->stats->fetch_204++; if ((http_GetHdr(bo->beresp, H_Content_Length, NULL) && bo->htc->content_length != 0) || http_GetHdr(bo->beresp, H_Transfer_Encoding, NULL)) bo->htc->body_status = BS_ERROR; else bo->htc->body_status = BS_NONE; } else if (http_IsStatus(bo->beresp, 304)) { /* * 304 is "Not Modified" it has no body. * [RFC7230 3.3 p28] */ wrk->stats->fetch_304++; bo->htc->body_status = BS_NONE; } else if (bo->htc->body_status == BS_CHUNKED) { wrk->stats->fetch_chunked++; } else if (bo->htc->body_status == BS_LENGTH) { assert(bo->htc->content_length > 0); wrk->stats->fetch_length++; } else if (bo->htc->body_status == BS_EOF) { wrk->stats->fetch_eof++; } else if (bo->htc->body_status == BS_ERROR) { wrk->stats->fetch_bad++; } else if (bo->htc->body_status == BS_NONE) { wrk->stats->fetch_none++; } else { WRONG("wrong bodystatus"); } if (bo->htc->body_status == BS_ERROR) { bo->htc->doclose = SC_RX_BODY; VDI_Finish(bo->wrk, bo); VSLb(bo->vsl, SLT_Error, "Body cannot be fetched"); assert(bo->director_state == DIR_S_NULL); return (F_STP_ERROR); } /* * What does RFC2616 think about TTL ? */ EXP_Clr(&bo->fetch_objcore->exp); RFC2616_Ttl(bo, now); /* private objects have negative TTL */ if (bo->fetch_objcore->flags & OC_F_PRIVATE) bo->fetch_objcore->exp.ttl = -1.; AZ(bo->do_esi); AZ(bo->was_304); if (http_IsStatus(bo->beresp, 304)) { if (bo->stale_oc != NULL && ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) { if (ObjCheckFlag(bo->wrk, bo->stale_oc, OF_CHGGZIP)) { /* * If we changed the gzip status of the object * the stored Content_Encoding controls we * must weaken any new ETag we get. */ http_Unset(bo->beresp, H_Content_Encoding); RFC2616_Weaken_Etag(bo->beresp); } http_Unset(bo->beresp, H_Content_Length); HTTP_Merge(bo->wrk, bo->stale_oc, bo->beresp); assert(http_IsStatus(bo->beresp, 200)); bo->was_304 = 1; } else if (!bo->do_pass) { /* * Backend sent unallowed 304 */ VSLb(bo->vsl, SLT_Error, "304 response but not conditional fetch"); bo->htc->doclose = SC_RX_BAD; VDI_Finish(bo->wrk, bo); return (F_STP_FAIL); } } bo->vfc->bo = bo; bo->vfc->oc = bo->fetch_objcore; bo->vfc->wrk = bo->wrk; bo->vfc->http = bo->beresp; bo->vfc->esi_req = bo->bereq; VCL_backend_response_method(bo->vcl, wrk, NULL, bo, NULL); if (wrk->handling == VCL_RET_ABANDON) { bo->htc->doclose = SC_RESP_CLOSE; VDI_Finish(bo->wrk, bo); return (F_STP_FAIL); } if (wrk->handling == VCL_RET_RETRY) { if (bo->htc->body_status != BS_NONE) bo->htc->doclose = SC_RESP_CLOSE; if (bo->director_state != DIR_S_NULL) VDI_Finish(bo->wrk, bo); if (bo->retries++ < cache_param->max_retries) return (F_STP_RETRY); VSLb(bo->vsl, SLT_VCL_Error, "Too many retries, delivering 503"); assert(bo->director_state == DIR_S_NULL); return (F_STP_ERROR); } assert(bo->state == BOS_REQ_DONE); if (bo->do_esi) bo->do_stream = 0; if (bo->do_pass || bo->uncacheable) bo->fetch_objcore->flags |= OC_F_PASS; assert(wrk->handling == VCL_RET_DELIVER); return (bo->was_304 ? F_STP_CONDFETCH : F_STP_FETCH); } /*-------------------------------------------------------------------- */ static void vbf_fetch_body_helper(struct busyobj *bo) { ssize_t l; uint8_t *ptr; enum vfp_status vfps = VFP_ERROR; ssize_t est; struct vfp_ctx *vfc; CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); vfc = bo->vfc; CHECK_OBJ_NOTNULL(vfc, VFP_CTX_MAGIC); AN(vfc->vfp_nxt); est = bo->htc->content_length; if (est < 0) est = 0; do { if (bo->abandon) { /* * A pass object and delivery was terminated * We don't fail the fetch, in order for hit-for-pass * objects to be created. */ AN(vfc->oc->flags & OC_F_PASS); VSLb(vfc->wrk->vsl, SLT_FetchError, "Pass delivery abandoned"); vfps = VFP_END; bo->htc->doclose = SC_RX_BODY; break; } AZ(vfc->failed); l = est; assert(l >= 0); if (VFP_GetStorage(vfc, &l, &ptr) != VFP_OK) { bo->htc->doclose = SC_RX_BODY; break; } AZ(vfc->failed); vfps = VFP_Suck(vfc, ptr, &l); if (l > 0 && vfps != VFP_ERROR) { bo->acct.beresp_bodybytes += l; VBO_extend(bo, l); if (est >= l) est -= l; else est = 0; } } while (vfps == VFP_OK); VFP_Close(vfc); if (vfps == VFP_ERROR) { AN(vfc->failed); (void)VFP_Error(vfc, "Fetch pipeline failed to process"); bo->htc->doclose = SC_RX_BODY; } if (!bo->do_stream) ObjTrimStore(bo->wrk, vfc->oc); } /*-------------------------------------------------------------------- */ static enum fetch_step vbf_stp_fetch(struct worker *wrk, struct busyobj *bo) { const char *p; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo->fetch_objcore, OBJCORE_MAGIC); assert(wrk->handling == VCL_RET_DELIVER); /* * The VCL variables beresp.do_g[un]zip tells us how we want the * object processed before it is stored. * * The backend Content-Encoding header tells us what we are going * to receive, which we classify in the following three classes: * * "Content-Encoding: gzip" --> object is gzip'ed. * no Content-Encoding --> object is not gzip'ed. * anything else --> do nothing wrt gzip * */ /* We do nothing unless the param is set */ if (!cache_param->http_gzip_support) bo->do_gzip = bo->do_gunzip = 0; if (bo->htc->content_length == 0) http_Unset(bo->beresp, H_Content_Encoding); if (bo->htc->body_status != BS_NONE) { bo->is_gzip = http_HdrIs(bo->beresp, H_Content_Encoding, "gzip"); bo->is_gunzip = !http_GetHdr(bo->beresp, H_Content_Encoding, NULL); assert(bo->is_gzip == 0 || bo->is_gunzip == 0); } /* We won't gunzip unless it is non-empty and gzip'ed */ if (bo->htc->body_status == BS_NONE || bo->htc->content_length == 0 || (bo->do_gunzip && !bo->is_gzip)) bo->do_gunzip = 0; /* We wont gzip unless it is non-empty and ungzip'ed */ if (bo->htc->body_status == BS_NONE || bo->htc->content_length == 0 || (bo->do_gzip && !bo->is_gunzip)) bo->do_gzip = 0; /* But we can't do both at the same time */ assert(bo->do_gzip == 0 || bo->do_gunzip == 0); if (bo->do_gunzip || (bo->is_gzip && bo->do_esi)) (void)VFP_Push(bo->vfc, &vfp_gunzip, 1); if (bo->htc->content_length != 0) { if (bo->do_esi && bo->do_gzip) { (void)VFP_Push(bo->vfc, &vfp_esi_gzip, 1); } else if (bo->do_esi && bo->is_gzip && !bo->do_gunzip) { (void)VFP_Push(bo->vfc, &vfp_esi_gzip, 1); } else if (bo->do_esi) { (void)VFP_Push(bo->vfc, &vfp_esi, 1); } else if (bo->do_gzip) { (void)VFP_Push(bo->vfc, &vfp_gzip, 1); } else if (bo->is_gzip && !bo->do_gunzip) { (void)VFP_Push(bo->vfc, &vfp_testgunzip, 1); } } if (bo->fetch_objcore->flags & OC_F_PRIVATE) AN(bo->uncacheable); /* No reason to try streaming a non-existing body */ if (bo->htc->body_status == BS_NONE) bo->do_stream = 0; if (VFP_Open(bo->vfc)) { (void)VFP_Error(bo->vfc, "Fetch pipeline failed to open"); bo->htc->doclose = SC_RX_BODY; VDI_Finish(bo->wrk, bo); return (F_STP_ERROR); } if (vbf_beresp2obj(bo)) { (void)VFP_Error(bo->vfc, "Could not get storage"); bo->htc->doclose = SC_RX_BODY; VDI_Finish(bo->wrk, bo); return (F_STP_ERROR); } if (bo->do_esi) ObjSetFlag(bo->wrk, bo->fetch_objcore, OF_ESIPROC, 1); if (bo->do_gzip || (bo->is_gzip && !bo->do_gunzip)) ObjSetFlag(bo->wrk, bo->fetch_objcore, OF_GZIPED, 1); if (bo->do_gzip || bo->do_gunzip) ObjSetFlag(bo->wrk, bo->fetch_objcore, OF_CHGGZIP, 1); if (http_IsStatus(bo->beresp, 200) && ( http_GetHdr(bo->beresp, H_Last_Modified, &p) || http_GetHdr(bo->beresp, H_ETag, &p))) ObjSetFlag(bo->wrk, bo->fetch_objcore, OF_IMSCAND, 1); if (bo->htc->body_status != BS_NONE) AZ(VDI_GetBody(bo->wrk, bo)); assert(bo->refcount >= 1); assert(bo->state == BOS_REQ_DONE); if (bo->do_stream) { HSH_Unbusy(wrk, bo->fetch_objcore); VBO_setstate(bo, BOS_STREAM); } VSLb(bo->vsl, SLT_Fetch_Body, "%u %s %s", bo->htc->body_status, body_status_2str(bo->htc->body_status), bo->do_stream ? "stream" : "-"); if (bo->htc->body_status != BS_NONE) { assert(bo->htc->body_status != BS_ERROR); vbf_fetch_body_helper(bo); } if (bo->vfc->failed) { VDI_Finish(bo->wrk, bo); if (!bo->do_stream) { assert(bo->state < BOS_STREAM); // XXX: doclose = ? return (F_STP_ERROR); } else { return (F_STP_FAIL); } } if (bo->do_stream) assert(bo->state == BOS_STREAM); else { assert(bo->state == BOS_REQ_DONE); HSH_Unbusy(wrk, bo->fetch_objcore); } /* Recycle the backend connection before setting BOS_FINISHED to give predictable backend reuse behavior for varnishtest */ VDI_Finish(bo->wrk, bo); VBO_setstate(bo, BOS_FINISHED); VSLb_ts_busyobj(bo, "BerespBody", W_TIM_real(wrk)); if (bo->stale_oc != NULL) EXP_Rearm(bo->stale_oc, bo->stale_oc->exp.t_origin, 0, 0, 0); return (F_STP_DONE); } /*-------------------------------------------------------------------- */ static enum fetch_step vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo) { void *oi; void *sp; ssize_t sl, al, l; uint8_t *ptr; enum objiter_status ois; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); AZ(vbf_beresp2obj(bo)); if (ObjGetattr(bo->wrk, bo->stale_oc, OA_ESIDATA, NULL) != NULL) AZ(ObjCopyAttr(bo->wrk, bo->fetch_objcore, bo->stale_oc, OA_ESIDATA)); AZ(ObjCopyAttr(bo->wrk, bo->fetch_objcore, bo->stale_oc, OA_FLAGS)); AZ(ObjCopyAttr(bo->wrk, bo->fetch_objcore, bo->stale_oc, OA_GZIPBITS)); if (bo->do_stream) { HSH_Unbusy(wrk, bo->fetch_objcore); VBO_setstate(bo, BOS_STREAM); } al = 0; oi = ObjIterBegin(wrk, bo->stale_oc); do { ois = ObjIter(bo->stale_oc, oi, &sp, &sl); if (ois == OIS_ERROR) (void)VFP_Error(bo->vfc, "Template object failed"); while (sl > 0) { l = ObjGetLen(bo->wrk, bo->stale_oc) - al; assert(l > 0); if (VFP_GetStorage(bo->vfc, &l, &ptr) != VFP_OK) break; if (sl < l) l = sl; memcpy(ptr, sp, l); VBO_extend(bo, l); al += l; sp = (char *)sp + l; sl -= l; } } while (!bo->vfc->failed && (ois == OIS_DATA || ois == OIS_STREAM)); ObjIterEnd(bo->stale_oc, &oi); if (bo->stale_oc->flags & OC_F_FAILED) (void)VFP_Error(bo->vfc, "Template object failed"); if (bo->vfc->failed) { VDI_Finish(bo->wrk, bo); return (F_STP_FAIL); } if (!bo->do_stream) HSH_Unbusy(wrk, bo->fetch_objcore); assert(ObjGetLen(bo->wrk, bo->fetch_objcore) == al); EXP_Rearm(bo->stale_oc, bo->stale_oc->exp.t_origin, 0, 0, 0); /* Recycle the backend connection before setting BOS_FINISHED to give predictable backend reuse behavior for varnishtest */ VDI_Finish(bo->wrk, bo); VBO_setstate(bo, BOS_FINISHED); VSLb_ts_busyobj(bo, "BerespBody", W_TIM_real(wrk)); return (F_STP_DONE); } /*-------------------------------------------------------------------- * Create synth object */ static enum fetch_step vbf_stp_error(struct worker *wrk, struct busyobj *bo) { ssize_t l, ll, o; double now; uint8_t *ptr; struct vsb *synth_body; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo->fetch_objcore, OBJCORE_MAGIC); AN(bo->fetch_objcore->flags & OC_F_BUSY); assert(bo->director_state == DIR_S_NULL); now = W_TIM_real(wrk); VSLb_ts_busyobj(bo, "Error", now); if(bo->fetch_objcore->stobj->stevedore != NULL) ObjFreeObj(bo->wrk, bo->fetch_objcore); // XXX: reset all beresp flags ? HTTP_Setup(bo->beresp, bo->ws, bo->vsl, SLT_BerespMethod); http_PutResponse(bo->beresp, "HTTP/1.1", 503, "Backend fetch failed"); http_TimeHeader(bo->beresp, "Date: ", now); http_SetHeader(bo->beresp, "Server: Varnish"); if (bo->fetch_objcore->objhead->waitinglist != NULL) { /* * If there is a waitinglist, it means that there is no * grace-able object, so cache the error return for a * short time, so the waiting list can drain, rather than * each objcore on the waiting list sequentially attempt * to fetch from the backend. */ bo->fetch_objcore->exp.t_origin = now; bo->fetch_objcore->exp.ttl = 1; bo->fetch_objcore->exp.grace = 5; bo->fetch_objcore->exp.keep = 5; } else { EXP_Clr(&bo->fetch_objcore->exp); bo->fetch_objcore->exp.t_origin = now; } synth_body = VSB_new_auto(); AN(synth_body); VCL_backend_error_method(bo->vcl, wrk, NULL, bo, synth_body); AZ(VSB_finish(synth_body)); if (wrk->handling == VCL_RET_ABANDON) { VSB_delete(synth_body); return (F_STP_FAIL); } if (wrk->handling == VCL_RET_RETRY) { VSB_delete(synth_body); if (bo->retries++ < cache_param->max_retries) return (F_STP_RETRY); VSLb(bo->vsl, SLT_VCL_Error, "Too many retries, failing"); return (F_STP_FAIL); } assert(wrk->handling == VCL_RET_DELIVER); bo->vfc->bo = bo; bo->vfc->wrk = bo->wrk; bo->vfc->oc = bo->fetch_objcore; bo->vfc->http = bo->beresp; bo->vfc->esi_req = bo->bereq; if (vbf_beresp2obj(bo)) { VSB_delete(synth_body); return (F_STP_FAIL); } ll = VSB_len(synth_body); o = 0; while (ll > 0) { l = ll; if (VFP_GetStorage(bo->vfc, &l, &ptr) != VFP_OK) break; memcpy(ptr, VSB_data(synth_body) + o, l); VBO_extend(bo, l); ll -= l; o += l; } VSB_delete(synth_body); HSH_Unbusy(wrk, bo->fetch_objcore); VBO_setstate(bo, BOS_FINISHED); return (F_STP_DONE); } /*-------------------------------------------------------------------- */ static enum fetch_step vbf_stp_fail(struct worker *wrk, struct busyobj *bo) { CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo->fetch_objcore, OBJCORE_MAGIC); assert(bo->state < BOS_FINISHED); HSH_Fail(bo->fetch_objcore); if (bo->fetch_objcore->exp_flags & OC_EF_EXP) { /* Already unbusied - expire it */ AN(bo->fetch_objcore); EXP_Rearm(bo->fetch_objcore, bo->fetch_objcore->exp.t_origin, 0, 0, 0); } wrk->stats->fetch_failed++; VBO_setstate(bo, BOS_FAILED); return (F_STP_DONE); } /*-------------------------------------------------------------------- */ static enum fetch_step vbf_stp_done(void) { WRONG("Just plain wrong"); NEEDLESS_RETURN(F_STP_DONE); } static void __match_proto__(task_func_t) vbf_fetch_thread(struct worker *wrk, void *priv) { struct busyobj *bo; enum fetch_step stp; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CAST_OBJ_NOTNULL(bo, priv, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(bo->fetch_objcore, OBJCORE_MAGIC); THR_SetBusyobj(bo); stp = F_STP_MKBEREQ; assert(isnan(bo->t_first)); assert(isnan(bo->t_prev)); VSLb_ts_busyobj(bo, "Start", W_TIM_real(wrk)); bo->wrk = wrk; wrk->vsl = bo->vsl; #if 0 if (bo->stale_oc != NULL) { CHECK_OBJ_NOTNULL(bo->stale_oc, OBJCORE_MAGIC); /* We don't want the oc/stevedore ops in fetching thread */ if (!ObjCheckFlag(wrk, bo->stale_oc, OF_IMSCAND)) (void)HSH_DerefObjCore(wrk, &bo->stale_oc); } #endif while (stp != F_STP_DONE) { CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); assert(bo->refcount >= 1); switch(stp) { #define FETCH_STEP(l, U, arg) \ case F_STP_##U: \ stp = vbf_stp_##l arg; \ break; #include "tbl/steps.h" #undef FETCH_STEP default: WRONG("Illegal fetch_step"); } } assert(bo->director_state == DIR_S_NULL); http_Teardown(bo->bereq); http_Teardown(bo->beresp); if (bo->state == BOS_FINISHED) { AZ(bo->fetch_objcore->flags & OC_F_FAILED); HSH_Complete(bo->fetch_objcore); VSLb(bo->vsl, SLT_Length, "%ju", (uintmax_t)ObjGetLen(bo->wrk, bo->fetch_objcore)); } AZ(bo->fetch_objcore->busyobj); if (bo->stale_oc != NULL) (void)HSH_DerefObjCore(wrk, &bo->stale_oc); wrk->vsl = NULL; VBO_DerefBusyObj(wrk, &bo); THR_SetBusyobj(NULL); } /*-------------------------------------------------------------------- */ void VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, struct objcore *oldoc, enum vbf_fetch_mode_e mode) { struct busyobj *bo, *bo_fetch; const char *how; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AN(oc->flags & OC_F_BUSY); CHECK_OBJ_ORNULL(oldoc, OBJCORE_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"); } bo = VBO_GetBusyObj(wrk, req); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); VSLb(bo->vsl, SLT_Begin, "bereq %u %s", VXID(req->vsl->wid), how); VSLb(req->vsl, SLT_Link, "bereq %u %s", VXID(bo->vsl->wid), how); THR_SetBusyobj(bo); bo_fetch = bo; bo->refcount = 2; oc->busyobj = bo; AN(bo->vcl); if (mode == VBF_PASS) bo->do_pass = 1; bo->vary = req->vary_b; req->vary_b = NULL; if (mode != VBF_BACKGROUND) HSH_Ref(oc); AZ(bo->fetch_objcore); bo->fetch_objcore = oc; AZ(bo->stale_oc); if (oldoc != NULL) { assert(oldoc->refcnt > 0); HSH_Ref(oldoc); bo->stale_oc = oldoc; } AZ(bo->req); bo->req = req; bo->fetch_task.priv = bo_fetch; bo->fetch_task.func = vbf_fetch_thread; if (Pool_Task(wrk->pool, &bo->fetch_task, TASK_QUEUE_BO)) { wrk->stats->fetch_no_thread++; (void)vbf_stp_fail(req->wrk, bo); if (bo->stale_oc != NULL) (void)HSH_DerefObjCore(wrk, &bo->stale_oc); VBO_DerefBusyObj(wrk, &bo_fetch); } else { bo_fetch = NULL; /* ref transferred to fetch thread */ if (mode == VBF_BACKGROUND) { VBO_waitstate(bo, BOS_REQ_DONE); } else { VBO_waitstate(bo, BOS_STREAM); if (bo->state == BOS_FAILED) { AN((oc->flags & OC_F_FAILED)); } else { AZ(bo->fetch_objcore->flags & OC_F_BUSY); } } } AZ(bo_fetch); VSLb_ts_req(req, "Fetch", W_TIM_real(wrk)); VBO_DerefBusyObj(wrk, &bo); THR_SetBusyobj(NULL); } varnish-4.1.1/bin/varnishd/cache/cache_deliver_proc.c0000644000201500234410000001006212652366721017512 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include "cache.h" #include "cache_filter.h" int VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len) { int retval; struct vdp_entry *vdp; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); assert(act == VDP_NULL || act == VDP_FLUSH); if (req->vdp_errval) return (req->vdp_errval); vdp = req->vdp_nxt; CHECK_OBJ_NOTNULL(vdp, VDP_ENTRY_MAGIC); req->vdp_nxt = VTAILQ_NEXT(vdp, list); assert(act > VDP_NULL || len > 0); /* Call the present layer, while pointing to the next layer down */ retval = vdp->func(req, act, &vdp->priv, ptr, len); if (retval) req->vdp_errval = retval; /* Latch error value */ req->vdp_nxt = vdp; return (retval); } void VDP_push(struct req *req, vdp_bytes *func, void *priv, int bottom) { struct vdp_entry *vdp; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); AN(func); #if 0 // Gross hack for debugging struct vsb *vsb; vsb = VSB_new_auto(); AN(vsb); Symbol_Lookup(vsb, func); AZ(VSB_finish(vsb)); VSLb(req->vsl, SLT_Debug, "VDP %s %p %d", VSB_data(vsb), priv, bottom); VSB_delete(vsb); #endif vdp = WS_Alloc(req->ws, sizeof *vdp); if (vdp == NULL) return; INIT_OBJ(vdp, VDP_ENTRY_MAGIC); vdp->func = func; vdp->priv = priv; if (bottom) VTAILQ_INSERT_TAIL(&req->vdp, vdp, list); else VTAILQ_INSERT_HEAD(&req->vdp, vdp, list); req->vdp_nxt = VTAILQ_FIRST(&req->vdp); AZ(vdp->func(req, VDP_INIT, &vdp->priv, NULL, 0)); } static void vdp_pop(struct req *req, vdp_bytes *func) { struct vdp_entry *vdp; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); vdp = VTAILQ_FIRST(&req->vdp); CHECK_OBJ_NOTNULL(vdp, VDP_ENTRY_MAGIC); assert(vdp->func == func); VTAILQ_REMOVE(&req->vdp, vdp, list); AZ(vdp->func(req, VDP_FINI, &vdp->priv, NULL, 0)); AZ(vdp->priv); req->vdp_nxt = VTAILQ_FIRST(&req->vdp); } void VDP_close(struct req *req) { CHECK_OBJ_NOTNULL(req, REQ_MAGIC); while (!VTAILQ_EMPTY(&req->vdp)) vdp_pop(req, VTAILQ_FIRST(&req->vdp)->func); } /*--------------------------------------------------------------------*/ enum objiter_status VDP_DeliverObj(struct req *req) { enum objiter_status ois; ssize_t len; void *oi; void *ptr; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); oi = ObjIterBegin(req->wrk, req->objcore); XXXAN(oi); do { ois = ObjIter(req->objcore, oi, &ptr, &len); switch(ois) { case OIS_DONE: AZ(len); break; case OIS_ERROR: break; case OIS_DATA: case OIS_STREAM: if (VDP_bytes(req, ois == OIS_DATA ? VDP_NULL : VDP_FLUSH, ptr, len)) ois = OIS_ERROR; break; default: WRONG("Wrong OIS value"); } } while (ois == OIS_DATA || ois == OIS_STREAM); (void)VDP_bytes(req, VDP_FLUSH, NULL, 0); ObjIterEnd(req->objcore, &oi); return (ois); } varnish-4.1.1/bin/varnishd/cache/cache_pool.h0000644000201500234410000000421212652366721016013 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Private include file for the pool aware code. */ #include "config.h" VTAILQ_HEAD(taskhead, pool_task); struct pool { unsigned magic; #define POOL_MAGIC 0x606658fa VTAILQ_ENTRY(pool) list; pthread_cond_t herder_cond; pthread_t herder_thr; struct lock mtx; struct taskhead idle_queue; struct taskhead queues[TASK_QUEUE_END]; unsigned nthr; unsigned dry; unsigned lqueue; uintmax_t ndropped; uintmax_t nqueued; struct dstat *a_stat; struct dstat *b_stat; struct waitfor wf; struct mempool *mpl_req; struct mempool *mpl_sess; struct waiter *waiter; }; void *pool_herder(void*); task_func_t pool_stat_summ; extern struct lock pool_mtx; void VCA_NewPool(struct pool *pp); varnish-4.1.1/bin/varnishd/cache/cache_priv.h0000644000201500234410000000763512652366721016036 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Stuff that should *never* be exposed to a VMOD */ /*-------------------------------------------------------------------- * A transport is how we talk HTTP for a given request. * This is different from a protocol because ESI child requests have * their own "protocol" to talk to the parent ESI request, which may * or may not, be talking a "real" HTTP protocol itself. */ typedef void vtr_deliver_f (struct req *, struct busyobj *, int sendbody); struct transport { unsigned magic; #define TRANSPORT_MAGIC 0xf157f32f vtr_deliver_f *deliver; }; /* Prototypes etc ----------------------------------------------------*/ /* cache_acceptor.c */ void VCA_Init(void); void VCA_Shutdown(void); /* cache_backend_cfg.c */ void VBE_InitCfg(void); void VBE_Poll(void); /* cache_backend_poll.c */ void VBP_Init(void); /* == cache_ban.c == */ /* From cache_main.c */ void BAN_Init(void); void BAN_Compile(void); void BAN_Shutdown(void); /* From cache_hash.c */ void BAN_NewObjCore(struct objcore *oc); void BAN_DestroyObj(struct objcore *oc); int BAN_CheckObject(struct worker *, struct objcore *, struct req *); /* cache_busyobj.c */ void VBO_Init(void); /* cache_cli.c [CLI] */ void CLI_Init(void); void CLI_Run(void); void CLI_AddFuncs(struct cli_proto *p); /* cache_expire.c */ void EXP_Init(void); /* cache_fetch_proc.c */ void VFP_Init(void); /* cache_http.c */ void HTTP_Init(void); /* cache_main.c */ void THR_SetName(const char *name); const char* THR_GetName(void); void THR_SetBusyobj(const struct busyobj *); struct busyobj * THR_GetBusyobj(void); void THR_SetRequest(const struct req *); struct req * THR_GetRequest(void); /* cache_lck.c */ void LCK_Init(void); /* cache_panic.c */ void PAN_Init(void); /* cache_pool.c */ void Pool_Init(void); /* cache_proxy.c [VPX] */ task_func_t VPX_Proto_Sess; /* cache_shmlog.c */ void VSM_Init(void); void VSL_Setup(struct vsl_log *vsl, void *ptr, size_t len); void VSL_ChgId(struct vsl_log *vsl, const char *typ, const char *why, uint32_t vxid); void VSL_End(struct vsl_log *vsl); /* cache_vcl.c */ struct director *VCL_DefaultDirector(const struct vcl *); const struct vrt_backend_probe *VCL_DefaultProbe(const struct vcl *); void VCL_Init(void); void VCL_Panic(struct vsb *, const struct vcl *); void VCL_Poll(void); /* cache_vrt.c */ void VRTPRIV_init(struct vrt_privs *privs); void VRTPRIV_dynamic_kill(struct vrt_privs *privs, uintptr_t id); /* cache_vrt_vmod.c */ void VMOD_Init(void); /* storage_persistent.c */ void SMP_Init(void); void SMP_Ready(void); varnish-4.1.1/bin/varnishd/cache/cache_wrk.c0000644000201500234410000002765112652366721015654 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Worker thread stuff unrelated to the worker thread pools. */ #include "config.h" #include #include #include "cache.h" #include "cache_pool.h" #include "vtim.h" #include "hash/hash_slinger.h" static void Pool_Work_Thread(struct pool *pp, struct worker *wrk); /*-------------------------------------------------------------------- * Create and start a back-ground thread which as its own worker and * session data structures; */ struct bgthread { unsigned magic; #define BGTHREAD_MAGIC 0x23b5152b const char *name; bgthread_t *func; void *priv; }; static void * wrk_bgthread(void *arg) { struct bgthread *bt; struct worker wrk; CAST_OBJ_NOTNULL(bt, arg, BGTHREAD_MAGIC); THR_SetName(bt->name); INIT_OBJ(&wrk, WORKER_MAGIC); (void)bt->func(&wrk, bt->priv); WRONG("BgThread terminated"); NEEDLESS_RETURN(NULL); } void WRK_BgThread(pthread_t *thr, const char *name, bgthread_t *func, void *priv) { struct bgthread *bt; ALLOC_OBJ(bt, BGTHREAD_MAGIC); AN(bt); bt->name = name; bt->func = func; bt->priv = priv; AZ(pthread_create(thr, NULL, wrk_bgthread, bt)); } /*--------------------------------------------------------------------*/ static void WRK_Thread(struct pool *qp, size_t stacksize, unsigned thread_workspace) { struct worker *w, ww; unsigned char ws[thread_workspace]; uintptr_t u; AN(qp); AN(stacksize); AN(thread_workspace); THR_SetName("cache-worker"); w = &ww; INIT_OBJ(w, WORKER_MAGIC); w->lastused = NAN; AZ(pthread_cond_init(&w->cond, NULL)); WS_Init(w->aws, "wrk", ws, thread_workspace); u = getpagesize(); AN(u); u -= 1U; w->stack_start = (((uintptr_t)&qp) + u) & ~u; /* XXX: assuming stack grows down. */ w->stack_end = w->stack_start - stacksize; VSL(SLT_WorkThread, 0, "%p start", w); Pool_Work_Thread(qp, w); AZ(w->pool); VSL(SLT_WorkThread, 0, "%p end", w); if (w->vcl != NULL) VCL_Rel(&w->vcl); AZ(pthread_cond_destroy(&w->cond)); HSH_Cleanup(w); Pool_Sumstat(w); } /*-------------------------------------------------------------------- * Summing of stats into pool counters */ static void pool_addstat(struct dstat *dst, struct dstat *src) { dst->summs++; #define L0(n) #define L1(n) (dst->n += src->n) #define VSC_F(n,t,l,s,f,v,d,e) L##l(n); #include "tbl/vsc_f_main.h" #undef VSC_F #undef L0 #undef L1 memset(src, 0, sizeof *src); } /*--------------------------------------------------------------------*/ static struct worker * pool_getidleworker(struct pool *pp) { struct pool_task *pt; struct worker *wrk; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); Lck_AssertHeld(&pp->mtx); pt = VTAILQ_FIRST(&pp->idle_queue); if (pt == NULL) { if (pp->nthr < cache_param->wthread_max) { pp->dry++; AZ(pthread_cond_signal(&pp->herder_cond)); } return (NULL); } AZ(pt->func); CAST_OBJ_NOTNULL(wrk, pt->priv, WORKER_MAGIC); return (wrk); } /*-------------------------------------------------------------------- * Special scheduling: If no thread can be found, the current thread * will be prepared for rescheduling instead. * The selected threads workspace is reserved and the argument put there. * Return one if another thread was scheduled, otherwise zero. */ int Pool_Task_Arg(struct worker *wrk, task_func_t *func, const void *arg, size_t arg_len) { struct pool *pp; struct worker *wrk2; int retval; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AN(arg); AN(arg_len); pp = wrk->pool; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); Lck_Lock(&pp->mtx); wrk2 = pool_getidleworker(pp); if (wrk2 != NULL) { VTAILQ_REMOVE(&pp->idle_queue, &wrk2->task, list); retval = 1; } else { wrk2 = wrk; retval = 0; } Lck_Unlock(&pp->mtx); AZ(wrk2->task.func); assert(arg_len <= WS_Reserve(wrk2->aws, arg_len)); memcpy(wrk2->aws->f, arg, arg_len); wrk2->task.func = func; wrk2->task.priv = wrk2->aws->f; if (retval) AZ(pthread_cond_signal(&wrk2->cond)); return (retval); } /*-------------------------------------------------------------------- * Enter a new task to be done */ int Pool_Task(struct pool *pp, struct pool_task *task, enum task_how how) { struct worker *wrk; int retval = 0; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); AN(task); AN(task->func); assert(how < TASK_QUEUE_END); Lck_Lock(&pp->mtx); /* The common case first: Take an idle thread, do it. */ wrk = pool_getidleworker(pp); if (wrk != NULL) { VTAILQ_REMOVE(&pp->idle_queue, &wrk->task, list); AZ(wrk->task.func); wrk->task.func = task->func; wrk->task.priv = task->priv; Lck_Unlock(&pp->mtx); AZ(pthread_cond_signal(&wrk->cond)); return (0); } /* Acceptors are not subject to queue limits */ if (how == TASK_QUEUE_VCA || pp->lqueue < cache_param->wthread_max + cache_param->wthread_queue_limit + pp->nthr) { pp->nqueued++; pp->lqueue++; VTAILQ_INSERT_TAIL(&pp->queues[how], task, list); } else { pp->ndropped++; retval = -1; } Lck_Unlock(&pp->mtx); return (retval); } /*-------------------------------------------------------------------- * Empty function used as a pointer value for the thread exit condition. */ static void __match_proto__(task_func_t) pool_kiss_of_death(struct worker *wrk, void *priv) { (void)wrk; (void)priv; } /*-------------------------------------------------------------------- * This is the work function for worker threads in the pool. */ static void Pool_Work_Thread(struct pool *pp, struct worker *wrk) { struct pool_task *tp; struct pool_task tpx, tps; int i; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); wrk->pool = pp; while (1) { Lck_Lock(&pp->mtx); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); WS_Reset(wrk->aws, NULL); AZ(wrk->vsl); for (i = 0; i < TASK_QUEUE_END; i++) { tp = VTAILQ_FIRST(&pp->queues[i]); if (tp != NULL) { pp->lqueue--; VTAILQ_REMOVE(&pp->queues[i], tp, list); break; } } if ((tp == NULL && wrk->stats->summs > 0) || (wrk->stats->summs >= cache_param->wthread_stats_rate)) pool_addstat(pp->a_stat, wrk->stats); if (tp != NULL) { wrk->stats->summs++; } else if (pp->b_stat != NULL && pp->a_stat->summs) { /* Nothing to do, push pool stats into global pool */ tps.func = pool_stat_summ; tps.priv = pp->a_stat; pp->a_stat = pp->b_stat; pp->b_stat = NULL; tp = &tps; } else { /* Nothing to do: To sleep, perchance to dream ... */ if (isnan(wrk->lastused)) wrk->lastused = VTIM_real(); wrk->task.func = NULL; wrk->task.priv = wrk; VTAILQ_INSERT_HEAD(&pp->idle_queue, &wrk->task, list); do { i = Lck_CondWait(&wrk->cond, &pp->mtx, wrk->vcl == NULL ? 0 : wrk->lastused+60.); if (i == ETIMEDOUT) VCL_Rel(&wrk->vcl); } while (wrk->task.func == NULL); tpx = wrk->task; tp = &tpx; wrk->stats->summs++; } Lck_Unlock(&pp->mtx); if (tp->func == pool_kiss_of_death) break; do { memset(&wrk->task, 0, sizeof wrk->task); assert(wrk->pool == pp); tp->func(wrk, tp->priv); if (DO_DEBUG(DBG_VCLREL) && wrk->vcl != NULL) VCL_Rel(&wrk->vcl); tpx = wrk->task; tp = &tpx; } while (tp->func != NULL); /* cleanup for next task */ wrk->seen_methods = 0; } wrk->pool = NULL; } /*-------------------------------------------------------------------- * Create another worker thread. */ struct pool_info { unsigned magic; #define POOL_INFO_MAGIC 0x4e4442d3 size_t stacksize; struct pool *qp; }; static void * pool_thread(void *priv) { struct pool_info *pi; CAST_OBJ_NOTNULL(pi, priv, POOL_INFO_MAGIC); WRK_Thread(pi->qp, pi->stacksize, cache_param->workspace_thread); FREE_OBJ(pi); return (NULL); } static void pool_breed(struct pool *qp) { pthread_t tp; pthread_attr_t tp_attr; struct pool_info *pi; AZ(pthread_attr_init(&tp_attr)); AZ(pthread_attr_setdetachstate(&tp_attr, PTHREAD_CREATE_DETACHED)); /* Set the stacksize for worker threads we create */ if (cache_param->wthread_stacksize != UINT_MAX) AZ(pthread_attr_setstacksize(&tp_attr, cache_param->wthread_stacksize)); ALLOC_OBJ(pi, POOL_INFO_MAGIC); AN(pi); AZ(pthread_attr_getstacksize(&tp_attr, &pi->stacksize)); pi->qp = qp; if (pthread_create(&tp, &tp_attr, pool_thread, pi)) { VSL(SLT_Debug, 0, "Create worker thread failed %d %s", errno, strerror(errno)); Lck_Lock(&pool_mtx); VSC_C_main->threads_failed++; Lck_Unlock(&pool_mtx); VTIM_sleep(cache_param->wthread_fail_delay); } else { qp->dry = 0; qp->nthr++; Lck_Lock(&pool_mtx); VSC_C_main->threads++; VSC_C_main->threads_created++; Lck_Unlock(&pool_mtx); VTIM_sleep(cache_param->wthread_add_delay); } AZ(pthread_attr_destroy(&tp_attr)); } /*-------------------------------------------------------------------- * Herd a single pool * * This thread wakes up whenever a pool queues. * * The trick here is to not be too aggressive about creating threads. * We do this by only examining one pool at a time, and by sleeping * a short while whenever we create a thread and a little while longer * whenever we fail to, hopefully missing a lot of cond_signals in * the meantime. * * XXX: probably need a lot more work. * */ void* pool_herder(void *priv) { struct pool *pp; struct pool_task *pt; double t_idle; struct worker *wrk; CAST_OBJ_NOTNULL(pp, priv, POOL_MAGIC); while (1) { /* Make more threads if needed and allowed */ if (pp->nthr < cache_param->wthread_min || (pp->dry && pp->nthr < cache_param->wthread_max)) { pool_breed(pp); continue; } assert(pp->nthr >= cache_param->wthread_min); if (pp->nthr > cache_param->wthread_min) { t_idle = VTIM_real() - cache_param->wthread_timeout; Lck_Lock(&pp->mtx); /* XXX: unsafe counters */ VSC_C_main->sess_queued += pp->nqueued; VSC_C_main->sess_dropped += pp->ndropped; pp->nqueued = pp->ndropped = 0; wrk = NULL; pt = VTAILQ_LAST(&pp->idle_queue, taskhead); if (pt != NULL) { AZ(pt->func); CAST_OBJ_NOTNULL(wrk, pt->priv, WORKER_MAGIC); if (wrk->lastused < t_idle || pp->nthr > cache_param->wthread_max) { /* Give it a kiss on the cheek... */ VTAILQ_REMOVE(&pp->idle_queue, &wrk->task, list); wrk->task.func = pool_kiss_of_death; AZ(pthread_cond_signal(&wrk->cond)); } else wrk = NULL; } Lck_Unlock(&pp->mtx); if (wrk != NULL) { pp->nthr--; Lck_Lock(&pool_mtx); VSC_C_main->threads--; VSC_C_main->threads_destroyed++; Lck_Unlock(&pool_mtx); VTIM_sleep(cache_param->wthread_destroy_delay); continue; } } Lck_Lock(&pp->mtx); if (!pp->dry) { (void)Lck_CondWait(&pp->herder_cond, &pp->mtx, VTIM_real() + 5); } else { /* XXX: unsafe counters */ VSC_C_main->threads_limited++; pp->dry = 0; } Lck_Unlock(&pp->mtx); } NEEDLESS_RETURN(NULL); } varnish-4.1.1/bin/varnishd/cache/cache_lck.c0000644000201500234410000001435712652366721015621 00000000000000/*- * Copyright (c) 2008-2011 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 geniuses who came up with pthreads did not think operations like * pthread_assert_mutex_held() were important enough to include them in * the API. * * Build our own locks on top of pthread mutexes and hope that the next * civilization is better at such crucial details than this one. */ #include "config.h" #include #include #include #include "cache.h" struct ilck { unsigned magic; #define ILCK_MAGIC 0x7b86c8a5 int held; pthread_mutex_t mtx; pthread_t owner; const char *w; struct VSC_C_lck *stat; }; static pthread_mutexattr_t attr; /*--------------------------------------------------------------------*/ static void Lck_Witness_Lock(const struct ilck *il, const char *p, int l, const char *try) { char *q, t[10]; int emit; AN(p); q = pthread_getspecific(witness_key); if (q == NULL) { q = calloc(1, 1024); AN(q); AZ(pthread_setspecific(witness_key, q)); } emit = *q != '\0'; strcat(q, " "); strcat(q, il->w); strcat(q, try); strcat(q, ","); strcat(q, p); strcat(q, ","); bprintf(t, "%d", l); strcat(q, t); if (emit) VSL(SLT_Witness, 0, "%s", q); } static void Lck_Witness_Unlock(const struct ilck *il) { char *q, *r; q = pthread_getspecific(witness_key); if (q == NULL) return; r = strrchr(q, ' '); if (r == NULL) r = q; else *r++ = '\0'; if (memcmp(r, il->w, strlen(il->w))) VSL(SLT_Witness, 0, "Unlock %s @ %s <%s>", il->w, r, q); else *r = '\0'; } /*--------------------------------------------------------------------*/ void __match_proto__() Lck__Lock(struct lock *lck, const char *p, int l) { struct ilck *ilck; CAST_OBJ_NOTNULL(ilck, lck->priv, ILCK_MAGIC); if (DO_DEBUG(DBG_WITNESS)) Lck_Witness_Lock(ilck, p, l, ""); AZ(pthread_mutex_lock(&ilck->mtx)); AZ(ilck->held); ilck->stat->locks++; ilck->owner = pthread_self(); ilck->held = 1; } void __match_proto__() Lck__Unlock(struct lock *lck, const char *p, int l) { struct ilck *ilck; (void)p; (void)l; CAST_OBJ_NOTNULL(ilck, lck->priv, ILCK_MAGIC); assert(pthread_equal(ilck->owner, pthread_self())); AN(ilck->held); ilck->held = 0; /* * #ifdef POSIX_STUPIDITY: * The pthread_t type has no defined assignment or comparison * operators, this is why pthread_equal() is necessary. * Unfortunately POSIX forgot to define a NULL value for pthread_t * so you can never unset a pthread_t variable. * We hack it and fill it with zero bits, hoping for sane * implementations of pthread. * #endif */ memset(&ilck->owner, 0, sizeof ilck->owner); AZ(pthread_mutex_unlock(&ilck->mtx)); if (DO_DEBUG(DBG_WITNESS)) Lck_Witness_Unlock(ilck); } int __match_proto__() Lck__Trylock(struct lock *lck, const char *p, int l) { struct ilck *ilck; int r; CAST_OBJ_NOTNULL(ilck, lck->priv, ILCK_MAGIC); if (DO_DEBUG(DBG_WITNESS)) Lck_Witness_Lock(ilck, p, l, "?"); r = pthread_mutex_trylock(&ilck->mtx); assert(r == 0 || r == EBUSY); if (r == 0) { AZ(ilck->held); ilck->held = 1; ilck->stat->locks++; ilck->owner = pthread_self(); } return (r); } void Lck__Assert(const struct lock *lck, int held) { struct ilck *ilck; CAST_OBJ_NOTNULL(ilck, lck->priv, ILCK_MAGIC); if (held) { assert(ilck->held); assert(pthread_equal(ilck->owner, pthread_self())); } else { AZ(ilck->held); AZ(pthread_equal(ilck->owner, pthread_self())); } } int __match_proto__() Lck_CondWait(pthread_cond_t *cond, struct lock *lck, double when) { struct ilck *ilck; int retval = 0; struct timespec ts; double t; CAST_OBJ_NOTNULL(ilck, lck->priv, ILCK_MAGIC); AN(ilck->held); assert(pthread_equal(ilck->owner, pthread_self())); ilck->held = 0; if (when == 0) { AZ(pthread_cond_wait(cond, &ilck->mtx)); } else { ts.tv_nsec = (long)(modf(when, &t) * 1e9); ts.tv_sec = (long)t; retval = pthread_cond_timedwait(cond, &ilck->mtx, &ts); assert(retval == 0 || retval == ETIMEDOUT); } AZ(ilck->held); ilck->held = 1; ilck->owner = pthread_self(); return (retval); } void Lck__New(struct lock *lck, struct VSC_C_lck *st, const char *w) { struct ilck *ilck; AN(st); AN(w); AZ(lck->priv); ALLOC_OBJ(ilck, ILCK_MAGIC); AN(ilck); ilck->w = w; ilck->stat = st; ilck->stat->creat++; AZ(pthread_mutex_init(&ilck->mtx, &attr)); lck->priv = ilck; } void Lck_Delete(struct lock *lck) { struct ilck *ilck; CAST_OBJ_NOTNULL(ilck, lck->priv, ILCK_MAGIC); ilck->stat->destroy++; lck->priv = NULL; AZ(pthread_mutex_destroy(&ilck->mtx)); FREE_OBJ(ilck); } struct VSC_C_lck * Lck_CreateClass(const char *name) { return(VSM_Alloc(sizeof(struct VSC_C_lck), VSC_CLASS, VSC_type_lck, name)); } #define LOCK(nam) struct VSC_C_lck *lck_##nam; #include "tbl/locks.h" #undef LOCK void LCK_Init(void) { AZ(pthread_mutexattr_init(&attr)); #if !defined(__APPLE__) && !defined(__MACH__) AZ(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK)); #endif #define LOCK(nam) lck_##nam = Lck_CreateClass(#nam); #include "tbl/locks.h" #undef LOCK } varnish-4.1.1/bin/varnishd/cache/cache_expire.c0000644000201500234410000003577312652366721016351 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * LRU and object timer handling. * */ #include "config.h" #include #include "cache.h" #include "binary_heap.h" #include "hash/hash_slinger.h" #include "vtim.h" struct exp_callback { unsigned magic; #define EXP_CALLBACK_MAGIC 0xab956eb1 exp_callback_f *func; void *priv; VTAILQ_ENTRY(exp_callback) list; }; struct exp_priv { unsigned magic; #define EXP_PRIV_MAGIC 0x9db22482 struct lock mtx; struct worker *wrk; struct vsl_log vsl; VTAILQ_HEAD(,objcore) inbox; struct binheap *heap; pthread_cond_t condvar; VTAILQ_HEAD(,exp_callback) ecb_list; pthread_rwlock_t cb_rwl; }; static struct exp_priv *exphdl; static void exp_event(struct worker *wrk, struct objcore *oc, enum exp_event_e e) { struct exp_callback *cb; /* * Strictly speaking this is not atomic, but neither is VMOD * loading in general, so this is a fair optimization */ if (VTAILQ_EMPTY(&exphdl->ecb_list)) return; AZ(pthread_rwlock_rdlock(&exphdl->cb_rwl)); VTAILQ_FOREACH(cb, &exphdl->ecb_list, list) { CHECK_OBJ_NOTNULL(cb, EXP_CALLBACK_MAGIC); cb->func(wrk, oc, e, cb->priv); } AZ(pthread_rwlock_unlock(&exphdl->cb_rwl)); } /*-------------------------------------------------------------------- * struct exp manipulations */ void EXP_Clr(struct exp *e) { e->ttl = -1; e->grace = 0; e->keep = 0; e->t_origin = 0; } /*-------------------------------------------------------------------- * Calculate an objects effective ttl time, taking req.ttl into account * if it is available. */ double EXP_Ttl(const struct req *req, const struct exp *e) { double r; r = e->ttl; if (req != NULL && req->d_ttl > 0. && req->d_ttl < r) r = req->d_ttl; return (e->t_origin + r); } /*-------------------------------------------------------------------- * Calculate when this object is no longer useful */ double EXP_When(const struct exp *e) { double when; if (e->t_origin == 0) return (0.); when = e->t_origin + e->ttl + e->grace + e->keep; AZ(isnan(when)); return (when); } /*-------------------------------------------------------------------- * Post an objcore to the exp_thread's inbox. */ static void exp_mail_it(struct objcore *oc) { CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AN(oc->exp_flags & OC_EF_OFFLRU); Lck_Lock(&exphdl->mtx); if (oc->exp_flags & OC_EF_DYING) 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); } /*-------------------------------------------------------------------- * Inject an object with a reference into the lru/binheap. * * This can either come from a stevedore (persistent) during startup * or from EXP_Insert() below. */ void EXP_Inject(struct worker *wrk, struct objcore *oc, struct lru *lru) { CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AZ(oc->exp_flags & (OC_EF_OFFLRU | OC_EF_INSERT | OC_EF_MOVE)); AZ(oc->exp_flags & OC_EF_DYING); AZ(oc->flags & OC_F_BUSY); CHECK_OBJ_NOTNULL(lru, LRU_MAGIC); Lck_Lock(&lru->mtx); lru->n_objcore++; oc->exp_flags |= OC_EF_OFFLRU | OC_EF_INSERT | OC_EF_EXP; oc->timer_when = EXP_When(&oc->exp); Lck_Unlock(&lru->mtx); exp_event(wrk, oc, EXP_INJECT); exp_mail_it(oc); } /*-------------------------------------------------------------------- * Insert new object. * * We grab a reference to the object, which will keep it around until * we decide its time to let it go. */ void EXP_Insert(struct worker *wrk, struct objcore *oc) { struct lru *lru; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); HSH_Ref(oc); AZ(oc->exp_flags & (OC_EF_OFFLRU | OC_EF_INSERT | OC_EF_MOVE)); AZ(oc->exp_flags & OC_EF_DYING); AN(oc->flags & OC_F_BUSY); lru = ObjGetLRU(oc); CHECK_OBJ_NOTNULL(lru, LRU_MAGIC); Lck_Lock(&lru->mtx); lru->n_objcore++; oc->exp_flags |= OC_EF_OFFLRU | OC_EF_INSERT | OC_EF_EXP; oc->exp_flags |= OC_EF_MOVE; Lck_Unlock(&lru->mtx); exp_event(wrk, oc, EXP_INSERT); exp_mail_it(oc); } /*-------------------------------------------------------------------- * Object was used, move to tail of LRU list. * * To avoid the exphdl->mtx becoming a hotspot, we only attempt to move * objects if they have not been moved recently and if the lock is available. * This optimization obviously leaves the LRU list imperfectly sorted. */ void EXP_Touch(struct objcore *oc, double now) { struct lru *lru; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); if (oc->flags & OC_F_INCOMPLETE) return; if (now - oc->last_lru < cache_param->lru_interval) return; lru = ObjGetLRU(oc); CHECK_OBJ_NOTNULL(lru, LRU_MAGIC); /* * For -spersistent (and possibly other stevedores, we don't move * objects on the lru list, since LRU doesn't really help much. */ if (lru->flags & LRU_F_DONTMOVE) return; if (Lck_Trylock(&lru->mtx)) return; AN(oc->exp_flags & OC_EF_EXP); if (!(oc->exp_flags & OC_EF_OFFLRU)) { /* Can only touch it while it's actually on the LRU list */ VTAILQ_REMOVE(&lru->lru_head, oc, lru_list); VTAILQ_INSERT_TAIL(&lru->lru_head, oc, lru_list); VSC_C_main->n_lru_moved++; } oc->last_lru = now; Lck_Unlock(&lru->mtx); } /*-------------------------------------------------------------------- * We have changed one or more of the object timers, tell the exp_thread * */ void EXP_Rearm(struct objcore *oc, double now, double ttl, double grace, double keep) { struct lru *lru; double when; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); assert(oc->refcnt > 0); AN(oc->exp_flags & OC_EF_EXP); if (!isnan(ttl)) oc->exp.ttl = now + ttl - oc->exp.t_origin; if (!isnan(grace)) oc->exp.grace = grace; if (!isnan(keep)) oc->exp.keep = keep; when = EXP_When(&oc->exp); VSL(SLT_ExpKill, 0, "EXP_Rearm p=%p E=%.9f e=%.9f f=0x%x", oc, oc->timer_when, when, oc->flags); if (when > oc->exp.t_origin && when > oc->timer_when) return; lru = ObjGetLRU(oc); CHECK_OBJ_NOTNULL(lru, LRU_MAGIC); Lck_Lock(&lru->mtx); if (!isnan(now) && when <= now) oc->exp_flags |= OC_EF_DYING; else oc->exp_flags |= OC_EF_MOVE; if (oc->exp_flags & OC_EF_OFFLRU) { oc = NULL; } else { oc->exp_flags |= OC_EF_OFFLRU; VTAILQ_REMOVE(&lru->lru_head, oc, lru_list); } Lck_Unlock(&lru->mtx); if (oc != NULL) exp_mail_it(oc); } /*-------------------------------------------------------------------- * Attempt to make space by nuking the oldest object on the LRU list * which isn't in use. * Returns: 1: did, 0: didn't, -1: can't */ int EXP_NukeOne(struct worker *wrk, struct lru *lru) { struct objcore *oc, *oc2; struct objhead *oh; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(lru, LRU_MAGIC); /* Find the first currently unused object on the LRU. */ Lck_Lock(&lru->mtx); VTAILQ_FOREACH_SAFE(oc, &lru->lru_head, lru_list, oc2) { CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); VSLb(wrk->vsl, SLT_ExpKill, "LRU_Cand p=%p f=0x%x r=%d", oc, oc->flags, oc->refcnt); AZ(oc->exp_flags & OC_EF_OFFLRU); AZ(oc->exp_flags & OC_EF_DYING); /* * It wont release any space if we cannot release the last * reference, besides, if somebody else has a reference, * it's a bad idea to nuke this object anyway. */ if (oc->refcnt > 1) continue; oh = oc->objhead; CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); if (Lck_Trylock(&oh->mtx)) continue; if (oc->refcnt == 1) { oc->exp_flags |= OC_EF_DYING | OC_EF_OFFLRU; 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 != NULL) break; } Lck_Unlock(&lru->mtx); if (oc == NULL) { VSLb(wrk->vsl, SLT_ExpKill, "LRU_Fail"); return (-1); } /* XXX: We could grab and return one storage segment to our caller */ ObjSlim(wrk, oc); exp_mail_it(oc); VSLb(wrk->vsl, SLT_ExpKill, "LRU x=%u", ObjGetXID(wrk, oc)); (void)HSH_DerefObjCore(wrk, &oc); return (1); } /*--------------------------------------------------------------------*/ uintptr_t EXP_Register_Callback(exp_callback_f *func, void *priv) { struct exp_callback *ecb; AN(func); ALLOC_OBJ(ecb, EXP_CALLBACK_MAGIC); AN(ecb); ecb->func = func; ecb->priv = priv; AZ(pthread_rwlock_wrlock(&exphdl->cb_rwl)); VTAILQ_INSERT_TAIL(&exphdl->ecb_list, ecb, list); AZ(pthread_rwlock_unlock(&exphdl->cb_rwl)); return ((uintptr_t)ecb); } void EXP_Deregister_Callback(uintptr_t *handle) { struct exp_callback *ecb; AN(handle); AN(*handle); AZ(pthread_rwlock_wrlock(&exphdl->cb_rwl)); VTAILQ_FOREACH(ecb, &exphdl->ecb_list, list) { CHECK_OBJ_NOTNULL(ecb, EXP_CALLBACK_MAGIC); if ((uintptr_t)ecb == *handle) break; } AN(ecb); VTAILQ_REMOVE(&exphdl->ecb_list, ecb, list); AZ(pthread_rwlock_unlock(&exphdl->cb_rwl)); FREE_OBJ(ecb); *handle = 0; } /*-------------------------------------------------------------------- * Handle stuff in the inbox */ static void exp_inbox(struct exp_priv *ep, struct objcore *oc, double now) { unsigned flags; struct lru *lru; CHECK_OBJ_NOTNULL(ep, EXP_PRIV_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); VSLb(&ep->vsl, SLT_ExpKill, "EXP_Inbox p=%p e=%.9f f=0x%x", oc, oc->timer_when, oc->flags); lru = ObjGetLRU(oc); CHECK_OBJ_NOTNULL(lru, LRU_MAGIC); /* Evacuate our action-flags, and put it back on the LRU list */ Lck_Lock(&lru->mtx); flags = oc->exp_flags; AN(flags & OC_EF_OFFLRU); oc->exp_flags &= ~(OC_EF_INSERT | OC_EF_MOVE); oc->last_lru = now; if (!(flags & OC_EF_DYING)) { VTAILQ_INSERT_TAIL(&lru->lru_head, oc, lru_list); oc->exp_flags &= ~OC_EF_OFFLRU; } Lck_Unlock(&lru->mtx); if (flags & OC_EF_DYING) { VSLb(&ep->vsl, SLT_ExpKill, "EXP_Kill p=%p e=%.9f f=0x%x", oc, oc->timer_when, oc->flags); if (!(flags & OC_EF_INSERT)) { assert(oc->timer_idx != BINHEAP_NOIDX); binheap_delete(ep->heap, oc->timer_idx); } assert(oc->timer_idx == BINHEAP_NOIDX); exp_event(ep->wrk, oc, EXP_REMOVE); (void)HSH_DerefObjCore(ep->wrk, &oc); return; } if (flags & OC_EF_MOVE) { oc->timer_when = EXP_When(&oc->exp); ObjUpdateMeta(ep->wrk, oc); } VSLb(&ep->vsl, SLT_ExpKill, "EXP_When p=%p e=%.9f f=0x%x", oc, oc->timer_when, flags); /* * XXX: There are some pathological cases here, were we * XXX: insert or move an expired object, only to find out * XXX: the next moment and rip them out again. */ if (flags & OC_EF_INSERT) { assert(oc->timer_idx == BINHEAP_NOIDX); binheap_insert(exphdl->heap, oc); assert(oc->timer_idx != BINHEAP_NOIDX); } else if (flags & OC_EF_MOVE) { assert(oc->timer_idx != BINHEAP_NOIDX); binheap_reorder(exphdl->heap, oc->timer_idx); assert(oc->timer_idx != BINHEAP_NOIDX); } else { WRONG("Objcore state wrong in inbox"); } } /*-------------------------------------------------------------------- * Expire stuff from the binheap */ static double exp_expire(struct exp_priv *ep, double now) { struct lru *lru; struct objcore *oc; CHECK_OBJ_NOTNULL(ep, EXP_PRIV_MAGIC); oc = binheap_root(ep->heap); if (oc == NULL) return (now + 355./113.); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); /* Ready ? */ if (oc->timer_when > now) return (oc->timer_when); VSC_C_main->n_expired++; lru = ObjGetLRU(oc); CHECK_OBJ_NOTNULL(lru, LRU_MAGIC); Lck_Lock(&lru->mtx); oc->exp_flags |= OC_EF_DYING; if (oc->exp_flags & OC_EF_OFFLRU) oc = NULL; else { oc->exp_flags |= OC_EF_OFFLRU; VTAILQ_REMOVE(&lru->lru_head, oc, lru_list); } Lck_Unlock(&lru->mtx); if (oc == NULL) return (now + 1e-3); // XXX ? /* Remove from binheap */ assert(oc->timer_idx != BINHEAP_NOIDX); binheap_delete(ep->heap, oc->timer_idx); assert(oc->timer_idx == BINHEAP_NOIDX); CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC); VSLb(&ep->vsl, SLT_ExpKill, "EXP_Expired x=%u t=%.0f", ObjGetXID(ep->wrk, oc), EXP_Ttl(NULL, &oc->exp) - now); exp_event(ep->wrk, oc, EXP_REMOVE); (void)HSH_DerefObjCore(ep->wrk, &oc); return (0); } /*-------------------------------------------------------------------- * This thread monitors the root of the binary heap and whenever an * object expires, accounting also for graceability, it is killed. */ static int __match_proto__(binheap_cmp_t) object_cmp(void *priv, const void *a, const void *b) { const struct objcore *aa, *bb; (void)priv; CAST_OBJ_NOTNULL(aa, a, OBJCORE_MAGIC); CAST_OBJ_NOTNULL(bb, b, OBJCORE_MAGIC); return (aa->timer_when < bb->timer_when); } static void __match_proto__(binheap_update_t) object_update(void *priv, void *p, unsigned u) { struct objcore *oc; (void)priv; CAST_OBJ_NOTNULL(oc, p, OBJCORE_MAGIC); oc->timer_idx = u; } static void * __match_proto__(bgthread_t) exp_thread(struct worker *wrk, void *priv) { struct objcore *oc; double t = 0, tnext = 0; struct exp_priv *ep; CAST_OBJ_NOTNULL(ep, priv, EXP_PRIV_MAGIC); ep->wrk = wrk; VSL_Setup(&ep->vsl, NULL, 0); ep->heap = binheap_new(NULL, object_cmp, object_update); AN(ep->heap); while (1) { Lck_Lock(&ep->mtx); 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); Pool_Sumstat(wrk); (void)Lck_CondWait(&ep->condvar, &ep->mtx, tnext); } Lck_Unlock(&ep->mtx); t = VTIM_real(); if (oc != NULL) exp_inbox(ep, oc, t); else tnext = exp_expire(ep, t); } NEEDLESS_RETURN(NULL); } /*--------------------------------------------------------------------*/ void EXP_Init(void) { struct exp_priv *ep; pthread_t pt; ALLOC_OBJ(ep, EXP_PRIV_MAGIC); AN(ep); Lck_New(&ep->mtx, lck_exp); AZ(pthread_cond_init(&ep->condvar, NULL)); VTAILQ_INIT(&ep->inbox); AZ(pthread_rwlock_init(&ep->cb_rwl, NULL)); VTAILQ_INIT(&ep->ecb_list); exphdl = ep; WRK_BgThread(&pt, "cache-timeout", exp_thread, ep); } varnish-4.1.1/bin/varnishd/cache/cache_backend_cfg.c0000644000201500234410000002607212652366721017253 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Handle configuration of backends from VCL programs. * */ #include "config.h" #include #include #include #include "cache.h" #include "vcl.h" #include "vcli.h" #include "vcli_priv.h" #include "vrt.h" #include "vtim.h" #include "cache_director.h" #include "cache_backend.h" static VTAILQ_HEAD(, backend) backends = VTAILQ_HEAD_INITIALIZER(backends); static VTAILQ_HEAD(, backend) cool_backends = VTAILQ_HEAD_INITIALIZER(cool_backends); static struct lock backends_mtx; static const char * const vbe_ah_healthy = "healthy"; static const char * const vbe_ah_sick = "sick"; static const char * const vbe_ah_probe = "probe"; static const char * const vbe_ah_deleted = "deleted"; /*-------------------------------------------------------------------- * Create a new static or dynamic director::backend instance. */ struct director * VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt) { struct backend *b; struct director *d; struct vsb *vsb; struct vcl *vcl; struct tcp_pool *tp = NULL; const struct vrt_backend_probe *vbp; int retval; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(vrt, VRT_BACKEND_MAGIC); assert(vrt->ipv4_suckaddr != NULL || vrt->ipv6_suckaddr != NULL); vcl = ctx->vcl; AN(vcl); AN(vrt->vcl_name); /* Create new backend */ ALLOC_OBJ(b, BACKEND_MAGIC); XXXAN(b); Lck_New(&b->mtx, lck_backend); #define DA(x) do { if (vrt->x != NULL) REPLACE((b->x), (vrt->x)); } while (0) #define DN(x) do { b->x = vrt->x; } while (0) VRT_BACKEND_HANDLE(); #undef DA #undef DN vsb = VSB_new_auto(); AN(vsb); VSB_printf(vsb, "%s.%s", VCL_Name(vcl), vrt->vcl_name); AZ(VSB_finish(vsb)); b->display_name = strdup(VSB_data(vsb)); AN(b->display_name); VSB_delete(vsb); b->vcl = vcl; b->healthy = 1; b->health_changed = VTIM_real(); b->admin_health = vbe_ah_probe; vbp = vrt->probe; if (vbp == NULL) vbp = VCL_DefaultProbe(vcl); Lck_Lock(&backends_mtx); VTAILQ_INSERT_TAIL(&backends, b, list); VSC_C_main->n_backend++; b->tcp_pool = VBT_Ref(vrt->ipv4_suckaddr, vrt->ipv6_suckaddr); if (vbp != NULL) { tp = VBT_Ref(vrt->ipv4_suckaddr, vrt->ipv6_suckaddr); assert(b->tcp_pool == tp); } Lck_Unlock(&backends_mtx); VBE_fill_director(b); if (vbp != NULL) VBP_Insert(b, vbp, tp); retval = VCL_AddBackend(ctx->vcl, b); if (retval == 0) return (b->director); d = b->director; VRT_delete_backend(ctx, &d); AZ(d); return (NULL); } /*-------------------------------------------------------------------- * Delete a dynamic director::backend instance. Undeleted dynamic and * static instances are GC'ed when the VCL is discarded (in cache_vcl.c) */ void VRT_delete_backend(VRT_CTX, struct director **dp) { struct director *d; struct backend *be; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(dp); d = *dp; *dp = NULL; CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CAST_OBJ_NOTNULL(be, d->priv, BACKEND_MAGIC); Lck_Lock(&be->mtx); be->admin_health = vbe_ah_deleted; be->health_changed = VTIM_real(); be->cooled = VTIM_real() + 60.; VTAILQ_REMOVE(&backends, be, list); VTAILQ_INSERT_TAIL(&cool_backends, be, list); Lck_Unlock(&be->mtx); // NB. The backend is still usable for the ongoing transactions, // this is why we don't bust the director's magic number. } /*--------------------------------------------------------------------- * These are for cross-calls with cache_vcl.c only. */ void VBE_Event(struct backend *be, enum vcl_event_e ev) { CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); if (ev == VCL_EVENT_WARM) { be->vsc = VSM_Alloc(sizeof *be->vsc, VSC_CLASS, VSC_type_vbe, be->display_name); AN(be->vsc); } if (be->probe != NULL && ev == VCL_EVENT_WARM) VBP_Control(be, 1); if (be->probe != NULL && ev == VCL_EVENT_COLD) VBP_Control(be, 0); if (ev == VCL_EVENT_COLD) { VSM_Free(be->vsc); be->vsc = NULL; } } void VBE_Delete(struct backend *be) { CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); if (be->probe != NULL) VBP_Remove(be); Lck_Lock(&backends_mtx); if (be->cooled > 0) VTAILQ_REMOVE(&cool_backends, be, list); else VTAILQ_REMOVE(&backends, be, list); VSC_C_main->n_backend--; VBT_Rel(&be->tcp_pool); Lck_Unlock(&backends_mtx); #define DA(x) do { if (be->x != NULL) free(be->x); } while (0) #define DN(x) /**/ VRT_BACKEND_HANDLE(); #undef DA #undef DN free(be->display_name); AZ(be->vsc); Lck_Delete(&be->mtx); FREE_OBJ(be); } /*--------------------------------------------------------------------- * String to admin_health */ static const char * vbe_str2adminhealth(const char *wstate) { #define FOO(x, y) if (strcasecmp(wstate, #x) == 0) return (vbe_ah_##y) FOO(healthy, healthy); FOO(sick, sick); FOO(probe, probe); FOO(auto, probe); return (NULL); #undef FOO } /*-------------------------------------------------------------------- * Test if backend is healthy and report when it last changed */ unsigned VBE_Healthy(const struct backend *backend, double *changed) { CHECK_OBJ_NOTNULL(backend, BACKEND_MAGIC); if (changed != NULL) *changed = backend->health_changed; if (backend->admin_health == vbe_ah_probe) return (backend->healthy); if (backend->admin_health == vbe_ah_sick) return (0); if (backend->admin_health == vbe_ah_deleted) return (0); if (backend->admin_health == vbe_ah_healthy) return (1); WRONG("Wrong admin health"); } /*--------------------------------------------------------------------- * A general function for finding backends and doing things with them. * * Return -1 on match-argument parse errors. * * If the call-back function returns negative, the search is terminated * and we relay that return value. * * Otherwise we return the number of matches. */ typedef int bf_func(struct cli *cli, struct backend *b, void *priv); static int backend_find(struct cli *cli, const char *matcher, bf_func *func, void *priv) { int i, found = 0; struct vsb *vsb; struct vcl *vcc = NULL; struct backend *b; VCL_Refresh(&vcc); AN(vcc); vsb = VSB_new_auto(); AN(vsb); if (matcher == NULL || *matcher == '\0' || !strcmp(matcher, "*")) { // all backends in active VCL VSB_printf(vsb, "%s.*", VCL_Name(vcc)); } else if (strchr(matcher, '.') != NULL) { // use pattern as is VSB_cat(vsb, matcher); } else { // pattern applies to active vcl VSB_printf(vsb, "%s.%s", VCL_Name(vcc), matcher); } AZ(VSB_finish(vsb)); Lck_Lock(&backends_mtx); VTAILQ_FOREACH(b, &backends, list) { if (b->admin_health == vbe_ah_deleted) continue; if (fnmatch(VSB_data(vsb), b->display_name, 0)) continue; found++; i = func(cli, b, priv); if (i < 0) { found = i; break; } } Lck_Unlock(&backends_mtx); VSB_delete(vsb); VCL_Rel(&vcc); return (found); } /*---------------------------------------------------------------------*/ static int __match_proto__() do_list(struct cli *cli, struct backend *b, void *priv) { int *probes; AN(priv); probes = priv; CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); VCLI_Out(cli, "\n%-30s", b->display_name); VCLI_Out(cli, " %-10s", b->admin_health); if (b->probe == NULL) VCLI_Out(cli, " %s", "Healthy (no probe)"); else { if (b->healthy) VCLI_Out(cli, " %s", "Healthy "); else VCLI_Out(cli, " %s", "Sick "); VBP_Status(cli, b, *probes); } /* XXX: report b->health_changed */ return (0); } static void cli_backend_list(struct cli *cli, const char * const *av, void *priv) { int probes = 0; (void)priv; ASSERT_CLI(); if (av[2] != NULL && !strcmp(av[2], "-p")) { av++; probes = 1; } else if (av[2] != NULL && av[2][0] == '-') { VCLI_Out(cli, "Invalid flags %s", av[2]); VCLI_SetResult(cli, CLIS_PARAM); return; } else if (av[3] != NULL) { VCLI_Out(cli, "Too many arguments"); VCLI_SetResult(cli, CLIS_PARAM); return; } VCLI_Out(cli, "%-30s %-10s %s", "Backend name", "Admin", "Probe"); (void)backend_find(cli, av[2], do_list, &probes); } /*---------------------------------------------------------------------*/ static int __match_proto__() do_set_health(struct cli *cli, struct backend *b, void *priv) { const char **ah; unsigned prev; (void)cli; AN(priv); ah = priv; AN(*ah); CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); prev = VBE_Healthy(b, NULL); if (b->admin_health != vbe_ah_deleted) b->admin_health = *ah; if (prev != VBE_Healthy(b, NULL)) b->health_changed = VTIM_real(); return (0); } static void cli_backend_set_health(struct cli *cli, const char * const *av, void *priv) { const char *ah; int n; (void)av; (void)priv; ASSERT_CLI(); AN(av[2]); AN(av[3]); ah = vbe_str2adminhealth(av[3]); if (ah == NULL) { VCLI_Out(cli, "Invalid state %s", av[3]); VCLI_SetResult(cli, CLIS_PARAM); return; } n = backend_find(cli, av[2], do_set_health, &ah); if (n == 0) { VCLI_Out(cli, "No Backends matches"); VCLI_SetResult(cli, CLIS_PARAM); } } /*---------------------------------------------------------------------*/ static struct cli_proto backend_cmds[] = { { "backend.list", "backend.list [-p] []", "\tList backends.", 0, 2, "", cli_backend_list }, { "backend.set_health", "backend.set_health ", "\tSet health status on the backends.", 2, 2, "", cli_backend_set_health }, { NULL } }; /*---------------------------------------------------------------------*/ void VBE_Poll(void) { struct backend *be; double now = VTIM_real(); Lck_Lock(&backends_mtx); while (1) { be = VTAILQ_FIRST(&cool_backends); if (be == NULL) break; if (be->cooled > now) break; if (be->n_conn > 0) continue; Lck_Unlock(&backends_mtx); VCL_DelBackend(be); VBE_Delete(be); Lck_Lock(&backends_mtx); } Lck_Unlock(&backends_mtx); } /*---------------------------------------------------------------------*/ void VBE_InitCfg(void) { CLI_AddFuncs(backend_cmds); Lck_New(&backends_mtx, lck_vbe); } varnish-4.1.1/bin/varnishd/cache/cache_pool.c0000644000201500234410000001371712652366721016020 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * We maintain a number of worker thread pools, to spread lock contention. * * Pools can be added on the fly, as a means to mitigate lock contention, * but can only be removed again by a restart. (XXX: we could fix that) * */ #include "config.h" #include #include #include "cache.h" #include "cache_pool.h" static pthread_t thr_pool_herder; static struct lock wstat_mtx; struct lock pool_mtx; static VTAILQ_HEAD(,pool) pools = VTAILQ_HEAD_INITIALIZER(pools); /*-------------------------------------------------------------------- * Summing of stats into global stats counters */ static void pool_sumstat(const struct dstat *src) { Lck_AssertHeld(&wstat_mtx); #define L0(n) #define L1(n) (VSC_C_main->n += src->n) #define VSC_F(n,t,l,s,f,v,d,e) L##l(n); #include "tbl/vsc_f_main.h" #undef VSC_F #undef L0 #undef L1 } void Pool_Sumstat(struct worker *wrk) { Lck_Lock(&wstat_mtx); pool_sumstat(wrk->stats); Lck_Unlock(&wstat_mtx); memset(wrk->stats, 0, sizeof *wrk->stats); } int Pool_TrySumstat(struct worker *wrk) { if (Lck_Trylock(&wstat_mtx)) return (0); pool_sumstat(wrk->stats); Lck_Unlock(&wstat_mtx); memset(wrk->stats, 0, sizeof *wrk->stats); return (1); } /*-------------------------------------------------------------------- * Facility for scheduling a task on any convenient pool. */ int Pool_Task_Any(struct pool_task *task, enum task_how how) { struct pool *pp; Lck_Lock(&pool_mtx); pp = VTAILQ_FIRST(&pools); if (pp != NULL) { VTAILQ_REMOVE(&pools, pp, list); VTAILQ_INSERT_TAIL(&pools, pp, list); } Lck_Unlock(&pool_mtx); if (pp == NULL) return (-1); // NB: When we remove pools, is there a race here ? return (Pool_Task(pp, task, how)); } /*-------------------------------------------------------------------- * Helper function to update stats for purges under lock */ void Pool_PurgeStat(unsigned nobj) { Lck_Lock(&wstat_mtx); VSC_C_main->n_purges++; VSC_C_main->n_obj_purged += nobj; Lck_Unlock(&wstat_mtx); } /*-------------------------------------------------------------------- * Special function to summ stats */ void __match_proto__(task_func_t) pool_stat_summ(struct worker *wrk, void *priv) { struct dstat *src; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(wrk->pool, POOL_MAGIC); AN(priv); src = priv; Lck_Lock(&wstat_mtx); pool_sumstat(src); Lck_Unlock(&wstat_mtx); memset(src, 0, sizeof *src); wrk->pool->b_stat = src; } /*-------------------------------------------------------------------- * Add a thread pool */ static struct pool * pool_mkpool(unsigned pool_no) { struct pool *pp; int i; ALLOC_OBJ(pp, POOL_MAGIC); if (pp == NULL) return (NULL); pp->a_stat = calloc(1, sizeof *pp->a_stat); AN(pp->a_stat); pp->b_stat = calloc(1, sizeof *pp->b_stat); AN(pp->b_stat); Lck_New(&pp->mtx, lck_wq); VTAILQ_INIT(&pp->idle_queue); for (i = 0; i < TASK_QUEUE_END; i++) VTAILQ_INIT(&pp->queues[i]); AZ(pthread_cond_init(&pp->herder_cond, NULL)); AZ(pthread_create(&pp->herder_thr, NULL, pool_herder, pp)); while (VTAILQ_EMPTY(&pp->idle_queue)) (void)usleep(10000); SES_NewPool(pp, pool_no); VCA_NewPool(pp); return (pp); } /*-------------------------------------------------------------------- * This thread adjusts the number of pools to match the parameter. * * NB: This is quite silly. The master should tell the child through * NB: CLI when parameters change and an appropriate call-out table * NB: be maintained for params which require action. */ static void * pool_poolherder(void *priv) { unsigned nwq; struct pool *pp; uint64_t u; THR_SetName("pool_herder"); (void)priv; nwq = 0; while (1) { if (nwq < cache_param->wthread_pools) { pp = pool_mkpool(nwq); if (pp != NULL) { Lck_Lock(&pool_mtx); VTAILQ_INSERT_TAIL(&pools, pp, list); Lck_Unlock(&pool_mtx); VSC_C_main->pools++; nwq++; continue; } } /* XXX: remove pools */ if (0) { Lck_Lock(&pool_mtx); pp = VTAILQ_FIRST(&pools); VTAILQ_REMOVE(&pools, pp, list); Lck_Unlock(&pool_mtx); AN(pp); MPL_Destroy(&pp->mpl_sess); MPL_Destroy(&pp->mpl_req); INCOMPL(); } (void)sleep(1); u = 0; Lck_Lock(&pool_mtx); VTAILQ_FOREACH(pp, &pools, list) u += pp->lqueue; Lck_Unlock(&pool_mtx); VSC_C_main->thread_queue_len = u; } NEEDLESS_RETURN(NULL); } /*--------------------------------------------------------------------*/ void Pool_Init(void) { Lck_New(&wstat_mtx, lck_wstat); Lck_New(&pool_mtx, lck_wq); AZ(pthread_create(&thr_pool_herder, NULL, pool_poolherder, NULL)); while (!VSC_C_main->pools) (void)usleep(10000); } varnish-4.1.1/bin/varnishd/cache/cache_backend.c0000644000201500234410000002324712652366721016435 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The director implementation for VCL backends. * */ #include "config.h" #include #include "cache.h" #include "vrt.h" #include "vtcp.h" #include "vtim.h" #include "cache_director.h" #include "cache_backend.h" #include "http1/cache_http1.h" #define FIND_TMO(tmx, dst, bo, be) \ do { \ CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); \ dst = bo->tmx; \ if (dst == 0.0) \ dst = be->tmx; \ if (dst == 0.0) \ dst = cache_param->tmx; \ } while (0) /*-------------------------------------------------------------------- * Get a connection to the backend */ static struct vbc * vbe_dir_getfd(struct worker *wrk, struct backend *bp, struct busyobj *bo) { struct vbc *vc; double tmod; char abuf1[VTCP_ADDRBUFSIZE], abuf2[VTCP_ADDRBUFSIZE]; char pbuf1[VTCP_PORTBUFSIZE], pbuf2[VTCP_PORTBUFSIZE]; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); AN(bp->vsc); if (!VBE_Healthy(bp, NULL)) { // XXX: per backend stats ? VSC_C_main->backend_unhealthy++; return (NULL); } if (bp->max_connections > 0 && bp->n_conn >= bp->max_connections) { // XXX: per backend stats ? VSC_C_main->backend_busy++; return (NULL); } AZ(bo->htc); bo->htc = WS_Alloc(bo->ws, sizeof *bo->htc); if (bo->htc == NULL) /* XXX: counter ? */ return (NULL); bo->htc->doclose = SC_NULL; FIND_TMO(connect_timeout, tmod, bo, bp); vc = VBT_Get(bp->tcp_pool, tmod, bp, wrk); if (vc == NULL) { // XXX: Per backend stats ? VSC_C_main->backend_fail++; bo->htc = NULL; return (NULL); } assert(vc->fd >= 0); AN(vc->addr); Lck_Lock(&bp->mtx); bp->n_conn++; bp->vsc->conn++; bp->vsc->req++; Lck_Unlock(&bp->mtx); VTCP_myname(vc->fd, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1); VTCP_hisname(vc->fd, abuf2, sizeof abuf2, pbuf2, sizeof pbuf2); VSLb(bo->vsl, SLT_BackendOpen, "%d %s %s %s %s %s", vc->fd, bp->display_name, abuf2, pbuf2, abuf1, pbuf1); INIT_OBJ(bo->htc, HTTP_CONN_MAGIC); bo->htc->priv = vc; bo->htc->fd = vc->fd; FIND_TMO(first_byte_timeout, bo->htc->first_byte_timeout, bo, bp); FIND_TMO(between_bytes_timeout, bo->htc->between_bytes_timeout, bo, bp); return (vc); } static unsigned __match_proto__(vdi_healthy_f) vbe_dir_healthy(const struct director *d, const struct busyobj *bo, double *changed) { struct backend *be; CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CHECK_OBJ_ORNULL(bo, BUSYOBJ_MAGIC); CAST_OBJ_NOTNULL(be, d->priv, BACKEND_MAGIC); return (VBE_Healthy(be, changed)); } static void __match_proto__(vdi_finish_f) vbe_dir_finish(const struct director *d, struct worker *wrk, struct busyobj *bo) { struct backend *bp; struct vbc *vbc; CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CAST_OBJ_NOTNULL(bp, d->priv, BACKEND_MAGIC); CHECK_OBJ_NOTNULL(bo->htc, HTTP_CONN_MAGIC); CAST_OBJ_NOTNULL(vbc, bo->htc->priv, VBC_MAGIC); bo->htc->priv = NULL; if (vbc->state != VBC_STATE_USED) VBT_Wait(wrk, vbc); if (bo->htc->doclose != SC_NULL) { VSLb(bo->vsl, SLT_BackendClose, "%d %s", vbc->fd, bp->display_name); VBT_Close(bp->tcp_pool, &vbc); Lck_Lock(&bp->mtx); } else { VSLb(bo->vsl, SLT_BackendReuse, "%d %s", vbc->fd, bp->display_name); Lck_Lock(&bp->mtx); VSC_C_main->backend_recycle++; VBT_Recycle(wrk, bp->tcp_pool, &vbc); } assert(bp->n_conn > 0); bp->n_conn--; #define ACCT(foo) bp->vsc->foo += bo->acct.foo; #include "tbl/acct_fields_bereq.h" #undef ACCT Lck_Unlock(&bp->mtx); bo->htc = NULL; } static int __match_proto__(vdi_gethdrs_f) vbe_dir_gethdrs(const struct director *d, struct worker *wrk, struct busyobj *bo) { int i, extrachance = 1; struct backend *bp; struct vbc *vbc; CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CAST_OBJ_NOTNULL(bp, d->priv, BACKEND_MAGIC); /* * Now that we know our backend, we can set a default Host: * header if one is necessary. This cannot be done in the VCL * because the backend may be chosen by a director. */ if (!http_GetHdr(bo->bereq, H_Host, NULL) && bp->hosthdr != NULL) http_PrintfHeader(bo->bereq, "Host: %s", bp->hosthdr); do { vbc = vbe_dir_getfd(wrk, bp, bo); if (vbc == NULL) { VSLb(bo->vsl, SLT_FetchError, "no backend connection"); return (-1); } AN(bo->htc); if (vbc->state != VBC_STATE_STOLEN) extrachance = 0; i = V1F_SendReq(wrk, bo, &bo->acct.bereq_hdrbytes, 0); if (vbc->state != VBC_STATE_USED) VBT_Wait(wrk, vbc); assert(vbc->state == VBC_STATE_USED); if (i == 0) i = V1F_FetchRespHdr(bo); if (i == 0) { AN(bo->htc->priv); return (0); } /* * If we recycled a backend connection, there is a finite chance * that the backend closed it before we got the bereq to it. * In that case do a single automatic retry if req.body allows. */ vbe_dir_finish(d, wrk, bo); AZ(bo->htc); if (i < 0) break; if (bo->req != NULL && bo->req->req_body_status != REQ_BODY_NONE && bo->req->req_body_status != REQ_BODY_CACHED) break; VSC_C_main->backend_retry++; } while (extrachance); return (-1); } static int __match_proto__(vdi_getbody_f) vbe_dir_getbody(const struct director *d, struct worker *wrk, struct busyobj *bo) { CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo->vfc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(bo->htc, HTTP_CONN_MAGIC); V1F_Setup_Fetch(bo->vfc, bo->htc); return (0); } static const struct suckaddr * __match_proto__(vdi_getip_f) vbe_dir_getip(const struct director *d, struct worker *wrk, struct busyobj *bo) { struct vbc *vbc; CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo->htc, HTTP_CONN_MAGIC); CAST_OBJ_NOTNULL(vbc, bo->htc->priv, VBC_MAGIC); return (vbc->addr); } /*--------------------------------------------------------------------*/ static void vbe_dir_http1pipe(const struct director *d, struct req *req, struct busyobj *bo) { int i; struct backend *bp; struct v1p_acct v1a; struct vbc *vbc; CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CAST_OBJ_NOTNULL(bp, d->priv, BACKEND_MAGIC); memset(&v1a, 0, sizeof v1a); /* This is hackish... */ v1a.req = req->acct.req_hdrbytes; req->acct.req_hdrbytes = 0; req->res_mode = RES_PIPE; vbc = vbe_dir_getfd(req->wrk, bp, bo); if (vbc == NULL) { VSLb(bo->vsl, SLT_FetchError, "no backend connection"); SES_Close(req->sp, SC_RX_TIMEOUT); } else { i = V1F_SendReq(req->wrk, bo, &v1a.bereq, 1); VSLb_ts_req(req, "Pipe", W_TIM_real(req->wrk)); if (vbc->state == VBC_STATE_STOLEN) VBT_Wait(req->wrk, vbc); if (i == 0) V1P_Process(req, vbc->fd, &v1a); VSLb_ts_req(req, "PipeSess", W_TIM_real(req->wrk)); SES_Close(req->sp, SC_TX_PIPE); bo->htc->doclose = SC_TX_PIPE; vbe_dir_finish(d, req->wrk, bo); } V1P_Charge(req, &v1a, bp->vsc); } /*--------------------------------------------------------------------*/ static void vbe_panic(const struct director *d, struct vsb *vsb) { struct backend *bp; CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CAST_OBJ_NOTNULL(bp, d->priv, BACKEND_MAGIC); VSB_printf(vsb, "display_name = %s,\n", bp->display_name); if (bp->ipv4_addr != NULL) VSB_printf(vsb, "ipv4 = %s,\n", bp->ipv4_addr); if (bp->ipv6_addr != NULL) VSB_printf(vsb, "ipv6 = %s,\n", bp->ipv6_addr); VSB_printf(vsb, "port = %s,\n", bp->port); VSB_printf(vsb, "hosthdr = %s,\n", bp->hosthdr); VSB_printf(vsb, "health=%s, admin_health=%s", bp->healthy ? "healthy" : "sick", bp->admin_health); VSB_printf(vsb, ", changed=%.1f,\n", bp->health_changed); VSB_printf(vsb, "n_conn = %u,\n", bp->n_conn); } /*--------------------------------------------------------------------*/ void VBE_fill_director(struct backend *be) { struct director *d; CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); INIT_OBJ(be->director, DIRECTOR_MAGIC); d = be->director; d->priv = be; d->name = "backend"; d->vcl_name = be->vcl_name; d->http1pipe = vbe_dir_http1pipe; d->healthy = vbe_dir_healthy; d->gethdrs = vbe_dir_gethdrs; d->getbody = vbe_dir_getbody; d->getip = vbe_dir_getip; d->finish = vbe_dir_finish; d->panic = vbe_panic; } varnish-4.1.1/bin/varnishd/cache/cache_busyobj.c0000644000201500234410000001447512652366721016526 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland * 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. * * Handle backend connections and backend request structures. * */ #include "config.h" #include #include #include "cache.h" #include "hash/hash_slinger.h" #include "cache/cache_filter.h" static struct mempool *vbopool; /*-------------------------------------------------------------------- */ void VBO_Init(void) { vbopool = MPL_New("busyobj", &cache_param->vbo_pool, &cache_param->workspace_backend); AN(vbopool); } /*-------------------------------------------------------------------- * BusyObj handling */ static struct busyobj * vbo_New(void) { struct busyobj *bo; unsigned sz; bo = MPL_Get(vbopool, &sz); XXXAN(bo); bo->magic = BUSYOBJ_MAGIC; bo->end = (char *)bo + sz; Lck_New(&bo->mtx, lck_busyobj); AZ(pthread_cond_init(&bo->cond, NULL)); return (bo); } static void vbo_Free(struct busyobj **bop) { struct busyobj *bo; AN(bop); bo = *bop; *bop = NULL; CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); AZ(bo->htc); AZ(bo->refcount); AZ(pthread_cond_destroy(&bo->cond)); Lck_Delete(&bo->mtx); MPL_Free(vbopool, bo); } struct busyobj * VBO_GetBusyObj(struct worker *wrk, const struct req *req) { struct busyobj *bo; uint16_t nhttp; unsigned sz; char *p; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); bo = vbo_New(); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); AZ(bo->refcount); bo->refcount = 1; p = (void*)(bo + 1); p = (void*)PRNDUP(p); assert(p < bo->end); nhttp = (uint16_t)cache_param->http_max_hdr; sz = HTTP_estimate(nhttp); bo->bereq0 = HTTP_create(p, nhttp); p += sz; p = (void*)PRNDUP(p); assert(p < bo->end); bo->bereq = HTTP_create(p, nhttp); p += sz; p = (void*)PRNDUP(p); assert(p < bo->end); bo->beresp = HTTP_create(p, nhttp); p += sz; p = (void*)PRNDUP(p); assert(p < bo->end); sz = cache_param->vsl_buffer; VSL_Setup(bo->vsl, p, sz); bo->vsl->wid = VXID_Get(wrk, VSL_BACKENDMARKER); p += sz; p = (void*)PRNDUP(p); assert(p < bo->end); WS_Init(bo->ws, "bo", p, bo->end - p); bo->do_stream = 1; bo->director_req = req->director_hint; bo->vcl = req->vcl; VCL_Ref(bo->vcl); bo->t_first = bo->t_prev = NAN; memcpy(bo->digest, req->digest, sizeof bo->digest); VRTPRIV_init(bo->privs); VFP_Setup(bo->vfc); return (bo); } void VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo) { struct busyobj *bo; struct objcore *oc = NULL; unsigned r; CHECK_OBJ_ORNULL(wrk, WORKER_MAGIC); AN(pbo); bo = *pbo; *pbo = NULL; CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_ORNULL(bo->fetch_objcore, OBJCORE_MAGIC); if (bo->fetch_objcore != NULL) { oc = bo->fetch_objcore; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC); Lck_Lock(&oc->objhead->mtx); assert(bo->refcount > 0); r = --bo->refcount; Lck_Unlock(&oc->objhead->mtx); } else { Lck_Lock(&bo->mtx); assert(bo->refcount > 0); r = --bo->refcount; Lck_Unlock(&bo->mtx); } if (r) return; AZ(bo->htc); AZ(bo->stale_oc); VRTPRIV_dynamic_kill(bo->privs, (uintptr_t)bo); assert(VTAILQ_EMPTY(&bo->privs->privs)); VSLb(bo->vsl, SLT_BereqAcct, "%ju %ju %ju %ju %ju %ju", (uintmax_t)bo->acct.bereq_hdrbytes, (uintmax_t)bo->acct.bereq_bodybytes, (uintmax_t)(bo->acct.bereq_hdrbytes + bo->acct.bereq_bodybytes), (uintmax_t)bo->acct.beresp_hdrbytes, (uintmax_t)bo->acct.beresp_bodybytes, (uintmax_t)(bo->acct.beresp_hdrbytes + bo->acct.beresp_bodybytes)); VSL_End(bo->vsl); AZ(bo->htc); if (bo->fetch_objcore != NULL) { AN(wrk); (void)HSH_DerefObjCore(wrk, &bo->fetch_objcore); } VCL_Rel(&bo->vcl); if (bo->vary != NULL) free(bo->vary); memset(&bo->refcount, 0, sizeof *bo - offsetof(struct busyobj, refcount)); vbo_Free(&bo); } void VBO_extend(struct busyobj *bo, ssize_t l) { CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo->vfc, VFP_CTX_MAGIC); if (l == 0) return; assert(l > 0); Lck_Lock(&bo->mtx); ObjExtend(bo->wrk, bo->vfc->oc, l); AZ(pthread_cond_broadcast(&bo->cond)); Lck_Unlock(&bo->mtx); } ssize_t VBO_waitlen(struct worker *wrk, struct busyobj *bo, ssize_t l) { ssize_t rv; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); Lck_Lock(&bo->mtx); rv = ObjGetLen(wrk, bo->fetch_objcore); while (1) { assert(l <= rv || bo->state == BOS_FAILED); if (rv > l || bo->state >= BOS_FINISHED) break; (void)Lck_CondWait(&bo->cond, &bo->mtx, 0); rv = ObjGetLen(wrk, bo->fetch_objcore); } Lck_Unlock(&bo->mtx); return (rv); } void VBO_setstate(struct busyobj *bo, enum busyobj_state_e next) { CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); assert(bo->do_stream || next != BOS_STREAM); assert(next > bo->state); Lck_Lock(&bo->mtx); bo->state = next; AZ(pthread_cond_broadcast(&bo->cond)); Lck_Unlock(&bo->mtx); } void VBO_waitstate(struct busyobj *bo, enum busyobj_state_e want) { Lck_Lock(&bo->mtx); while (1) { if (bo->state >= want) break; (void)Lck_CondWait(&bo->cond, &bo->mtx, 0); } Lck_Unlock(&bo->mtx); } varnish-4.1.1/bin/varnishd/cache/cache_req_fsm.c0000644000201500234410000005465212652366721016506 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This file contains the request-handling state engine, which is intended to * (over time) be(ome) protocol agnostic. * We already use this now with ESI:includes, which are for all relevant * purposes a different "protocol" * * A special complication is the fact that we can suspend processing of * a request when hash-lookup finds a busy objhdr. * */ #include "config.h" #include "cache.h" #include "cache_director.h" #include "cache_filter.h" #include "hash/hash_slinger.h" #include "vcl.h" #include "vsha256.h" #include "vtim.h" static void cnt_vdp(struct req *req, struct busyobj *bo) { const char *r; uint16_t status; int sendbody; intmax_t resp_len; CHECK_OBJ_NOTNULL(req->transport, TRANSPORT_MAGIC); resp_len = http_GetContentLength(req->resp); if (bo != NULL) req->resp_len = resp_len; else req->resp_len = ObjGetLen(req->wrk, req->objcore); req->res_mode = 0; /* RFC 7230, 3.3.3 */ status = http_GetStatus(req->resp); if (!strcmp(req->http0->hd[HTTP_HDR_METHOD].b, "HEAD")) { if (req->objcore->flags & OC_F_PASS) sendbody = -1; else sendbody = 0; } else if (status < 200 || status == 204 || status == 304) { req->resp_len = -1; sendbody = 0; } else sendbody = 1; if (!req->disable_esi && req->resp_len != 0 && ObjGetattr(req->wrk, req->objcore, OA_ESIDATA, NULL) != NULL) VDP_push(req, VDP_ESI, NULL, 0); if (cache_param->http_gzip_support && ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED) && !RFC2616_Req_Gzip(req->http)) VDP_push(req, VDP_gunzip, NULL, 1); if (cache_param->http_range_support && http_IsStatus(req->resp, 200)) { http_SetHeader(req->resp, "Accept-Ranges: bytes"); if (sendbody && http_GetHdr(req->http, H_Range, &r)) VRG_dorange(req, r); } if (sendbody < 0) { /* Don't touch pass+HEAD C-L */ sendbody = 0; } else if (resp_len >= 0 && resp_len == req->resp_len) { /* Reuse C-L header */ } else { http_Unset(req->resp, H_Content_Length); if (req->resp_len >= 0 && sendbody) http_PrintfHeader(req->resp, "Content-Length: %jd", req->resp_len); } req->transport->deliver(req, bo, sendbody); } /*-------------------------------------------------------------------- * Deliver an object to client */ static enum req_fsm_nxt cnt_deliver(struct worker *wrk, struct req *req) { struct busyobj *bo; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(req->objcore->objhead, OBJHEAD_MAGIC); AN(req->vcl); assert(req->objcore->refcnt > 0); if (req->objcore->exp_flags & OC_EF_EXP) EXP_Touch(req->objcore, req->t_prev); HTTP_Setup(req->resp, req->ws, req->vsl, SLT_RespMethod); if (HTTP_Decode(req->resp, ObjGetattr(req->wrk, req->objcore, OA_HEADERS, NULL))) { req->err_code = 500; req->req_step = R_STP_SYNTH; return (REQ_FSM_MORE); } http_ForceField(req->resp, HTTP_HDR_PROTO, "HTTP/1.1"); if (req->is_hit) http_PrintfHeader(req->resp, "X-Varnish: %u %u", VXID(req->vsl->wid), ObjGetXID(wrk, req->objcore)); else http_PrintfHeader(req->resp, "X-Varnish: %u", VXID(req->vsl->wid)); /* * We base Age calculation upon the last timestamp taken during * client request processing. This gives some inaccuracy, but * since Age is only full second resolution that shouldn't * matter. (Last request timestamp could be a Start timestamp * taken before the object entered into cache leading to negative * age. Truncate to zero in that case). */ http_PrintfHeader(req->resp, "Age: %.0f", fmax(0., req->t_prev - req->objcore->exp.t_origin)); http_SetHeader(req->resp, "Via: 1.1 varnish-v4"); if (cache_param->http_gzip_support && ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED) && !RFC2616_Req_Gzip(req->http)) RFC2616_Weaken_Etag(req->resp); VCL_deliver_method(req->vcl, wrk, req, NULL, NULL); VSLb_ts_req(req, "Process", W_TIM_real(wrk)); /* Stop the insanity before it turns "Hotel California" on us */ if (req->restarts >= cache_param->max_restarts) wrk->handling = VCL_RET_DELIVER; if (wrk->handling != VCL_RET_DELIVER) { (void)HSH_DerefObjCore(wrk, &req->objcore); http_Teardown(req->resp); switch (wrk->handling) { case VCL_RET_RESTART: req->req_step = R_STP_RESTART; break; case VCL_RET_SYNTH: req->req_step = R_STP_SYNTH; break; default: INCOMPL(); } return (REQ_FSM_MORE); } assert(wrk->handling == VCL_RET_DELIVER); if (!(req->objcore->flags & OC_F_PASS) && req->esi_level == 0 && http_IsStatus(req->resp, 200) && req->http->conds && RFC2616_Do_Cond(req)) http_PutResponse(req->resp, "HTTP/1.1", 304, NULL); /* Grab a ref to the bo if there is one, and hand it down */ bo = HSH_RefBusy(req->objcore); if (bo != NULL) { if (req->esi_level == 0 && bo->state == BOS_FINISHED) { VBO_DerefBusyObj(wrk, &bo); } else if (!bo->do_stream) { VBO_waitstate(bo, BOS_FINISHED); VBO_DerefBusyObj(wrk, &bo); } } cnt_vdp(req, bo); VSLb_ts_req(req, "Resp", W_TIM_real(wrk)); if (http_HdrIs(req->resp, H_Connection, "close")) req->doclose = SC_RESP_CLOSE; if (req->objcore->flags & (OC_F_PRIVATE | OC_F_PASS)) { if (bo != NULL) VBO_waitstate(bo, BOS_FINISHED); ObjSlim(wrk, req->objcore); } if (bo != NULL) VBO_DerefBusyObj(wrk, &bo); (void)HSH_DerefObjCore(wrk, &req->objcore); http_Teardown(req->resp); return (REQ_FSM_DONE); } /*-------------------------------------------------------------------- * Emit a synthetic response */ static enum req_fsm_nxt cnt_synth(struct worker *wrk, struct req *req) { struct http *h; double now; struct vsb *synth_body; ssize_t sz, szl; uint8_t *ptr; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); wrk->stats->s_synth++; now = W_TIM_real(wrk); VSLb_ts_req(req, "Process", now); if (req->err_code < 100 || req->err_code > 999) req->err_code = 501; HTTP_Setup(req->resp, req->ws, req->vsl, SLT_RespMethod); h = req->resp; http_TimeHeader(h, "Date: ", now); http_SetHeader(h, "Server: Varnish"); http_PrintfHeader(req->resp, "X-Varnish: %u", VXID(req->vsl->wid)); http_PutResponse(h, "HTTP/1.1", req->err_code, req->err_reason); synth_body = VSB_new_auto(); AN(synth_body); VCL_synth_method(req->vcl, wrk, req, NULL, synth_body); AZ(VSB_finish(synth_body)); http_Unset(h, H_Content_Length); http_PrintfHeader(req->resp, "Content-Length: %zd", VSB_len(synth_body)); /* Discard any lingering request body before delivery */ (void)VRB_Ignore(req); if (wrk->handling == VCL_RET_RESTART) { HTTP_Setup(h, req->ws, req->vsl, SLT_RespMethod); VSB_delete(synth_body); req->req_step = R_STP_RESTART; return (REQ_FSM_MORE); } assert(wrk->handling == VCL_RET_DELIVER); if (http_HdrIs(req->resp, H_Connection, "close")) req->doclose = SC_RESP_CLOSE; req->objcore = HSH_Private(wrk); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); if (STV_NewObject(req->objcore, wrk, TRANSIENT_STORAGE, 1024)) { szl = VSB_len(synth_body); assert(szl >= 0); } else szl = -1; if (szl > 0) { sz = szl; if (ObjGetSpace(wrk, req->objcore, &sz, &ptr) && sz >= szl) { memcpy(ptr, VSB_data(synth_body), szl); ObjExtend(wrk, req->objcore, szl); } else szl = -1; } if (szl < 0) { VSLb(req->vsl, SLT_Error, "Could not get storage"); req->doclose = SC_OVERLOAD; } else cnt_vdp(req, NULL); (void)HSH_DerefObjCore(wrk, &req->objcore); VSB_delete(synth_body); VSLb_ts_req(req, "Resp", W_TIM_real(wrk)); req->err_code = 0; req->err_reason = NULL; return (REQ_FSM_DONE); } /*-------------------------------------------------------------------- * Initiated a fetch (pass/miss) which we intend to deliver */ static enum req_fsm_nxt cnt_fetch(struct worker *wrk, struct req *req) { CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); wrk->stats->s_fetch++; (void)VRB_Ignore(req); if (req->objcore->flags & OC_F_FAILED) { req->err_code = 503; req->req_step = R_STP_SYNTH; (void)HSH_DerefObjCore(wrk, &req->objcore); AZ(req->objcore); return (REQ_FSM_MORE); } req->req_step = R_STP_DELIVER; return (REQ_FSM_MORE); } /*-------------------------------------------------------------------- * Attempt to lookup objhdr from hash. We disembark and reenter * this state if we get suspended on a busy objhdr. */ static enum req_fsm_nxt cnt_lookup(struct worker *wrk, struct req *req) { struct objcore *oc, *boc; enum lookup_e lr; int had_objhead = 0; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); AZ(req->objcore); AN(req->vcl); VRY_Prep(req); AZ(req->objcore); if (req->hash_objhead) had_objhead = 1; lr = HSH_Lookup(req, &oc, &boc, req->esi_level == 0 ? 1 : 0, req->hash_always_miss ? 1 : 0 ); if (lr == HSH_BUSY) { /* * We lost the session to a busy object, disembark the * worker thread. We return to STP_LOOKUP when the busy * object has been unbusied, and still have the objhead * around to restart the lookup with. */ return (REQ_FSM_DISEMBARK); } if (had_objhead) VSLb_ts_req(req, "Waitinglist", W_TIM_real(wrk)); if (boc == NULL) { VRY_Finish(req, DISCARD); } else { AN(boc->flags & OC_F_BUSY); VRY_Finish(req, KEEP); } AZ(req->objcore); if (lr == HSH_MISS) { /* Found nothing */ AZ(oc); AN(boc); AN(boc->flags & OC_F_BUSY); req->objcore = boc; req->req_step = R_STP_MISS; return (REQ_FSM_MORE); } CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AZ(oc->flags & OC_F_BUSY); req->objcore = oc; if ((oc->flags & OC_F_PASS) && boc != NULL) { /* Treat a graced Hit-For-Pass as a miss */ req->objcore = boc; req->stale_oc = oc; req->req_step = R_STP_MISS; return (REQ_FSM_MORE); } else if (oc->flags & OC_F_PASS) { /* Found a hit-for-pass */ VSLb(req->vsl, SLT_Debug, "XXXX HIT-FOR-PASS"); VSLb(req->vsl, SLT_HitPass, "%u", ObjGetXID(wrk, req->objcore)); (void)HSH_DerefObjCore(wrk, &req->objcore); wrk->stats->cache_hitpass++; req->req_step = R_STP_PASS; return (REQ_FSM_MORE); } VSLb(req->vsl, SLT_Hit, "%u", ObjGetXID(wrk, req->objcore)); VCL_hit_method(req->vcl, wrk, req, NULL, NULL); switch (wrk->handling) { case VCL_RET_DELIVER: if (boc != NULL) { AZ(oc->flags & OC_F_PASS); AZ(boc->busyobj); VBF_Fetch(wrk, req, boc, oc, VBF_BACKGROUND); } else { (void)VRB_Ignore(req);// XXX: handle err } wrk->stats->cache_hit++; req->is_hit = 1; req->req_step = R_STP_DELIVER; return (REQ_FSM_MORE); case VCL_RET_FETCH: VSLb(req->vsl, SLT_VCL_Error, "change return(fetch) to return(miss) in vcl_hit{}"); /* FALL-THROUGH */ case VCL_RET_MISS: if (boc != NULL) { req->objcore = boc; req->stale_oc = oc; req->req_step = R_STP_MISS; } else { (void)HSH_DerefObjCore(wrk, &req->objcore); /* * We don't have a busy object, so treat this * like a pass */ VSLb(req->vsl, SLT_VCL_Error, "vcl_hit{} returns miss without busy object." " Doing pass."); req->req_step = R_STP_PASS; } return (REQ_FSM_MORE); case VCL_RET_RESTART: req->req_step = R_STP_RESTART; break; case VCL_RET_SYNTH: req->req_step = R_STP_SYNTH; break; case VCL_RET_PASS: wrk->stats->cache_hit++; req->is_hit = 1; req->req_step = R_STP_PASS; break; default: INCOMPL(); } /* Drop our object, we won't need it */ (void)HSH_DerefObjCore(wrk, &req->objcore); if (boc != NULL) { (void)HSH_DerefObjCore(wrk, &boc); VRY_Clear(req); } return (REQ_FSM_MORE); } /*-------------------------------------------------------------------- * Cache miss. */ static enum req_fsm_nxt cnt_miss(struct worker *wrk, struct req *req) { CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); AN(req->vcl); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); VCL_miss_method(req->vcl, wrk, req, NULL, NULL); switch (wrk->handling) { case VCL_RET_FETCH: wrk->stats->cache_miss++; VBF_Fetch(wrk, req, req->objcore, req->stale_oc, VBF_NORMAL); if (req->stale_oc != NULL) (void)HSH_DerefObjCore(wrk, &req->stale_oc); req->req_step = R_STP_FETCH; return (REQ_FSM_MORE); case VCL_RET_SYNTH: req->req_step = R_STP_SYNTH; break; case VCL_RET_RESTART: req->req_step = R_STP_RESTART; break; case VCL_RET_PASS: req->req_step = R_STP_PASS; break; default: WRONG("Illegal return from vcl_miss{}"); } VRY_Clear(req); if (req->stale_oc != NULL) (void)HSH_DerefObjCore(wrk, &req->stale_oc); AZ(HSH_DerefObjCore(wrk, &req->objcore)); return (REQ_FSM_MORE); } /*-------------------------------------------------------------------- * Pass processing */ static enum req_fsm_nxt cnt_pass(struct worker *wrk, struct req *req) { CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); AN(req->vcl); AZ(req->objcore); VCL_pass_method(req->vcl, wrk, req, NULL, NULL); switch (wrk->handling) { case VCL_RET_SYNTH: req->req_step = R_STP_SYNTH; break; case VCL_RET_RESTART: req->req_step = R_STP_RESTART; break; case VCL_RET_FETCH: wrk->stats->s_pass++; req->objcore = HSH_Private(wrk); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); VBF_Fetch(wrk, req, req->objcore, NULL, VBF_PASS); req->req_step = R_STP_FETCH; break; default: WRONG("Illegal return from cnt_pass{}"); } return (REQ_FSM_MORE); } /*-------------------------------------------------------------------- * Pipe mode */ static enum req_fsm_nxt cnt_pipe(struct worker *wrk, struct req *req) { struct busyobj *bo; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); AN(req->vcl); wrk->stats->s_pipe++; bo = VBO_GetBusyObj(wrk, req); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); VSLb(bo->vsl, SLT_Begin, "bereq %u pipe", VXID(req->vsl->wid)); VSLb(req->vsl, SLT_Link, "bereq %u pipe", VXID(bo->vsl->wid)); THR_SetBusyobj(bo); 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", VXID(req->vsl->wid)); http_SetHeader(bo->bereq, "Connection: close"); VCL_pipe_method(req->vcl, wrk, req, bo, NULL); if (wrk->handling == VCL_RET_SYNTH) INCOMPL(); assert(wrk->handling == VCL_RET_PIPE); if (VDI_Http1Pipe(req, bo) < 0) VSLb(bo->vsl, SLT_VCL_Error, "Backend does not support pipe"); http_Teardown(bo->bereq); VBO_DerefBusyObj(wrk, &bo); THR_SetBusyobj(NULL); return (REQ_FSM_DONE); } /*-------------------------------------------------------------------- * Handle restart events */ static enum req_fsm_nxt cnt_restart(struct worker *wrk, struct req *req) { CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); req->director_hint = 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_SYNTH; } else { // XXX: ReqEnd + ReqAcct ? VSLb_ts_req(req, "Restart", W_TIM_real(wrk)); VSL_ChgId(req->vsl, "req", "restart", VXID_Get(wrk, VSL_CLIENTMARKER)); VSLb_ts_req(req, "Start", req->t_prev); req->err_code = 0; req->req_step = R_STP_RECV; } req->is_hit = 0; return (REQ_FSM_MORE); } /*-------------------------------------------------------------------- * We have a complete request, set everything up and start it. * We can come here both with a request from the client and with * a interior request during ESI delivery. */ static enum req_fsm_nxt cnt_recv(struct worker *wrk, struct req *req) { unsigned recv_handling; struct SHA256Context sha256ctx; const char *xff; char *ci, *cp; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); AN(req->vcl); AZ(req->objcore); AZ(req->err_code); AZ(isnan(req->t_first)); AZ(isnan(req->t_prev)); AZ(isnan(req->t_req)); AZ(SES_Get_client_ip(req->sp, &ci)); AZ(SES_Get_client_port(req->sp, &cp)); VSLb(req->vsl, SLT_ReqStart, "%s %s", ci, cp); http_VSL_log(req->http); if (req->restarts == 0) { /* * This really should be done earlier, but we want to capture * it in the VSL log. */ http_CollectHdr(req->http, H_X_Forwarded_For); if (http_GetHdr(req->http, H_X_Forwarded_For, &xff)) { http_Unset(req->http, H_X_Forwarded_For); http_PrintfHeader(req->http, "X-Forwarded-For: %s, %s", xff, ci); } else { http_PrintfHeader(req->http, "X-Forwarded-For: %s", ci); } } /* By default we use the first backend */ AZ(req->director_hint); req->director_hint = VCL_DefaultDirector(req->vcl); AN(req->director_hint); req->d_ttl = -1; req->disable_esi = 0; req->hash_always_miss = 0; req->hash_ignore_busy = 0; req->client_identity = NULL; http_CollectHdr(req->http, H_Cache_Control); VCL_recv_method(req->vcl, wrk, req, NULL, NULL); /* Attempts to cache req.body may fail */ if (req->req_body_status == REQ_BODY_FAIL) { req->doclose = SC_RX_BODY; return (REQ_FSM_DONE); } 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_ForceHeader(req->http, H_Accept_Encoding, "gzip"); } else { http_Unset(req->http, H_Accept_Encoding); } } SHA256_Init(&sha256ctx); VCL_hash_method(req->vcl, wrk, req, NULL, &sha256ctx); assert(wrk->handling == VCL_RET_LOOKUP); SHA256_Final(req->digest, &sha256ctx); switch(recv_handling) { case VCL_RET_PURGE: req->req_step = R_STP_PURGE; return (REQ_FSM_MORE); case VCL_RET_HASH: req->req_step = R_STP_LOOKUP; return (REQ_FSM_MORE); case VCL_RET_PIPE: if (req->esi_level == 0) { req->req_step = R_STP_PIPE; return (REQ_FSM_MORE); } VSLb(req->vsl, SLT_VCL_Error, "vcl_recv{} returns pipe for ESI included object." " Doing pass."); req->req_step = R_STP_PASS; return (REQ_FSM_DONE); case VCL_RET_PASS: req->req_step = R_STP_PASS; return (REQ_FSM_MORE); case VCL_RET_SYNTH: req->req_step = R_STP_SYNTH; return (REQ_FSM_MORE); default: WRONG("Illegal return from vcl_recv{}"); } } /*-------------------------------------------------------------------- * Find the objhead, purge it. * * XXX: We should ask VCL if we should fetch a new copy of the object. */ static enum req_fsm_nxt cnt_purge(struct worker *wrk, struct req *req) { struct objcore *oc, *boc; enum lookup_e lr; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); AZ(req->objcore); AN(req->vcl); VRY_Prep(req); AZ(req->objcore); lr = HSH_Lookup(req, &oc, &boc, 1, 1); assert (lr == HSH_MISS); AZ(oc); CHECK_OBJ_NOTNULL(boc, OBJCORE_MAGIC); VRY_Finish(req, DISCARD); HSH_Purge(wrk, boc->objhead, 0, 0, 0); AZ(HSH_DerefObjCore(wrk, &boc)); VCL_purge_method(req->vcl, wrk, req, NULL, NULL); switch (wrk->handling) { case VCL_RET_RESTART: req->req_step = R_STP_RESTART; break; case VCL_RET_SYNTH: req->req_step = R_STP_SYNTH; break; default: WRONG("Illegal return from vcl_purge{}"); } return (REQ_FSM_MORE); } /*-------------------------------------------------------------------- * Central state engine dispatcher. * * Kick the session around until it has had enough. * */ static void cnt_diag(struct req *req, const char *state) { CHECK_OBJ_NOTNULL(req, REQ_MAGIC); VSLb(req->vsl, SLT_Debug, "vxid %u STP_%s sp %p vcl %p", req->vsl->wid, state, req->sp, req->vcl); VSL_Flush(req->vsl, 0); } enum req_fsm_nxt CNT_Request(struct worker *wrk, struct req *req) { enum req_fsm_nxt nxt; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); /* * Possible entrance states */ assert( req->req_step == R_STP_LOOKUP || req->req_step == R_STP_RECV); AN(req->vsl->wid & VSL_CLIENTMARKER); req->wrk = wrk; wrk->vsl = req->vsl; for (nxt = REQ_FSM_MORE; nxt == REQ_FSM_MORE; ) { /* * This is a good place to be paranoid about the various * pointers still pointing to the things we expect. */ CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_ORNULL(wrk->nobjhead, OBJHEAD_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); /* * We don't want the thread workspace to be used for * anything of long duration, so mandate that it be * empty on state-transitions. */ WS_Assert(wrk->aws); assert(wrk->aws->s == wrk->aws->f); switch (req->req_step) { #define REQ_STEP(l,u,arg) \ case R_STP_##u: \ if (DO_DEBUG(DBG_REQ_STATE)) \ cnt_diag(req, #u); \ nxt = cnt_##l arg; \ break; #include "tbl/steps.h" #undef REQ_STEP default: WRONG("State engine misfire"); } WS_Assert(wrk->aws); CHECK_OBJ_ORNULL(wrk->nobjhead, OBJHEAD_MAGIC); } wrk->vsl = NULL; if (nxt == REQ_FSM_DONE) { AN(req->vsl->wid); VRB_Free(req); req->wrk = NULL; } return (nxt); } void CNT_AcctLogCharge(struct dstat *ds, struct req *req) { struct acct_req *a; AN(ds); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); a = &req->acct; if (req->vsl->wid && !(req->res_mode & RES_PIPE)) { VSLb(req->vsl, SLT_ReqAcct, "%ju %ju %ju %ju %ju %ju", (uintmax_t)a->req_hdrbytes, (uintmax_t)a->req_bodybytes, (uintmax_t)(a->req_hdrbytes + a->req_bodybytes), (uintmax_t)a->resp_hdrbytes, (uintmax_t)a->resp_bodybytes, (uintmax_t)(a->resp_hdrbytes + a->resp_bodybytes)); } #define ACCT(foo) \ ds->s_##foo += a->foo; \ a->foo = 0; #include "tbl/acct_fields_req.h" #undef ACCT } varnish-4.1.1/bin/varnishd/cache/cache_ban_build.c0000644000201500234410000001743112652366721016763 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "config.h" #include #include "cache.h" #include "cache_ban.h" #include "vend.h" #include "vtim.h" struct ban_proto { unsigned magic; #define BAN_PROTO_MAGIC 0xd8adc494 unsigned flags; /* BANS_FLAG_* */ struct vsb *vsb; char *err; }; /*-------------------------------------------------------------------- * Variables we can purge on */ static const struct pvar { const char *name; unsigned flag; uint8_t tag; } pvars[] = { #define PVAR(a, b, c) { (a), (b), (c) }, #include "tbl/ban_vars.h" #undef PVAR { 0, 0, 0} }; /*-------------------------------------------------------------------- */ static char ban_build_err_no_mem[] = "No Memory"; /*-------------------------------------------------------------------- */ struct ban_proto * BAN_Build(void) { struct ban_proto *bp; ALLOC_OBJ(bp, BAN_PROTO_MAGIC); if (bp == NULL) return (bp); bp->vsb = VSB_new_auto(); if (bp->vsb == NULL) { FREE_OBJ(bp); return (NULL); } return (bp); } void BAN_Abandon(struct ban_proto *bp) { CHECK_OBJ_NOTNULL(bp, BAN_PROTO_MAGIC); VSB_delete(bp->vsb); FREE_OBJ(bp); } /*-------------------------------------------------------------------- */ static void ban_add_lump(const struct ban_proto *bp, const void *p, uint32_t len) { uint8_t buf[sizeof len]; buf[0] = 0xff; while (VSB_len(bp->vsb) & PALGN) VSB_putc(bp->vsb, buf[0]); vbe32enc(buf, len); VSB_bcat(bp->vsb, buf, sizeof buf); VSB_bcat(bp->vsb, p, len); } /*-------------------------------------------------------------------- */ static const char * ban_error(struct ban_proto *bp, const char *fmt, ...) { va_list ap; CHECK_OBJ_NOTNULL(bp, BAN_PROTO_MAGIC); AN(bp->vsb); /* First error is sticky */ if (bp->err == NULL) { if (fmt == ban_build_err_no_mem) { bp->err = ban_build_err_no_mem; } else { /* Record the error message in the vsb */ VSB_clear(bp->vsb); va_start(ap, fmt); (void)VSB_vprintf(bp->vsb, fmt, ap); va_end(ap); AZ(VSB_finish(bp->vsb)); bp->err = VSB_data(bp->vsb); } } return (bp->err); } /*-------------------------------------------------------------------- * Parse and add a http argument specification * Output something which HTTP_GetHdr understands */ static void ban_parse_http(const struct ban_proto *bp, const char *a1) { int l; l = strlen(a1) + 1; assert(l <= 127); VSB_putc(bp->vsb, (char)l); VSB_cat(bp->vsb, a1); VSB_putc(bp->vsb, ':'); VSB_putc(bp->vsb, '\0'); } /*-------------------------------------------------------------------- * Parse and add a ban test specification */ static const char * ban_parse_regexp(struct ban_proto *bp, const char *a3) { const char *error; int erroroffset, rc; size_t sz; pcre *re; re = pcre_compile(a3, 0, &error, &erroroffset, NULL); if (re == NULL) return (ban_error(bp, "Regex compile error: %s", error)); rc = pcre_fullinfo(re, NULL, PCRE_INFO_SIZE, &sz); AZ(rc); ban_add_lump(bp, re, sz); pcre_free(re); return (0); } /*-------------------------------------------------------------------- * Add a (and'ed) test-condition to a ban */ const char * BAN_AddTest(struct ban_proto *bp, const char *a1, const char *a2, const char *a3) { const struct pvar *pv; const char *err; CHECK_OBJ_NOTNULL(bp, BAN_PROTO_MAGIC); AN(bp->vsb); AN(a1); AN(a2); AN(a3); if (bp->err != NULL) return (bp->err); for (pv = pvars; pv->name != NULL; pv++) if (!strncmp(a1, pv->name, strlen(pv->name))) break; if (pv->name == NULL) return (ban_error(bp, "Unknown or unsupported field \"%s\"", a1)); bp->flags |= pv->flag; VSB_putc(bp->vsb, pv->tag); if (pv->flag & BANS_FLAG_HTTP) ban_parse_http(bp, a1 + strlen(pv->name)); ban_add_lump(bp, a3, strlen(a3) + 1); if (!strcmp(a2, "~")) { VSB_putc(bp->vsb, BANS_OPER_MATCH); err = ban_parse_regexp(bp, a3); if (err) return (err); } else if (!strcmp(a2, "!~")) { VSB_putc(bp->vsb, BANS_OPER_NMATCH); err = ban_parse_regexp(bp, a3); if (err) return (err); } else if (!strcmp(a2, "==")) { VSB_putc(bp->vsb, BANS_OPER_EQ); } else if (!strcmp(a2, "!=")) { VSB_putc(bp->vsb, BANS_OPER_NEQ); } else { return (ban_error(bp, "expected conditional (~, !~, == or !=) got \"%s\"", a2)); } return (NULL); } /*-------------------------------------------------------------------- * We maintain ban_start as a pointer to the first element of the list * as a separate variable from the VTAILQ, to avoid depending on the * internals of the VTAILQ macros. We tacitly assume that a pointer * write is always atomic in doing so. * * Returns: * 0: Ban successfully inserted * -1: Ban not inserted due to shutdown in progress. The ban has been * deleted. */ const char * BAN_Commit(struct ban_proto *bp) { struct ban *b, *bi; ssize_t ln; double t0; CHECK_OBJ_NOTNULL(bp, BAN_PROTO_MAGIC); AN(bp->vsb); if (ban_shutdown) return (ban_error(bp, "Shutting down")); AZ(VSB_finish(bp->vsb)); ln = VSB_len(bp->vsb); assert(ln >= 0); ALLOC_OBJ(b, BAN_MAGIC); if (b == NULL) return (ban_error(bp, ban_build_err_no_mem)); VTAILQ_INIT(&b->objcore); b->spec = malloc(ln + BANS_HEAD_LEN); if (b->spec == NULL) { free(b); return (ban_error(bp, ban_build_err_no_mem)); } b->flags = bp->flags; memset(b->spec, 0, BANS_HEAD_LEN); t0 = VTIM_real(); memcpy(b->spec + BANS_TIMESTAMP, &t0, sizeof t0); b->spec[BANS_FLAGS] = b->flags & 0xff; memcpy(b->spec + BANS_HEAD_LEN, VSB_data(bp->vsb), ln); ln += BANS_HEAD_LEN; vbe32enc(b->spec + BANS_LENGTH, ln); Lck_Lock(&ban_mtx); if (ban_shutdown) { /* We could have raced a shutdown */ Lck_Unlock(&ban_mtx); BAN_Free(b); return (ban_error(bp, "Shutting down")); } bi = VTAILQ_FIRST(&ban_head); VTAILQ_INSERT_HEAD(&ban_head, b, list); ban_start = b; VSC_C_main->bans++; VSC_C_main->bans_added++; VSC_C_main->bans_persisted_bytes += ln; if (b->flags & BANS_FLAG_OBJ) VSC_C_main->bans_obj++; if (b->flags & BANS_FLAG_REQ) VSC_C_main->bans_req++; if (bi != NULL) ban_info(BI_NEW, b->spec, ln); /* Notify stevedores */ if (cache_param->ban_dups) { /* Hunt down duplicates, and mark them as completed */ for (bi = VTAILQ_NEXT(b, list); bi != NULL; bi = VTAILQ_NEXT(bi, list)) { if (!(bi->flags & BANS_FLAG_COMPLETED) && ban_equal(b->spec, bi->spec)) { ban_mark_completed(bi); VSC_C_main->bans_dups++; } } } if (!(b->flags & BANS_FLAG_REQ)) ban_kick_lurker(); Lck_Unlock(&ban_mtx); BAN_Abandon(bp); return (NULL); } varnish-4.1.1/bin/varnishd/cache/cache_vary.c0000644000201500234410000002151112652366721016017 00000000000000/*- * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Do Vary processing. * * When we insert an object into the cache which has a Vary: header, * we encode a vary matching string containing the headers mentioned * and their value. * * When we match an object in the cache, we check the present request * against the vary matching string. * * The only kind of header-munging we do is leading & trailing space * removal. All the potential "q=foo" gymnastics is not worth the * effort. * * The vary matching string has the following format: * * Sequence of: { * \ Length of header contents. * / * \ *
\ Same format as argument to http_GetHdr() * ':' / * '\0' / *
> Only present if length != 0xffff * } * 0xff, \ Length field * 0xff, / * '\0' > Terminator */ #include "config.h" #include #include "cache.h" #include "vct.h" #include "vend.h" static unsigned VRY_Validate(const uint8_t *vary); /********************************************************************** * Create a Vary matching string from a Vary header * * Return value: * <0: Parse error * 0: No Vary header on object * >0: Length of Vary matching string in *psb */ int VRY_Create(struct busyobj *bo, struct vsb **psb) { const char *v, *p, *q, *h, *e; struct vsb *sb, *sbh; unsigned l; int error = 0; CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo->bereq, HTTP_MAGIC); CHECK_OBJ_NOTNULL(bo->beresp, HTTP_MAGIC); AN(psb); AZ(*psb); /* No Vary: header, no worries */ if (!http_GetHdr(bo->beresp, H_Vary, &v)) return (0); /* For vary matching string */ sb = VSB_new_auto(); AN(sb); /* For header matching strings */ sbh = VSB_new_auto(); AN(sbh); for (p = v; *p; p++) { /* Find next header-name */ if (vct_issp(*p)) continue; for (q = p; *q && !vct_issp(*q) && *q != ','; q++) continue; if (q - p > INT8_MAX) { VSLb(bo->vsl, SLT_Error, "Vary header name length exceeded"); error = 1; break; } /* Build a header-matching string out of it */ VSB_clear(sbh); VSB_printf(sbh, "%c%.*s:%c", (char)(1 + (q - p)), (int)(q - p), p, 0); AZ(VSB_finish(sbh)); if (http_GetHdr(bo->bereq, VSB_data(sbh), &h)) { AZ(vct_issp(*h)); /* Trim trailing space */ e = strchr(h, '\0'); while (e > h && vct_issp(e[-1])) e--; /* Encode two byte length and contents */ l = e - h; if (l > 0xffff - 1) { VSLb(bo->vsl, SLT_Error, "Vary header maximum length exceeded"); error = 1; break; } } else { e = h; l = 0xffff; } VSB_printf(sb, "%c%c", (int)(l >> 8), (int)(l & 0xff)); /* Append to vary matching string */ VSB_bcat(sb, VSB_data(sbh), VSB_len(sbh)); if (e != h) VSB_bcat(sb, h, e - h); while (vct_issp(*q)) q++; if (*q == '\0') break; if (*q != ',') { VSLb(bo->vsl, SLT_Error, "Malformed Vary header"); error = 1; break; } p = q; } if (error) { VSB_delete(sbh); VSB_delete(sb); return (-1); } /* Terminate vary matching string */ VSB_printf(sb, "%c%c%c", 0xff, 0xff, 0); VSB_delete(sbh); AZ(VSB_finish(sb)); *psb = sb; return (VSB_len(sb)); } /* * Find length of a vary entry */ static unsigned VRY_Len(const uint8_t *p) { unsigned l = vbe16dec(p); return (2 + p[2] + 2 + (l == 0xffff ? 0 : l)); } /* * Compare two vary entries */ static int vry_cmp(const uint8_t *v1, const uint8_t *v2) { unsigned retval = 0; if (!memcmp(v1, v2, VRY_Len(v1))) { /* Same same */ retval = 0; } else if (memcmp(v1 + 2, v2 + 2, v1[2] + 2)) { /* Different header */ retval = 1; } else if (cache_param->http_gzip_support && !strcasecmp(H_Accept_Encoding, (const char*) v1 + 2)) { /* * If we do gzip processing, we do not vary on Accept-Encoding, * because we want everybody to get the gzip'ed object, and * varnish will gunzip as necessary. We implement the skip at * check time, rather than create time, so that object in * persistent storage can be used with either setting of * http_gzip_support. */ retval = 0; } else { /* Same header, different content */ retval = 2; } return (retval); } /********************************************************************** * Prepare predictive vary string * * XXX: Strictly speaking vary_b and vary_e could be replaced with * XXX: req->ws->{f,r}. Space in struct req vs. code-readability... */ void VRY_Prep(struct req *req) { if (req->hash_objhead == NULL) { /* Not a waiting list return */ AZ(req->vary_b); AZ(req->vary_l); AZ(req->vary_e); (void)WS_Reserve(req->ws, 0); } else { AN(req->ws->r); } req->vary_b = (void*)req->ws->f; req->vary_e = (void*)req->ws->r; if (req->vary_b + 2 < req->vary_e) req->vary_b[2] = '\0'; } void VRY_Clear(struct req *req) { CHECK_OBJ_NOTNULL(req, REQ_MAGIC); if (req->vary_b != NULL) free(req->vary_b); req->vary_b = NULL; AZ(req->vary_e); AZ(req->vary_l); } /********************************************************************** * Finish predictive vary processing */ void VRY_Finish(struct req *req, enum vry_finish_flag flg) { uint8_t *p = NULL; (void)VRY_Validate(req->vary_b); if (flg == KEEP && req->vary_l != NULL) { p = malloc(req->vary_l - req->vary_b); if (p != NULL) { memcpy(p, req->vary_b, req->vary_l - req->vary_b); (void)VRY_Validate(p); } } WS_Release(req->ws, 0); req->vary_l = NULL; req->vary_e = NULL; req->vary_b = p; } /********************************************************************** * Match vary strings, and build a new cached string if possible. * * Return zero if there is certainly no match. * Return non-zero if there could be a match or if we couldn't tell. */ int VRY_Match(struct req *req, const uint8_t *vary) { uint8_t *vsp = req->vary_b; const char *h, *e; unsigned lh, ln; int i, oflo = 0; AN(vsp); while (vary[2]) { if (vsp + 2 >= req->vary_e) { /* * Too little workspace to find out */ oflo = 1; break; } i = vry_cmp(vary, vsp); if (i == 1) { /* * Different header, build a new entry, * then compare again with that new entry. */ ln = 2 + vary[2] + 2; i = http_GetHdr(req->http, (const char*)(vary+2), &h); if (i) { /* Trim trailing space */ e = strchr(h, '\0'); while (e > h && vct_issp(e[-1])) e--; lh = e - h; assert(lh < 0xffff); ln += lh; } else { e = h = NULL; lh = 0xffff; } if (vsp + ln + 3 >= req->vary_e) { /* * Not enough space to build new entry * and put terminator behind it. */ oflo = 1; break; } vbe16enc(vsp, (uint16_t)lh); memcpy(vsp + 2, vary + 2, vary[2] + 2); if (h != NULL) memcpy(vsp + 2 + vsp[2] + 2, h, lh); vsp[ln + 0] = 0xff; vsp[ln + 1] = 0xff; vsp[ln + 2] = 0; (void)VRY_Validate(vsp); req->vary_l = vsp + ln + 3; i = vry_cmp(vary, vsp); assert(i == 0 || i == 2); } if (i == 0) { /* Same header, same contents */ vsp += VRY_Len(vsp); vary += VRY_Len(vary); } else if (i == 2) { /* Same header, different contents, cannot match */ return (0); } } if (oflo) { vsp = req->vary_b; req->vary_l = NULL; if (vsp + 2 < req->vary_e) { vsp[0] = 0xff; vsp[1] = 0xff; vsp[2] = 0; } return (0); } else { return (1); } } /* * Check the validity of a Vary string and return its total length */ static unsigned VRY_Validate(const uint8_t *vary) { unsigned retval = 0; while (vary[2] != 0) { assert(strlen((const char*)vary+3) == vary[2]); retval += VRY_Len(vary); vary += VRY_Len(vary); } return (retval + 3); } varnish-4.1.1/bin/varnishd/cache/cache_http.c0000644000201500234410000006446312652366721016032 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * HTTP request storage and manipulation */ #include "config.h" #include #include #include "cache.h" #include "vend.h" #include "vct.h" #include "vtim.h" #define HTTPH(a, b, c) char b[] = "*" a ":"; #include "tbl/http_headers.h" #undef HTTPH const char H__Status[] = "\010:status:"; const char H__Proto[] = "\007:proto:"; const char H__Reason[] = "\010:reason:"; /*-------------------------------------------------------------------- * These two functions are in an incestous relationship with the * order of macros in include/tbl/vsl_tags_http.h * * 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)); 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)); 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) { unsigned u; for (u = 0; u < hp->nhd; u++) if (hp->hd[u].b != NULL) http_VSLH(hp, u); } /*--------------------------------------------------------------------*/ static void http_fail(const struct http *hp) { VSC_C_main->losthdr++; VSLb(hp->vsl, SLT_Error, "out of workspace (%s)", hp->ws->id); WS_MarkOverflow(hp->ws); } /*--------------------------------------------------------------------*/ /* List of canonical HTTP response code names from RFC2616 */ static struct http_msg { unsigned nbr; const char *txt; } http_msg[] = { #define HTTP_RESP(n, t) { n, t}, #include "tbl/http_response.h" { 0, NULL } }; const char * http_Status2Reason(unsigned status) { struct http_msg *mp; status %= 1000; assert(status >= 100); for (mp = http_msg; mp->nbr != 0 && mp->nbr <= status; mp++) if (mp->nbr == status) return (mp->txt); return ("Unknown HTTP Status"); } /*--------------------------------------------------------------------*/ unsigned HTTP_estimate(unsigned nhttp) { /* XXX: We trust the structs to size-aligned as necessary */ return (PRNDUP(sizeof (struct http) + sizeof(txt) * nhttp + nhttp)); } struct http * HTTP_create(void *p, uint16_t nhttp) { struct http *hp; hp = p; hp->magic = HTTP_MAGIC; hp->hd = (void*)(hp + 1); hp->shd = nhttp; hp->hdf = (void*)(hp->hd + nhttp); return (hp); } /*--------------------------------------------------------------------*/ void HTTP_Setup(struct http *hp, struct ws *ws, struct vsl_log *vsl, enum VSL_tag_e whence) { http_Teardown(hp); hp->nhd = HTTP_HDR_FIRST; hp->logtag = whence; hp->ws = ws; hp->vsl = vsl; } /*-------------------------------------------------------------------- * http_Teardown() is a safety feature, we use it to zap all http * structs once we're done with them, to minimize the risk that * old stale pointers exist to no longer valid stuff. */ void http_Teardown(struct http *hp) { CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); AN(hp->shd); memset(&hp->nhd, 0, sizeof *hp - offsetof(struct http, nhd)); memset(hp->hd, 0, sizeof *hp->hd * hp->shd); memset(hp->hdf, 0, sizeof *hp->hdf * hp->shd); } /*--------------------------------------------------------------------*/ void HTTP_Copy(struct http *to, const struct http * const fm) { assert(fm->nhd <= to->shd); memcpy(&to->nhd, &fm->nhd, sizeof *to - offsetof(struct http, nhd)); memcpy(to->hd, fm->hd, fm->nhd * sizeof *to->hd); memcpy(to->hdf, fm->hdf, fm->nhd * sizeof *to->hdf); } /*--------------------------------------------------------------------*/ void http_SetH(const struct http *to, unsigned n, const char *fm) { assert(n < to->nhd); AN(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 http_PutField(const struct http *to, int field, const char *string) { char *p; CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); p = WS_Copy(to->ws, string, -1); if (p == NULL) { http_fail(to); VSLb(to->vsl, SLT_LostHeader, "%s", string); return; } to->hd[field].b = p; to->hd[field].e = strchr(p, '\0'); to->hdf[field] = 0; http_VSLH(to, field); } /*--------------------------------------------------------------------*/ static int http_IsHdr(const txt *hh, const char *hdr) { unsigned l; Tcheck(*hh); AN(hdr); l = hdr[0]; assert(l == strlen(hdr + 1)); assert(hdr[l] == ':'); hdr++; return (!strncasecmp(hdr, hh->b, l)); } /*--------------------------------------------------------------------*/ static unsigned http_findhdr(const struct http *hp, unsigned l, const char *hdr) { unsigned u; for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) { Tcheck(hp->hd[u]); if (hp->hd[u].e < hp->hd[u].b + l + 1) continue; if (hp->hd[u].b[l] != ':') continue; if (strncasecmp(hdr, hp->hd[u].b, l)) continue; return (u); } return (0); } /*-------------------------------------------------------------------- * Count how many instances we have of this header */ unsigned http_CountHdr(const struct http *hp, const char *hdr) { unsigned retval = 0; unsigned u; CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) { Tcheck(hp->hd[u]); if (http_IsHdr(&hp->hd[u], hdr)) retval++; } return (retval); } /*-------------------------------------------------------------------- * This function collapses multiple headerlines of the same name. * The lines are joined with a comma, according to [rfc2616, 4.2bot, p32] */ void http_CollectHdr(struct http *hp, const char *hdr) { unsigned u, l, ml, f, x, d; char *b = NULL, *e = NULL; CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); if (WS_Overflowed(hp->ws)) return; l = hdr[0]; assert(l == strlen(hdr + 1)); assert(hdr[l] == ':'); f = http_findhdr(hp, l - 1, hdr + 1); if (f == 0) return; for (d = u = f + 1; u < hp->nhd; u++) { Tcheck(hp->hd[u]); if (!http_IsHdr(&hp->hd[u], hdr)) { if (d != u) { hp->hd[d] = hp->hd[u]; hp->hdf[d] = hp->hdf[u]; } d++; continue; } if (b == NULL) { /* Found second header, start our collection */ ml = WS_Reserve(hp->ws, 0); b = hp->ws->f; e = b + ml; x = Tlen(hp->hd[f]); if (b + x >= e) { http_fail(hp); VSLb(hp->vsl, SLT_LostHeader, "%s", hdr + 1); WS_Release(hp->ws, 0); return; } memcpy(b, hp->hd[f].b, x); b += x; } AN(b); AN(e); /* Append the Nth header we found */ if (b < e) *b++ = ','; x = Tlen(hp->hd[u]) - l; if (b + x >= e) { http_fail(hp); VSLb(hp->vsl, SLT_LostHeader, "%s", hdr + 1); WS_Release(hp->ws, 0); return; } memcpy(b, hp->hd[u].b + *hdr, x); b += x; } if (b == NULL) return; hp->nhd = (uint16_t)d; AN(e); *b = '\0'; hp->hd[f].b = hp->ws->f; hp->hd[f].e = b; WS_ReleaseP(hp->ws, b + 1); } /*--------------------------------------------------------------------*/ int http_GetHdr(const struct http *hp, const char *hdr, const char **ptr) { unsigned u, l; const char *p; l = hdr[0]; assert(l == strlen(hdr + 1)); assert(hdr[l] == ':'); hdr++; u = http_findhdr(hp, l - 1, hdr); if (u == 0) { if (ptr != NULL) *ptr = NULL; return (0); } if (ptr != NULL) { p = hp->hd[u].b + l; while (vct_issp(*p)) p++; *ptr = p; } return (1); } /*----------------------------------------------------------------------------- * Split source string at any of the separators, return pointer to first * and last+1 char of substrings, with whitespace trimed at both ends. * If sep being an empty string is shorthand for VCT::SP * If stop is NULL, src is NUL terminated. */ static int http_split(const char **src, const char *stop, const char *sep, const char **b, const char **e) { const char *p, *q; AN(src); AN(*src); AN(sep); AN(b); AN(e); if (stop == NULL) stop = strchr(*src, '\0'); for (p = *src; p < stop && (vct_issp(*p) || strchr(sep, *p)); p++) continue; if (p >= stop) { *b = NULL; *e = NULL; return (0); } *b = p; if (*sep == '\0') { for (q = p + 1; q < stop && !vct_issp(*q); q++) continue; *e = q; *src = q; return (1); } for (q = p + 1; q < stop && !strchr(sep, *q); q++) continue; *src = q; while (q > p && vct_issp(q[-1])) q--; *e = q; return (1); } /*----------------------------------------------------------------------------- * Comparison rule for tokens: * if target string starts with '"', we use memcmp() and expect closing * double quote as well * otherwise we use strncascmp() * * On match we increment *bp past the token name. */ static int http_istoken(const char **bp, const char *e, const char *token) { int fl = strlen(token); const char *b; AN(bp); AN(e); AN(token); b = *bp; if (b + fl + 2 <= e && *b == '"' && !memcmp(b + 1, token, fl) && b[fl + 1] == '"') { *bp += fl + 2; return (1); } if (b + fl <= e && !strncasecmp(b, token, fl) && (b + fl == e || !vct_istchar(b[fl]))) { *bp += fl; return (1); } return (0); } /*----------------------------------------------------------------------------- * Find a given data element (token) in a header according to RFC2616's #rule * (section 2.1, p15) * * On case sensitivity: * * Section 4.2 (Messages Headers) defines field (header) name as case * insensitive, but the field (header) value/content may be case-sensitive. * * http_GetHdrToken looks up a token in a header value and the rfc does not say * explicitly if tokens are to be compared with or without respect to case. * * But all examples and specific statements regarding tokens follow the rule * that unquoted tokens are to be matched case-insensitively and quoted tokens * case-sensitively. * * The optional pb and pe arguments will point to the token content start and * end+1, white space trimmed on both sides. */ int http_GetHdrToken(const struct http *hp, const char *hdr, const char *token, const char **pb, const char **pe) { const char *h, *b, *e; if (pb != NULL) *pb = NULL; if (pe != NULL) *pe = NULL; if (!http_GetHdr(hp, hdr, &h)) return (0); AN(h); while(http_split(&h, NULL, ",", &b, &e)) if (http_istoken(&b, e, token)) break; if (b == NULL) return (0); if (pb != NULL) { for (; vct_islws(*b); b++) continue; if (b == e) { b = NULL; e = NULL; } *pb = b; if (pe != NULL) *pe = e; } return (1); } /*-------------------------------------------------------------------- * Find a given headerfields Q value. */ double http_GetHdrQ(const struct http *hp, const char *hdr, const char *field) { const char *hb, *he, *b, *e; int i; double a, f; i = http_GetHdrToken(hp, hdr, field, &hb, &he); if (!i) return (0.); if (hb == NULL) return (1.); while(http_split(&hb, he, ";", &b, &e)) { if (*b != 'q') continue; for (b++; b < e && vct_issp(*b); b++) continue; if (b == e || *b != '=') continue; break; } if (b == NULL) return (1.); for (b++; b < e && vct_issp(*b); b++) continue; if (b == e || (*b != '.' && !vct_isdigit(*b))) return (0.); a = 0; while (b < e && vct_isdigit(*b)) { a *= 10.; a += *b - '0'; b++; } if (b == e || *b++ != '.') return (a); f = .1; while (b < e && vct_isdigit(*b)) { a += f * (*b - '0'); f *= .1; b++; } return (a); } /*-------------------------------------------------------------------- * Find a given headerfields value. */ int http_GetHdrField(const struct http *hp, const char *hdr, const char *field, const char **ptr) { const char *h; int i; if (ptr != NULL) *ptr = NULL; h = NULL; i = http_GetHdrToken(hp, hdr, field, &h, NULL); if (!i) return (i); if (ptr != NULL && h != NULL) { /* Skip whitespace, looking for '=' */ while (*h && vct_issp(*h)) h++; if (*h == '=') { h++; while (*h && vct_issp(*h)) h++; *ptr = h; } } return (i); } /*--------------------------------------------------------------------*/ ssize_t http_GetContentLength(const struct http *hp) { ssize_t cl, cll; const char *b; CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); if (!http_GetHdr(hp, H_Content_Length, &b)) return (-1); cl = 0; if (!vct_isdigit(*b)) return (-2); for (;vct_isdigit(*b); b++) { cll = cl; cl *= 10; cl += *b - '0'; if (cll != cl / 10) return (-2); } while (vct_islws(*b)) b++; if (*b != '\0') return (-2); return (cl); } /*-------------------------------------------------------------------- */ enum sess_close http_DoConnection(struct http *hp) { const char *h, *b, *e; enum sess_close retval; unsigned u, v; if (hp->protover == 10) retval = SC_REQ_HTTP10; else retval = SC_NULL; http_CollectHdr(hp, H_Connection); if (!http_GetHdr(hp, H_Connection, &h)) return (retval); AN(h); while (http_split(&h, NULL, ",", &b, &e)) { u = pdiff(b, e); if (u == 5 && !strncasecmp(b, "close", u)) retval = SC_REQ_CLOSE; if (u == 10 && !strncasecmp(b, "keep-alive", u)) retval = SC_NULL; /* Refuse removal of well-known-headers if they would pass. */ /*lint -save -e506 */ #define HTTPH(a, x, c) \ if (!((c) & HTTPH_R_PASS) && \ strlen(a) == u && !strncasecmp(a, b, u)) \ return (SC_RX_BAD); #include "tbl/http_headers.h" #undef HTTPH /*lint -restore */ v = http_findhdr(hp, u, b); if (v > 0) hp->hdf[v] |= HDF_FILTER; } return (retval); } /*--------------------------------------------------------------------*/ int http_HdrIs(const struct http *hp, const char *hdr, const char *val) { const char *p; if (!http_GetHdr(hp, hdr, &p)) return (0); AN(p); if (!strcasecmp(p, val)) return (1); return (0); } /*--------------------------------------------------------------------*/ uint16_t http_GetStatus(const struct http *hp) { CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); return (hp->status); } int http_IsStatus(const struct http *hp, int val) { CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); assert(val >= 100 && val <= 999); return (val == (hp->status % 1000)); } /*-------------------------------------------------------------------- * Setting the status will also set the Reason appropriately */ void http_SetStatus(struct http *to, uint16_t status) { char buf[4]; CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); /* * We allow people to use top digits for internal VCL * signalling, but strip them from the ASCII version. */ to->status = status; status %= 1000; assert(status >= 100); bprintf(buf, "%03d", status); http_PutField(to, HTTP_HDR_STATUS, buf); http_SetH(to, HTTP_HDR_REASON, http_Status2Reason(status)); } /*--------------------------------------------------------------------*/ const char * http_GetMethod(const struct http *hp) { CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); Tcheck(hp->hd[HTTP_HDR_METHOD]); return (hp->hd[HTTP_HDR_METHOD].b); } /*-------------------------------------------------------------------- * Force a particular header field to a particular value */ void http_ForceField(const struct http *to, unsigned n, const char *t) { CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); assert(n < HTTP_HDR_FIRST); AN(t); if (to->hd[n].b == NULL || strcmp(to->hd[n].b, t)) http_SetH(to, n, t); } /*--------------------------------------------------------------------*/ void http_PutResponse(struct http *to, const char *proto, uint16_t status, const char *reason) { CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); if (proto != NULL) http_SetH(to, HTTP_HDR_PROTO, proto); http_SetStatus(to, status); if (reason == NULL) reason = http_Status2Reason(status); http_SetH(to, HTTP_HDR_REASON, reason); } /*-------------------------------------------------------------------- * Estimate how much workspace we need to Filter this header according * to 'how'. */ unsigned http_EstimateWS(const struct http *fm, unsigned how) { unsigned u, l; l = 4; CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); for (u = 0; u < fm->nhd; u++) { if (u == HTTP_HDR_METHOD || u == HTTP_HDR_URL) continue; AN(fm->hd[u].b); AN(fm->hd[u].e); if (fm->hdf[u] & HDF_FILTER) continue; #define HTTPH(a, b, c) \ if (((c) & how) && http_IsHdr(&fm->hd[u], (b))) \ continue; #include "tbl/http_headers.h" #undef HTTPH l += Tlen(fm->hd[u]) + 1L; } return (PRNDUP(l + 1L)); } /*-------------------------------------------------------------------- * Encode http struct as byte string. * * XXX: We could save considerable special-casing below by encoding also * XXX: H__Status, H__Reason and H__Proto into the string, but it would * XXX: add 26-30 bytes to all encoded objects to save a little code. * XXX: It could possibly be a good idea for later HTTP versions. */ void HTTP_Encode(const struct http *fm, uint8_t *p0, unsigned l, unsigned how) { unsigned u, w; uint16_t n; uint8_t *p, *e; AN(p0); AN(l); p = p0; e = p + l; assert(p + 5 <= e); assert(fm->nhd <= fm->shd); n = HTTP_HDR_FIRST - 3; vbe16enc(p + 2, fm->status); p += 4; CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); for (u = 0; u < fm->nhd; u++) { if (u == HTTP_HDR_METHOD || u == HTTP_HDR_URL) continue; AN(fm->hd[u].b); AN(fm->hd[u].e); if (fm->hdf[u] & HDF_FILTER) continue; #define HTTPH(a, b, c) \ if (((c) & how) && http_IsHdr(&fm->hd[u], (b))) \ continue; #include "tbl/http_headers.h" #undef HTTPH http_VSLH(fm, u); w = Tlen(fm->hd[u]) + 1L; assert(p + w + 1 <= e); memcpy(p, fm->hd[u].b, w); p += w; n++; } *p++ = '\0'; assert(p <= e); vbe16enc(p0, n + 1); } /*-------------------------------------------------------------------- * Decode byte string into http struct */ int HTTP_Decode(struct http *to, const uint8_t *fm) { CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); AN(to->vsl); AN(fm); if (vbe16dec(fm) <= to->shd) { to->status = vbe16dec(fm + 2); fm += 4; for (to->nhd = 0; to->nhd < to->shd; to->nhd++) { if (to->nhd == HTTP_HDR_METHOD || to->nhd == HTTP_HDR_URL) { to->hd[to->nhd].b = NULL; to->hd[to->nhd].e = NULL; continue; } if (*fm == '\0') return (0); to->hd[to->nhd].b = (const void*)fm; fm = (const void*)strchr((const void*)fm, '\0'); to->hd[to->nhd].e = (const void*)fm; fm++; http_VSLH(to, to->nhd); } } VSLb(to->vsl, SLT_Error, "Too many headers to Decode object (%u vs. %u)", vbe16dec(fm), to->shd); return (-1); } /*--------------------------------------------------------------------*/ uint16_t HTTP_GetStatusPack(struct worker *wrk, struct objcore *oc) { const char *ptr; ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); AN(ptr); return(vbe16dec(ptr + 2)); } /*--------------------------------------------------------------------*/ /* Get the first packed header */ int HTTP_IterHdrPack(struct worker *wrk, struct objcore *oc, const char **p) { const char *ptr; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AN(p); if (*p == NULL) { ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); AN(ptr); ptr += 4; /* Skip nhd and status */ ptr = strchr(ptr, '\0') + 1; /* Skip :proto: */ ptr = strchr(ptr, '\0') + 1; /* Skip :status: */ ptr = strchr(ptr, '\0') + 1; /* Skip :reason: */ *p = ptr; } else { *p = strchr(*p, '\0') + 1; /* Skip to next header */ } if (**p == '\0') return (0); return (1); } const char * HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) { const char *ptr; unsigned l; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AN(hdr); l = hdr[0]; assert(l > 0); assert(l == strlen(hdr + 1)); assert(hdr[l] == ':'); hdr++; if (hdr[0] == ':') { /* Special cases */ ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); AN(ptr); ptr += 4; /* Skip nhd and status */ if (!strcmp(hdr, ":proto:")) return (ptr); ptr = strchr(ptr, '\0') + 1; if (!strcmp(hdr, ":status:")) return (ptr); ptr = strchr(ptr, '\0') + 1; if (!strcmp(hdr, ":reason:")) return (ptr); WRONG("Unknown magic packed header"); } HTTP_FOREACH_PACK(wrk, oc, ptr) { if (!strncasecmp(ptr, hdr, l)) { ptr += l; while (vct_islws(*ptr)) ptr++; return (ptr); } } return (NULL); } /*-------------------------------------------------------------------- * Merge any headers in the oc->OA_HEADER into the struct http if they * are not there already. */ void HTTP_Merge(struct worker *wrk, struct objcore *oc, struct http *to) { const char *ptr; unsigned u; const char *p; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); AN(ptr); to->status = vbe16dec(ptr + 2); ptr += 4; for (u = 0; u < HTTP_HDR_FIRST; u++) { if (u == HTTP_HDR_METHOD || u == HTTP_HDR_URL) continue; http_SetH(to, u, ptr); ptr = strchr(ptr, '\0') + 1; } while (*ptr != '\0') { p = strchr(ptr, ':'); AN(p); if (!http_findhdr(to, p - ptr, ptr)) http_SetHeader(to, ptr); ptr = strchr(ptr, '\0') + 1; } } /*--------------------------------------------------------------------*/ static void http_filterfields(struct http *to, const struct http *fm, unsigned how) { unsigned u; CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); to->nhd = HTTP_HDR_FIRST; to->status = fm->status; for (u = HTTP_HDR_FIRST; u < fm->nhd; u++) { if (fm->hd[u].b == NULL) continue; if (fm->hdf[u] & HDF_FILTER) continue; Tcheck(fm->hd[u]); #define HTTPH(a, b, c) \ if (((c) & how) && http_IsHdr(&fm->hd[u], (b))) \ continue; #include "tbl/http_headers.h" #undef HTTPH assert (to->nhd < to->shd); to->hd[to->nhd] = fm->hd[u]; to->hdf[to->nhd] = 0; http_VSLH(to, to->nhd); to->nhd++; } } /*--------------------------------------------------------------------*/ static void http_linkh(const struct http *to, const struct http *fm, unsigned n) { assert(n < HTTP_HDR_FIRST); Tcheck(fm->hd[n]); to->hd[n] = fm->hd[n]; to->hdf[n] = fm->hdf[n]; http_VSLH(to, n); } /*--------------------------------------------------------------------*/ void http_FilterReq(struct http *to, const struct http *fm, unsigned how) { CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); http_linkh(to, fm, HTTP_HDR_METHOD); http_linkh(to, fm, HTTP_HDR_URL); http_linkh(to, fm, HTTP_HDR_PROTO); http_filterfields(to, fm, how); } /*-------------------------------------------------------------------- * This function copies any header fields which reference foreign * storage into our own WS. */ void http_CopyHome(const struct http *hp) { unsigned u, l; char *p; for (u = 0; u < hp->nhd; u++) { if (hp->hd[u].b == NULL) continue; if (hp->hd[u].b >= hp->ws->s && hp->hd[u].e <= hp->ws->e) continue; l = Tlen(hp->hd[u]); p = WS_Copy(hp->ws, hp->hd[u].b, l + 1L); if (p == NULL) { http_fail(hp); VSLb(hp->vsl, SLT_LostHeader, "%s", hp->hd[u].b); return; } hp->hd[u].b = p; hp->hd[u].e = p + l; } } /*--------------------------------------------------------------------*/ void http_SetHeader(struct http *to, const char *hdr) { CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); if (to->nhd >= to->shd) { VSLb(to->vsl, SLT_LostHeader, "%s", hdr); http_fail(to); return; } http_SetH(to, to->nhd++, 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); } void http_PrintfHeader(struct http *to, const char *fmt, ...) { va_list ap; unsigned l, n; CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); l = WS_Reserve(to->ws, 0); va_start(ap, fmt); n = vsnprintf(to->ws->f, l, fmt, ap); va_end(ap); if (n + 1 >= l || to->nhd >= to->shd) { http_fail(to); VSLb(to->vsl, SLT_LostHeader, "%s", to->ws->f); WS_Release(to->ws, 0); return; } to->hd[to->nhd].b = to->ws->f; 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 http_TimeHeader(struct http *to, const char *fmt, double now) { char *p; CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); p = WS_Alloc(to->ws, strlen(fmt) + VTIM_FORMAT_SIZE); if (p == NULL) { http_fail(to); VSLb(to->vsl, SLT_LostHeader, "%s", fmt); return; } strcpy(p, fmt); VTIM_format(now, strchr(p, '\0')); to->hd[to->nhd].b = p; to->hd[to->nhd].e = strchr(p, '\0'); to->hdf[to->nhd] = 0; http_VSLH(to, to->nhd); to->nhd++; } /*--------------------------------------------------------------------*/ void http_Unset(struct http *hp, const char *hdr) { uint16_t u, v; for (v = u = HTTP_HDR_FIRST; u < hp->nhd; u++) { if (hp->hd[u].b == NULL) continue; 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); } v++; } hp->nhd = v; } /*--------------------------------------------------------------------*/ void HTTP_Init(void) { #define HTTPH(a, b, c) b[0] = (char)strlen(b + 1); #include "tbl/http_headers.h" #undef HTTPH } varnish-4.1.1/bin/varnishd/cache/cache_esi.h0000644000201500234410000000372512652366721015632 00000000000000/*- * Copyright (c) 2011 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. * */ #define VEC_GZ (0x21) #define VEC_V1 (0x40 + 1) #define VEC_V2 (0x40 + 2) #define VEC_V8 (0x40 + 8) #define VEC_C1 (0x50 + 1) #define VEC_C2 (0x50 + 2) #define VEC_C8 (0x50 + 8) #define VEC_S1 (0x60 + 1) #define VEC_S2 (0x60 + 2) #define VEC_S8 (0x60 + 8) #define VEC_INCL 'I' typedef ssize_t vep_callback_t(struct vfp_ctx *, void *priv, ssize_t l, enum vgz_flag flg); struct vep_state *VEP_Init(struct vfp_ctx *vc, const struct http *req, vep_callback_t *cb, void *cb_priv); void VEP_Parse(struct vep_state *, const char *p, size_t l); struct vsb *VEP_Finish(struct vep_state *); varnish-4.1.1/bin/varnishd/cache/cache_esi_parse.c0000644000201500234410000007354412652366721017025 00000000000000/*- * Copyright (c) 2011 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. * * VEP Varnish Esi Parsing */ #include "config.h" #include "cache.h" #include "cache_esi.h" #include "vct.h" #include "vend.h" #include "vgz.h" //#define Debug(fmt, ...) printf(fmt, __VA_ARGS__) #define Debug(fmt, ...) /**/ struct vep_state; enum dowhat {DO_ATTR, DO_TAG}; typedef void dostuff_f(struct vep_state *, enum dowhat); struct vep_match { const char *match; const char * const *state; }; enum vep_mark { VERBATIM = 0, SKIP }; struct vep_state { unsigned magic; #define VEP_MAGIC 0x55cb9b82 struct vsb *vsb; const char *url; struct vfp_ctx *vc; int dogzip; vep_callback_t *cb; void *cb_priv; /* Internal Counter for default call-back function */ ssize_t cb_x; /* parser state */ const char *state; unsigned startup; unsigned esi_found; unsigned endtag; unsigned emptytag; unsigned canattr; unsigned remove; ssize_t o_wait; ssize_t o_pending; ssize_t o_total; uint32_t crc; ssize_t o_crc; uint32_t crcp; ssize_t o_last; const char *hack_p; const char *ver_p; const char *until; const char *until_p; const char *until_s; int in_esi_tag; const char *esicmt; const char *esicmt_p; struct vep_match *attr; struct vsb *attr_vsb; int attr_delim; struct vep_match *match; struct vep_match *match_hit; char tag[10]; int tag_i; dostuff_f *dostuff; struct vsb *include_src; unsigned nm_skip; unsigned nm_verbatim; unsigned nm_pending; enum vep_mark last_mark; }; /*---------------------------------------------------------------------*/ static const char * const VEP_START = "[Start]"; static const char * const VEP_BOM = "[BOM]"; static const char * const VEP_TESTXML = "[TestXml]"; static const char * const VEP_NOTXML = "[NotXml]"; static const char * const VEP_NEXTTAG = "[NxtTag]"; static const char * const VEP_NOTMYTAG = "[NotMyTag]"; static const char * const VEP_STARTTAG = "[StartTag]"; static const char * const VEP_COMMENT = "[Comment]"; static const char * const VEP_CDATA = "[CDATA]"; static const char * const VEP_ESITAG = "[ESITag]"; static const char * const VEP_ESIREMOVE = "[ESI:Remove]"; static const char * const VEP_ESIINCLUDE = "[ESI:Include]"; static const char * const VEP_ESICOMMENT = "[ESI:Comment]"; static const char * const VEP_ESIBOGON = "[ESI:Bogon]"; static const char * const VEP_INTAG = "[InTag]"; static const char * const VEP_TAGERROR = "[TagError]"; static const char * const VEP_ATTR = "[Attribute]"; static const char * const VEP_SKIPATTR = "[SkipAttribute]"; static const char * const VEP_ATTRDELIM = "[AttrDelim]"; static const char * const VEP_ATTRGETVAL = "[AttrGetValue]"; static const char * const VEP_ATTRVAL = "[AttrValue]"; static const char * const VEP_UNTIL = "[Until]"; static const char * const VEP_MATCHBUF = "[MatchBuf]"; static const char * const VEP_MATCH = "[Match]"; /*---------------------------------------------------------------------*/ static struct vep_match vep_match_starttag[] = { { "!--", &VEP_COMMENT }, { "esi:", &VEP_ESITAG }, { "![CDATA[", &VEP_CDATA }, { NULL, &VEP_NOTMYTAG } }; /*---------------------------------------------------------------------*/ static struct vep_match vep_match_esi[] = { { "include", &VEP_ESIINCLUDE }, { "remove", &VEP_ESIREMOVE }, { "comment", &VEP_ESICOMMENT }, { NULL, &VEP_ESIBOGON } }; /*---------------------------------------------------------------------*/ static struct vep_match vep_match_attr_include[] = { { "src=", &VEP_ATTRGETVAL }, { NULL, &VEP_SKIPATTR } }; /*---------------------------------------------------------------------*/ static struct vep_match vep_match_bom[] = { { "\xeb\xbb\xbf", &VEP_START }, { NULL, &VEP_BOM } }; /*-------------------------------------------------------------------- * Report a parsing error */ static void vep_error(const struct vep_state *vep, const char *p) { intmax_t l; VSC_C_main->esi_errors++; l = (intmax_t)(vep->ver_p - vep->hack_p); VSLb(vep->vc->wrk->vsl, SLT_ESI_xmlerror, "ERR at %jd %s", l, p); } /*-------------------------------------------------------------------- * Report a parsing warning */ static void vep_warn(const struct vep_state *vep, const char *p) { intmax_t l; VSC_C_main->esi_warnings++; l = (intmax_t)(vep->ver_p - vep->hack_p); VSLb(vep->vc->wrk->vsl, SLT_ESI_xmlerror, "WARN at %jd %s", l, p); } /*--------------------------------------------------------------------- * return match or NULL if more input needed. */ static struct vep_match * vep_match(struct vep_state *vep, const char *b, const char *e) { struct vep_match *vm; const char *q, *r; ssize_t l; for (vm = vep->match; vm->match; vm++) { r = b; for (q = vm->match; *q && r < e; q++, r++) if (*q != *r) break; if (*q != '\0' && r == e) { if (b != vep->tag) { l = e - b; assert(l < sizeof vep->tag); memmove(vep->tag, b, l); vep->tag_i = l; } return (NULL); } if (*q == '\0') return (vm); } return (vm); } /*--------------------------------------------------------------------- * */ static void vep_emit_len(const struct vep_state *vep, ssize_t l, int m8, int m16, int m64) { uint8_t buf[9]; assert(l > 0); if (l < 256) { buf[0] = (uint8_t)m8; buf[1] = (uint8_t)l; assert((ssize_t)buf[1] == l); VSB_bcat(vep->vsb, buf, 2); } else if (l < 65536) { buf[0] = (uint8_t)m16; vbe16enc(buf + 1, (uint16_t)l); assert((ssize_t)vbe16dec(buf + 1) == l); VSB_bcat(vep->vsb, buf, 3); } else { buf[0] = (uint8_t)m64; vbe64enc(buf + 1, l); assert((ssize_t)vbe64dec(buf + 1) == l); VSB_bcat(vep->vsb, buf, 9); } } static void vep_emit_skip(const struct vep_state *vep, ssize_t l) { vep_emit_len(vep, l, VEC_S1, VEC_S2, VEC_S8); } static void vep_emit_verbatim(const struct vep_state *vep, ssize_t l, ssize_t l_crc) { uint8_t buf[4]; vep_emit_len(vep, l, VEC_V1, VEC_V2, VEC_V8); if (vep->dogzip) { vep_emit_len(vep, l_crc, VEC_C1, VEC_C2, VEC_C8); vbe32enc(buf, vep->crc); VSB_bcat(vep->vsb, buf, sizeof buf); } } static void vep_emit_common(struct vep_state *vep, ssize_t l, enum vep_mark mark) { assert(l >= 0); if (l == 0) return; assert(mark == SKIP || mark == VERBATIM); if (mark == SKIP) vep_emit_skip(vep, l); else vep_emit_verbatim(vep, l, vep->o_crc); vep->crc = crc32(0L, Z_NULL, 0); vep->o_crc = 0; vep->o_total += l; } /*--------------------------------------------------------------------- * */ static void vep_mark_common(struct vep_state *vep, const char *p, enum vep_mark mark) { ssize_t l, lcb; assert(mark == SKIP || mark == VERBATIM); /* The NO-OP case, no data, no pending data & no change of mode */ if (vep->last_mark == mark && p == vep->ver_p && vep->o_pending == 0) return; /* * If we changed mode, emit whatever the opposite mode * assembled before the pending bytes. */ if (vep->last_mark != mark && (vep->o_wait > 0 || vep->startup)) { lcb = vep->cb(vep->vc, vep->cb_priv, 0, mark == VERBATIM ? VGZ_RESET : VGZ_ALIGN); vep_emit_common(vep, lcb - vep->o_last, vep->last_mark); vep->o_last = lcb; vep->o_wait = 0; } /* Transfer pending bytes CRC into active mode CRC */ if (vep->o_pending) { (void)vep->cb(vep->vc, vep->cb_priv, vep->o_pending, VGZ_NORMAL); if (vep->o_crc == 0) { vep->crc = vep->crcp; vep->o_crc = vep->o_pending; } else { vep->crc = crc32_combine(vep->crc, vep->crcp, vep->o_pending); vep->o_crc += vep->o_pending; } vep->crcp = crc32(0L, Z_NULL, 0); vep->o_wait += vep->o_pending; vep->o_pending = 0; } /* * Process this bit of input */ AN(vep->ver_p); l = p - vep->ver_p; assert(l >= 0); vep->crc = crc32(vep->crc, (const void*)vep->ver_p, l); vep->o_crc += l; vep->ver_p = p; vep->o_wait += l; vep->last_mark = mark; (void)vep->cb(vep->vc, vep->cb_priv, l, VGZ_NORMAL); } static void vep_mark_verbatim(struct vep_state *vep, const char *p) { vep_mark_common(vep, p, VERBATIM); vep->nm_verbatim++; } static void vep_mark_skip(struct vep_state *vep, const char *p) { vep_mark_common(vep, p, SKIP); vep->nm_skip++; } static void vep_mark_pending(struct vep_state *vep, const char *p) { ssize_t l; AN(vep->ver_p); l = p - vep->ver_p; assert(l > 0); assert(l >= 0); vep->crcp = crc32(vep->crcp, (const void *)vep->ver_p, l); vep->ver_p = p; vep->o_pending += l; vep->nm_pending++; } /*--------------------------------------------------------------------- */ static void __match_proto__() vep_do_comment(struct vep_state *vep, enum dowhat what) { Debug("DO_COMMENT(%d)\n", what); assert(what == DO_TAG); if (!vep->emptytag) vep_error(vep, "ESI 1.0 needs final '/'"); } /*--------------------------------------------------------------------- */ static void __match_proto__() vep_do_remove(struct vep_state *vep, enum dowhat what) { Debug("DO_REMOVE(%d, end %d empty %d remove %d)\n", what, vep->endtag, vep->emptytag, vep->remove); assert(what == DO_TAG); if (vep->emptytag) { vep_error(vep, "ESI 1.0 not legal"); } else { if (vep->remove && !vep->endtag) vep_error(vep, "ESI 1.0 already open"); else if (!vep->remove && vep->endtag) vep_error(vep, "ESI 1.0 not open"); else vep->remove = !vep->endtag; } } /*--------------------------------------------------------------------- */ static void __match_proto__() vep_do_include(struct vep_state *vep, enum dowhat what) { const char *p, *q, *h; ssize_t l; Debug("DO_INCLUDE(%d)\n", what); if (what == DO_ATTR) { Debug("ATTR (%s) (%s)\n", vep->match_hit->match, VSB_data(vep->attr_vsb)); if (vep->include_src != NULL) { vep_error(vep, "ESI 1.0 " "has multiple src= attributes"); vep->state = VEP_TAGERROR; VSB_delete(vep->attr_vsb); VSB_delete(vep->include_src); vep->attr_vsb = NULL; vep->include_src = NULL; return; } vep->include_src = vep->attr_vsb; return; } assert(what == DO_TAG); if (!vep->emptytag) vep_warn(vep, "ESI 1.0 lacks final '/'"); if (vep->include_src == NULL) { vep_error(vep, "ESI 1.0 lacks src attr"); return; } /* * Strictly speaking, we ought to spit out any piled up skip before * emitting the VEC for the include, but objectively that makes no * difference and robs us of a chance to collapse another skip into * this on so we don't do that. * However, we cannot tolerate any verbatim stuff piling up. * The mark_skip() before calling dostuff should have taken * care of that. Make sure. */ assert(vep->o_wait == 0 || vep->last_mark == SKIP); /* XXX: what if it contains NUL bytes ?? */ p = VSB_data(vep->include_src); l = VSB_len(vep->include_src); h = 0; if (l > 7 && !memcmp(p, "http://", 7)) { h = p + 7; p = strchr(h, '/'); AN(p); Debug("HOST <%.*s> PATH <%s>\n", (int)(p-h),h, p); VSB_printf(vep->vsb, "%c", VEC_INCL); VSB_printf(vep->vsb, "Host: %.*s%c", (int)(p-h), h, 0); } else if (l > 8 && !memcmp(p, "https://", 8)) { if (!FEATURE(FEATURE_ESI_IGNORE_HTTPS)) { vep_warn(vep, "ESI 1.0 with https:// ignored"); vep->state = VEP_TAGERROR; vep->attr_vsb = NULL; vep->include_src = NULL; return; } vep_warn(vep, "ESI 1.0 https:// treated as http://"); h = p + 8; p = strchr(h, '/'); AN(p); VSB_printf(vep->vsb, "%c", VEC_INCL); VSB_printf(vep->vsb, "Host: %.*s%c", (int)(p-h), h, 0); } else if (*p == '/') { VSB_printf(vep->vsb, "%c", VEC_INCL); VSB_printf(vep->vsb, "%c", 0); } else { VSB_printf(vep->vsb, "%c", VEC_INCL); VSB_printf(vep->vsb, "%c", 0); /* Look for the last / before a '?' */ h = NULL; for (q = vep->url; *q && *q != '?'; q++) if (*q == '/') h = q; if (h == NULL) h = q + 1; Debug("INCL:: [%.*s]/[%s]\n", (int)(h - vep->url), vep->url, p); VSB_printf(vep->vsb, "%.*s/", (int)(h - vep->url), vep->url); } l -= (p - VSB_data(vep->include_src)); for (q = p; *q != '\0'; ) { if (*q == '&') { #define R(w,f,r) \ if (q + w <= p + l && !memcmp(q, f, w)) { \ VSB_printf(vep->vsb, "%c", r); \ q += w; \ continue; \ } R(6, "'", '\''); R(6, """, '"'); R(4, "<", '<'); R(4, ">", '>'); R(5, "&", '&'); } VSB_printf(vep->vsb, "%c", *q++); } #undef R VSB_printf(vep->vsb, "%c", 0); VSB_delete(vep->include_src); vep->include_src = NULL; } /*--------------------------------------------------------------------- * Lex/Parse object for ESI instructions * * This function is called with the input object piecemal so do not * assume that we have more than one char available at at time, but * optimize for getting huge chunks. * * NB: At the bottom of this source-file, there is a dot-diagram matching * NB: the state-machine. Please maintain it along with the code. */ void VEP_Parse(struct vep_state *vep, const char *p, size_t l) { const char *e; struct vep_match *vm; int i; CHECK_OBJ_NOTNULL(vep, VEP_MAGIC); assert(l > 0); if (vep->startup) { /* * We must force the GZIP header out as a SKIP string, * otherwise an object starting with ver_p = ""; vep->last_mark = SKIP; vep_mark_common(vep, vep->ver_p, VERBATIM); vep->startup = 0; AZ(vep->hack_p); vep->hack_p = p; } vep->ver_p = p; e = p + l; while (p < e) { AN(vep->state); i = e - p; if (i > 10) i = 10; Debug("EP %s %d (%.*s) [%.*s]\n", vep->state, vep->remove, vep->tag_i, vep->tag, i, p); assert(p >= vep->ver_p); /****************************************************** * SECTION A */ if (vep->state == VEP_START) { if (FEATURE(FEATURE_ESI_REMOVE_BOM) && *p == '\xeb') { vep->match = vep_match_bom; vep->state = VEP_MATCH; } else vep->state = VEP_BOM; } else if (vep->state == VEP_BOM) { vep_mark_skip(vep, p); if (FEATURE(FEATURE_ESI_DISABLE_XML_CHECK)) vep->state = VEP_NEXTTAG; else vep->state = VEP_TESTXML; } else if (vep->state == VEP_TESTXML) { /* * If the first non-whitespace char is different * from '<' we assume this is not XML. */ while (p < e && vct_islws(*p)) p++; vep_mark_verbatim(vep, p); if (p < e && *p == '<') { p++; vep->state = VEP_STARTTAG; } else if (p < e && *p == '\xeb') { VSLb(vep->vc->wrk->vsl, SLT_ESI_xmlerror, "No ESI processing, " "first char not '<' but BOM." " (See feature esi_remove_bom)" ); vep->state = VEP_NOTXML; } else if (p < e) { VSLb(vep->vc->wrk->vsl, SLT_ESI_xmlerror, "No ESI processing, " "first char not '<'." " (See feature esi_disable_xml_check)" ); vep->state = VEP_NOTXML; } } else if (vep->state == VEP_NOTXML) { /* * This is not recognized as XML, just skip thru * vfp_esi_end() will handle the rest */ p = e; vep_mark_verbatim(vep, p); /****************************************************** * SECTION B */ } else if (vep->state == VEP_NOTMYTAG) { if (FEATURE(FEATURE_ESI_IGNORE_OTHER_ELEMENTS)) { p++; vep->state = VEP_NEXTTAG; } else { vep->tag_i = 0; while (p < e) { if (*p++ == '>') { vep->state = VEP_NEXTTAG; break; } } } if (p == e && !vep->remove) vep_mark_verbatim(vep, p); } else if (vep->state == VEP_NEXTTAG) { /* * Hunt for start of next tag and keep an eye * out for end of EsiCmt if armed. */ vep->emptytag = 0; vep->endtag = 0; vep->attr = NULL; vep->dostuff = NULL; while (p < e && *p != '<') { if (vep->esicmt_p == NULL) { p++; continue; } if (*p != *vep->esicmt_p) { p++; vep->esicmt_p = vep->esicmt; continue; } if (!vep->remove && vep->esicmt_p == vep->esicmt) vep_mark_verbatim(vep, p); p++; if (*++vep->esicmt_p == '\0') { vep->esi_found = 1; vep->esicmt = NULL; vep->esicmt_p = NULL; /* * The end of the esicmt * should not be emitted. * But the stuff before should */ vep_mark_skip(vep, p); } } if (p < e) { if (!vep->remove) vep_mark_verbatim(vep, p); assert(*p == '<'); p++; vep->state = VEP_STARTTAG; } else if (vep->esicmt_p == vep->esicmt && !vep->remove) vep_mark_verbatim(vep, p); /****************************************************** * SECTION C */ } else if (vep->state == VEP_STARTTAG) { /* * Start of tag, set up match table */ if (p < e) { if (*p == '/') { vep->endtag = 1; p++; } vep->match = vep_match_starttag; vep->state = VEP_MATCH; } } else if (vep->state == VEP_COMMENT) { /* * We are in a comment, find out if it is an * ESI comment or a regular comment */ if (vep->esicmt == NULL) vep->esicmt_p = vep->esicmt = "esi"; while (p < e) { if (*p != *vep->esicmt_p) { vep->esicmt_p = vep->esicmt = NULL; vep->until_p = vep->until = "-->"; vep->until_s = VEP_NEXTTAG; vep->state = VEP_UNTIL; break; } p++; if (*++vep->esicmt_p != '\0') continue; if (vep->remove) vep_error(vep, "ESI 1.0 Nested "; vep->state = VEP_NEXTTAG; vep_mark_skip(vep, p); break; } } else if (vep->state == VEP_CDATA) { /* * Easy: just look for the end of CDATA */ vep->until_p = vep->until = "]]>"; vep->until_s = VEP_NEXTTAG; vep->state = VEP_UNTIL; } else if (vep->state == VEP_ESITAG) { vep->in_esi_tag = 1; vep->esi_found = 1; vep_mark_skip(vep, p); vep->match = vep_match_esi; vep->state = VEP_MATCH; } else if (vep->state == VEP_ESIINCLUDE) { if (vep->remove) { vep_error(vep, "ESI 1.0 element" " nested in "); vep->state = VEP_TAGERROR; } else if (vep->endtag) { vep_error(vep, "ESI 1.0 illegal end-tag"); vep->state = VEP_TAGERROR; } else { vep->dostuff = vep_do_include; vep->state = VEP_INTAG; vep->attr = vep_match_attr_include; } } else if (vep->state == VEP_ESIREMOVE) { vep->dostuff = vep_do_remove; vep->state = VEP_INTAG; } else if (vep->state == VEP_ESICOMMENT) { if (vep->remove) { vep_error(vep, "ESI 1.0 element" " nested in "); vep->state = VEP_TAGERROR; } else if (vep->endtag) { vep_error(vep, "ESI 1.0 illegal end-tag"); vep->state = VEP_TAGERROR; } else { vep->dostuff = vep_do_comment; vep->state = VEP_INTAG; } } else if (vep->state == VEP_ESIBOGON) { vep_error(vep, "ESI 1.0 element"); vep->state = VEP_TAGERROR; /****************************************************** * SECTION D */ } else if (vep->state == VEP_INTAG) { vep->tag_i = 0; while (p < e && vct_islws(*p) && !vep->emptytag) { p++; vep->canattr = 1; } if (p < e && *p == '/' && !vep->emptytag) { p++; vep->emptytag = 1; vep->canattr = 0; } if (p < e && *p == '>') { p++; AN(vep->dostuff); vep_mark_skip(vep, p); vep->dostuff(vep, DO_TAG); vep->in_esi_tag = 0; vep->state = VEP_NEXTTAG; } else if (p < e && vep->emptytag) { vep_error(vep, "XML 1.0 '>' does not follow '/' in tag"); vep->state = VEP_TAGERROR; } else if (p < e && vep->canattr && vct_isxmlnamestart(*p)) { vep->state = VEP_ATTR; } else if (p < e) { vep_error(vep, "XML 1.0 Illegal attribute start char"); vep->state = VEP_TAGERROR; } } else if (vep->state == VEP_TAGERROR) { while (p < e && *p != '>') p++; if (p < e) { p++; vep_mark_skip(vep, p); vep->in_esi_tag = 0; vep->state = VEP_NEXTTAG; } /****************************************************** * SECTION E */ } else if (vep->state == VEP_ATTR) { AZ(vep->attr_delim); if (vep->attr == NULL) { p++; AZ(vep->attr_vsb); vep->state = VEP_SKIPATTR; } else { vep->match = vep->attr; vep->state = VEP_MATCH; } } else if (vep->state == VEP_SKIPATTR) { while (p < e && vct_isxmlname(*p)) p++; if (p < e && *p == '=') { p++; vep->state = VEP_ATTRDELIM; } else if (p < e && *p == '>') { vep->state = VEP_INTAG; } else if (p < e && *p == '/') { vep->state = VEP_INTAG; } else if (p < e && vct_issp(*p)) { vep->state = VEP_INTAG; } else if (p < e) { vep_error(vep, "XML 1.0 Illegal attr char"); vep->state = VEP_TAGERROR; } } else if (vep->state == VEP_ATTRGETVAL) { vep->attr_vsb = VSB_new_auto(); vep->state = VEP_ATTRDELIM; } else if (vep->state == VEP_ATTRDELIM) { AZ(vep->attr_delim); if (*p == '"' || *p == '\'') { vep->attr_delim = *p++; vep->state = VEP_ATTRVAL; } else if (!vct_issp(*p)) { vep->attr_delim = ' '; vep->state = VEP_ATTRVAL; } else { vep_error(vep, "XML 1.0 Illegal attribute delimiter"); vep->state = VEP_TAGERROR; } } else if (vep->state == VEP_ATTRVAL) { while (p < e && *p != '>' && *p != vep->attr_delim && (vep->attr_delim != ' ' || !vct_issp(*p))) { if (vep->attr_vsb != NULL) VSB_putc(vep->attr_vsb, *p); p++; } if (p < e && *p == '>') { vep_error(vep, "XML 1.0 Missing end attribute delimiter"); vep->state = VEP_TAGERROR; vep->attr_delim = 0; if (vep->attr_vsb != NULL) { AZ(VSB_finish(vep->attr_vsb)); VSB_delete(vep->attr_vsb); vep->attr_vsb = NULL; } } else if (p < e) { vep->attr_delim = 0; p++; vep->state = VEP_INTAG; if (vep->attr_vsb != NULL) { AZ(VSB_finish(vep->attr_vsb)); AN(vep->dostuff); vep->dostuff(vep, DO_ATTR); vep->attr_vsb = NULL; } } /****************************************************** * Utility Section */ } else if (vep->state == VEP_MATCH) { /* * Match against a table */ vm = vep_match(vep, p, e); vep->match_hit = vm; if (vm != NULL) { if (vm->match != NULL) p += strlen(vm->match); vep->state = *vm->state; vep->match = NULL; vep->tag_i = 0; } else { memcpy(vep->tag, p, e - p); vep->tag_i = e - p; vep->state = VEP_MATCHBUF; p = e; } } else if (vep->state == VEP_MATCHBUF) { /* * Match against a table while split over input * sections. */ AN(vep->match); do { if (*p == '>') { for (vm = vep->match; vm->match != NULL; vm++) continue; AZ(vm->match); } else { vep->tag[vep->tag_i++] = *p++; vm = vep_match(vep, vep->tag, vep->tag + vep->tag_i); if (vm && vm->match == NULL) { vep->tag_i--; p--; } } } while (vm == NULL && p < e); vep->match_hit = vm; if (vm == NULL) { assert(p == e); } else { vep->state = *vm->state; vep->match = NULL; } } else if (vep->state == VEP_UNTIL) { /* * Skip until we see magic string */ while (p < e) { if (*p++ != *vep->until_p++) { vep->until_p = vep->until; } else if (*vep->until_p == '\0') { vep->state = vep->until_s; break; } } if (p == e && !vep->remove) vep_mark_verbatim(vep, p); } else { Debug("*** Unknown state %s\n", vep->state); INCOMPL(); } } /* * We must always mark up the storage we got, try to do so * in the most efficient way, in particular with respect to * minimizing and limiting use of pending. */ if (p == vep->ver_p) ; else if (vep->in_esi_tag) vep_mark_skip(vep, p); else if (vep->remove) vep_mark_skip(vep, p); else vep_mark_pending(vep, p); } /*--------------------------------------------------------------------- */ static ssize_t __match_proto__() vep_default_cb(struct vfp_ctx *vc, void *priv, ssize_t l, enum vgz_flag flg) { ssize_t *s; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); AN(priv); s = priv; *s += l; (void)flg; return (*s); } /*--------------------------------------------------------------------- */ struct vep_state * VEP_Init(struct vfp_ctx *vc, const struct http *req, vep_callback_t *cb, void *cb_priv) { struct vep_state *vep; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(req, HTTP_MAGIC); vep = WS_Alloc(vc->http->ws, sizeof *vep); AN(vep); INIT_OBJ(vep, VEP_MAGIC); vep->url = req->hd[HTTP_HDR_URL].b; vep->vc = vc; vep->vsb = VSB_new_auto(); AN(vep->vsb); if (cb != NULL) { vep->dogzip = 1; /* XXX */ VSB_printf(vep->vsb, "%c", VEC_GZ); vep->cb = cb; vep->cb_priv = cb_priv; } else { vep->cb = vep_default_cb; vep->cb_priv = &vep->cb_x; } vep->state = VEP_START; vep->crc = crc32(0L, Z_NULL, 0); vep->crcp = crc32(0L, Z_NULL, 0); vep->startup = 1; return (vep); } /*--------------------------------------------------------------------- */ struct vsb * VEP_Finish(struct vep_state *vep) { ssize_t l, lcb; CHECK_OBJ_NOTNULL(vep, VEP_MAGIC); if (vep->o_pending) vep_mark_common(vep, vep->ver_p, vep->last_mark); if (vep->o_wait > 0) { lcb = vep->cb(vep->vc, vep->cb_priv, 0, VGZ_ALIGN); vep_emit_common(vep, lcb - vep->o_last, vep->last_mark); } // NB: We don't account for PAD+SUM+LEN in gzip'ed objects (void)vep->cb(vep->vc, vep->cb_priv, 0, VGZ_FINISH); AZ(VSB_finish(vep->vsb)); l = VSB_len(vep->vsb); if (vep->esi_found && l > 0) return (vep->vsb); VSB_delete(vep->vsb); return (NULL); } #if 0 digraph xml { rankdir="LR" size="7,10" ################################################################# # SECTION A # START [shape=ellipse] TESTXML [shape=ellipse] NOTXML [shape=ellipse] NEXTTAGa [shape=hexagon, label="NEXTTAG"] STARTTAGa [shape=hexagon, label="STARTTAG"] START -> TESTXML START -> NEXTTAGa [style=dotted, label="syntax:1"] TESTXML -> TESTXML [label="lws"] TESTXML -> NOTXML TESTXML -> STARTTAGa [label="'<'"] ################################################################# # SECTION B NOTMYTAG [shape=ellipse] NEXTTAG [shape=ellipse] NOTMYTAG -> NEXTTAG [style=dotted, label="syntax:2"] STARTTAGb [shape=hexagon, label="STARTTAG"] NOTMYTAG -> NEXTTAG [label="'>'"] NOTMYTAG -> NOTMYTAG [label="*"] NEXTTAG -> NEXTTAG [label="'-->'"] NEXTTAG -> NEXTTAG [label="*"] NEXTTAG -> STARTTAGb [label="'<'"] ################################################################# # SECTION C STARTTAG [shape=ellipse] COMMENT [shape=ellipse] CDATA [shape=ellipse] ESITAG [shape=ellipse] ESIETAG [shape=ellipse] ESIINCLUDE [shape=ellipse] ESIREMOVE [shape=ellipse] ESICOMMENT [shape=ellipse] ESIBOGON [shape=ellipse] INTAGc [shape=hexagon, label="INTAG"] NOTMYTAGc [shape=hexagon, label="NOTMYTAG"] NEXTTAGc [shape=hexagon, label="NEXTTAG"] TAGERRORc [shape=hexagon, label="TAGERROR"] C1 [shape=circle,label=""] STARTTAG -> COMMENT [label="'"] CDATA -> CDATA [label="*"] CDATA -> NEXTTAGc [label="]]>"] ESITAG -> ESIINCLUDE [label="'include'"] ESITAG -> ESIREMOVE [label="'remove'"] ESITAG -> ESICOMMENT [label="'comment'"] ESITAG -> ESIBOGON [label="*"] ESICOMMENT -> INTAGc ESICOMMENT -> TAGERRORc ESICOMMENT -> TAGERRORc [style=dotted, label="nested\nin\nremove"] ESIREMOVE -> INTAGc ESIREMOVE -> TAGERRORc ESIINCLUDE -> INTAGc ESIINCLUDE -> TAGERRORc ESIINCLUDE -> TAGERRORc [style=dotted, label="nested\nin\nremove"] ESIBOGON -> TAGERRORc ################################################################# # SECTION D INTAG [shape=ellipse] TAGERROR [shape=ellipse] NEXTTAGd [shape=hexagon, label="NEXTTAG"] ATTRd [shape=hexagon, label="ATTR"] D1 [shape=circle, label=""] D2 [shape=circle, label=""] INTAG -> D1 [label="lws"] D1 -> D2 [label="/"] INTAG -> D2 [label="/"] INTAG -> NEXTTAGd [label=">"] D1 -> NEXTTAGd [label=">"] D2 -> NEXTTAGd [label=">"] D1 -> ATTRd [label="XMLstartchar"] D1 -> TAGERROR [label="*"] D2 -> TAGERROR [label="*"] TAGERROR -> TAGERROR [label="*"] TAGERROR -> NEXTTAGd [label="'>'"] ################################################################# # SECTION E ATTR [shape=ellipse] SKIPATTR [shape=ellipse] ATTRGETVAL [shape=ellipse] ATTRDELIM [shape=ellipse] ATTRVAL [shape=ellipse] TAGERRORe [shape=hexagon, label="TAGERROR"] INTAGe [shape=hexagon, label="INTAG"] ATTR -> SKIPATTR [label="*"] ATTR -> ATTRGETVAL [label="wanted attr"] SKIPATTR -> SKIPATTR [label="XMLname"] SKIPATTR -> ATTRDELIM [label="'='"] SKIPATTR -> TAGERRORe [label="*"] ATTRGETVAL -> ATTRDELIM ATTRDELIM -> ATTRVAL [label="\""] ATTRDELIM -> ATTRVAL [label="\'"] ATTRDELIM -> ATTRVAL [label="*"] ATTRDELIM -> TAGERRORe [label="lws"] ATTRVAL -> TAGERRORe [label="'>'"] ATTRVAL -> INTAGe [label="delim"] ATTRVAL -> ATTRVAL [label="*"] } #endif varnish-4.1.1/bin/varnishd/cache/cache_mempool.c0000644000201500234410000002040712652366721016511 00000000000000/*- * Copyright (c) 2011 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. * * Generic memory pool */ #include "config.h" #include #include #include #include "cache.h" #include "vtim.h" struct memitem { unsigned magic; #define MEMITEM_MAGIC 0x42e55401 unsigned size; VTAILQ_ENTRY(memitem) list; double touched; }; VTAILQ_HEAD(memhead_s, memitem); struct mempool { unsigned magic; #define MEMPOOL_MAGIC 0x37a75a8d char name[12]; struct memhead_s list; struct memhead_s surplus; struct lock mtx; volatile struct poolparam *param; volatile unsigned *cur_size; uint64_t live; struct VSC_C_mempool *vsc; unsigned n_pool; pthread_t thread; double t_now; int self_destruct; }; /*--------------------------------------------------------------------- */ static struct memitem * mpl_alloc(const struct mempool *mpl) { unsigned tsz; struct memitem *mi; CHECK_OBJ_NOTNULL(mpl, MEMPOOL_MAGIC); tsz = *mpl->cur_size; mi = calloc(tsz, 1); AN(mi); mi->magic = MEMITEM_MAGIC; mi->size = tsz; mpl->vsc->sz_wanted = tsz; mpl->vsc->sz_actual = tsz - sizeof *mi; return (mi); } /*--------------------------------------------------------------------- * Pool-guard * Attempt to keep number of free items in pool inside bounds with * minimum locking activity, and keep an eye on items at the tail * of the list not getting too old. */ static void * mpl_guard(void *priv) { struct mempool *mpl; struct memitem *mi = NULL; double mpl_slp __state_variable__(mpl_slp); double last = 0; CAST_OBJ_NOTNULL(mpl, priv, MEMPOOL_MAGIC); THR_SetName(mpl->name); mpl_slp = 0.15; // random while (1) { VTIM_sleep(mpl_slp); mpl_slp = 0.814; // random mpl->t_now = VTIM_real(); if (mi != NULL && (mpl->n_pool > mpl->param->max_pool || mi->size < *mpl->cur_size)) { FREE_OBJ(mi); mi = NULL; } if (mi == NULL && mpl->n_pool < mpl->param->min_pool) mi = mpl_alloc(mpl); if (mpl->n_pool < mpl->param->min_pool && mi != NULL) { /* can do */ } else if (mpl->n_pool > mpl->param->max_pool && mi == NULL) { /* can do */ } else if (!VTAILQ_EMPTY(&mpl->surplus)) { /* can do */ } else if (last + .1 * mpl->param->max_age < mpl->t_now) { /* should do */ } else if (mpl->self_destruct) { /* can do */ } else { continue; /* nothing to do */ } mpl_slp = 0.314; // random if (Lck_Trylock(&mpl->mtx)) continue; if (mpl->self_destruct) { AZ(mpl->live); while (1) { if (mi == NULL) { mi = VTAILQ_FIRST(&mpl->list); if (mi != NULL) { mpl->vsc->pool = --mpl->n_pool; VTAILQ_REMOVE(&mpl->list, mi, list); } } if (mi == NULL) { mi = VTAILQ_FIRST(&mpl->surplus); if (mi != NULL) VTAILQ_REMOVE(&mpl->surplus, mi, list); } if (mi == NULL) break; FREE_OBJ(mi); mi = NULL; } VSM_Free(mpl->vsc); Lck_Unlock(&mpl->mtx); Lck_Delete(&mpl->mtx); FREE_OBJ(mpl); break; } if (mpl->n_pool < mpl->param->min_pool && mi != NULL && mi->size >= *mpl->cur_size) { CHECK_OBJ_NOTNULL(mi, MEMITEM_MAGIC); mpl->vsc->pool = ++mpl->n_pool; mi->touched = mpl->t_now; VTAILQ_INSERT_HEAD(&mpl->list, mi, list); mi = NULL; mpl_slp = .01; // random } if (mpl->n_pool > mpl->param->max_pool && mi == NULL) { mi = VTAILQ_FIRST(&mpl->list); CHECK_OBJ_NOTNULL(mi, MEMITEM_MAGIC); mpl->vsc->pool = --mpl->n_pool; mpl->vsc->surplus++; VTAILQ_REMOVE(&mpl->list, mi, list); mpl_slp = .01; // random } if (mi == NULL) { mi = VTAILQ_FIRST(&mpl->surplus); if (mi != NULL) { CHECK_OBJ_NOTNULL(mi, MEMITEM_MAGIC); VTAILQ_REMOVE(&mpl->surplus, mi, list); mpl_slp = .01; // random } } if (mi == NULL && mpl->n_pool > mpl->param->min_pool) { mi = VTAILQ_LAST(&mpl->list, memhead_s); CHECK_OBJ_NOTNULL(mi, MEMITEM_MAGIC); if (mi->touched + mpl->param->max_age < mpl->t_now) { mpl->vsc->pool = --mpl->n_pool; mpl->vsc->timeout++; VTAILQ_REMOVE(&mpl->list, mi, list); mpl_slp = .01; // random } else { mi = NULL; last = mpl->t_now; } } else if (mpl->n_pool <= mpl->param->min_pool) { last = mpl->t_now; } Lck_Unlock(&mpl->mtx); if (mi != NULL) { FREE_OBJ(mi); mi = NULL; } } return (NULL); } /*--------------------------------------------------------------------- * Create a new memory pool, and start the guard thread for it. */ struct mempool * MPL_New(const char *name, volatile struct poolparam *pp, volatile unsigned *cur_size) { struct mempool *mpl; ALLOC_OBJ(mpl, MEMPOOL_MAGIC); AN(mpl); bprintf(mpl->name, "MPL_%s", name); mpl->param = pp; mpl->cur_size = cur_size; VTAILQ_INIT(&mpl->list); VTAILQ_INIT(&mpl->surplus); Lck_New(&mpl->mtx, lck_mempool); /* XXX: prealloc min_pool */ mpl->vsc = VSM_Alloc(sizeof *mpl->vsc, VSC_CLASS, VSC_type_mempool, mpl->name + 4); AN(mpl->vsc); AZ(pthread_create(&mpl->thread, NULL, mpl_guard, mpl)); AZ(pthread_detach(mpl->thread)); return (mpl); } /*--------------------------------------------------------------------- * Destroy a memory pool. There must be no live items, and we cheat * and leave all the hard work to the guard thread. */ void MPL_Destroy(struct mempool **mpp) { struct mempool *mpl; AN(mpp); mpl = *mpp; *mpp = NULL; CHECK_OBJ_NOTNULL(mpl, MEMPOOL_MAGIC); Lck_Lock(&mpl->mtx); AZ(mpl->live); mpl->self_destruct = 1; Lck_Unlock(&mpl->mtx); } /*--------------------------------------------------------------------- */ void * MPL_Get(struct mempool *mpl, unsigned *size) { struct memitem *mi; CHECK_OBJ_NOTNULL(mpl, MEMPOOL_MAGIC); AN(size); Lck_Lock(&mpl->mtx); mpl->vsc->allocs++; mpl->vsc->live = ++mpl->live; do { mi = VTAILQ_FIRST(&mpl->list); if (mi == NULL) { mpl->vsc->randry++; break; } mpl->vsc->pool = --mpl->n_pool; CHECK_OBJ_NOTNULL(mi, MEMITEM_MAGIC); VTAILQ_REMOVE(&mpl->list, mi, list); if (mi->size < *mpl->cur_size) { mpl->vsc->toosmall++; VTAILQ_INSERT_HEAD(&mpl->surplus, mi, list); mi = NULL; } else { mpl->vsc->recycle++; } } while (mi == NULL); Lck_Unlock(&mpl->mtx); if (mi == NULL) mi = mpl_alloc(mpl); *size = mi->size - sizeof *mi; CHECK_OBJ_NOTNULL(mi, MEMITEM_MAGIC); /* Throw away sizeof info for FlexeLint: */ return ((void*)(uintptr_t)(mi+1)); } void MPL_Free(struct mempool *mpl, void *item) { struct memitem *mi; CHECK_OBJ_NOTNULL(mpl, MEMPOOL_MAGIC); AN(item); mi = (void*)((uintptr_t)item - sizeof(*mi)); CHECK_OBJ_NOTNULL(mi, MEMITEM_MAGIC); memset(item, 0, mi->size - sizeof *mi); Lck_Lock(&mpl->mtx); mpl->vsc->frees++; mpl->vsc->live = --mpl->live; if (mi->size < *mpl->cur_size) { mpl->vsc->toosmall++; VTAILQ_INSERT_HEAD(&mpl->surplus, mi, list); } else { mpl->vsc->pool = ++mpl->n_pool; mi->touched = mpl->t_now; VTAILQ_INSERT_HEAD(&mpl->list, mi, list); } Lck_Unlock(&mpl->mtx); } void MPL_AssertSane(void *item) { struct memitem *mi; mi = (void*)((uintptr_t)item - sizeof(*mi)); CHECK_OBJ_NOTNULL(mi, MEMITEM_MAGIC); } varnish-4.1.1/bin/varnishd/cache/cache_acceptor.c0000644000201500234410000003405612652366721016646 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This source file has the various trickery surrounding the accept/listen * sockets. * */ #include "config.h" #include #include #include #include #include #include "cache.h" #include "cache_pool.h" #include "common/heritage.h" #include "vcli.h" #include "vcli_priv.h" #include "vsa.h" #include "vtcp.h" #include "vtim.h" static pthread_t VCA_thread; static double vca_pace = 0.0; static struct lock pace_mtx; static unsigned pool_accepting; struct wrk_accept { unsigned magic; #define WRK_ACCEPT_MAGIC 0x8c4b4d59 /* Accept stuff */ struct sockaddr_storage acceptaddr; socklen_t acceptaddrlen; int acceptsock; struct listen_sock *acceptlsock; }; struct poolsock { unsigned magic; #define POOLSOCK_MAGIC 0x1b0a2d38 struct listen_sock *lsock; struct pool_task task; struct pool *pool; }; /*-------------------------------------------------------------------- * TCP options we want to control */ static struct tcp_opt { int level; int optname; const char *strname; socklen_t sz; void *ptr; int need; } tcp_opts[] = { #define TCPO(lvl, nam, sz) { lvl, nam, #nam, sizeof(sz), 0, 0}, TCPO(SOL_SOCKET, SO_LINGER, struct linger) TCPO(SOL_SOCKET, SO_KEEPALIVE, int) TCPO(IPPROTO_TCP, TCP_NODELAY, int) #ifdef SO_SNDTIMEO_WORKS TCPO(SOL_SOCKET, SO_SNDTIMEO, struct timeval) #endif #ifdef SO_RCVTIMEO_WORKS TCPO(SOL_SOCKET, SO_RCVTIMEO, struct timeval) #endif #ifdef HAVE_TCP_KEEP TCPO(IPPROTO_TCP, TCP_KEEPIDLE, int) TCPO(IPPROTO_TCP, TCP_KEEPCNT, int) TCPO(IPPROTO_TCP, TCP_KEEPINTVL, int) #endif #undef TCPO }; static const int n_tcp_opts = sizeof tcp_opts / sizeof tcp_opts[0]; /*-------------------------------------------------------------------- * We want to get out of any kind of trouble-hit TCP connections as fast * as absolutely possible, so we set them LINGER enabled with zero timeout, * so that even if there are outstanding write data on the socket, a close(2) * will return immediately. */ static const struct linger linger = { .l_onoff = 0, }; /* * We turn on keepalives by default to assist in detecting clients that have * hung up on connections returning from waitinglists */ static unsigned need_test; /*-------------------------------------------------------------------- * Some kernels have bugs/limitations with respect to which options are * inherited from the accept/listen socket, so we have to keep track of * which, if any, sockopts we have to set on the accepted socket. */ static int vca_tcp_opt_init(void) { int n; int one = 1; struct tcp_opt *to; struct timeval tv; int chg = 0; int x; memset(&tv, 0, sizeof tv); memset(&x, 0, sizeof x); for (n = 0; n < n_tcp_opts; n++) { to = &tcp_opts[n]; if (to->ptr == NULL) to->ptr = calloc(to->sz, 1); AN(to->ptr); if (!strcmp(to->strname, "SO_LINGER")) { assert(to->sz == sizeof linger); memcpy(to->ptr, &linger, sizeof linger); to->need = 1; } else if (!strcmp(to->strname, "TCP_NODELAY")) { assert(to->sz == sizeof one); memcpy(to->ptr, &one, sizeof one); to->need = 1; } else if (!strcmp(to->strname, "SO_KEEPALIVE")) { assert(to->sz == sizeof one); memcpy(to->ptr, &one, sizeof one); to->need = 1; #define NEW_VAL(to, xx) \ do { \ assert(to->sz == sizeof xx); \ if (memcmp(to->ptr, &(xx), sizeof xx)) { \ memcpy(to->ptr, &(xx), sizeof xx); \ to->need = 1; \ chg = 1; \ need_test = 1; \ } \ } while (0) #ifdef SO_SNDTIMEO_WORKS } else if (!strcmp(to->strname, "SO_SNDTIMEO")) { tv = VTIM_timeval(cache_param->idle_send_timeout); NEW_VAL(to, tv); #endif #ifdef SO_RCVTIMEO_WORKS } else if (!strcmp(to->strname, "SO_RCVTIMEO")) { tv = VTIM_timeval(cache_param->timeout_idle); NEW_VAL(to, tv); #endif #ifdef HAVE_TCP_KEEP } else if (!strcmp(to->strname, "TCP_KEEPIDLE")) { x = (int)(cache_param->tcp_keepalive_time); NEW_VAL(to, x); } else if (!strcmp(to->strname, "TCP_KEEPCNT")) { x = (int)(cache_param->tcp_keepalive_probes); NEW_VAL(to, x); } else if (!strcmp(to->strname, "TCP_KEEPINTVL")) { x = (int)(cache_param->tcp_keepalive_intvl); NEW_VAL(to, x); #endif } } return (chg); } static void vca_tcp_opt_test(int sock) { int i, n; struct tcp_opt *to; socklen_t l; void *ptr; for (n = 0; n < n_tcp_opts; n++) { to = &tcp_opts[n]; to->need = 1; ptr = calloc(to->sz, 1); AN(ptr); l = to->sz; i = getsockopt(sock, to->level, to->optname, ptr, &l); if (i == 0 && !memcmp(ptr, to->ptr, to->sz)) to->need = 0; free(ptr); if (i && errno != ENOPROTOOPT) VTCP_Assert(i); } } static void vca_tcp_opt_set(int sock, int force) { int n; struct tcp_opt *to; for (n = 0; n < n_tcp_opts; n++) { to = &tcp_opts[n]; if (to->need || force) { VTCP_Assert(setsockopt(sock, to->level, to->optname, to->ptr, to->sz)); } } } /*-------------------------------------------------------------------- * If accept(2)'ing fails, we pace ourselves to relive any resource * shortage if possible. */ static void vca_pace_check(void) { double p; if (vca_pace == 0.0) return; Lck_Lock(&pace_mtx); p = vca_pace; Lck_Unlock(&pace_mtx); if (p > 0.0) VTIM_sleep(p); } static void vca_pace_bad(void) { Lck_Lock(&pace_mtx); vca_pace += cache_param->acceptor_sleep_incr; if (vca_pace > cache_param->acceptor_sleep_max) vca_pace = cache_param->acceptor_sleep_max; Lck_Unlock(&pace_mtx); } static void vca_pace_good(void) { if (vca_pace == 0.0) return; Lck_Lock(&pace_mtx); vca_pace *= cache_param->acceptor_sleep_decay; if (vca_pace < cache_param->acceptor_sleep_incr) vca_pace = 0.0; Lck_Unlock(&pace_mtx); } /*-------------------------------------------------------------------- * The pool-task for a newly accepted session * * Called from assigned worker thread */ static void __match_proto__(task_func_t) vca_make_session(struct worker *wrk, void *arg) { struct sess *sp; struct wrk_accept *wa; struct sockaddr_storage ss; struct suckaddr *sa; socklen_t sl; char laddr[VTCP_ADDRBUFSIZE]; char lport[VTCP_PORTBUFSIZE]; char raddr[VTCP_ADDRBUFSIZE]; char rport[VTCP_PORTBUFSIZE]; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CAST_OBJ_NOTNULL(wa, arg, WRK_ACCEPT_MAGIC); /* Turn accepted socket into a session */ AN(wrk->aws->r); sp = SES_New(wrk->pool); if (sp == NULL) { /* * We consider this a DoS situation and silently close the * connection with minimum effort and fuzz, rather than try * to send an intelligent message back. */ AZ(close(wa->acceptsock)); wrk->stats->sess_drop++; vca_pace_bad(); WS_Release(wrk->aws, 0); return; } CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); wrk->stats->s_sess++; sp->t_open = VTIM_real(); sp->t_idle = sp->t_open; sp->vxid = VXID_Get(wrk, VSL_CLIENTMARKER); sp->fd = wa->acceptsock; wa->acceptsock = -1; sp->sess_step = wa->acceptlsock->first_step; assert(wa->acceptaddrlen <= vsa_suckaddr_len); SES_Reserve_remote_addr(sp, &sa); AN(VSA_Build(sa, &wa->acceptaddr, wa->acceptaddrlen)); sp->sattr[SA_CLIENT_ADDR] = sp->sattr[SA_REMOTE_ADDR]; VTCP_name(sa, raddr, sizeof raddr, rport, sizeof rport); SES_Set_String_Attr(sp, SA_CLIENT_IP, raddr); SES_Set_String_Attr(sp, SA_CLIENT_PORT, rport); sl = sizeof ss; AZ(getsockname(sp->fd, (void*)&ss, &sl)); SES_Reserve_local_addr(sp, &sa); AN(VSA_Build(sa, &ss, sl)); sp->sattr[SA_SERVER_ADDR] = sp->sattr[SA_LOCAL_ADDR]; VTCP_name(sa, laddr, sizeof laddr, lport, sizeof lport); VSL(SLT_Begin, sp->vxid, "sess 0 %s", wa->acceptlsock->proto_name); VSL(SLT_SessOpen, sp->vxid, "%s %s %s %s %s %.6f %d", raddr, rport, wa->acceptlsock->name, laddr, lport, sp->t_open, sp->fd); WS_Release(wrk->aws, 0); vca_pace_good(); wrk->stats->sess_conn++; if (need_test) { vca_tcp_opt_test(sp->fd); need_test = 0; } vca_tcp_opt_set(sp->fd, 0); /* SES_Proto_Sess() must be sceduled with reserved WS */ assert(8 <= WS_Reserve(sp->ws, 8)); wrk->task.func = SES_Proto_Sess; wrk->task.priv = sp; } /*-------------------------------------------------------------------- * This function accepts on a single socket for a single session pool. * * As long as we can stick the accepted connection to another thread * we do so, otherwise we put the socket back on the "BACK" pool * and handle the new connection ourselves. */ static void __match_proto__(task_func_t) vca_accept_task(struct worker *wrk, void *arg) { struct wrk_accept wa; struct poolsock *ps; struct listen_sock *ls; int i; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CAST_OBJ_NOTNULL(ps, arg, POOLSOCK_MAGIC); ls = ps->lsock; CHECK_OBJ_NOTNULL(ls, LISTEN_SOCK_MAGIC); while (!pool_accepting) VTIM_sleep(.1); while (1) { INIT_OBJ(&wa, WRK_ACCEPT_MAGIC); wa.acceptlsock = ls; vca_pace_check(); wa.acceptaddrlen = sizeof wa.acceptaddr; do { i = accept(ls->sock, (void*)&wa.acceptaddr, &wa.acceptaddrlen); } while (i < 0 && errno == EAGAIN); if (i < 0) { switch (errno) { case ECONNABORTED: break; case EMFILE: VSL(SLT_Debug, ls->sock, "Too many open files"); vca_pace_bad(); break; case EBADF: VSL(SLT_Debug, ls->sock, "Accept failed: %s", strerror(errno)); return; default: VSL(SLT_Debug, ls->sock, "Accept failed: %s", strerror(errno)); vca_pace_bad(); break; } wrk->stats->sess_fail++; (void)Pool_TrySumstat(wrk); continue; } wa.acceptsock = i; if (!Pool_Task_Arg(wrk, vca_make_session, &wa, sizeof wa)) { /* * We couldn't get another thread, so we will handle * the request in this worker thread, but first we * must reschedule the listening task so it will be * taken up by another thread again. */ AZ(Pool_Task(wrk->pool, &ps->task, TASK_QUEUE_VCA)); return; } /* * We were able to hand off, so release this threads VCL * reference (if any) so we don't hold on to discarded VCLs. */ if (wrk->vcl != NULL) VCL_Rel(&wrk->vcl); } } /*-------------------------------------------------------------------- * Called when a worker and attached session pool is created, to * allocate the tasks which will listen to sockets for that pool. */ void VCA_NewPool(struct pool *pp) { struct listen_sock *ls; struct poolsock *ps; VTAILQ_FOREACH(ls, &heritage.socks, list) { ALLOC_OBJ(ps, POOLSOCK_MAGIC); AN(ps); ps->lsock = ls; ps->task.func = vca_accept_task; ps->task.priv = ps; ps->pool = pp; AZ(Pool_Task(pp, &ps->task, TASK_QUEUE_VCA)); } } /*--------------------------------------------------------------------*/ static void * vca_acct(void *arg) { struct listen_sock *ls; double t0, now; THR_SetName("cache-acceptor"); (void)arg; (void)vca_tcp_opt_init(); VTAILQ_FOREACH(ls, &heritage.socks, list) { assert (ls->sock > 0); // We know where stdin is AZ(listen(ls->sock, cache_param->listen_depth)); vca_tcp_opt_set(ls->sock, 1); if (cache_param->accept_filter) { int i; i = VTCP_filter_http(ls->sock); if (i) VSL(SLT_Error, ls->sock, "Kernel filtering: sock=%d, ret=%d %s", ls->sock, i, strerror(errno)); } } need_test = 1; pool_accepting = 1; t0 = VTIM_real(); while (1) { (void)sleep(1); if (vca_tcp_opt_init()) { VTAILQ_FOREACH(ls, &heritage.socks, list) vca_tcp_opt_set(ls->sock, 1); } now = VTIM_real(); VSC_C_main->uptime = (uint64_t)(now - t0); } NEEDLESS_RETURN(NULL); } /*--------------------------------------------------------------------*/ static void ccf_start(struct cli *cli, const char * const *av, void *priv) { (void)cli; (void)av; (void)priv; AZ(pthread_create(&VCA_thread, NULL, vca_acct, NULL)); } /*--------------------------------------------------------------------*/ static void ccf_listen_address(struct cli *cli, const char * const *av, void *priv) { struct listen_sock *ls; char h[32], p[32]; (void)cli; (void)av; (void)priv; /* * This CLI command is primarily used by varnishtest. Don't * respond until listen(2) has been called, in order to avoid * a race where varnishtest::client would attempt to connect(2) * before listen(2) has been called. */ while(!pool_accepting) VTIM_sleep(.1); VTAILQ_FOREACH(ls, &heritage.socks, list) { VTCP_myname(ls->sock, h, sizeof h, p, sizeof p); VCLI_Out(cli, "%s %s\n", h, p); } } /*--------------------------------------------------------------------*/ static struct cli_proto vca_cmds[] = { { CLI_SERVER_START, "i", ccf_start }, { "debug.listen_address", "debug.listen_address", "\tReport the actual listen address.", 0, 0, "d", ccf_listen_address, NULL }, { NULL } }; void VCA_Init(void) { CLI_AddFuncs(vca_cmds); Lck_New(&pace_mtx, lck_vcapace); } void VCA_Shutdown(void) { struct listen_sock *ls; int i; VTAILQ_FOREACH(ls, &heritage.socks, list) { i = ls->sock; ls->sock = -1; (void)close(i); } } varnish-4.1.1/bin/varnishd/cache/cache_vcl.c0000644000201500234410000005225012652366721015626 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Interface *to* compiled VCL code: Loading, unloading, calling into etc. * * The interface *from* the compiled VCL code is in cache_vrt.c. */ #include "config.h" #include #include #include #include "cache.h" #include "vcl.h" #include "vrt.h" #include "cache_director.h" #include "cache_backend.h" #include "vcli.h" #include "vcli_priv.h" static const char * const VCL_TEMP_INIT = "init"; static const char * const VCL_TEMP_COLD = "cold"; static const char * const VCL_TEMP_WARM = "warm"; static const char * const VCL_TEMP_BUSY = "busy"; static const char * const VCL_TEMP_COOLING = "cooling"; struct vcl { unsigned magic; #define VCL_MAGIC 0x214188f2 VTAILQ_ENTRY(vcl) list; void *dlh; const struct VCL_conf *conf; char state[8]; char *loaded_name; unsigned busy; unsigned discard; const char *temp; VTAILQ_HEAD(,backend) backend_list; VTAILQ_HEAD(,vclref) ref_list; }; struct vclref { unsigned magic; #define VCLREF_MAGIC 0x47fb6848 const struct vcl *vcl; VTAILQ_ENTRY(vclref) list; char desc[32]; }; /* * XXX: Presently all modifications to this list happen from the * CLI event-engine, so no locking is necessary */ static VTAILQ_HEAD(, vcl) vcl_head = VTAILQ_HEAD_INITIALIZER(vcl_head); static struct lock vcl_mtx; static struct vcl *vcl_active; /* protected by vcl_mtx */ /*--------------------------------------------------------------------*/ void VCL_Panic(struct vsb *vsb, const struct vcl *vcl) { int i; AN(vsb); if (vcl == NULL) return; VSB_printf(vsb, "vcl = {\n"); VSB_indent(vsb, 2); VSB_printf(vsb, "temp = %s\n", vcl->temp); VSB_printf(vsb, "srcname = {\n"); VSB_indent(vsb, 2); for (i = 0; i < vcl->conf->nsrc; ++i) VSB_printf(vsb, "\"%s\",\n", vcl->conf->srcname[i]); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ const char * VCL_Return_Name(unsigned r) { switch (r) { #define VCL_RET_MAC(l, U, B) case VCL_RET_##U: return(#l); #include "tbl/vcl_returns.h" #undef VCL_RET_MAC default: return (NULL); } } const char * VCL_Method_Name(unsigned m) { switch (m) { #define VCL_MET_MAC(func, upper, typ, bitmap) case VCL_MET_##upper: return (#upper); #include "tbl/vcl_returns.h" #undef VCL_MET_MAC default: return (NULL); } } /*--------------------------------------------------------------------*/ static void VCL_Get(struct vcl **vcc) { while (vcl_active == NULL) (void)usleep(100000); CHECK_OBJ_NOTNULL(vcl_active, VCL_MAGIC); assert(vcl_active->temp == VCL_TEMP_WARM); Lck_Lock(&vcl_mtx); AN(vcl_active); *vcc = vcl_active; AN(*vcc); AZ((*vcc)->discard); (*vcc)->busy++; Lck_Unlock(&vcl_mtx); } void VCL_Refresh(struct vcl **vcc) { CHECK_OBJ_NOTNULL(vcl_active, VCL_MAGIC); assert(vcl_active->temp == VCL_TEMP_WARM); if (*vcc == vcl_active) return; if (*vcc != NULL) VCL_Rel(vcc); /* XXX: optimize locking */ VCL_Get(vcc); } void VCL_Ref(struct vcl *vcl) { CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); assert(vcl->temp != VCL_TEMP_INIT && vcl->temp != VCL_TEMP_COLD); Lck_Lock(&vcl_mtx); assert(vcl->busy > 0); vcl->busy++; Lck_Unlock(&vcl_mtx); } void VCL_Rel(struct vcl **vcc) { struct vcl *vcl; AN(*vcc); vcl = *vcc; *vcc = NULL; CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); Lck_Lock(&vcl_mtx); assert(vcl->busy > 0); vcl->busy--; /* * We do not garbage collect discarded VCL's here, that happens * in VCL_Poll() which is called from the CLI thread. */ Lck_Unlock(&vcl_mtx); } /*--------------------------------------------------------------------*/ int VCL_AddBackend(struct vcl *vcl, struct backend *be) { CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); if (vcl->temp == VCL_TEMP_COOLING) return (1); Lck_Lock(&vcl_mtx); VTAILQ_INSERT_TAIL(&vcl->backend_list, be, vcl_list); Lck_Unlock(&vcl_mtx); if (vcl->temp == VCL_TEMP_WARM || vcl->temp == VCL_TEMP_BUSY) /* Only when adding backend to already warm VCL */ VBE_Event(be, VCL_EVENT_WARM); else if (vcl->temp != VCL_TEMP_INIT) WRONG("Dynamic Backends can only be added to warm VCLs"); return (0); } void VCL_DelBackend(struct backend *be) { struct vcl *vcl; CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); vcl = be->vcl; CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); Lck_Lock(&vcl_mtx); VTAILQ_REMOVE(&vcl->backend_list, be, vcl_list); Lck_Unlock(&vcl_mtx); if (vcl->temp == VCL_TEMP_WARM) VBE_Event(be, VCL_EVENT_COLD); } static void vcl_BackendEvent(const struct vcl *vcl, enum vcl_event_e e) { struct backend *be; ASSERT_CLI(); CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); AZ(vcl->busy); VTAILQ_FOREACH(be, &vcl->backend_list, vcl_list) VBE_Event(be, e); } static void vcl_KillBackends(struct vcl *vcl) { struct backend *be; CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); AZ(vcl->busy); assert(VTAILQ_EMPTY(&vcl->ref_list)); while (1) { be = VTAILQ_FIRST(&vcl->backend_list); if (be == NULL) break; VTAILQ_REMOVE(&vcl->backend_list, be, vcl_list); VBE_Delete(be); } } /*--------------------------------------------------------------------*/ static struct vcl * VCL_Open(const char *fn, struct vsb *msg) { struct vcl *vcl; void *dlh; struct VCL_conf const *cnf; AN(fn); AN(msg); dlh = dlopen(fn, RTLD_NOW | RTLD_LOCAL); if (dlh == NULL) { VSB_printf(msg, "Could not load compiled VCL.\n"); VSB_printf(msg, "\tdlopen(%s) = %s\n", fn, dlerror()); return (NULL); } cnf = dlsym(dlh, "VCL_conf"); if (cnf == NULL) { VSB_printf(msg, "Compiled VCL lacks metadata.\n"); (void)dlclose(dlh); return (NULL); } if (cnf->magic != VCL_CONF_MAGIC) { VSB_printf(msg, "Compiled VCL has mangled metadata.\n"); (void)dlclose(dlh); return (NULL); } ALLOC_OBJ(vcl, VCL_MAGIC); AN(vcl); vcl->dlh = dlh; vcl->conf = cnf; return (vcl); } static void VCL_Close(struct vcl **vclp) { struct vcl *vcl; CHECK_OBJ_NOTNULL(*vclp, VCL_MAGIC); vcl = *vclp; *vclp = NULL; AZ(dlclose(vcl->dlh)); FREE_OBJ(vcl); } /*-------------------------------------------------------------------- * NB: This function is called from the test-load subprocess. */ int VCL_TestLoad(const char *fn) { struct vsb *vsb; struct vcl *vcl; int retval = 0; AN(fn); vsb = VSB_new_auto(); AN(vsb); vcl = VCL_Open(fn, vsb); if (vcl == NULL) { AZ(VSB_finish(vsb)); fprintf(stderr, "%s", VSB_data(vsb)); retval = -1; } else VCL_Close(&vcl); VSB_delete(vsb); return (retval); } /*--------------------------------------------------------------------*/ struct director * VCL_DefaultDirector(const struct vcl *vcl) { CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); return (*vcl->conf->default_director); } const char * VCL_Name(const struct vcl *vcl) { CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); return (vcl->loaded_name); } const struct vrt_backend_probe * VCL_DefaultProbe(const struct vcl *vcl) { CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); return (vcl->conf->default_probe); } /*--------------------------------------------------------------------*/ void VRT_count(VRT_CTX, unsigned u) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->vcl, VCL_MAGIC); assert(u < ctx->vcl->conf->nref); if (ctx->vsl != NULL) VSLb(ctx->vsl, SLT_VCL_trace, "%u %u.%u", u, ctx->vcl->conf->ref[u].line, ctx->vcl->conf->ref[u].pos); } struct vclref * VRT_ref_vcl(VRT_CTX, const char *desc) { struct vcl *vcl; struct vclref* ref; ASSERT_CLI(); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(desc); AN(*desc); vcl = ctx->vcl; CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); xxxassert(vcl->temp == VCL_TEMP_WARM); ALLOC_OBJ(ref, VCLREF_MAGIC); AN(ref); ref->vcl = vcl; bprintf(ref->desc, "%s", desc); Lck_Lock(&vcl_mtx); VTAILQ_INSERT_TAIL(&vcl->ref_list, ref, list); Lck_Unlock(&vcl_mtx); return (ref); } void VRT_rel_vcl(VRT_CTX, struct vclref **refp) { struct vcl *vcl; struct vclref *ref; AN(refp); ref = *refp; *refp = NULL; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ref, VCLREF_MAGIC); vcl = ctx->vcl; CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); assert(vcl == ref->vcl); assert(vcl->temp == VCL_TEMP_WARM || vcl->temp == VCL_TEMP_BUSY || vcl->temp == VCL_TEMP_COOLING); Lck_Lock(&vcl_mtx); assert(!VTAILQ_EMPTY(&vcl->ref_list)); VTAILQ_REMOVE(&vcl->ref_list, ref, list); /* No garbage collection here, for the same reasons as in VCL_Rel. */ Lck_Unlock(&vcl_mtx); FREE_OBJ(ref); } /*--------------------------------------------------------------------*/ static struct vcl * vcl_find(const char *name) { struct vcl *vcl; ASSERT_CLI(); VTAILQ_FOREACH(vcl, &vcl_head, list) { if (vcl->discard) continue; if (!strcmp(vcl->loaded_name, name)) return (vcl); } return (NULL); } static int vcl_setup_event(VRT_CTX, enum vcl_event_e ev) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(ctx->handling); AN(ctx->vcl); AN(ctx->msg); assert(ev == VCL_EVENT_LOAD || ev == VCL_EVENT_WARM); return (ctx->vcl->conf->event_vcl(ctx, ev)); } static void vcl_failsafe_event(VRT_CTX, enum vcl_event_e ev) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(ctx->handling); AN(ctx->vcl); assert(ev == VCL_EVENT_COLD || ev == VCL_EVENT_DISCARD || ev == VCL_EVENT_USE); if (ctx->vcl->conf->event_vcl(ctx, ev) != 0) WRONG("A VMOD cannot fail USE, COLD or DISCARD events"); } static void vcl_print_refs(VRT_CTX) { struct vcl *vcl; struct vclref *ref; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->vcl, VCL_MAGIC); AN(ctx->msg); vcl = ctx->vcl; VSB_printf(ctx->msg, "VCL %s is waiting for:", vcl->loaded_name); Lck_Lock(&vcl_mtx); VTAILQ_FOREACH(ref, &ctx->vcl->ref_list, list) VSB_printf(ctx->msg, "\n\t- %s", ref->desc); Lck_Unlock(&vcl_mtx); } static int vcl_set_state(VRT_CTX, const char *state) { struct vcl *vcl; int i = 0; ASSERT_CLI(); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(ctx->handling); AN(ctx->vcl); AN(state); assert(ctx->msg != NULL || *state == '0'); vcl = ctx->vcl; AN(vcl->temp); switch(state[0]) { case '0': assert(vcl->temp != VCL_TEMP_COLD); if (vcl->busy == 0 && (vcl->temp == VCL_TEMP_WARM || vcl->temp == VCL_TEMP_BUSY)) { vcl->temp = VTAILQ_EMPTY(&vcl->ref_list) ? VCL_TEMP_COLD : VCL_TEMP_COOLING; vcl_failsafe_event(ctx, VCL_EVENT_COLD); vcl_BackendEvent(vcl, VCL_EVENT_COLD); } else if (vcl->busy) vcl->temp = VCL_TEMP_BUSY; else if (VTAILQ_EMPTY(&vcl->ref_list)) vcl->temp = VCL_TEMP_COLD; else vcl->temp = VCL_TEMP_COOLING; break; case '1': assert(vcl->temp != VCL_TEMP_WARM); /* The warm VCL hasn't seen a cold event yet */ if (vcl->temp == VCL_TEMP_BUSY) vcl->temp = VCL_TEMP_WARM; /* The VCL must first reach a stable cold state */ else if (vcl->temp == VCL_TEMP_COOLING) { vcl_print_refs(ctx); i = -1; } else { vcl->temp = VCL_TEMP_WARM; i = vcl_setup_event(ctx, VCL_EVENT_WARM); if (i == 0) vcl_BackendEvent(vcl, VCL_EVENT_WARM); else AZ(vcl->conf->event_vcl(ctx, VCL_EVENT_COLD)); } break; default: WRONG("Wrong enum state"); } return (i); } static void vcl_cancel_load(VRT_CTX, struct cli *cli, const char *name, const char *step) { struct vcl *vcl = ctx->vcl; AZ(VSB_finish(ctx->msg)); VCLI_SetResult(cli, CLIS_CANT); VCLI_Out(cli, "VCL \"%s\" Failed %s", name, step); if (VSB_len(ctx->msg)) VCLI_Out(cli, "\nMessage:\n\t%s", VSB_data(ctx->msg)); AZ(vcl->conf->event_vcl(ctx, VCL_EVENT_DISCARD)); vcl_KillBackends(vcl); VCL_Close(&vcl); VSB_delete(ctx->msg); } static void VCL_Load(struct cli *cli, const char *name, const char *fn, const char *state) { struct vcl *vcl; struct vrt_ctx ctx; unsigned hand = 0; struct vsb *vsb; int i; ASSERT_CLI(); vcl = vcl_find(name); if (vcl != NULL) { VCLI_SetResult(cli, CLIS_PARAM); VCLI_Out(cli, "Config '%s' already loaded", name); return; } vsb = VSB_new_auto(); AN(vsb); vcl = VCL_Open(fn, vsb); if (vcl == NULL) { AZ(VSB_finish(vsb)); VCLI_SetResult(cli, CLIS_PARAM); VCLI_Out(cli, "%s", VSB_data(vsb)); VSB_delete(vsb); return; } vcl->loaded_name = strdup(name); XXXAN(vcl->loaded_name); VTAILQ_INIT(&vcl->backend_list); VTAILQ_INIT(&vcl->ref_list); vcl->temp = VCL_TEMP_INIT; INIT_OBJ(&ctx, VRT_CTX_MAGIC); ctx.method = VCL_MET_INIT; ctx.handling = &hand; ctx.vcl = vcl; VSB_clear(vsb); ctx.msg = vsb; i = vcl_setup_event(&ctx, VCL_EVENT_LOAD); if (i) { vcl_cancel_load(&ctx, cli, name, "initialization"); return; } VSB_clear(vsb); i = vcl_set_state(&ctx, state); if (i) { assert(*state == '1'); vcl_cancel_load(&ctx, cli, name, "warmup"); return; } VSB_delete(vsb); bprintf(vcl->state, "%s", state + 1); assert(hand == VCL_RET_OK); VCLI_Out(cli, "Loaded \"%s\" as \"%s\"", fn , name); VTAILQ_INSERT_TAIL(&vcl_head, vcl, list); Lck_Lock(&vcl_mtx); if (vcl_active == NULL) vcl_active = vcl; Lck_Unlock(&vcl_mtx); VSC_C_main->n_vcl++; VSC_C_main->n_vcl_avail++; } /*-------------------------------------------------------------------- * This function is polled from the CLI thread to dispose of any non-busy * VCLs which have been discarded. */ static void VCL_Nuke(struct vcl *vcl) { struct vrt_ctx ctx; unsigned hand = 0; INIT_OBJ(&ctx, VRT_CTX_MAGIC); ASSERT_CLI(); assert(vcl != vcl_active); assert(vcl->discard); AZ(vcl->busy); assert(VTAILQ_EMPTY(&vcl->ref_list)); VTAILQ_REMOVE(&vcl_head, vcl, list); ctx.method = VCL_MET_FINI; ctx.handling = &hand; ctx.vcl = vcl; vcl_failsafe_event(&ctx, VCL_EVENT_DISCARD); vcl_KillBackends(vcl); free(vcl->loaded_name); VCL_Close(&vcl); VSC_C_main->n_vcl--; VSC_C_main->n_vcl_discard--; } /*--------------------------------------------------------------------*/ void VCL_Poll(void) { struct vrt_ctx ctx; struct vcl *vcl, *vcl2; unsigned hand; ASSERT_CLI(); VTAILQ_FOREACH_SAFE(vcl, &vcl_head, list, vcl2) { if (vcl->temp == VCL_TEMP_BUSY || vcl->temp == VCL_TEMP_COOLING) { INIT_OBJ(&ctx, VRT_CTX_MAGIC); ctx.vcl = vcl; ctx.handling = &hand; (void)vcl_set_state(&ctx, "0"); } if (vcl->discard && vcl->temp == VCL_TEMP_COLD) VCL_Nuke(vcl); } } /*--------------------------------------------------------------------*/ static void __match_proto__(cli_func_t) ccf_config_list(struct cli *cli, const char * const *av, void *priv) { struct vcl *vcl; const char *flg; (void)av; (void)priv; ASSERT_CLI(); VTAILQ_FOREACH(vcl, &vcl_head, list) { if (vcl == vcl_active) { flg = "active"; } else if (vcl->discard) { flg = "discarded"; } else flg = "available"; VCLI_Out(cli, "%-10s %4s/%-8s %6u %s\n", flg, vcl->state, vcl->temp, vcl->busy, vcl->loaded_name); } } static void __match_proto__(cli_func_t) ccf_config_load(struct cli *cli, const char * const *av, void *priv) { AZ(priv); ASSERT_CLI(); VCL_Load(cli, av[2], av[3], av[4]); } static void __match_proto__(cli_func_t) ccf_config_state(struct cli *cli, const char * const *av, void *priv) { struct vrt_ctx ctx; unsigned hand; INIT_OBJ(&ctx, VRT_CTX_MAGIC); ctx.msg = VSB_new_auto(); AN(ctx.msg); ctx.handling = &hand; (void)cli; AZ(priv); ASSERT_CLI(); AN(av[2]); AN(av[3]); ctx.vcl = vcl_find(av[2]); AN(ctx.vcl); // MGT ensures this if (vcl_set_state(&ctx, av[3]) == 0) { bprintf(ctx.vcl->state, "%s", av[3] + 1); VSB_delete(ctx.msg); return; } AZ(VSB_finish(ctx.msg)); VCLI_SetResult(cli, CLIS_CANT); VCLI_Out(cli, "Failed ", ctx.vcl->loaded_name, av[3] + 1); if (VSB_len(ctx.msg)) VCLI_Out(cli, "\nMessage:\n\t%s", VSB_data(ctx.msg)); VSB_delete(ctx.msg); } static void __match_proto__(cli_func_t) ccf_config_discard(struct cli *cli, const char * const *av, void *priv) { struct vcl *vcl; ASSERT_CLI(); (void)cli; AZ(priv); vcl = vcl_find(av[2]); AN(vcl); // MGT ensures this Lck_Lock(&vcl_mtx); assert (vcl != vcl_active); // MGT ensures this VSC_C_main->n_vcl_discard++; VSC_C_main->n_vcl_avail--; vcl->discard = 1; Lck_Unlock(&vcl_mtx); if (vcl->temp == VCL_TEMP_COLD) VCL_Nuke(vcl); } static void __match_proto__(cli_func_t) ccf_config_use(struct cli *cli, const char * const *av, void *priv) { struct vcl *vcl; struct vrt_ctx ctx; unsigned hand = 0; ASSERT_CLI(); AN(cli); AZ(priv); vcl = vcl_find(av[2]); AN(vcl); // MGT ensures this assert(vcl->temp == VCL_TEMP_WARM); // MGT ensures this INIT_OBJ(&ctx, VRT_CTX_MAGIC); ctx.handling = &hand; ctx.vcl = vcl; vcl_failsafe_event(&ctx, VCL_EVENT_USE); Lck_Lock(&vcl_mtx); vcl_active = vcl; Lck_Unlock(&vcl_mtx); } static void __match_proto__(cli_func_t) ccf_config_show(struct cli *cli, const char * const *av, void *priv) { struct vcl *vcl; int verbose = 0; int i; ASSERT_CLI(); AZ(priv); if (!strcmp(av[2], "-v") && av[3] == NULL) { VCLI_Out(cli, "Too few parameters"); VCLI_SetResult(cli, CLIS_TOOFEW); return; } else if (strcmp(av[2], "-v") && av[3] != NULL) { VCLI_Out(cli, "Unknown options '%s'", av[2]); VCLI_SetResult(cli, CLIS_PARAM); return; } else if (av[3] != NULL) { verbose = 1; vcl = vcl_find(av[3]); } else vcl = vcl_find(av[2]); if (vcl == NULL) { VCLI_Out(cli, "No VCL named '%s'", av[3] == NULL ? av[2] : av[3]); VCLI_SetResult(cli, CLIS_PARAM); return; } if (verbose) { for (i = 0; i < vcl->conf->nsrc; i++) VCLI_Out(cli, "// VCL.SHOW %d %zd %s\n%s\n", i, strlen(vcl->conf->srcbody[i]), vcl->conf->srcname[i], vcl->conf->srcbody[i]); } else { VCLI_Out(cli, "%s", vcl->conf->srcbody[0]); } } /*-------------------------------------------------------------------- * Method functions to call into VCL programs. * * Either the request or busyobject must be specified, but not both. * The workspace argument is where random VCL stuff gets space from. */ static void vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo, void *specific, unsigned method, vcl_func_f *func) { char *aws; struct vsl_log *vsl = NULL; struct vrt_ctx ctx; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); INIT_OBJ(&ctx, VRT_CTX_MAGIC); if (req != NULL) { CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req->sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(req->vcl, VCL_MAGIC); vsl = req->vsl; ctx.vcl = req->vcl; ctx.http_req = req->http; ctx.http_req_top = req->top->http; ctx.http_resp = req->resp; ctx.req = req; ctx.now = req->t_prev; ctx.ws = req->ws; } if (bo != NULL) { CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo->vcl, VCL_MAGIC); vsl = bo->vsl; ctx.vcl = bo->vcl; ctx.http_bereq = bo->bereq; ctx.http_beresp = bo->beresp; ctx.bo = bo; ctx.now = bo->t_prev; ctx.ws = bo->ws; } assert(ctx.now != 0); ctx.vsl = vsl; ctx.specific = specific; ctx.method = method; ctx.handling = &wrk->handling; aws = WS_Snapshot(wrk->aws); wrk->handling = 0; wrk->cur_method = method; wrk->seen_methods |= method; AN(vsl); VSLb(vsl, SLT_VCL_call, "%s", VCL_Method_Name(method)); (void)func(&ctx); VSLb(vsl, SLT_VCL_return, "%s", VCL_Return_Name(wrk->handling)); wrk->cur_method |= 1; // Magic marker /* * VCL/Vmods are not allowed to make permanent allocations from * wrk->aws, but they can reserve and return from it. */ assert(aws == WS_Snapshot(wrk->aws)); } #define VCL_MET_MAC(func, upper, typ, bitmap) \ void \ VCL_##func##_method(struct vcl *vcl, struct worker *wrk, \ struct req *req, struct busyobj *bo, void *specific) \ { \ \ CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); \ CHECK_OBJ_NOTNULL(vcl->conf, VCL_CONF_MAGIC); \ CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); \ vcl_call_method(wrk, req, bo, specific, \ VCL_MET_ ## upper, vcl->conf->func##_func); \ AN((1U << wrk->handling) & bitmap); \ } #include "tbl/vcl_returns.h" #undef VCL_MET_MAC /*--------------------------------------------------------------------*/ static struct cli_proto vcl_cmds[] = { { CLI_VCL_LOAD, "i", ccf_config_load }, { CLI_VCL_LIST, "i", ccf_config_list }, { CLI_VCL_STATE, "i", ccf_config_state }, { CLI_VCL_DISCARD, "i", ccf_config_discard }, { CLI_VCL_USE, "i", ccf_config_use }, { CLI_VCL_SHOW, "", ccf_config_show }, { NULL } }; void VCL_Init(void) { CLI_AddFuncs(vcl_cmds); Lck_New(&vcl_mtx, lck_vcl); } varnish-4.1.1/bin/varnishd/cache/cache_vrt_var.c0000644000201500234410000004220112652366721016520 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Runtime support for compiled VCL programs */ #include "config.h" #include "cache.h" #include "common/heritage.h" #include "hash/hash_slinger.h" #include "cache_director.h" #include "vrt.h" #include "vrt_obj.h" static char vrt_hostname[255] = ""; /*-------------------------------------------------------------------- * VRT variables relating to first line of HTTP/1.1 req/resp */ static void vrt_do_string(const struct http *hp, int fld, const char *err, const char *p, va_list ap) { const char *b; CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); b = VRT_String(hp->ws, NULL, p, ap); if (b == NULL || *b == '\0') { VSLb(hp->vsl, SLT_LostHeader, "%s", err); WS_MarkOverflow(hp->ws); return; } http_SetH(hp, fld, b); } #define VRT_HDR_L(obj, hdr, fld) \ void \ VRT_l_##obj##_##hdr(VRT_CTX, const char *p, ...) \ { \ va_list ap; \ \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ va_start(ap, p); \ vrt_do_string(ctx->http_##obj, fld, #obj "." #hdr, p, ap); \ va_end(ap); \ } #define VRT_HDR_R(obj, hdr, fld) \ const char * \ VRT_r_##obj##_##hdr(VRT_CTX) \ { \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->http_##obj, HTTP_MAGIC); \ return (ctx->http_##obj->hd[fld].b); \ } #define VRT_HDR_LR(obj, hdr, fld) \ VRT_HDR_L(obj, hdr, fld) \ VRT_HDR_R(obj, hdr, fld) #define VRT_STATUS_L(obj) \ void \ VRT_l_##obj##_status(VRT_CTX, long num) \ { \ \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->http_##obj, HTTP_MAGIC); \ if (num > 65535) { \ VSLb(ctx->vsl, SLT_VCL_Error, "%s.status > 65535", #obj); \ WS_MarkOverflow(ctx->http_##obj->ws); \ } else if ((num % 1000) < 100) { \ VSLb(ctx->vsl, SLT_VCL_Error, "illegal %s.status (..0##)", \ #obj); \ WS_MarkOverflow(ctx->http_##obj->ws); \ } else { \ http_SetStatus(ctx->http_##obj, (uint16_t)num); \ } \ } #define VRT_STATUS_R(obj) \ long \ VRT_r_##obj##_status(VRT_CTX) \ { \ \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->http_##obj, HTTP_MAGIC); \ return(ctx->http_##obj->status); \ } VRT_HDR_LR(req, method, HTTP_HDR_METHOD) VRT_HDR_LR(req, url, HTTP_HDR_URL) VRT_HDR_LR(req, proto, HTTP_HDR_PROTO) VRT_HDR_R(req_top, method, HTTP_HDR_METHOD) VRT_HDR_R(req_top, url, HTTP_HDR_URL) VRT_HDR_R(req_top, proto, HTTP_HDR_PROTO) VRT_HDR_LR(resp, proto, HTTP_HDR_PROTO) VRT_HDR_LR(resp, reason, HTTP_HDR_REASON) VRT_STATUS_L(resp) VRT_STATUS_R(resp) VRT_HDR_LR(bereq, method, HTTP_HDR_METHOD) VRT_HDR_LR(bereq, url, HTTP_HDR_URL) VRT_HDR_LR(bereq, proto, HTTP_HDR_PROTO) VRT_HDR_LR(beresp, proto, HTTP_HDR_PROTO) VRT_HDR_LR(beresp, reason, HTTP_HDR_REASON) VRT_STATUS_L(beresp) VRT_STATUS_R(beresp) /*-------------------------------------------------------------------- * Pulling things out of the packed object->http */ long VRT_r_obj_status(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); return (HTTP_GetStatusPack(ctx->req->wrk, ctx->req->objcore)); } const char * VRT_r_obj_proto(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, H__Proto)); } const char * VRT_r_obj_reason(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, H__Reason)); } /*-------------------------------------------------------------------- * bool-fields (.do_*) */ #define VBERESPW0(field) #define VBERESPW1(field) \ void \ VRT_l_beresp_##field(VRT_CTX, unsigned a) \ { \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \ ctx->bo->field = a ? 1 : 0; \ } #define VBERESPR0(field) #define VBERESPR1(field) \ unsigned \ VRT_r_beresp_##field(VRT_CTX) \ { \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \ return (ctx->bo->field); \ } #define BO_FLAG(l, r, w, d) \ VBERESPR##r(l) \ VBERESPW##w(l) #include "tbl/bo_flags.h" #undef BO_FLAG /*--------------------------------------------------------------------*/ unsigned VRT_r_bereq_uncacheable(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); return (ctx->bo->do_pass); } void VRT_l_beresp_uncacheable(VRT_CTX, unsigned a) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); if (ctx->bo->uncacheable && !a) { VSLb(ctx->vsl, SLT_VCL_Error, "Ignoring attempt to reset beresp.uncacheable"); } else if (a) { ctx->bo->uncacheable = 1; } } unsigned VRT_r_beresp_uncacheable(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); return (ctx->bo->uncacheable); } /*--------------------------------------------------------------------*/ const char * VRT_r_client_identity(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); if (ctx->req->client_identity != NULL) return (ctx->req->client_identity); return(SES_Get_String_Attr(ctx->req->sp, SA_CLIENT_IP)); } void VRT_l_client_identity(VRT_CTX, const char *str, ...) { va_list ap; const char *b; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); va_start(ap, str); b = VRT_String(ctx->req->http->ws, NULL, str, ap); va_end(ap); if (b == NULL) { VSLb(ctx->vsl, SLT_LostHeader, "client.identity"); WS_MarkOverflow(ctx->req->http->ws); return; } ctx->req->client_identity = b; } /*--------------------------------------------------------------------*/ #define BEREQ_TIMEOUT(which) \ void \ VRT_l_bereq_##which(VRT_CTX, double num) \ { \ \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \ ctx->bo->which = (num > 0.0 ? num : 0.0); \ } \ \ double \ VRT_r_bereq_##which(VRT_CTX) \ { \ \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \ return (ctx->bo->which); \ } BEREQ_TIMEOUT(connect_timeout) BEREQ_TIMEOUT(first_byte_timeout) BEREQ_TIMEOUT(between_bytes_timeout) /*--------------------------------------------------------------------*/ const char * VRT_r_beresp_backend_name(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); if (ctx->bo->director_resp != NULL) return (ctx->bo->director_resp->vcl_name); return (NULL); } /*-------------------------------------------------------------------- * Backends do not in general have a IP number (any more) and this * variable is really not about the backend, but the backend connection. * XXX: we may need a more general beresp.backend.{details|ident} */ VCL_IP VRT_r_beresp_backend_ip(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); return (VDI_GetIP(ctx->bo->wrk, ctx->bo)); } /*--------------------------------------------------------------------*/ const char * VRT_r_beresp_storage_hint(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); if (ctx->bo->storage_hint != NULL) return (ctx->bo->storage_hint); else return (NULL); } void VRT_l_beresp_storage_hint(VRT_CTX, const char *str, ...) { va_list ap; const char *b; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); va_start(ap, str); b = VRT_String(ctx->bo->ws, NULL, str, ap); // XXX: ctx->ws ? va_end(ap); if (b == NULL) { VSLb(ctx->vsl, SLT_LostHeader, "storage.hint"); WS_MarkOverflow(ctx->bo->beresp->ws); return; } ctx->bo->storage_hint = b; } /*--------------------------------------------------------------------*/ #define REQ_VAR_L(nm, elem, type,extra) \ \ void \ VRT_l_req_##nm(VRT_CTX, type arg) \ { \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); \ extra; \ ctx->req->elem = arg; \ } #define REQ_VAR_R(nm, elem, type) \ \ type \ VRT_r_req_##nm(VRT_CTX) \ { \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); \ return(ctx->req->elem); \ } REQ_VAR_L(backend_hint, director_hint, const struct director *,) REQ_VAR_R(backend_hint, director_hint, const struct director *) REQ_VAR_L(ttl, d_ttl, double, if (!(arg>0.0)) arg = 0;) REQ_VAR_R(ttl, d_ttl, double) /*--------------------------------------------------------------------*/ void VRT_l_bereq_backend(VRT_CTX, const struct director *be) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); ctx->bo->director_req = be; } const struct director * VRT_r_bereq_backend(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); return (ctx->bo->director_req); } const struct director * VRT_r_beresp_backend(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); return (ctx->bo->director_resp); } /*--------------------------------------------------------------------*/ void VRT_l_req_esi(VRT_CTX, unsigned process_esi) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); /* * Only allow you to turn of esi in the main request * else everything gets confused */ if(ctx->req->esi_level == 0) ctx->req->disable_esi = !process_esi; } unsigned VRT_r_req_esi(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); return (!ctx->req->disable_esi); } long VRT_r_req_esi_level(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); return(ctx->req->esi_level); } /*--------------------------------------------------------------------*/ unsigned VRT_r_req_can_gzip(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); return (RFC2616_Req_Gzip(ctx->req->http)); // XXX ? } /*--------------------------------------------------------------------*/ long VRT_r_req_restarts(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); return (ctx->req->restarts); } long VRT_r_bereq_retries(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); return (ctx->bo->retries); } /*-------------------------------------------------------------------- * In exp.*: * t_origin is absolute * ttl is relative to t_origin * grace&keep are relative to ttl * In VCL: * ttl is relative to now * grace&keep are relative to ttl */ #define VRT_DO_EXP_L(which, sexp, fld, offset) \ \ void \ VRT_l_##which##_##fld(VRT_CTX, double a) \ { \ \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ a += (offset); \ if (a < 0.0) \ a = 0.0; \ sexp.fld = a; \ VSLb(ctx->vsl, SLT_TTL, "VCL %.0f %.0f %.0f %.0f", \ sexp.ttl, sexp.grace, sexp.keep, sexp.t_origin); \ } #define VRT_DO_EXP_R(which, sexp, fld, offset) \ \ double \ VRT_r_##which##_##fld(VRT_CTX) \ { \ double d; \ \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ d = sexp.fld; \ if (d <= 0.0) \ d = 0.0; \ d -= (offset); \ return(d); \ } VRT_DO_EXP_R(obj, ctx->req->objcore->exp, ttl, ctx->now - ctx->req->objcore->exp.t_origin) VRT_DO_EXP_R(obj, ctx->req->objcore->exp, grace, 0) VRT_DO_EXP_R(obj, ctx->req->objcore->exp, keep, 0) VRT_DO_EXP_L(beresp, ctx->bo->fetch_objcore->exp, ttl, ctx->now - ctx->bo->fetch_objcore->exp.t_origin) VRT_DO_EXP_R(beresp, ctx->bo->fetch_objcore->exp, ttl, ctx->now - ctx->bo->fetch_objcore->exp.t_origin) VRT_DO_EXP_L(beresp, ctx->bo->fetch_objcore->exp, grace, 0) VRT_DO_EXP_R(beresp, ctx->bo->fetch_objcore->exp, grace, 0) VRT_DO_EXP_L(beresp, ctx->bo->fetch_objcore->exp, keep, 0) VRT_DO_EXP_R(beresp, ctx->bo->fetch_objcore->exp, keep, 0) /*-------------------------------------------------------------------- */ #define VRT_DO_AGE_R(which, sexp) \ \ double \ VRT_r_##which##_##age(VRT_CTX) \ { \ \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ return(ctx->now - sexp.t_origin); \ } VRT_DO_AGE_R(obj, ctx->req->objcore->exp) VRT_DO_AGE_R(beresp, ctx->bo->fetch_objcore->exp) /*-------------------------------------------------------------------- * [be]req.xid */ const char * VRT_r_req_xid(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); return (WS_Printf(ctx->req->http->ws, "%u", VXID(ctx->req->vsl->wid))); } const char * VRT_r_bereq_xid(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); return (WS_Printf(ctx->bo->bereq->ws, "%u", VXID(ctx->bo->vsl->wid))); } /*-------------------------------------------------------------------- * req fields */ #define VREQW0(field) #define VREQW1(field) \ void \ VRT_l_req_##field(VRT_CTX, unsigned a) \ { \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); \ ctx->req->field = a ? 1 : 0; \ } #define VREQR0(field) #define VREQR1(field) \ unsigned \ VRT_r_req_##field(VRT_CTX) \ { \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); \ return (ctx->req->field); \ } #define REQ_FLAG(l, r, w, d) \ VREQR##r(l) \ VREQW##w(l) #include "tbl/req_flags.h" #undef REQ_FLAG /*--------------------------------------------------------------------*/ #define GIP(fld) \ VCL_IP \ VRT_r_##fld##_ip(VRT_CTX) \ { \ struct suckaddr *sa; \ \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->req->sp, SESS_MAGIC); \ AZ(SES_Get_##fld##_addr(ctx->req->sp, &sa)); \ return (sa); \ } GIP(local) GIP(remote) GIP(client) GIP(server) #undef GIP /*--------------------------------------------------------------------*/ const char* VRT_r_server_identity(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (heritage.identity != NULL) return (heritage.identity); else return (heritage.name); } const char* VRT_r_server_hostname(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (vrt_hostname[0] == '\0') AZ(gethostname(vrt_hostname, sizeof(vrt_hostname))); return (vrt_hostname); } /*--------------------------------------------------------------------*/ long VRT_r_obj_hits(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); return (ctx->req->is_hit ? ctx->req->objcore->hits : 0); } unsigned VRT_r_obj_uncacheable(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); return (ctx->req->objcore->flags & OC_F_PASS ? 1 : 0); } /*--------------------------------------------------------------------*/ unsigned VRT_r_resp_is_streaming(VRT_CTX) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); if (ctx->req->objcore == NULL) return (0); /* When called from vcl_synth */ CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); return (ctx->req->objcore->flags & OC_F_INCOMPLETE ? 1 : 0); } /*--------------------------------------------------------------------*/ #define HTTP_VAR(x) \ struct http * \ VRT_r_##x(VRT_CTX) \ { \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->http_##x, HTTP_MAGIC); \ return (ctx->http_##x); \ } HTTP_VAR(req) HTTP_VAR(resp) HTTP_VAR(bereq) HTTP_VAR(beresp) varnish-4.1.1/bin/varnishd/cache/cache_ban.c0000644000201500234410000004277712652366721015617 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "config.h" #include #include "cache.h" #include "cache_ban.h" #include "hash/hash_slinger.h" #include "vcli.h" #include "vcli_priv.h" #include "vend.h" #include "vmb.h" struct lock ban_mtx; int ban_shutdown; struct banhead_s ban_head = VTAILQ_HEAD_INITIALIZER(ban_head); struct ban * volatile ban_start; static pthread_t ban_thread; static int ban_holds; struct ban_test { uint8_t oper; uint8_t arg1; const char *arg1_spec; const char *arg2; const void *arg2_spec; }; /*-------------------------------------------------------------------- * Storage handling of bans */ static struct ban * ban_alloc(void) { struct ban *b; ALLOC_OBJ(b, BAN_MAGIC); if (b != NULL) VTAILQ_INIT(&b->objcore); return (b); } void BAN_Free(struct ban *b) { CHECK_OBJ_NOTNULL(b, BAN_MAGIC); AZ(b->refcount); assert(VTAILQ_EMPTY(&b->objcore)); if (b->spec != NULL) free(b->spec); FREE_OBJ(b); } /*-------------------------------------------------------------------- * Get/release holds which prevent the ban_lurker from starting. * Holds are held while stevedores load zombie objects. */ void BAN_Hold(void) { Lck_Lock(&ban_mtx); /* Once holds are released, we allow no more */ assert(ban_holds > 0); ban_holds++; Lck_Unlock(&ban_mtx); } void BAN_Release(void) { Lck_Lock(&ban_mtx); assert(ban_holds > 0); ban_holds--; Lck_Unlock(&ban_mtx); if (ban_holds == 0) WRK_BgThread(&ban_thread, "ban-lurker", ban_lurker, NULL); } /*-------------------------------------------------------------------- * Extract time and length from ban-spec */ double ban_time(const uint8_t *banspec) { double t; assert(sizeof t == (BANS_LENGTH - BANS_TIMESTAMP)); memcpy(&t, banspec, sizeof t); return (t); } unsigned ban_len(const uint8_t *banspec) { unsigned u; u = vbe32dec(banspec + BANS_LENGTH); return (u); } int ban_equal(const uint8_t *bs1, const uint8_t *bs2) { unsigned u; /* * Compare two ban-strings. * The memcmp() is safe because the first field we compare is the * length and that is part of the fixed header structure. */ u = vbe32dec(bs1 + BANS_LENGTH); return (!memcmp(bs1 + BANS_LENGTH, bs2 + BANS_LENGTH, u - BANS_LENGTH)); } void ban_mark_completed(struct ban *b) { unsigned ln; CHECK_OBJ_NOTNULL(b, BAN_MAGIC); Lck_AssertHeld(&ban_mtx); AN(b->spec); if (!(b->flags & BANS_FLAG_COMPLETED)) { ln = ban_len(b->spec); b->flags |= BANS_FLAG_COMPLETED; b->spec[BANS_FLAGS] |= BANS_FLAG_COMPLETED; VWMB(); vbe32enc(b->spec + BANS_LENGTH, BANS_HEAD_LEN); VSC_C_main->bans_completed++; VSC_C_main->bans_persisted_fragmentation += ln - ban_len(b->spec); } } /*-------------------------------------------------------------------- * Access a lump of bytes in a ban test spec */ static const void * ban_get_lump(const uint8_t **bs) { const void *r; unsigned ln; while (**bs == 0xff) *bs += 1; ln = vbe32dec(*bs); *bs += 4; r = (const void*)*bs; *bs += ln; return (r); } /*-------------------------------------------------------------------- * Pick a test apart from a spec string */ static void ban_iter(const uint8_t **bs, struct ban_test *bt) { memset(bt, 0, sizeof *bt); bt->arg1 = *(*bs)++; if (bt->arg1 == BANS_ARG_REQHTTP || bt->arg1 == BANS_ARG_OBJHTTP) { bt->arg1_spec = (const char *)*bs; (*bs) += (*bs)[0] + 2; } bt->arg2 = ban_get_lump(bs); bt->oper = *(*bs)++; if (bt->oper == BANS_OPER_MATCH || bt->oper == BANS_OPER_NMATCH) bt->arg2_spec = ban_get_lump(bs); } /*-------------------------------------------------------------------- * A new object is created, grab a reference to the newest ban */ void BAN_NewObjCore(struct objcore *oc) { CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AZ(oc->ban); AN(oc->objhead); Lck_Lock(&ban_mtx); oc->ban = ban_start; ban_start->refcount++; VTAILQ_INSERT_TAIL(&ban_start->objcore, oc, ban_list); Lck_Unlock(&ban_mtx); } /*-------------------------------------------------------------------- * An object is destroyed, release its ban reference */ void BAN_DestroyObj(struct objcore *oc) { CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); Lck_Lock(&ban_mtx); CHECK_OBJ_ORNULL(oc->ban, BAN_MAGIC); if (oc->ban != NULL) { assert(oc->ban->refcount > 0); oc->ban->refcount--; VTAILQ_REMOVE(&oc->ban->objcore, oc, ban_list); oc->ban = NULL; } Lck_Unlock(&ban_mtx); } /*-------------------------------------------------------------------- * Find and/or Grab a reference to an objects ban based on timestamp * Assume we have a BAN_Hold, so list traversal is safe. */ struct ban * BAN_RefBan(struct objcore *oc, double t0) { struct ban *b; double t1 = 0; VTAILQ_FOREACH(b, &ban_head, list) { t1 = ban_time(b->spec); if (t1 <= t0) break; } AN(b); assert(t1 == t0); Lck_Lock(&ban_mtx); assert(ban_holds > 0); b->refcount++; VTAILQ_INSERT_TAIL(&b->objcore, oc, ban_list); Lck_Unlock(&ban_mtx); return (b); } /*-------------------------------------------------------------------- * Compile a full ban list and export this area to the stevedores for * persistence. */ static void ban_export(void) { struct ban *b; struct vsb vsb; unsigned ln; Lck_AssertHeld(&ban_mtx); ln = VSC_C_main->bans_persisted_bytes - VSC_C_main->bans_persisted_fragmentation; AN(VSB_new(&vsb, NULL, ln, VSB_AUTOEXTEND)); VTAILQ_FOREACH_REVERSE(b, &ban_head, banhead_s, list) { AZ(VSB_bcat(&vsb, b->spec, ban_len(b->spec))); } AZ(VSB_finish(&vsb)); assert(VSB_len(&vsb) == ln); STV_BanExport((const uint8_t *)VSB_data(&vsb), VSB_len(&vsb)); VSB_delete(&vsb); VSC_C_main->bans_persisted_bytes = ln; VSC_C_main->bans_persisted_fragmentation = 0; } void ban_info(enum baninfo event, const uint8_t *ban, unsigned len) { if (STV_BanInfo(event, ban, len)) { /* One or more stevedores reported failure. Export the * list instead. The exported list should take up less * space due to drops being purged and completed being * truncated. */ /* XXX: Keep some measure of how much space can be * saved, and only export if it's worth it. Assert if * not */ ban_export(); } } /*-------------------------------------------------------------------- * Put a skeleton ban in the list, unless there is an identical, * time & condition, ban already in place. * * If a newer ban has same condition, mark the inserted ban COMPLETED, * also mark any older bans, with the same condition COMPLETED. */ static void ban_reload(const uint8_t *ban, unsigned len) { struct ban *b, *b2; int duplicate = 0; double t0, t1, t2 = 9e99; ASSERT_CLI(); Lck_AssertHeld(&ban_mtx); t0 = ban_time(ban); assert(len == ban_len(ban)); VTAILQ_FOREACH(b, &ban_head, list) { t1 = ban_time(b->spec); assert(t1 < t2); t2 = t1; if (t1 == t0) return; if (t1 < t0) break; if (ban_equal(b->spec, ban)) duplicate = 1; } VSC_C_main->bans++; VSC_C_main->bans_added++; b2 = ban_alloc(); AN(b2); b2->spec = malloc(len); AN(b2->spec); memcpy(b2->spec, ban, len); if (ban[BANS_FLAGS] & BANS_FLAG_REQ) { VSC_C_main->bans_req++; b2->flags |= BANS_FLAG_REQ; } if (duplicate) VSC_C_main->bans_dups++; if (duplicate || (ban[BANS_FLAGS] & BANS_FLAG_COMPLETED)) ban_mark_completed(b2); if (b == NULL) VTAILQ_INSERT_TAIL(&ban_head, b2, list); else VTAILQ_INSERT_BEFORE(b, b2, list); VSC_C_main->bans_persisted_bytes += len; /* Hunt down older duplicates */ for (b = VTAILQ_NEXT(b2, list); b != NULL; b = VTAILQ_NEXT(b, list)) { if (b->flags & BANS_FLAG_COMPLETED) continue; if (ban_equal(b->spec, ban)) { ban_mark_completed(b); VSC_C_main->bans_dups++; } } } /*-------------------------------------------------------------------- * Reload a series of persisted ban specs */ void BAN_Reload(const uint8_t *ptr, unsigned len) { const uint8_t *pe; unsigned l; AZ(ban_shutdown); pe = ptr + len; Lck_Lock(&ban_mtx); while (ptr < pe) { /* XXX: This can be optimized by traversing the live * ban list together with the reload list (combining * the loops in BAN_Reload and ban_reload). */ l = ban_len(ptr); assert(ptr + l <= pe); ban_reload(ptr, l); ptr += l; } Lck_Unlock(&ban_mtx); } /*-------------------------------------------------------------------- * Get a bans timestamp */ double BAN_Time(const struct ban *b) { if (b == NULL) return (0.0); CHECK_OBJ_NOTNULL(b, BAN_MAGIC); return (ban_time(b->spec)); } /*-------------------------------------------------------------------- * Evaluate ban-spec */ int ban_evaluate(struct worker *wrk, const uint8_t *bs, struct objcore *oc, const struct http *reqhttp, unsigned *tests) { struct ban_test bt; const uint8_t *be; const char *p; const char *arg1; be = bs + ban_len(bs); bs += BANS_HEAD_LEN; while (bs < be) { (*tests)++; ban_iter(&bs, &bt); arg1 = NULL; switch (bt.arg1) { case BANS_ARG_URL: AN(reqhttp); arg1 = reqhttp->hd[HTTP_HDR_URL].b; break; case BANS_ARG_REQHTTP: AN(reqhttp); (void)http_GetHdr(reqhttp, bt.arg1_spec, &p); arg1 = p; break; case BANS_ARG_OBJHTTP: arg1 = HTTP_GetHdrPack(wrk, oc, bt.arg1_spec); break; case BANS_ARG_OBJSTATUS: arg1 = HTTP_GetHdrPack(wrk, oc, H__Status); break; default: WRONG("Wrong BAN_ARG code"); } switch (bt.oper) { case BANS_OPER_EQ: if (arg1 == NULL || strcmp(arg1, bt.arg2)) return (0); break; case BANS_OPER_NEQ: if (arg1 != NULL && !strcmp(arg1, bt.arg2)) return (0); break; case BANS_OPER_MATCH: if (arg1 == NULL || pcre_exec(bt.arg2_spec, NULL, arg1, strlen(arg1), 0, 0, NULL, 0) < 0) return (0); break; case BANS_OPER_NMATCH: if (arg1 != NULL && pcre_exec(bt.arg2_spec, NULL, arg1, strlen(arg1), 0, 0, NULL, 0) >= 0) return (0); break; default: WRONG("Wrong BAN_OPER code"); } } return (1); } /*-------------------------------------------------------------------- * Check an object against all applicable bans * * Return: * -1 not all bans checked, but none of the checked matched * Only if !has_req * 0 No bans matched, object moved to ban_start. * 1 Ban matched, object removed from ban list. */ int BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) { struct ban *b; struct vsl_log *vsl; struct ban * volatile b0; unsigned tests; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); vsl = req->vsl; CHECK_OBJ_NOTNULL(oc->ban, BAN_MAGIC); /* First do an optimistic unlocked check */ b0 = ban_start; CHECK_OBJ_NOTNULL(b0, BAN_MAGIC); if (b0 == oc->ban) return (0); /* If that fails, make a safe check */ Lck_Lock(&ban_mtx); b0 = ban_start; Lck_Unlock(&ban_mtx); if (b0 == oc->ban) return (0); /* * This loop is safe without locks, because we know we hold * a refcount on a ban somewhere in the list and we do not * inspect the list past that ban. */ tests = 0; for (b = b0; b != oc->ban; b = VTAILQ_NEXT(b, list)) { CHECK_OBJ_NOTNULL(b, BAN_MAGIC); if (b->flags & BANS_FLAG_COMPLETED) continue; if (ban_evaluate(wrk, b->spec, oc, req->http, &tests)) break; } Lck_Lock(&ban_mtx); VSC_C_main->bans_tested++; VSC_C_main->bans_tests_tested += tests; oc->ban->refcount--; VTAILQ_REMOVE(&oc->ban->objcore, oc, ban_list); if (b == oc->ban) { /* not banned */ VTAILQ_INSERT_TAIL(&b0->objcore, oc, ban_list); b0->refcount++; oc->ban = b0; b = NULL; } else { oc->ban = NULL; } if (VTAILQ_LAST(&ban_head, banhead_s)->refcount == 0) ban_kick_lurker(); Lck_Unlock(&ban_mtx); if (b == NULL) { /* not banned */ ObjUpdateMeta(wrk, oc); return (0); } else { VSLb(vsl, SLT_ExpBan, "%u banned lookup", ObjGetXID(wrk, oc)); VSC_C_main->bans_obj_killed++; EXP_Rearm(oc, oc->exp.t_origin, 0, 0, 0); // XXX fake now return (1); } } /*-------------------------------------------------------------------- * CLI functions to add bans */ static void ccf_ban(struct cli *cli, const char * const *av, void *priv) { int narg, i; struct ban_proto *bp; const char *err = NULL; (void)priv; /* First do some cheap checks on the arguments */ for (narg = 0; av[narg + 2] != NULL; narg++) continue; if ((narg % 4) != 3) { VCLI_Out(cli, "Wrong number of arguments"); VCLI_SetResult(cli, CLIS_PARAM); return; } for (i = 3; i < narg; i += 4) { if (strcmp(av[i + 2], "&&")) { VCLI_Out(cli, "Found \"%s\" expected &&", av[i + 2]); VCLI_SetResult(cli, CLIS_PARAM); return; } } bp = BAN_Build(); if (bp == NULL) { VCLI_Out(cli, "Out of Memory"); VCLI_SetResult(cli, CLIS_CANT); return; } for (i = 0; i < narg; i += 4) { err = BAN_AddTest(bp, av[i + 2], av[i + 3], av[i + 4]); if (err) break; } if (err == NULL) err = BAN_Commit(bp); if (err != NULL) { VCLI_Out(cli, "%s", err); BAN_Abandon(bp); VCLI_SetResult(cli, CLIS_PARAM); } } static void ban_render(struct cli *cli, const uint8_t *bs) { struct ban_test bt; const uint8_t *be; be = bs + ban_len(bs); bs += BANS_HEAD_LEN; while (bs < be) { ban_iter(&bs, &bt); switch (bt.arg1) { case BANS_ARG_URL: VCLI_Out(cli, "req.url"); break; case BANS_ARG_REQHTTP: VCLI_Out(cli, "req.http.%.*s", bt.arg1_spec[0] - 1, bt.arg1_spec + 1); break; case BANS_ARG_OBJHTTP: VCLI_Out(cli, "obj.http.%.*s", bt.arg1_spec[0] - 1, bt.arg1_spec + 1); break; case BANS_ARG_OBJSTATUS: VCLI_Out(cli, "obj.status"); break; default: WRONG("Wrong BANS_ARG"); } switch (bt.oper) { case BANS_OPER_EQ: VCLI_Out(cli, " == "); break; case BANS_OPER_NEQ: VCLI_Out(cli, " != "); break; case BANS_OPER_MATCH: VCLI_Out(cli, " ~ "); break; case BANS_OPER_NMATCH: VCLI_Out(cli, " !~ "); break; default: WRONG("Wrong BANS_OPER"); } VCLI_Out(cli, "%s", bt.arg2); if (bs < be) VCLI_Out(cli, " && "); } } static void ccf_ban_list(struct cli *cli, const char * const *av, void *priv) { struct ban *b, *bl; int64_t o; (void)av; (void)priv; /* Get a reference so we are safe to traverse the list */ Lck_Lock(&ban_mtx); bl = VTAILQ_LAST(&ban_head, banhead_s); bl->refcount++; Lck_Unlock(&ban_mtx); VCLI_Out(cli, "Present bans:\n"); VTAILQ_FOREACH(b, &ban_head, list) { o = bl == b ? 1 : 0; VCLI_Out(cli, "%10.6f %5ju %s", ban_time(b->spec), (intmax_t)(b->refcount - o), b->flags & BANS_FLAG_COMPLETED ? "C" : "-"); if (DO_DEBUG(DBG_LURKER)) { VCLI_Out(cli, "%s%s %p ", b->flags & BANS_FLAG_REQ ? "R" : "-", b->flags & BANS_FLAG_OBJ ? "O" : "-", b); } VCLI_Out(cli, " "); ban_render(cli, b->spec); VCLI_Out(cli, "\n"); if (VCLI_Overflow(cli)) break; if (DO_DEBUG(DBG_LURKER)) { Lck_Lock(&ban_mtx); struct objcore *oc; VTAILQ_FOREACH(oc, &b->objcore, ban_list) VCLI_Out(cli, " oc = %p\n", oc); Lck_Unlock(&ban_mtx); } } Lck_Lock(&ban_mtx); bl->refcount--; ban_kick_lurker(); // XXX: Mostly for testcase b00009.vtc Lck_Unlock(&ban_mtx); } static struct cli_proto ban_cmds[] = { { CLI_BAN, "", ccf_ban }, { CLI_BAN_LIST, "", ccf_ban_list }, { NULL } }; /*-------------------------------------------------------------------- */ void BAN_Compile(void) { struct ban *b; /* * All bans have been read from all persistent stevedores. Export * the compiled list */ ASSERT_CLI(); AZ(ban_shutdown); Lck_Lock(&ban_mtx); /* Report the place-holder ban */ b = VTAILQ_FIRST(&ban_head); AZ(STV_BanInfo(BI_NEW, b->spec, ban_len(b->spec))); ban_export(); Lck_Unlock(&ban_mtx); ban_start = VTAILQ_FIRST(&ban_head); BAN_Release(); } void BAN_Init(void) { struct ban_proto *bp; Lck_New(&ban_mtx, lck_ban); CLI_AddFuncs(ban_cmds); ban_holds = 1; /* Add a placeholder ban */ bp = BAN_Build(); AN(bp); AZ(pthread_cond_init(&ban_lurker_cond, NULL)); AZ(BAN_Commit(bp)); Lck_Lock(&ban_mtx); ban_mark_completed(VTAILQ_FIRST(&ban_head)); Lck_Unlock(&ban_mtx); } /*-------------------------------------------------------------------- * Shutdown of the ban system. * * When this function returns, no new bans will be accepted, and no * bans will be dropped (ban lurker thread stopped), so that no * STV_BanInfo calls will be executed. */ void BAN_Shutdown(void) { void *status; Lck_Lock(&ban_mtx); ban_shutdown = 1; ban_kick_lurker(); Lck_Unlock(&ban_mtx); AZ(pthread_join(ban_thread, &status)); AZ(status); Lck_Lock(&ban_mtx); /* Export the ban list to compact it */ ban_export(); Lck_Unlock(&ban_mtx); } varnish-4.1.1/bin/varnishd/cache/cache_vrt_re.c0000644000201500234410000001040112652366721016333 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Runtime support for compiled VCL programs, regexps */ #include "config.h" #include #include "cache.h" #include "vrt.h" static void Tadd(char **b, char *e, const char *p, int l) { assert((*b) <= e); if (l <= 0) { } if ((*b) + l < e) { memcpy((*b), p, l); (*b) += l; } else { (*b) = e; } } void VRT_re_init(void **rep, const char *re) { vre_t *t; const char *error; int erroroffset; /* This was already check-compiled by the VCL compiler */ t = VRE_compile(re, 0, &error, &erroroffset); AN(t); *rep = t; } void VRT_re_fini(void *rep) { vre_t *vv; vv = rep; if (rep != NULL) VRE_free(&vv); } int VRT_re_match(VRT_CTX, const char *s, void *re) { vre_t *t; int i; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (s == NULL) s = ""; AN(re); t = re; i = VRE_exec(t, s, strlen(s), 0, 0, NULL, 0, &cache_param->vre_limits); if (i >= 0) return (1); if (i < VRE_ERROR_NOMATCH ) VSLb(ctx->vsl, SLT_VCL_Error, "Regexp matching returned %d", i); return (0); } const char * VRT_regsub(VRT_CTX, int all, const char *str, void *re, const char *sub) { int ovector[30]; vre_t *t; int i, l; char *res_b; char *res_e; char *b0; const char *s; unsigned u, x; int options = 0; int offset = 0; size_t len; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(re); if (str == NULL) str = ""; if (sub == NULL) sub = ""; t = re; memset(ovector, 0, sizeof(ovector)); len = strlen(str); i = VRE_exec(t, str, len, 0, options, ovector, 30, &cache_param->vre_limits); /* If it didn't match, we can return the original string */ if (i == VRE_ERROR_NOMATCH) return(str); if (i < VRE_ERROR_NOMATCH ) { VSLb(ctx->vsl, SLT_VCL_Error, "Regexp matching returned %d", i); return(str); } u = WS_Reserve(ctx->ws, 0); res_e = res_b = b0 = ctx->ws->f; res_e += u; do { /* Copy prefix to match */ Tadd(&res_b, res_e, str + offset, ovector[0] - offset); for (s = sub ; *s != '\0'; s++ ) { if (*s != '\\' || s[1] == '\0') { if (res_b < res_e) *res_b++ = *s; continue; } s++; if (isdigit(*s)) { x = *s - '0'; l = ovector[2*x+1] - ovector[2*x]; Tadd(&res_b, res_e, str + ovector[2*x], l); continue; } else { if (res_b < res_e) *res_b++ = *s; } } offset = ovector[1]; if (!all) break; memset(ovector, 0, sizeof(ovector)); options |= VRE_NOTEMPTY; i = VRE_exec(t, str, len, offset, options, ovector, 30, &cache_param->vre_limits); if (i < VRE_ERROR_NOMATCH ) { WS_Release(ctx->ws, 0); VSLb(ctx->vsl, SLT_VCL_Error, "Regexp matching returned %d", i); return(str); } } while (i != VRE_ERROR_NOMATCH); /* Copy suffix to match */ Tadd(&res_b, res_e, str + offset, 1 + len - offset); if (res_b >= res_e) { WS_MarkOverflow(ctx->ws); WS_Release(ctx->ws, 0); return (str); } assert(res_b <= res_e); WS_ReleaseP(ctx->ws, res_b); return (b0); } varnish-4.1.1/bin/varnishd/cache/cache_req_body.c0000644000201500234410000001716212652366721016651 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "config.h" #include #include "cache.h" #include "http1/cache_http1.h" #include "cache_filter.h" #include "vtim.h" #include "hash/hash_slinger.h" /*---------------------------------------------------------------------- * Iterate over the req.body. * * This can be done exactly once if uncached, and multiple times if the * req.body is cached. * * return length or -1 on error */ ssize_t VRB_Iterate(struct req *req, req_body_iter_f *func, void *priv) { char buf[8192]; ssize_t l, ll = 0; void *p; int i; struct vfp_ctx *vfc; enum vfp_status vfps = VFP_ERROR; void *oi; enum objiter_status ois; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); AN(func); switch(req->req_body_status) { case REQ_BODY_CACHED: oi = ObjIterBegin(req->wrk, req->body_oc); AN(oi); do { ois = ObjIter(req->body_oc, oi, &p, &l); ll += l; if (l > 0 && func(req, priv, p, l)) break; } while (ois == OIS_DATA); ObjIterEnd(req->body_oc, &oi); return (ois == OIS_DONE ? ll : -1); case REQ_BODY_NONE: return (0); case REQ_BODY_WITH_LEN: case REQ_BODY_WITHOUT_LEN: break; case REQ_BODY_TAKEN: VSLb(req->vsl, SLT_VCL_Error, "Uncached req.body can only be consumed once."); return (-1); case REQ_BODY_FAIL: VSLb(req->vsl, SLT_FetchError, "Had failed reading req.body before."); return (-1); default: WRONG("Wrong req_body_status in VRB_IterateReqBody()"); } Lck_Lock(&req->sp->mtx); if (req->req_body_status == REQ_BODY_WITH_LEN || req->req_body_status == REQ_BODY_WITHOUT_LEN) { req->req_body_status = REQ_BODY_TAKEN; i = 0; } else i = -1; Lck_Unlock(&req->sp->mtx); if (i) { VSLb(req->vsl, SLT_VCL_Error, "Multiple attempts to access non-cached req.body"); return (i); } CHECK_OBJ_NOTNULL(req->htc, HTTP_CONN_MAGIC); vfc = req->htc->vfc; VFP_Setup(vfc); vfc->http = req->http; vfc->wrk = req->wrk; V1F_Setup_Fetch(vfc, req->htc); if (VFP_Open(vfc) < 0) { VSLb(req->vsl, SLT_FetchError, "Could not open Fetch Pipeline"); return (-1); } do { l = sizeof buf; vfps = VFP_Suck(vfc, buf, &l); if (vfps == VFP_ERROR) { req->req_body_status = REQ_BODY_FAIL; ll = -1; break; } else if (l > 0) { req->req_bodybytes += l; req->acct.req_bodybytes += l; ll += l; l = func(req, priv, buf, l); if (l) { req->req_body_status = REQ_BODY_FAIL; ll = -1; break; } } } while (vfps == VFP_OK); VFP_Close(vfc); VSLb_ts_req(req, "ReqBody", VTIM_real()); return (ll); } /*---------------------------------------------------------------------- * DiscardReqBody() is a dedicated function, because we might * be able to disuade or terminate its transmission in some protocols. * For HTTP1 we have no such luck, and we just iterate it into oblivion. */ static int __match_proto__(req_body_iter_f) httpq_req_body_discard(struct req *req, void *priv, void *ptr, size_t len) { CHECK_OBJ_NOTNULL(req, REQ_MAGIC); (void)priv; (void)ptr; (void)len; return (0); } int VRB_Ignore(struct req *req) { CHECK_OBJ_NOTNULL(req, REQ_MAGIC); if (req->req_body_status == REQ_BODY_WITH_LEN || req->req_body_status == REQ_BODY_WITHOUT_LEN) (void)VRB_Iterate(req, httpq_req_body_discard, NULL); return(0); } /*---------------------------------------------------------------------- */ void VRB_Free(struct req *req) { CHECK_OBJ_NOTNULL(req, REQ_MAGIC); if (req->body_oc != NULL) AZ(HSH_DerefObjCore(req->wrk, &req->body_oc)); } /*---------------------------------------------------------------------- * Cache the req.body if it is smaller than the given size * * This function must be called before any backend fetches are kicked * off to prevent parallelism. */ ssize_t VRB_Cache(struct req *req, ssize_t maxsize) { ssize_t l, yet; struct vfp_ctx *vfc; uint8_t *ptr; enum vfp_status vfps = VFP_ERROR; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); assert (req->req_step == R_STP_RECV); switch(req->req_body_status) { case REQ_BODY_CACHED: return (req->req_bodybytes); case REQ_BODY_FAIL: return (-1); case REQ_BODY_NONE: return (0); case REQ_BODY_WITHOUT_LEN: case REQ_BODY_WITH_LEN: break; default: WRONG("Wrong req_body_status in VRB_Cache()"); } CHECK_OBJ_NOTNULL(req->htc, HTTP_CONN_MAGIC); vfc = req->htc->vfc; VFP_Setup(vfc); vfc->wrk = req->wrk; if (req->htc->content_length > maxsize) { req->req_body_status = REQ_BODY_FAIL; (void)VFP_Error(vfc, "Request body too big to cache"); return (-1); } req->body_oc = HSH_Private(req->wrk); AN(req->body_oc); XXXAN(STV_NewObject(req->body_oc, req->wrk, TRANSIENT_STORAGE, 8)); vfc->http = req->http; vfc->oc = req->body_oc; V1F_Setup_Fetch(vfc, req->htc); if (VFP_Open(vfc) < 0) { req->req_body_status = REQ_BODY_FAIL; return (-1); } AZ(req->req_bodybytes); AN(req->htc); yet = req->htc->content_length; if (yet < 0) yet = 0; do { AZ(vfc->failed); if (req->req_bodybytes > maxsize) { req->req_body_status = REQ_BODY_FAIL; (void)VFP_Error(vfc, "Request body too big to cache"); VFP_Close(vfc); return(-1); } l = yet; if (VFP_GetStorage(vfc, &l, &ptr) != VFP_OK) break; AZ(vfc->failed); AN(ptr); AN(l); vfps = VFP_Suck(vfc, ptr, &l); if (l > 0 && vfps != VFP_ERROR) { req->req_bodybytes += l; req->acct.req_bodybytes += l; if (yet >= l) yet -= l; ObjExtend(req->wrk, req->body_oc, l); } } while (vfps == VFP_OK); VFP_Close(vfc); ObjTrimStore(req->wrk, req->body_oc); /* XXX: check missing: if (req->htc->content_length >= 0) MUSTBE (req->req_bodybytes == req->htc->content_length); */ if (vfps == VFP_END) { assert(req->req_bodybytes >= 0); if (req->req_bodybytes != req->htc->content_length) { /* We must update also the "pristine" req.* copy */ http_Unset(req->http0, H_Content_Length); http_Unset(req->http0, H_Transfer_Encoding); http_PrintfHeader(req->http0, "Content-Length: %ju", (uintmax_t)req->req_bodybytes); http_Unset(req->http, H_Content_Length); http_Unset(req->http, H_Transfer_Encoding); http_PrintfHeader(req->http, "Content-Length: %ju", (uintmax_t)req->req_bodybytes); } req->req_body_status = REQ_BODY_CACHED; } else { req->req_body_status = REQ_BODY_FAIL; } VSLb_ts_req(req, "ReqBody", VTIM_real()); return (vfps == VFP_END ? req->req_bodybytes : -1); } varnish-4.1.1/bin/varnishd/cache/cache_director.c0000644000201500234410000001243312652366721016654 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Abstract director API * * The abstract director API does not know how we talk to the backend or * if there even is one in the usual meaning of the word. * */ #include "config.h" #include "cache.h" #include "cache_director.h" /* Resolve director --------------------------------------------------*/ static const struct director * vdi_resolve(struct worker *wrk, struct busyobj *bo) { const struct director *d; const struct director *d2; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); for (d = bo->director_req; d != NULL && d->resolve != NULL; d = d2) { CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); d2 = d->resolve(d, wrk, bo); if (d2 == NULL) VSLb(bo->vsl, SLT_FetchError, "Director %s returned no backend", d->vcl_name); } CHECK_OBJ_ORNULL(d, DIRECTOR_MAGIC); if (d == NULL) VSLb(bo->vsl, SLT_FetchError, "No backend"); bo->director_resp = d; return (d); } /* Get a set of response headers -------------------------------------*/ int VDI_GetHdr(struct worker *wrk, struct busyobj *bo) { const struct director *d; int i = -1; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); d = vdi_resolve(wrk, bo); if (d != NULL) { AN(d->gethdrs); bo->director_state = DIR_S_HDRS; i = d->gethdrs(d, wrk, bo); } if (i) bo->director_state = DIR_S_NULL; return (i); } /* Setup body fetch --------------------------------------------------*/ int VDI_GetBody(struct worker *wrk, struct busyobj *bo) { const struct director *d; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); d = bo->director_resp; CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); AZ(d->resolve); AN(d->getbody); assert(bo->director_state == DIR_S_HDRS); bo->director_state = DIR_S_BODY; return (d->getbody(d, wrk, bo)); } /* Get IP number (if any ) -------------------------------------------*/ const struct suckaddr * VDI_GetIP(struct worker *wrk, struct busyobj *bo) { const struct director *d; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); d = bo->director_resp; CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); assert(bo->director_state == DIR_S_HDRS || bo->director_state == DIR_S_BODY); AZ(d->resolve); if (d->getip == NULL) return (NULL); return (d->getip(d, wrk, bo)); } /* Finish fetch ------------------------------------------------------*/ void VDI_Finish(struct worker *wrk, struct busyobj *bo) { const struct director *d; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); d = bo->director_resp; CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); AZ(d->resolve); AN(d->finish); assert(bo->director_state != DIR_S_NULL); d->finish(d, wrk, bo); bo->director_state = DIR_S_NULL; } /* Get a connection --------------------------------------------------*/ int VDI_Http1Pipe(struct req *req, struct busyobj *bo) { const struct director *d; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); d = vdi_resolve(req->wrk, bo); if (d == NULL || d->http1pipe == NULL) return (-1); d->http1pipe(d, req, bo); return (0); } /* Check health -------------------------------------------------------- * * If director has no healthy method, we just assume it is healthy. */ int VDI_Healthy(const struct director *d, const struct busyobj *bo) { CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); if (d->healthy == NULL) return (1); return (d->healthy(d, bo, NULL)); } /* Dump panic info ----------------------------------------------------- */ void VDI_Panic(const struct director *d, struct vsb *vsb, const char *nm) { if (d == NULL) return; VSB_printf(vsb, "%s = %p {\n", nm, d); VSB_indent(vsb, 2); VSB_printf(vsb, "vcl_name = %s,\n", d->vcl_name); VSB_printf(vsb, "type = %s {\n", d->name); VSB_indent(vsb, 2); if (d->panic != NULL) d->panic(d, vsb); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); } varnish-4.1.1/bin/varnishd/cache/cache_director.h0000644000201500234410000000666612652366721016674 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Director APIs * * A director ("VDI") is an abstract entity which can either satisfy a * backend fetch request or select another director for the job. * * In theory a director does not have to talk HTTP over TCP, it can satisfy * the backend request using any means it wants, although this is presently * not implemented. * */ /*-------------------------------------------------------------------- * A director is a piece of code which selects one of possibly multiple * backends to use. */ typedef unsigned vdi_healthy_f(const struct director *, const struct busyobj *, double *changed); typedef const struct director *vdi_resolve_f(const struct director *, struct worker *, struct busyobj *); typedef int vdi_gethdrs_f(const struct director *, struct worker *, struct busyobj *); typedef int vdi_getbody_f(const struct director *, struct worker *, struct busyobj *); typedef const struct suckaddr *vdi_getip_f(const struct director *, struct worker *, struct busyobj *); typedef void vdi_finish_f(const struct director *, struct worker *, struct busyobj *); typedef void vdi_http1pipe_f(const struct director *, struct req *, struct busyobj *); typedef void vdi_panic_f(const struct director *, struct vsb *); struct director { unsigned magic; #define DIRECTOR_MAGIC 0x3336351d const char *name; char *vcl_name; vdi_http1pipe_f *http1pipe; vdi_healthy_f *healthy; vdi_resolve_f *resolve; vdi_gethdrs_f *gethdrs; vdi_getbody_f *getbody; vdi_getip_f *getip; vdi_finish_f *finish; vdi_panic_f *panic; void *priv; const void *priv2; }; /* cache_director.c */ int VDI_GetHdr(struct worker *, struct busyobj *); int VDI_GetBody(struct worker *, struct busyobj *); const struct suckaddr *VDI_GetIP(struct worker *, struct busyobj *); void VDI_Finish(struct worker *wrk, struct busyobj *bo); int VDI_Http1Pipe(struct req *, struct busyobj *); int VDI_Healthy(const struct director *, const struct busyobj *); void VDI_Panic(const struct director *, struct vsb *, const char *nm); varnish-4.1.1/bin/varnishd/cache/cache_panic.c0000644000201500234410000003525212652366721016137 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Smørgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #ifndef HAVE_EXECINFO_H #include "compat/execinfo.h" #else #include #endif #include #include #include #include "cache.h" #include "cache_filter.h" #include "common/heritage.h" #include "vrt.h" #include "cache_director.h" #include "storage/storage.h" #include "vcli_priv.h" /* * The panic string is constructed in memory, then copied to the * shared memory. * * It can be extracted post-mortem from a core dump using gdb: * * (gdb) printf "%s", panicstr */ static struct vsb pan_vsb_storage, *pan_vsb; static pthread_mutex_t panicstr_mtx = PTHREAD_MUTEX_INITIALIZER; static void pan_sess(struct vsb *, const struct sess *); /*--------------------------------------------------------------------*/ const char * body_status_2str(enum body_status e) { switch(e) { #define BODYSTATUS(U,l) case BS_##U: return (#l); #include "tbl/body_status.h" #undef BODYSTATUS default: return ("?"); } } /*--------------------------------------------------------------------*/ static const char * reqbody_status_2str(enum req_body_state_e e) { switch (e) { #define REQ_BODY(U) case REQ_BODY_##U: return("R_BODY_" #U); #include "tbl/req_body.h" #undef REQ_BODY default: return("?"); } } /*--------------------------------------------------------------------*/ const char * sess_close_2str(enum sess_close sc, int want_desc) { switch (sc) { case SC_NULL: return(want_desc ? "(null)": "NULL"); #define SESS_CLOSE(nm, s, err, desc) \ case SC_##nm: return(want_desc ? desc : #nm); #include "tbl/sess_close.h" #undef SESS_CLOSE default: return(want_desc ? "(invalid)" : "INVALID"); } } /*--------------------------------------------------------------------*/ static void pan_ws(struct vsb *vsb, const struct ws *ws) { VSB_printf(vsb, "ws = %p {\n", ws); VSB_indent(vsb, 2); if (WS_Overflowed(ws)) VSB_printf(vsb, "OVERFLOW "); VSB_printf(vsb, "id = \"%s\",\n", ws->id); VSB_printf(vsb, "{s,f,r,e} = {%p", ws->s); if (ws->f > ws->s) VSB_printf(vsb, ",+%ld", (long) (ws->f - ws->s)); else VSB_printf(vsb, ",%p", ws->f); if (ws->r > ws->s) VSB_printf(vsb, ",+%ld", (long) (ws->r - ws->s)); else VSB_printf(vsb, ",%p", ws->r); if (ws->e > ws->s) VSB_printf(vsb, ",+%ld", (long) (ws->e - ws->s)); else VSB_printf(vsb, ",%p", ws->e); VSB_printf(vsb, "},\n"); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ static void pan_htc(struct vsb *vsb, const struct http_conn *htc) { VSB_printf(vsb, "http_conn = %p {\n", htc); VSB_indent(vsb, 2); VSB_printf(vsb, "fd = %d,\n", htc->fd); VSB_printf(vsb, "doclose = %s,\n", sess_close_2str(htc->doclose, 0)); VSB_printf(vsb, "ws = %p,\n", htc->ws); VSB_printf(vsb, "{rxbuf_b, rxbuf_e} = {%p, %p},\n", htc->rxbuf_b, htc->rxbuf_e); VSB_printf(vsb, "{pipeline_b, pipeline_e} = {%p, %p},\n", htc->pipeline_b, htc->pipeline_e); VSB_printf(vsb, "content_length = %jd,\n", (intmax_t)htc->content_length); VSB_printf(vsb, "body_status = %s,\n", body_status_2str(htc->body_status)); VSB_printf(vsb, "first_byte_timeout = %f,\n", htc->first_byte_timeout); VSB_printf(vsb, "between_bytes_timeout = %f,\n", htc->between_bytes_timeout); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ static void pan_http(struct vsb *vsb, const char *id, const struct http *h) { int i; VSB_printf(vsb, "http[%s] = %p {\n", id, h); VSB_indent(vsb, 2); VSB_printf(vsb, "ws[%s] = %p,\n", h->ws ? h->ws->id : "", h->ws); VSB_printf(vsb, "hdrs {\n"); VSB_indent(vsb, 2); for (i = 0; i < h->nhd; ++i) { if (h->hd[i].b == NULL && h->hd[i].e == NULL) continue; VSB_printf(vsb, "\"%.*s\",\n", (int)(h->hd[i].e - h->hd[i].b), h->hd[i].b); } VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ static void pan_objcore(struct vsb *vsb, const char *typ, const struct objcore *oc) { VSB_printf(vsb, "objcore[%s] = %p {\n", typ, oc); VSB_indent(vsb, 2); VSB_printf(vsb, "refcnt = %d,\n", oc->refcnt); VSB_printf(vsb, "flags = 0x%x,\n", oc->flags); VSB_printf(vsb, "exp_flags = 0x%x,\n", oc->exp_flags); VSB_printf(vsb, "exp = { %f, %f, %f, %f }\n", oc->exp.t_origin, oc->exp.ttl, oc->exp.grace, oc->exp.keep); VSB_printf(vsb, "objhead = %p,\n", oc->objhead); VSB_printf(vsb, "stevedore = %p", oc->stobj->stevedore); if (oc->stobj->stevedore != NULL) { VSB_printf(vsb, " (%s", oc->stobj->stevedore->name); if (strlen(oc->stobj->stevedore->ident)) VSB_printf(vsb, " %s", oc->stobj->stevedore->ident); VSB_printf(vsb, ")"); } VSB_printf(vsb, ",\n"); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ static void pan_wrk(struct vsb *vsb, const struct worker *wrk) { const char *hand; unsigned m, u; const char *p; VSB_printf(vsb, "worker = %p {\n", wrk); VSB_indent(vsb, 2); VSB_printf(vsb, "stack = {0x%jx -> 0x%jx},\n", (uintmax_t)wrk->stack_start, (uintmax_t)wrk->stack_end); pan_ws(vsb, wrk->aws); m = wrk->cur_method; VSB_printf(vsb, "VCL::method = "); if (m == 0) { VSB_printf(vsb, "none,\n"); return; } if (!(m & 1)) VSB_printf(vsb, "inside "); m &= ~1; hand = VCL_Method_Name(m); if (hand != NULL) VSB_printf(vsb, "%s,\n", hand); else VSB_printf(vsb, "0x%x,\n", m); hand = VCL_Return_Name(wrk->handling); if (hand != NULL) VSB_printf(vsb, "VCL::return = %s,\n", hand); else VSB_printf(vsb, "VCL::return = 0x%x,\n", wrk->handling); VSB_printf(vsb, "VCL::methods = {"); m = wrk->seen_methods; p = ""; for (u = 1; m ; u <<= 1) { if (m & u) { VSB_printf(vsb, "%s%s", p, VCL_Method_Name(u)); m &= ~u; p = ", "; } } VSB_printf(vsb, "},\n"); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); } static void pan_busyobj(struct vsb *vsb, const struct busyobj *bo) { struct vfp_entry *vfe; const char *p; VSB_printf(vsb, "busyobj = %p {\n", bo); VSB_indent(vsb, 2); pan_ws(vsb, bo->ws); VSB_printf(vsb, "refcnt = %u,\n", bo->refcount); VSB_printf(vsb, "retries = %d, ", bo->retries); VSB_printf(vsb, "failed = %d, ", bo->vfc->failed); VSB_printf(vsb, "state = %d,\n", (int)bo->state); VSB_printf(vsb, "flags = {"); p = ""; /*lint -save -esym(438,p) */ #define BO_FLAG(l, r, w, d) \ if(bo->l) { VSB_printf(vsb, "%s" #l, p); p = ", "; } #include "tbl/bo_flags.h" #undef BO_FLAG /*lint -restore */ VSB_printf(vsb, "},\n"); if (VALID_OBJ(bo->htc, HTTP_CONN_MAGIC)) pan_htc(vsb, bo->htc); if (!VTAILQ_EMPTY(&bo->vfc->vfp)) { VSB_printf(vsb, "filters ="); VTAILQ_FOREACH(vfe, &bo->vfc->vfp, list) VSB_printf(vsb, " %s=%d", vfe->vfp->name, (int)vfe->closed); VSB_printf(vsb, "\n"); } VDI_Panic(bo->director_req, vsb, "director_req"); if (bo->director_resp == bo->director_req) VSB_printf(vsb, "director_resp = director_req,\n"); else VDI_Panic(bo->director_resp, vsb, "director_resp"); if (bo->bereq != NULL && bo->bereq->ws != NULL) pan_http(vsb, "bereq", bo->bereq); if (bo->beresp != NULL && bo->beresp->ws != NULL) pan_http(vsb, "beresp", bo->beresp); if (bo->fetch_objcore) pan_objcore(vsb, "fetch", bo->fetch_objcore); if (bo->stale_oc) pan_objcore(vsb, "ims", bo->stale_oc); VCL_Panic(vsb, bo->vcl); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ static void pan_req(struct vsb *vsb, const struct req *req) { const char *stp; VSB_printf(vsb, "req = %p {\n", req); VSB_indent(vsb, 2); VSB_printf(vsb, "vxid = %u, ", VXID(req->vsl->wid)); switch (req->req_step) { #define REQ_STEP(l, u, arg) case R_STP_##u: stp = "R_STP_" #u; break; #include "tbl/steps.h" #undef REQ_STEP default: stp = NULL; } if (stp != NULL) VSB_printf(vsb, "step = %s,\n", stp); else VSB_printf(vsb, "step = 0x%x,\n", req->req_step); VSB_printf(vsb, "req_body = %s,\n", reqbody_status_2str(req->req_body_status)); if (req->err_code) VSB_printf(vsb, "err_code = %d, err_reason = %s,\n", req->err_code, req->err_reason ? req->err_reason : "(null)"); VSB_printf(vsb, "restarts = %d, esi_level = %d,\n", req->restarts, req->esi_level); if (req->sp != NULL) pan_sess(vsb, req->sp); if (req->wrk != NULL) pan_wrk(vsb, req->wrk); pan_ws(vsb, req->ws); if (VALID_OBJ(req->htc, HTTP_CONN_MAGIC)) pan_htc(vsb, req->htc); pan_http(vsb, "req", req->http); if (req->resp->ws != NULL) pan_http(vsb, "resp", req->resp); VCL_Panic(vsb, req->vcl); if (req->objcore != NULL) { pan_objcore(vsb, "REQ", req->objcore); if (req->objcore->busyobj != NULL) pan_busyobj(vsb, req->objcore->busyobj); } VSB_printf(vsb, "flags = {\n"); VSB_indent(vsb, 2); #define REQ_FLAG(l, r, w, d) if(req->l) VSB_printf(vsb, #l ",\n"); #include "tbl/req_flags.h" #undef REQ_FLAG VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ static void pan_sess(struct vsb *vsb, const struct sess *sp) { const char *stp; char *ci; char *cp; VSB_printf(vsb, "sp = %p {\n", sp); VSB_indent(vsb, 2); VSB_printf(vsb, "fd = %d, vxid = %u,\n", sp->fd, VXID(sp->vxid)); AZ(SES_Get_client_ip(sp, &ci)); AZ(SES_Get_client_port(sp, &cp)); VSB_printf(vsb, "client = %s %s,\n", ci, cp); switch (sp->sess_step) { #define SESS_STEP(l, u) case S_STP_##u: stp = "S_STP_" #u; break; #include "tbl/steps.h" #undef SESS_STEP default: stp = NULL; } if (stp != NULL) VSB_printf(vsb, "step = %s,\n", stp); else VSB_printf(vsb, "step = 0x%x,\n", sp->sess_step); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ static void pan_backtrace(struct vsb *vsb) { void *array[10]; size_t size; size_t i; char **strings; char *p; size = backtrace (array, 10); if (size == 0) return; VSB_printf(vsb, "Backtrace:\n"); VSB_indent(vsb, 2); for (i = 0; i < size; i++) { if (Symbol_Lookup(vsb, array[i]) < 0) { strings = backtrace_symbols(&array[i], 1); if (strings == NULL || strings[0] == NULL) { VSB_printf(vsb, "%p: (?)", array[i]); } else { p = strrchr(strings[0], '/'); if (p == NULL) p = strings[0]; else p++; VSB_printf(vsb, "%p: %s", array[i], p); } } VSB_printf (vsb, "\n"); } VSB_indent(vsb, -2); } /*--------------------------------------------------------------------*/ static void __attribute__((__noreturn__)) pan_ic(const char *func, const char *file, int line, const char *cond, enum vas_e kind) { const char *q; struct req *req; struct busyobj *bo; struct sigaction sa; int err = errno; AZ(pthread_mutex_lock(&panicstr_mtx)); /* Won't be released, we're going to die anyway */ /* * should we trigger a SIGSEGV while handling a panic, our sigsegv * handler would hide the panic, so we need to reset the handler to * default */ memset(&sa, 0, sizeof sa); sa.sa_handler = SIG_DFL; (void)sigaction(SIGSEGV, &sa, NULL); /* Set SIGABRT back to default so the final abort() has the desired effect */ (void)sigaction(SIGABRT, &sa, NULL); switch(kind) { case VAS_WRONG: VSB_printf(pan_vsb, "Wrong turn at %s:%d:\n%s\n", file, line, cond); break; case VAS_VCL: VSB_printf(pan_vsb, "Panic from VCL:\n %s\n", cond); break; case VAS_MISSING: VSB_printf(pan_vsb, "Missing errorhandling code in %s(), %s line %d:\n" " Condition(%s) not true.", func, file, line, cond); break; case VAS_INCOMPLETE: VSB_printf(pan_vsb, "Incomplete code in %s(), %s line %d:\n", func, file, line); break; default: case VAS_ASSERT: VSB_printf(pan_vsb, "Assert error in %s(), %s line %d:\n" " Condition(%s) not true.\n", func, file, line, cond); break; } if (err) VSB_printf(pan_vsb, "errno = %d (%s)\n", err, strerror(err)); q = THR_GetName(); if (q != NULL) VSB_printf(pan_vsb, "thread = (%s)\n", q); VSB_printf(pan_vsb, "version = %s\n", VCS_version); VSB_printf(pan_vsb, "ident = %s,%s\n", VSB_data(vident) + 1, Waiter_GetName()); pan_backtrace(pan_vsb); if (!FEATURE(FEATURE_SHORT_PANIC)) { req = THR_GetRequest(); if (req != NULL) { pan_req(pan_vsb, req); VSL_Flush(req->vsl, 0); } bo = THR_GetBusyobj(); if (bo != NULL) { pan_busyobj(pan_vsb, bo); VSL_Flush(bo->vsl, 0); } } VSB_printf(pan_vsb, "\n"); VSB_putc(pan_vsb, '\0'); /* NUL termination */ if (FEATURE(FEATURE_NO_COREDUMP)) exit(4); else abort(); } /*--------------------------------------------------------------------*/ static void __match_proto__(cli_func_t) ccf_panic(struct cli *cli, const char * const *av, void *priv) { (void)cli; (void)av; AZ(priv); AZ(strcmp("", "You asked for it")); } /*--------------------------------------------------------------------*/ static struct cli_proto debug_cmds[] = { { "debug.panic.worker", "debug.panic.worker", "\tPanic the worker process.", 0, 0, "d", ccf_panic }, { NULL } }; /*--------------------------------------------------------------------*/ void PAN_Init(void) { VAS_Fail = pan_ic; pan_vsb = &pan_vsb_storage; AN(heritage.panic_str); AN(heritage.panic_str_len); AN(VSB_new(pan_vsb, heritage.panic_str, heritage.panic_str_len, VSB_FIXEDLEN)); CLI_AddFuncs(debug_cmds); } varnish-4.1.1/bin/varnishd/cache/cache_ban_lurker.c0000644000201500234410000001613312652366721017166 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "config.h" #include "cache.h" #include "cache_ban.h" #include "hash/hash_slinger.h" #include "vtim.h" static struct objcore oc_marker = { .magic = OBJCORE_MAGIC, }; static unsigned ban_batch; static unsigned ban_generation; pthread_cond_t ban_lurker_cond; void ban_kick_lurker(void) { Lck_AssertHeld(&ban_mtx); ban_generation++; AZ(pthread_cond_signal(&ban_lurker_cond)); } static void ban_cleantail(void) { struct ban *b; do { Lck_Lock(&ban_mtx); b = VTAILQ_LAST(&ban_head, banhead_s); if (b != VTAILQ_FIRST(&ban_head) && b->refcount == 0) { if (b->flags & BANS_FLAG_COMPLETED) VSC_C_main->bans_completed--; if (b->flags & BANS_FLAG_OBJ) VSC_C_main->bans_obj--; if (b->flags & BANS_FLAG_REQ) VSC_C_main->bans_req--; VSC_C_main->bans--; VSC_C_main->bans_deleted++; VTAILQ_REMOVE(&ban_head, b, list); VSC_C_main->bans_persisted_fragmentation += ban_len(b->spec); ban_info(BI_DROP, b->spec, ban_len(b->spec)); } else { b = NULL; } Lck_Unlock(&ban_mtx); if (b != NULL) BAN_Free(b); } while (b != NULL); } /*-------------------------------------------------------------------- * Our task here is somewhat tricky: The canonical locking order is * objhead->mtx first, then ban_mtx, because that is the order which * makes most sense in HSH_Lookup(), but we come the other way. * We optimistically try to get them the other way, and get out of * the way if that fails, and retry again later. */ static struct objcore * ban_lurker_getfirst(struct vsl_log *vsl, struct ban *bt) { struct objhead *oh; struct objcore *oc; while (1) { Lck_Lock(&ban_mtx); oc = VTAILQ_FIRST(&bt->objcore); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); if (oc == &oc_marker) { VTAILQ_REMOVE(&bt->objcore, oc, ban_list); Lck_Unlock(&ban_mtx); return (NULL); } oh = oc->objhead; CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); if (!Lck_Trylock(&oh->mtx)) { if (oc->refcnt == 0) { Lck_Unlock(&oh->mtx); } else { /* * We got the lock, and the oc is not being * dismantled under our feet. * Take it off the ban and (optimistically) * put it on the * destination ban */ AZ(oc->flags & OC_F_BUSY); oc->refcnt += 1; VTAILQ_REMOVE(&bt->objcore, oc, ban_list); VTAILQ_INSERT_TAIL(&bt->objcore, oc, ban_list); Lck_Unlock(&oh->mtx); Lck_Unlock(&ban_mtx); break; } } /* Try again, later */ Lck_Unlock(&ban_mtx); VSC_C_main->bans_lurker_contention++; VSL_Flush(vsl, 0); VTIM_sleep(cache_param->ban_lurker_sleep); } return (oc); } static void ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt, struct banhead_s *obans, struct ban *bd) { struct ban *bl, *bln; struct objcore *oc; unsigned tests; int i; /* * First see if there is anything to do, and if so, insert marker */ Lck_Lock(&ban_mtx); oc = VTAILQ_FIRST(&bt->objcore); if (oc != NULL) VTAILQ_INSERT_TAIL(&bt->objcore, &oc_marker, ban_list); Lck_Unlock(&ban_mtx); if (oc == NULL) return; while (1) { if (++ban_batch > cache_param->ban_lurker_batch) { VTIM_sleep(cache_param->ban_lurker_sleep); ban_batch = 0; } oc = ban_lurker_getfirst(vsl, bt); if (oc == NULL) return; i = 0; VTAILQ_FOREACH_REVERSE_SAFE(bl, obans, banhead_s, l_list, bln) { if (bl->flags & BANS_FLAG_COMPLETED) { /* Ban was overtaken by new (dup) ban */ VTAILQ_REMOVE(obans, bl, l_list); continue; } tests = 0; i = ban_evaluate(wrk, bl->spec, oc, NULL, &tests); VSC_C_main->bans_lurker_tested++; VSC_C_main->bans_lurker_tests_tested += tests; if (i) break; } if (i) { VSLb(vsl, SLT_ExpBan, "%u banned by lurker", ObjGetXID(wrk, oc)); EXP_Rearm(oc, oc->exp.t_origin, 0, 0, 0); // XXX ^ fake now VSC_C_main->bans_lurker_obj_killed++; } else { if (oc->ban != bd) { Lck_Lock(&ban_mtx); oc->ban->refcount--; VTAILQ_REMOVE(&oc->ban->objcore, oc, ban_list); oc->ban = bd; bd->refcount++; VTAILQ_INSERT_TAIL(&bd->objcore, oc, ban_list); Lck_Unlock(&ban_mtx); ObjUpdateMeta(wrk, oc); } } (void)HSH_DerefObjCore(wrk, &oc); } } /*-------------------------------------------------------------------- * Ban lurker thread */ static double ban_lurker_work(struct worker *wrk, struct vsl_log *vsl) { struct ban *b, *bd; struct banhead_s obans; double d, dt, n; dt = 49.62; // Random, non-magic if (cache_param->ban_lurker_sleep == 0) return (dt); Lck_Lock(&ban_mtx); b = ban_start; Lck_Unlock(&ban_mtx); d = VTIM_real() - cache_param->ban_lurker_age; bd = NULL; VTAILQ_INIT(&obans); for (; b != NULL; b = VTAILQ_NEXT(b, list)) { if (bd != NULL) ban_lurker_test_ban(wrk, vsl, b, &obans, bd); if (b->flags & BANS_FLAG_COMPLETED) continue; if (b->flags & BANS_FLAG_REQ) { bd = VTAILQ_NEXT(b, list); continue; } n = ban_time(b->spec) - d; if (n < 0) { VTAILQ_INSERT_TAIL(&obans, b, l_list); if (bd == NULL) bd = b; } else if (n < dt) { dt = n; } } Lck_Lock(&ban_mtx); VTAILQ_FOREACH(b, &obans, l_list) ban_mark_completed(b); Lck_Unlock(&ban_mtx); return (dt); } void * __match_proto__(bgthread_t) ban_lurker(struct worker *wrk, void *priv) { struct vsl_log vsl; volatile double d; unsigned gen = ban_generation + 1; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AZ(priv); VSL_Setup(&vsl, NULL, 0); while (!ban_shutdown) { d = ban_lurker_work(wrk, &vsl); ban_cleantail(); if (DO_DEBUG(DBG_LURKER)) VSLb(&vsl, SLT_Debug, "lurker: sleep = %lf", d); d += VTIM_real(); Lck_Lock(&ban_mtx); if (gen == ban_generation) { (void)Lck_CondWait(&ban_lurker_cond, &ban_mtx, d); ban_batch = 0; } gen = ban_generation; Lck_Unlock(&ban_mtx); } pthread_exit(0); NEEDLESS_RETURN(NULL); } varnish-4.1.1/bin/varnishd/cache/cache_vrt.c0000644000201500234410000002645312652366721015663 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Runtime support for compiled VCL programs */ #include "config.h" #include "cache.h" #include "cache_director.h" #include "hash/hash_slinger.h" #include "vav.h" #include "vcl.h" #include "vrt.h" #include "vrt_obj.h" #include "vtcp.h" #include "vtim.h" const void * const vrt_magic_string_end = &vrt_magic_string_end; const void * const vrt_magic_string_unset = &vrt_magic_string_unset; /*--------------------------------------------------------------------*/ void VRT_synth(VRT_CTX, unsigned code, const char *reason) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); if (code < 100 || code > 999) code = 503; ctx->req->err_code = (uint16_t)code; ctx->req->err_reason = reason ? reason : http_Status2Reason(ctx->req->err_code); } /*--------------------------------------------------------------------*/ void VRT_acl_log(VRT_CTX, const char *msg) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); VSLb(ctx->vsl, SLT_VCL_acl, "%s", msg); } /*--------------------------------------------------------------------*/ struct http * VRT_selecthttp(VRT_CTX, enum gethdr_e where) { struct http *hp; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); switch (where) { case HDR_REQ: hp = ctx->http_req; break; case HDR_REQ_TOP: hp = ctx->http_req_top; break; case HDR_BEREQ: hp = ctx->http_bereq; break; case HDR_BERESP: hp = ctx->http_beresp; break; case HDR_RESP: hp = ctx->http_resp; break; default: WRONG("VRT_selecthttp 'where' invalid"); } return (hp); } /*--------------------------------------------------------------------*/ const char * VRT_GetHdr(VRT_CTX, const struct gethdr_s *hs) { const char *p; struct http *hp; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (hs->where == HDR_OBJ) { CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); return(HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, hs->what)); } hp = VRT_selecthttp(ctx, hs->where); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); if (!http_GetHdr(hp, hs->what, &p)) return (NULL); return (p); } /*-------------------------------------------------------------------- * Collapse a STRING_LIST in the space provided, or return NULL */ char * VRT_StringList(char *d, unsigned dl, const char *p, va_list ap) { char *b, *e; unsigned x; b = d; e = b + dl; while (p != vrt_magic_string_end && b < e) { if (p != NULL) { x = strlen(p); if (b + x < e) memcpy(b, p, x); b += x; } p = va_arg(ap, const char *); } if (b >= e) return (NULL); *b++ = '\0'; return (b); } /*-------------------------------------------------------------------- * Copy and merge a STRING_LIST into a workspace. */ const char * VRT_String(struct ws *ws, const char *h, const char *p, va_list ap) { char *b, *e; unsigned u, x; u = WS_Reserve(ws, 0); e = b = ws->f; e += u; if (h != NULL) { x = strlen(h); if (b + x < e) memcpy(b, h, x); b += x; if (b < e) *b = ' '; b++; } b = VRT_StringList(b, e > b ? e - b : 0, p, ap); if (b == NULL || b == e) { WS_Release(ws, 0); return (NULL); } e = b; b = ws->f; WS_Release(ws, e - b); return (b); } /*-------------------------------------------------------------------- * Copy and merge a STRING_LIST on the current workspace */ const char * VRT_CollectString(VRT_CTX, const char *p, ...) { va_list ap; const char *b; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->ws, WS_MAGIC); va_start(ap, p); b = VRT_String(ctx->ws, NULL, p, ap); va_end(ap); return (b); } /*--------------------------------------------------------------------*/ void VRT_SetHdr(VRT_CTX , const struct gethdr_s *hs, const char *p, ...) { struct http *hp; va_list ap; const char *b; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(hs); AN(hs->what); hp = VRT_selecthttp(ctx, hs->where); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); va_start(ap, p); if (p == vrt_magic_string_unset) { http_Unset(hp, hs->what); } else { b = VRT_String(hp->ws, hs->what + 1, p, ap); if (b == NULL) { VSLb(ctx->vsl, SLT_LostHeader, "%s", hs->what + 1); } else { http_Unset(hp, hs->what); http_SetHeader(hp, b); } } va_end(ap); } /*--------------------------------------------------------------------*/ void VRT_handling(VRT_CTX, unsigned hand) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); assert(hand < VCL_RET_MAX); *ctx->handling = hand; } /*-------------------------------------------------------------------- * Feed data into the hash calculation */ void VRT_hashdata(VRT_CTX, const char *str, ...) { va_list ap; const char *p; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); AN(ctx->specific); HSH_AddString(ctx->req, ctx->specific, str); va_start(ap, str); while (1) { p = va_arg(ap, const char *); if (p == vrt_magic_string_end) break; HSH_AddString(ctx->req, ctx->specific, p); } va_end(ap); /* * Add a 'field-separator' to make it more difficult to * manipulate the hash. */ HSH_AddString(ctx->req, ctx->specific, NULL); } /*--------------------------------------------------------------------*/ double VRT_r_now(VRT_CTX) { (void)ctx; return (VTIM_real()); } /*--------------------------------------------------------------------*/ char * VRT_IP_string(VRT_CTX, VCL_IP ip) { char *p; unsigned len; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (ip == NULL) return (NULL); len = WS_Reserve(ctx->ws, 0); if (len == 0) { WS_Release(ctx->ws, 0); return (NULL); } p = ctx->ws->f; VTCP_name(ip, p, len, NULL, 0); WS_Release(ctx->ws, strlen(p) + 1); return (p); } char * VRT_INT_string(VRT_CTX, long num) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); return (WS_Printf(ctx->ws, "%ld", num)); } char * VRT_REAL_string(VRT_CTX, double num) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); return (WS_Printf(ctx->ws, "%.3f", num)); } char * VRT_TIME_string(VRT_CTX, double t) { char *p; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); p = WS_Alloc(ctx->ws, VTIM_FORMAT_SIZE); if (p != NULL) VTIM_format(t, p); return (p); } const char * __match_proto__() VRT_BACKEND_string(VCL_BACKEND d) { if (d == NULL) return (NULL); CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); return (d->vcl_name); } const char * VRT_BOOL_string(unsigned val) { return (val ? "true" : "false"); } /*--------------------------------------------------------------------*/ void VRT_Rollback(VRT_CTX, const struct http *hp) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); if (hp == ctx->http_req) { CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); HTTP_Copy(ctx->req->http, ctx->req->http0); WS_Reset(ctx->req->ws, ctx->req->ws_req); } else if (hp == ctx->http_bereq) { CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); HTTP_Copy(ctx->bo->bereq, ctx->bo->bereq0); WS_Reset(ctx->bo->bereq->ws, ctx->bo->ws_bo); WS_Reset(ctx->bo->ws, ctx->bo->ws_bo); } else WRONG("VRT_Rollback 'hp' invalid"); } /*--------------------------------------------------------------------*/ void VRT_synth_page(VRT_CTX, const char *str, ...) { va_list ap; const char *p; struct vsb *vsb; CAST_OBJ_NOTNULL(vsb, ctx->specific, VSB_MAGIC); va_start(ap, str); p = str; while (p != vrt_magic_string_end) { if (p == NULL) p = "(null)"; VSB_cat(vsb, p); p = va_arg(ap, const char *); } va_end(ap); } /*--------------------------------------------------------------------*/ void VRT_ban_string(VRT_CTX, const char *str) { char *a1, *a2, *a3; char **av; struct ban_proto *bp; const char *err; int i; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(ctx->vsl); AN(str); bp = BAN_Build(); if (bp == NULL) { VSLb(ctx->vsl, SLT_VCL_Error, "ban(): Out of Memory"); return; } av = VAV_Parse(str, NULL, ARGV_NOESC); AN(av); if (av[0] != NULL) { VSLb(ctx->vsl, SLT_VCL_Error, "ban(): %s", av[0]); VAV_Free(av); BAN_Abandon(bp); return; } for (i = 0; ;) { a1 = av[++i]; if (a1 == NULL) { VSLb(ctx->vsl, SLT_VCL_Error, "ban(): No ban conditions found."); break; } a2 = av[++i]; if (a2 == NULL) { VSLb(ctx->vsl, SLT_VCL_Error, "ban(): Expected comparison operator."); break; } a3 = av[++i]; if (a3 == NULL) { VSLb(ctx->vsl, SLT_VCL_Error, "ban(): Expected second operand."); break; } err = BAN_AddTest(bp, a1, a2, a3); if (err) { VSLb(ctx->vsl, SLT_VCL_Error, "ban(): %s", err); break; } if (av[++i] == NULL) { err = BAN_Commit(bp); if (err == NULL) bp = NULL; else VSLb(ctx->vsl, SLT_VCL_Error, "ban(): %s", err); break; } if (strcmp(av[i], "&&")) { VSLb(ctx->vsl, SLT_VCL_Error, "ban(): Expected && between conditions," " found \"%s\"", av[i]); break; } } if (bp != NULL) BAN_Abandon(bp); VAV_Free(av); } /*-------------------------------------------------------------------- * * XXX this really should be ssize_t VRT_CacheReqBody(VRT_CTX, size_t) * - change with next VRT major bump */ int VRT_CacheReqBody(VRT_CTX, long long maxsize) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); if (ctx->method != VCL_MET_RECV) { VSLb(ctx->vsl, SLT_VCL_Error, "req.body can only be cached in vcl_recv{}"); return (-1); } return (VRB_Cache(ctx->req, maxsize)); } /*-------------------------------------------------------------------- * purges */ void VRT_purge(VRT_CTX, double ttl, double grace, double keep) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->wrk, WORKER_MAGIC); if (ctx->method == VCL_MET_HIT) HSH_Purge(ctx->req->wrk, ctx->req->objcore->objhead, ttl, grace, keep); else if (ctx->method == VCL_MET_MISS) HSH_Purge(ctx->req->wrk, ctx->req->objcore->objhead, ttl, grace, keep); } /*-------------------------------------------------------------------- * Simple stuff */ int VRT_strcmp(const char *s1, const char *s2) { if (s1 == NULL || s2 == NULL) return(1); return (strcmp(s1, s2)); } void VRT_memmove(void *dst, const void *src, unsigned len) { (void)memmove(dst, src, len); } varnish-4.1.1/bin/varnishd/cache/cache_esi_fetch.c0000644000201500234410000001574712652366721017005 00000000000000/*- * Copyright (c) 2011 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. * * VEF Varnish Esi Fetching */ #include "config.h" #include #include #include "cache.h" #include "cache_filter.h" #include "cache_esi.h" /*--------------------------------------------------------------------- */ struct vef_priv { unsigned magic; #define VEF_MAGIC 0xf104b51f int error; ssize_t tot; struct vgz *vgz; struct vep_state *vep; char *ibuf; char *ibuf_i; char *ibuf_o; ssize_t ibuf_sz; }; static ssize_t vfp_vep_callback(struct vfp_ctx *vc, void *priv, ssize_t l, enum vgz_flag flg) { struct vef_priv *vef; ssize_t dl; const void *dp; uint8_t *ptr; int i; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CAST_OBJ_NOTNULL(vef, priv, VEF_MAGIC); assert(l >= 0); if (vef->error) { vef->tot += l; return (vef->tot); } /* * l == 0 is valid when 'flg' calls for action, but in the * normal case we can just ignore a l==0 request. * (It would cause Z_BUF_ERROR anyway) */ if (l == 0 && flg == VGZ_NORMAL) return (vef->tot); CHECK_OBJ_NOTNULL(vc->bo, BUSYOBJ_MAGIC); VGZ_Ibuf(vef->vgz, vef->ibuf_o, l); do { dl = 0; if (VFP_GetStorage(vc, &dl, &ptr) != VFP_OK) { vef->error = ENOMEM; vef->tot += l; return (vef->tot); } VGZ_Obuf(vef->vgz, ptr, dl); i = VGZ_Gzip(vef->vgz, &dp, &dl, flg); VGZ_UpdateObj(vc, vef->vgz, VUA_UPDATE); vef->tot += dl; VBO_extend(vc->bo, dl); } while (i != VGZ_ERROR && (!VGZ_IbufEmpty(vef->vgz) || VGZ_ObufFull(vef->vgz))); assert(i == VGZ_ERROR || VGZ_IbufEmpty(vef->vgz)); vef->ibuf_o += l; return (vef->tot); } static enum vfp_status vfp_esi_end(struct vfp_ctx *vc, struct vef_priv *vef, enum vfp_status retval) { struct vsb *vsb; ssize_t l; void *p; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vef, VEF_MAGIC); vsb = VEP_Finish(vef->vep); if (vsb != NULL) { if (retval == VFP_END) { l = VSB_len(vsb); assert(l > 0); p = ObjSetattr(vc->wrk, vc->oc, OA_ESIDATA, l, VSB_data(vsb)); if (p == NULL) { retval = VFP_Error(vc, "Could not allocate storage for esidata"); } } VSB_delete(vsb); } if (vef->vgz != NULL) { VGZ_UpdateObj(vc, vef->vgz, VUA_END_GZIP); if (VGZ_Destroy(&vef->vgz) != VGZ_END) retval = VFP_Error(vc, "ESI+Gzip Failed at the very end"); } if (vef->ibuf != NULL) free(vef->ibuf); FREE_OBJ(vef); return (retval); } static enum vfp_status __match_proto__(vfp_init_f) vfp_esi_gzip_init(struct vfp_ctx *vc, struct vfp_entry *vfe) { struct vef_priv *vef; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vc->esi_req, HTTP_MAGIC); CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); ALLOC_OBJ(vef, VEF_MAGIC); if (vef == NULL) return (VFP_ERROR); vef->vgz = VGZ_NewGzip(vc->wrk->vsl, "G F E"); vef->vep = VEP_Init(vc, vc->esi_req, vfp_vep_callback, vef); vef->ibuf_sz = cache_param->gzip_buffer; vef->ibuf = calloc(1L, vef->ibuf_sz); if (vef->ibuf == NULL) return (vfp_esi_end(vc, vef, VFP_ERROR)); vef->ibuf_i = vef->ibuf; vef->ibuf_o = vef->ibuf; vfe->priv1 = vef; RFC2616_Weaken_Etag(vc->http); http_Unset(vc->http, H_Content_Length); http_Unset(vc->http, H_Content_Encoding); http_SetHeader(vc->http, "Content-Encoding: gzip"); RFC2616_Vary_AE(vc->http); return (VFP_OK); } static enum vfp_status __match_proto__(vfp_pull_f) vfp_esi_gzip_pull(struct vfp_ctx *vc, struct vfp_entry *vfe, void *p, ssize_t *lp) { enum vfp_status vp; ssize_t d, l; struct vef_priv *vef; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); CAST_OBJ_NOTNULL(vef, vfe->priv1, VEF_MAGIC); AN(p); AN(lp); *lp = 0; l = vef->ibuf_sz - (vef->ibuf_i - vef->ibuf); if (DO_DEBUG(DBG_ESI_CHOP)) { d = (random() & 3) + 1; if (d < l) l = d; } vp = VFP_Suck(vc, vef->ibuf_i, &l); if (l > 0) { VEP_Parse(vef->vep, vef->ibuf_i, l); vef->ibuf_i += l; assert(vef->ibuf_o >= vef->ibuf && vef->ibuf_o <= vef->ibuf_i); if (vef->error) { errno = vef->error; return (VFP_ERROR); } l = vef->ibuf_i - vef->ibuf_o; if (l > 0) memmove(vef->ibuf, vef->ibuf_o, l); vef->ibuf_o = vef->ibuf; vef->ibuf_i = vef->ibuf + l; } if (vp == VFP_END) { vp = vfp_esi_end(vc, vef, vp); vfe->priv1 = NULL; } return (vp); } static enum vfp_status __match_proto__(vfp_init_f) vfp_esi_init(struct vfp_ctx *vc, struct vfp_entry *vfe) { struct vef_priv *vef; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vc->esi_req, HTTP_MAGIC); ALLOC_OBJ(vef, VEF_MAGIC); if (vef == NULL) return (VFP_ERROR); vef->vep = VEP_Init(vc, vc->esi_req, NULL, NULL); vfe->priv1 = vef; return (VFP_OK); } static enum vfp_status __match_proto__(vfp_pull_f) vfp_esi_pull(struct vfp_ctx *vc, struct vfp_entry *vfe, void *p, ssize_t *lp) { enum vfp_status vp; ssize_t d; struct vef_priv *vef; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); CAST_OBJ_NOTNULL(vef, vfe->priv1, VEF_MAGIC); AN(p); AN(lp); if (DO_DEBUG(DBG_ESI_CHOP)) { d = (random() & 3) + 1; if (d < *lp) *lp = d; } vp = VFP_Suck(vc, p, lp); if (vp != VFP_ERROR && *lp > 0) VEP_Parse(vef->vep, p, *lp); if (vp == VFP_END) { vp = vfp_esi_end(vc, vef, vp); vfe->priv1 = NULL; } return (vp); } static void __match_proto__(vfp_fini_f) vfp_esi_fini(struct vfp_ctx *vc, struct vfp_entry *vfe) { CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); if (vfe->priv1 != NULL) (void)vfp_esi_end(vc, vfe->priv1, VFP_ERROR); vfe->priv1 = NULL; } const struct vfp vfp_esi = { .name = "ESI", .init = vfp_esi_init, .pull = vfp_esi_pull, .fini = vfp_esi_fini, }; const struct vfp vfp_esi_gzip = { .name = "ESI_GZIP", .init = vfp_esi_gzip_init, .pull = vfp_esi_gzip_pull, .fini = vfp_esi_fini, }; varnish-4.1.1/bin/varnishd/cache/cache_cli.c0000644000201500234410000000715312652366721015613 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Caching process CLI handling. * * We only have one CLI source, the stdin/stdout pipes from the manager * process, but we complicate things by having undocumented commands that * we do not want to show in a plain help, and by having commands that the * manager has already shown in help before asking us. */ #include "config.h" #include "cache.h" #include "common/heritage.h" #include "vcli.h" #include "vcli_common.h" #include "vcli_priv.h" #include "vcli_serve.h" pthread_t cli_thread; static struct lock cli_mtx; static int add_check; static struct VCLS *cls; /* * The CLI commandlist is split in three: * - Commands we get from/share with the manager, we don't show these * in help, as the manager already did that. * - Cache process commands, show in help * - Undocumented debug commands, show in undocumented "help -d" */ /*-------------------------------------------------------------------- * Add CLI functions to the appropriate command set */ void CLI_AddFuncs(struct cli_proto *p) { AZ(add_check); Lck_Lock(&cli_mtx); AZ(VCLS_AddFunc(cls, 0, p)); Lck_Unlock(&cli_mtx); } static void cli_cb_before(const struct cli *cli) { ASSERT_CLI(); VSL(SLT_CLI, 0, "Rd %s", cli->cmd); VCL_Poll(); VBE_Poll(); Lck_Lock(&cli_mtx); } static void cli_cb_after(const struct cli *cli) { ASSERT_CLI(); Lck_Unlock(&cli_mtx); VSL(SLT_CLI, 0, "Wr %03u %zd %s", cli->result, VSB_len(cli->sb), VSB_data(cli->sb)); } void CLI_Run(void) { int i; add_check = 1; AN(VCLS_AddFd(cls, heritage.cli_in, heritage.cli_out, NULL, NULL)); do { i = VCLS_Poll(cls, -1); } while(i > 0); VSL(SLT_CLI, 0, "EOF on CLI connection, worker stops"); VCA_Shutdown(); } /*--------------------------------------------------------------------*/ static struct cli_proto cli_cmds[] = { { CLI_PING, "i", VCLS_func_ping }, { CLI_HELP, "i", VCLS_func_help }, { NULL } }; /*-------------------------------------------------------------------- * Initialize the CLI subsystem */ void CLI_Init(void) { Lck_New(&cli_mtx, lck_cli); cli_thread = pthread_self(); cls = VCLS_New(cli_cb_before, cli_cb_after, &cache_param->cli_buffer, &cache_param->cli_limit); AN(cls); CLI_AddFuncs(cli_cmds); } varnish-4.1.1/bin/varnishd/cache/cache_vrt_priv.c0000644000201500234410000000770212652366721016717 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Runtime support for compiled VCL programs: private variables */ #include "config.h" #include #include "cache.h" #include "vrt.h" struct vrt_priv { unsigned magic; #define VRT_PRIV_MAGIC 0x24157a52 VTAILQ_ENTRY(vrt_priv) list; struct vmod_priv priv[1]; const struct vcl *vcl; uintptr_t id; uintptr_t vmod_id; }; /*-------------------------------------------------------------------- */ void VRTPRIV_init(struct vrt_privs *privs) { privs->magic = VRT_PRIVS_MAGIC; VTAILQ_INIT(&privs->privs); } static struct vmod_priv * VRT_priv_dynamic(VRT_CTX, uintptr_t id, uintptr_t vmod_id) { struct vrt_privs *vps; struct vrt_priv *vp; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (ctx->req) { CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->sp, SESS_MAGIC); CAST_OBJ_NOTNULL(vps, ctx->req->sp->privs, VRT_PRIVS_MAGIC); } else { CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); CAST_OBJ_NOTNULL(vps, ctx->bo->privs, VRT_PRIVS_MAGIC); } VTAILQ_FOREACH(vp, &vps->privs, list) { CHECK_OBJ_NOTNULL(vp, VRT_PRIV_MAGIC); if (vp->vcl == ctx->vcl && vp->id == id && vp->vmod_id == vmod_id) return (vp->priv); } ALLOC_OBJ(vp, VRT_PRIV_MAGIC); AN(vp); vp->vcl = ctx->vcl; vp->id = id; vp->vmod_id = vmod_id; VTAILQ_INSERT_TAIL(&vps->privs, vp, list); return (vp->priv); } void VRTPRIV_dynamic_kill(struct vrt_privs *privs, uintptr_t id) { struct vrt_priv *vp, *vp1; CHECK_OBJ_NOTNULL(privs, VRT_PRIVS_MAGIC); VTAILQ_FOREACH_SAFE(vp, &privs->privs, list, vp1) { CHECK_OBJ_NOTNULL(vp, VRT_PRIV_MAGIC); if (id == vp->id) { VTAILQ_REMOVE(&privs->privs, vp, list); VRT_priv_fini(vp->priv); FREE_OBJ(vp); } } } struct vmod_priv * VRT_priv_task(VRT_CTX, void *vmod_id) { uintptr_t id; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (ctx->req) { CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); id = (uintptr_t)ctx->req; } else { CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); id = (uintptr_t)ctx->bo; } return (VRT_priv_dynamic(ctx, id, (uintptr_t)vmod_id)); } struct vmod_priv * VRT_priv_top(VRT_CTX, void *vmod_id) { uintptr_t id; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (ctx->req) { CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->top, REQ_MAGIC); id = (uintptr_t)&ctx->req->top->top; return (VRT_priv_dynamic(ctx, id, (uintptr_t)vmod_id)); } return (NULL); } /*-------------------------------------------------------------------- */ void VRT_priv_fini(const struct vmod_priv *p) { if (p->priv != (void*)0 && p->free != (void*)0) p->free(p->priv); } varnish-4.1.1/bin/varnishd/cache/cache_req.c0000644000201500234410000001155612652366721015635 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Request management * */ #include "config.h" #include #include #include #include #include "cache.h" #include "cache_pool.h" #include "vtim.h" /*-------------------------------------------------------------------- * Alloc/Free a request */ struct req * Req_New(const struct worker *wrk, struct sess *sp) { struct pool *pp; struct req *req; uint16_t nhttp; unsigned sz, hl; char *p, *e; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); pp = sp->pool; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); req = MPL_Get(pp->mpl_req, &sz); AN(req); req->magic = REQ_MAGIC; req->sp = sp; req->top = req; // esi overrides e = (char*)req + sz; p = (char*)(req + 1); p = (void*)PRNDUP(p); assert(p < e); nhttp = (uint16_t)cache_param->http_max_hdr; hl = HTTP_estimate(nhttp); req->http = HTTP_create(p, nhttp); p += hl; p = (void*)PRNDUP(p); assert(p < e); req->http0 = HTTP_create(p, nhttp); p += hl; p = (void*)PRNDUP(p); assert(p < e); req->resp = HTTP_create(p, nhttp); p += hl; p = (void*)PRNDUP(p); assert(p < e); sz = cache_param->vsl_buffer; VSL_Setup(req->vsl, p, sz); p += sz; p = (void*)PRNDUP(p); assert(p < e); WS_Init(req->ws, "req", p, e - p); req->req_bodybytes = 0; req->t_first = NAN; req->t_prev = NAN; req->t_req = NAN; req->vdp_nxt = 0; VTAILQ_INIT(&req->vdp); return (req); } void Req_Release(struct req *req) { struct sess *sp; struct pool *pp; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); /* Make sure the request counters have all been zeroed */ #define ACCT(foo) \ AZ(req->acct.foo); #include "tbl/acct_fields_req.h" #undef ACCT AZ(req->vcl); if (req->vsl->wid) VSL_End(req->vsl); sp = req->sp; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); pp = sp->pool; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); MPL_AssertSane(req); VSL_Flush(req->vsl, 0); req->sp = NULL; MPL_Free(pp->mpl_req, req); } /*---------------------------------------------------------------------- */ int Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); assert(sp == req->sp); req->director_hint = NULL; req->restarts = 0; AZ(req->esi_level); assert(req->top == req); if (req->vcl != NULL) { if (wrk->vcl != NULL) VCL_Rel(&wrk->vcl); wrk->vcl = req->vcl; req->vcl = NULL; } VRTPRIV_dynamic_kill(sp->privs, (uintptr_t)req); VRTPRIV_dynamic_kill(sp->privs, (uintptr_t)&req->top); /* Charge and log byte counters */ if (req->vsl->wid) { CNT_AcctLogCharge(wrk->stats, req); VSL_End(req->vsl); } req->req_bodybytes = 0; if (!isnan(req->t_prev) && req->t_prev > 0.) sp->t_idle = req->t_prev; else sp->t_idle = W_TIM_real(wrk); req->t_first = NAN; req->t_prev = NAN; req->t_req = NAN; req->req_body_status = REQ_BODY_INIT; req->hash_always_miss = 0; req->hash_ignore_busy = 0; req->is_hit = 0; if (sp->fd >= 0 && req->doclose != SC_NULL) SES_Close(sp, req->doclose); if (sp->fd < 0) { wrk->stats->sess_closed++; AZ(req->vcl); Req_Release(req); SES_Delete(sp, SC_NULL, NAN); return (1); } WS_Reset(req->ws, NULL); WS_Reset(wrk->aws, NULL); return (0); } /*---------------------------------------------------------------------- */ void __match_proto__() Req_Fail(struct req *req, enum sess_close reason) { CHECK_OBJ_NOTNULL(req, REQ_MAGIC); if (req->sp->fd >= 0) SES_Close(req->sp, reason); } varnish-4.1.1/bin/varnishd/cache/cache_vrt_vmod.c0000644000201500234410000001130112652366721016672 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Runtime support for compiled VCL programs */ #include "config.h" #include #include #include #include "cache.h" #include "vcli_priv.h" #include "vrt.h" /*-------------------------------------------------------------------- * Modules stuff */ struct vmod { unsigned magic; #define VMOD_MAGIC 0xb750219c VTAILQ_ENTRY(vmod) list; int ref; char *nm; char *path; void *hdl; const void *funcs; int funclen; }; static VTAILQ_HEAD(,vmod) vmods = VTAILQ_HEAD_INITIALIZER(vmods); int VRT_Vmod_Init(struct vmod **hdl, void *ptr, int len, const char *nm, const char *path, const char *file_id, VRT_CTX) { struct vmod *v; const struct vmod_data *d; char buf[256]; void *dlhdl; ASSERT_CLI(); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(ctx->msg); AN(hdl); AZ(*hdl); dlhdl = dlopen(path, RTLD_NOW | RTLD_LOCAL); if (dlhdl == NULL) { VSB_printf(ctx->msg, "Loading VMOD %s from %s:\n", nm, path); VSB_printf(ctx->msg, "dlopen() failed: %s\n", dlerror()); VSB_printf(ctx->msg, "Check child process permissions.\n"); return (1); } VTAILQ_FOREACH(v, &vmods, list) if (v->hdl == dlhdl) break; if (v == NULL) { ALLOC_OBJ(v, VMOD_MAGIC); AN(v); v->hdl = dlhdl; bprintf(buf, "Vmod_%s_Data", nm); d = dlsym(v->hdl, buf); if (d == NULL || d->file_id == NULL || strcmp(d->file_id, file_id)) { VSB_printf(ctx->msg, "Loading VMOD %s from %s:\n", nm, path); VSB_printf(ctx->msg, "This is no longer the same file seen by" " the VCL-compiler.\n"); (void)dlclose(v->hdl); FREE_OBJ(v); return (1); } if (d->vrt_major != VRT_MAJOR_VERSION || d->vrt_minor > VRT_MINOR_VERSION || d->name == NULL || strcmp(d->name, nm) || d->func == NULL || d->func_len <= 0 || d->proto == NULL || d->spec == NULL || d->abi == NULL) { VSB_printf(ctx->msg, "Loading VMOD %s from %s:\n", nm, path); VSB_printf(ctx->msg, "VMOD data is mangled.\n"); (void)dlclose(v->hdl); FREE_OBJ(v); return (1); } v->funclen = d->func_len; v->funcs = d->func; REPLACE(v->nm, nm); REPLACE(v->path, path); VSC_C_main->vmods++; VTAILQ_INSERT_TAIL(&vmods, v, list); } assert(len == v->funclen); memcpy(ptr, v->funcs, v->funclen); v->ref++; *hdl = v; return (0); } void VRT_Vmod_Fini(struct vmod **hdl) { struct vmod *v; ASSERT_CLI(); AN(hdl); v = *hdl; *hdl = NULL; CHECK_OBJ_NOTNULL(v, VMOD_MAGIC); #ifndef DONT_DLCLOSE_VMODS /* * atexit(3) handlers are not called during dlclose(3). We don't * normally use them, but we do when running GCOV. This option * enables us to do that. */ AZ(dlclose(v->hdl)); #endif if (--v->ref != 0) return; free(v->nm); free(v->path); VTAILQ_REMOVE(&vmods, v, list); VSC_C_main->vmods--; FREE_OBJ(v); } /*---------------------------------------------------------------------*/ static void ccf_debug_vmod(struct cli *cli, const char * const *av, void *priv) { struct vmod *v; (void)av; (void)priv; ASSERT_CLI(); VTAILQ_FOREACH(v, &vmods, list) VCLI_Out(cli, "%5d %s (%s)\n", v->ref, v->nm, v->path); } static struct cli_proto vcl_cmds[] = { { "debug.vmod", "debug.vmod", "\tShow loaded vmods.", 0, 0, "d", ccf_debug_vmod }, { NULL } }; void VMOD_Init(void) { CLI_AddFuncs(vcl_cmds); } varnish-4.1.1/bin/varnishd/cache/cache_backend.h0000644000201500234410000001016312652366721016433 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Backend and APIs * * A backend ("VBE") is a director which talks HTTP over TCP. * * As you'll notice the terminology is a bit muddled here, but we try to * keep it clean on the user-facing side, where a "director" is always * a "pick a backend/director" functionality, and a "backend" is whatever * satisfies the actual request in the end. * */ struct vbp_target; struct vrt_ctx; struct vrt_backend_probe; struct tcp_pool; /*-------------------------------------------------------------------- * An instance of a backend from a VCL program. */ struct backend { unsigned magic; #define BACKEND_MAGIC 0x64c4c7c6 unsigned n_conn; VTAILQ_ENTRY(backend) list; VTAILQ_ENTRY(backend) vcl_list; struct lock mtx; VRT_BACKEND_FIELDS() struct vcl *vcl; char *display_name; struct vbp_target *probe; unsigned healthy; const char *admin_health; double health_changed; struct VSC_C_vbe *vsc; struct tcp_pool *tcp_pool; struct director director[1]; double cooled; }; /*--------------------------------------------------------------------- * Backend connection -- private to cache_backend*.c */ struct vbc { unsigned magic; #define VBC_MAGIC 0x0c5e6592 int fd; VTAILQ_ENTRY(vbc) list; const struct suckaddr *addr; uint8_t state; #define VBC_STATE_AVAIL (1<<0) #define VBC_STATE_USED (1<<1) #define VBC_STATE_STOLEN (1<<2) #define VBC_STATE_CLEANUP (1<<3) struct waited waited[1]; struct tcp_pool *tcp_pool; pthread_cond_t *cond; }; /*--------------------------------------------------------------------- * Prototypes */ /* cache_backend.c */ void VBE_fill_director(struct backend *be); /* cache_backend_cfg.c */ unsigned VBE_Healthy(const struct backend *b, double *changed); #ifdef VCL_MET_MAX void VBE_Event(struct backend *, enum vcl_event_e); #endif void VBE_Delete(struct backend *be); /* cache_backend_probe.c */ void VBP_Insert(struct backend *b, struct vrt_backend_probe const *p, struct tcp_pool *); void VBP_Remove(struct backend *b); void VBP_Control(const struct backend *b, int stop); void VBP_Status(struct cli *cli, const struct backend *, int details); /* cache_backend_tcp.c */ struct tcp_pool *VBT_Ref(const struct suckaddr *ip4, const struct suckaddr *ip6); void VBT_Rel(struct tcp_pool **tpp); int VBT_Open(const struct tcp_pool *tp, double tmo, const struct suckaddr **sa); void VBT_Recycle(const struct worker *, struct tcp_pool *, struct vbc **); void VBT_Close(struct tcp_pool *tp, struct vbc **vbc); struct vbc *VBT_Get(struct tcp_pool *, double tmo, const struct backend *, struct worker *); void VBT_Wait(struct worker *, struct vbc *); /* cache_vcl.c */ int VCL_AddBackend(struct vcl *, struct backend *); void VCL_DelBackend(struct backend *); varnish-4.1.1/bin/varnishd/cache/cache_fetch_proc.c0000644000201500234410000001344512652366721017161 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include "cache.h" #include "cache_filter.h" #include "vcli_priv.h" static unsigned fetchfrag; /*-------------------------------------------------------------------- * We want to issue the first error we encounter on fetching and * supress the rest. This function does that. * * Other code is allowed to look at busyobj->fetch_failed to bail out * * For convenience, always return -1 */ enum vfp_status VFP_Error(struct vfp_ctx *vc, const char *fmt, ...) { va_list ap; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); if (!vc->failed) { va_start(ap, fmt); VSLbv(vc->wrk->vsl, SLT_FetchError, fmt, ap); va_end(ap); vc->failed = 1; } return (VFP_ERROR); } /*-------------------------------------------------------------------- * Fetch Storage to put object into. * */ enum vfp_status VFP_GetStorage(struct vfp_ctx *vc, ssize_t *sz, uint8_t **ptr) { ssize_t l; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); AN(sz); assert(*sz >= 0); AN(ptr); l = fetchfrag; if (l == 0) l = *sz; if (l == 0) l = cache_param->fetch_chunksize; *sz = l; if (!ObjGetSpace(vc->wrk, vc->oc, sz, ptr)) { *sz = 0; *ptr = NULL; return (VFP_Error(vc, "Could not get storage")); } assert(*sz > 0); AN(*ptr); return (VFP_OK); } /********************************************************************** */ void VFP_Setup(struct vfp_ctx *vc) { INIT_OBJ(vc, VFP_CTX_MAGIC); VTAILQ_INIT(&vc->vfp); } /********************************************************************** */ void VFP_Close(struct vfp_ctx *vc) { struct vfp_entry *vfe; VTAILQ_FOREACH(vfe, &vc->vfp, list) { if(vfe->vfp->fini != NULL) vfe->vfp->fini(vc, vfe); VSLb(vc->wrk->vsl, SLT_VfpAcct, "%s %ju %ju", vfe->vfp->name, (uintmax_t)vfe->calls, (uintmax_t)vfe->bytes_out); } } int VFP_Open(struct vfp_ctx *vc) { struct vfp_entry *vfe; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vc->http, HTTP_MAGIC); CHECK_OBJ_NOTNULL(vc->wrk, WORKER_MAGIC); AN(vc->wrk->vsl); VTAILQ_FOREACH_REVERSE(vfe, &vc->vfp, vfp_entry_s, list) { if (vfe->vfp->init == NULL) continue; vfe->closed = vfe->vfp->init(vc, vfe); if (vfe->closed != VFP_OK && vfe->closed != VFP_NULL) { (void)VFP_Error(vc, "Fetch filter %s failed to open", vfe->vfp->name); VFP_Close(vc); return (-1); } } return (0); } /********************************************************************** * Suck data up from lower levels. * Once a layer return non VFP_OK, clean it up and produce the same * return value for any subsequent calls. */ enum vfp_status VFP_Suck(struct vfp_ctx *vc, void *p, ssize_t *lp) { enum vfp_status vp; struct vfp_entry *vfe; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); AN(p); AN(lp); vfe = vc->vfp_nxt; CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC); vc->vfp_nxt = VTAILQ_NEXT(vfe, list); if (vfe->closed == VFP_NULL) { /* Layer asked to be bypassed when opened */ vp = VFP_Suck(vc, p, lp); } else if (vfe->closed == VFP_OK) { vp = vfe->vfp->pull(vc, vfe, p, lp); if (vp != VFP_OK && vp != VFP_END && vp != VFP_ERROR) { (void)VFP_Error(vc, "Fetch filter %s returned %d", vfe->vfp->name, vp); vp = VFP_ERROR; } vfe->closed = vp; vfe->calls++; vfe->bytes_out += *lp; } else { /* Already closed filter */ *lp = 0; vp = vfe->closed; } vc->vfp_nxt = vfe; return (vp); } /*-------------------------------------------------------------------- */ struct vfp_entry * VFP_Push(struct vfp_ctx *vc, const struct vfp *vfp, int top) { struct vfp_entry *vfe; CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(vc->http, HTTP_MAGIC); vfe = WS_Alloc(vc->http->ws, sizeof *vfe); AN(vfe); INIT_OBJ(vfe, VFP_ENTRY_MAGIC); vfe->vfp = vfp; vfe->closed = VFP_OK; if (top) VTAILQ_INSERT_HEAD(&vc->vfp, vfe, list); else VTAILQ_INSERT_TAIL(&vc->vfp, vfe, list); if (VTAILQ_FIRST(&vc->vfp) == vfe) vc->vfp_nxt = vfe; return (vfe); } /*-------------------------------------------------------------------- * Debugging aids */ static void debug_fragfetch(struct cli *cli, const char * const *av, void *priv) { (void)priv; (void)cli; fetchfrag = strtoul(av[2], NULL, 0); } static struct cli_proto debug_cmds[] = { { "debug.fragfetch", "debug.fragfetch", "\tEnable fetch fragmentation.", 1, 1, "d", debug_fragfetch }, { NULL } }; /*-------------------------------------------------------------------- * */ void VFP_Init(void) { CLI_AddFuncs(debug_cmds); } varnish-4.1.1/bin/varnishd/cache/cache_esi_deliver.c0000644000201500234410000004323112652366721017333 00000000000000/*- * Copyright (c) 2011 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. * * VED - Varnish Esi Delivery */ #include "config.h" #include #include #include "cache.h" #include "cache_filter.h" #include "vtim.h" #include "cache_esi.h" #include "vend.h" #include "vgz.h" static vtr_deliver_f VED_Deliver; static const uint8_t gzip_hdr[] = { 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03 }; struct ecx { unsigned magic; #define ECX_MAGIC 0x0b0f9163 uint8_t *p; uint8_t *e; int state; ssize_t l; int isgzip; struct req *preq; ssize_t l_crc; uint32_t crc; }; /*--------------------------------------------------------------------*/ static void ved_include(struct req *preq, const char *src, const char *host, struct ecx *ecx) { struct worker *wrk; struct req *req; enum req_fsm_nxt s; struct transport xp; CHECK_OBJ_NOTNULL(preq, REQ_MAGIC); CHECK_OBJ_NOTNULL(ecx, ECX_MAGIC); wrk = preq->wrk; if (preq->esi_level >= cache_param->max_esi_depth) return; req = Req_New(wrk, preq->sp); req->req_body_status = REQ_BODY_NONE; AZ(req->vsl->wid); req->vsl->wid = VXID_Get(wrk, VSL_CLIENTMARKER); VSLb(req->vsl, SLT_Begin, "req %u esi", VXID(preq->vsl->wid)); VSLb(preq->vsl, SLT_Link, "req %u esi", VXID(req->vsl->wid)); req->esi_level = preq->esi_level + 1; if (preq->esi_level == 0) assert(preq->top == preq); else CHECK_OBJ_NOTNULL(preq->top, REQ_MAGIC); req->top = preq->top; HTTP_Copy(req->http0, preq->http0); req->http0->ws = req->ws; req->http0->vsl = req->vsl; req->http0->logtag = SLT_ReqMethod; req->http0->conds = 0; http_SetH(req->http0, HTTP_HDR_URL, src); if (host != NULL && *host != '\0') { http_Unset(req->http0, H_Host); http_SetHeader(req->http0, host); } http_ForceField(req->http0, HTTP_HDR_METHOD, "GET"); http_ForceField(req->http0, HTTP_HDR_PROTO, "HTTP/1.1"); /* Don't allow conditionals, we can't use a 304 */ http_Unset(req->http0, H_If_Modified_Since); http_Unset(req->http0, H_If_None_Match); /* Don't allow Range */ http_Unset(req->http0, H_Range); /* Set Accept-Encoding according to what we want */ http_Unset(req->http0, H_Accept_Encoding); if (ecx->isgzip) http_ForceHeader(req->http0, H_Accept_Encoding, "gzip"); /* Client content already taken care of */ http_Unset(req->http0, H_Content_Length); /* Reset request to status before we started messing with it */ HTTP_Copy(req->http, req->http0); req->vcl = preq->vcl; preq->vcl = NULL; req->wrk = preq->wrk; /* * XXX: We should decide if we should cache the director * XXX: or not (for session/backend coupling). Until then * XXX: make sure we don't trip up the check in vcl_recv. */ req->req_step = R_STP_RECV; req->t_req = preq->t_req; assert(isnan(req->t_first)); assert(isnan(req->t_prev)); INIT_OBJ(&xp, TRANSPORT_MAGIC); xp.deliver = VED_Deliver; req->transport = &xp; req->transport_priv = ecx; THR_SetRequest(req); VSLb_ts_req(req, "Start", W_TIM_real(wrk)); req->ws_req = WS_Snapshot(req->ws); while (1) { req->wrk = wrk; s = CNT_Request(wrk, req); if (s == REQ_FSM_DONE) break; DSL(DBG_WAITINGLIST, req->vsl->wid, "loop waiting for ESI (%d)", (int)s); assert(s == REQ_FSM_DISEMBARK); AZ(req->wrk); (void)usleep(10000); } VRTPRIV_dynamic_kill(req->sp->privs, (uintptr_t)req); CNT_AcctLogCharge(wrk->stats, req); VSL_End(req->vsl); preq->vcl = req->vcl; req->vcl = NULL; req->wrk = NULL; THR_SetRequest(preq); Req_Release(req); } /*--------------------------------------------------------------------*/ //#define Debug(fmt, ...) printf(fmt, __VA_ARGS__) #define Debug(fmt, ...) /**/ static ssize_t ved_decode_len(struct req *req, uint8_t **pp) { uint8_t *p; ssize_t l; p = *pp; switch (*p & 15) { case 1: l = p[1]; p += 2; break; case 2: l = vbe16dec(p + 1); p += 3; break; case 8: l = vbe64dec(p + 1); p += 9; break; default: VSLb(req->vsl, SLT_Error, "ESI-corruption: Illegal Length %d %d\n", *p, (*p & 15)); WRONG("ESI-codes: illegal length"); } *pp = p; assert(l > 0); return (l); } /*--------------------------------------------------------------------- */ int __match_proto__(vdp_bytes) VDP_ESI(struct req *req, enum vdp_action act, void **priv, const void *ptr, ssize_t len) { uint8_t *q, *r; ssize_t l = 0; uint32_t icrc = 0; uint8_t tailbuf[8 + 5]; const uint8_t *pp; struct ecx *ecx, *pecx; int retval = 0; if (act == VDP_INIT) { AZ(*priv); ALLOC_OBJ(ecx, ECX_MAGIC); AN(ecx); ecx->preq = req; *priv = ecx; RFC2616_Weaken_Etag(req->resp); req->res_mode |= RES_ESI; if (req->resp_len != 0) req->resp_len = -1; return (0); } CAST_OBJ_NOTNULL(ecx, *priv, ECX_MAGIC); if (act == VDP_FINI) { FREE_OBJ(ecx); *priv = NULL; return (0); } pp = ptr; while (1) { switch (ecx->state) { case 0: ecx->p = ObjGetattr(req->wrk, req->objcore, OA_ESIDATA, &l); AN(ecx->p); assert(l > 0); ecx->e = ecx->p + l; if (*ecx->p == VEC_GZ) { ecx->isgzip = 1; ecx->p++; } if (req->esi_level == 0) { /* * Only the top level document gets to * decide this. */ if (ecx->isgzip) { assert(sizeof gzip_hdr == 10); /* Send out the gzip header */ retval = VDP_bytes(req, VDP_NULL, gzip_hdr, 10); ecx->l_crc = 0; ecx->crc = crc32(0L, Z_NULL, 0); } } ecx->state = 1; break; case 1: if (ecx->p >= ecx->e) { ecx->state = 2; break; } switch (*ecx->p) { case VEC_V1: case VEC_V2: case VEC_V8: ecx->l = ved_decode_len(req, &ecx->p); if (ecx->l < 0) return (-1); if (ecx->isgzip) { assert(*ecx->p == VEC_C1 || *ecx->p == VEC_C2 || *ecx->p == VEC_C8); l = ved_decode_len(req, &ecx->p); if (l < 0) return (-1); icrc = vbe32dec(ecx->p); ecx->p += 4; if (ecx->isgzip) { ecx->crc = crc32_combine( ecx->crc, icrc, l); ecx->l_crc += l; } } ecx->state = 3; break; case VEC_S1: case VEC_S2: case VEC_S8: ecx->l = ved_decode_len(req, &ecx->p); if (ecx->l < 0) return (-1); Debug("SKIP1(%d)\n", (int)ecx->l); ecx->state = 4; break; case VEC_INCL: ecx->p++; q = (void*)strchr((const char*)ecx->p, '\0'); AN(q); q++; r = (void*)strchr((const char*)q, '\0'); AN(r); if (VDP_bytes(req, VDP_FLUSH, NULL, 0)) { ecx->p = ecx->e; break; } Debug("INCL [%s][%s] BEGIN\n", q, ecx->p); ved_include(req, (const char*)q, (const char*)ecx->p, ecx); Debug("INCL [%s][%s] END\n", q, ecx->p); ecx->p = r + 1; break; default: VSLb(req->vsl, SLT_Error, "ESI corruption line %d 0x%02x [%s]\n", __LINE__, *ecx->p, ecx->p); WRONG("ESI-codes: Illegal code"); } break; case 2: if (ecx->isgzip && req->esi_level == 0) { /* * We are bytealigned here, so simply emit * a gzip literal block with finish bit set. */ tailbuf[0] = 0x01; tailbuf[1] = 0x00; tailbuf[2] = 0x00; tailbuf[3] = 0xff; tailbuf[4] = 0xff; /* Emit CRC32 */ vle32enc(tailbuf + 5, ecx->crc); /* MOD(2^32) length */ vle32enc(tailbuf + 9, ecx->l_crc); (void)VDP_bytes(req, VDP_NULL, tailbuf, 13); } if (req->transport->deliver == VED_Deliver) { CAST_OBJ_NOTNULL(pecx, req->transport_priv, ECX_MAGIC); pecx->crc = crc32_combine(pecx->crc, ecx->crc, ecx->l_crc); pecx->l_crc += ecx->l_crc; } retval = VDP_bytes(req, VDP_FLUSH, NULL, 0); ecx->state = 99; return (retval); case 3: case 4: /* * There is no guarantee that the 'l' bytes are all * in the same storage segment, so loop over storage * until we have processed them all. */ if (ecx->l <= len) { if (ecx->state == 3) retval = VDP_bytes(req, act, pp, ecx->l); len -= ecx->l; pp += ecx->l; ecx->state = 1; break; } if (ecx->state == 3 && len > 0) retval = VDP_bytes(req, act, pp, len); ecx->l -= len; return (retval); case 99: /* * VEP does not account for the PAD+CRC+LEN * so we can see up to approx 15 bytes here. */ return (retval); default: WRONG("FOO"); break; } if (retval) return (retval); } } /* * Account body bytes on req * Push bytes to preq */ static inline int ved_bytes(struct req *req, struct req *preq, enum vdp_action act, const void *ptr, ssize_t len) { req->acct.resp_bodybytes += len; return (VDP_bytes(preq, act, ptr, len)); } /*--------------------------------------------------------------------- * If a gzip'ed ESI object includes a ungzip'ed object, we need to make * it looked like a gzip'ed data stream. The official way to do so would * be to fire up libvgz and gzip it, but we don't, we fake it. * * First, we cannot know if it is ungzip'ed on purpose, the admin may * know something we don't. * * What do you mean "BS ?" * * All right then... * * The matter of the fact is that we simply will not fire up a gzip in * the output path because it costs too much memory and CPU, so we simply * wrap the data in very convenient "gzip copy-blocks" and send it down * the stream with a bit more overhead. */ static int __match_proto__(vdp_bytes) ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv, const void *pv, ssize_t l) { uint8_t buf1[5], buf2[5]; const uint8_t *p; uint16_t lx; struct ecx *ecx; struct req *preq; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CAST_OBJ_NOTNULL(ecx, *priv, ECX_MAGIC); preq = ecx->preq; (void)priv; if (act == VDP_INIT) return (0); if (act == VDP_FINI) { *priv = NULL; return (0); } if (l == 0) return (ved_bytes(req, ecx->preq, act, pv, l)); p = pv; if (ecx->isgzip) { ecx->crc = crc32(ecx->crc, p, l); ecx->l_crc += l; } lx = 65535; buf1[0] = 0; vle16enc(buf1 + 1, lx); vle16enc(buf1 + 3, ~lx); while (l > 0) { if (l >= 65535) { lx = 65535; if (ved_bytes(req, preq, VDP_NULL, buf1, sizeof buf1)) return (-1); } else { lx = (uint16_t)l; buf2[0] = 0; vle16enc(buf2 + 1, lx); vle16enc(buf2 + 3, ~lx); if (ved_bytes(req, preq, VDP_NULL, buf2, sizeof buf2)) return (-1); } if (ved_bytes(req, preq, VDP_NULL, p, lx)) return (-1); l -= lx; p += lx; } /* buf2 is local, have to flush */ return (ved_bytes(req, preq, VDP_FLUSH, NULL, 0)); } /*--------------------------------------------------------------------- * Include an object in a gzip'ed ESI object delivery * * This is not written as a VDP (yet) because it relies on the * OA_GZIPBITS which only becomes available when the input side * has fully digested the object and located the magic bit positions. * * We can improve this two ways. * * One is to run a gunzip instance here, to find the stopbit ourselves, * but that would be double work, in particular when passing a gziped * object, where we would have two null-gunzips. * * The other is to have the input side guarantee that OA_GZIPBITS::stopbit * always is committed before the chunk of data containing it. We would * be required to poll OA_GZIPBITS on every chunk presented, but that is * much cheaper than running a gunzip instance. */ static void ved_stripgzip(struct req *req, struct busyobj *bo) { ssize_t start, last, stop, lpad; ssize_t l; char *p; uint32_t icrc; uint32_t ilen; uint64_t olen; uint8_t *dbits; uint8_t *pp; uint8_t tailbuf[8]; enum objiter_status ois; void *oi; void *sp; ssize_t sl, ll, dl; struct ecx *ecx; struct req *preq; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); CAST_OBJ_NOTNULL(ecx, req->transport_priv, ECX_MAGIC); preq = ecx->preq; if (bo != NULL) VBO_waitstate(bo, BOS_FINISHED); AN(ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED)); /* * This is the interesting case: Deliver all the deflate * blocks, stripping the "LAST" bit of the last one and * padding it, as necessary, to a byte boundary. */ p = ObjGetattr(req->wrk, req->objcore, OA_GZIPBITS, &l); AN(p); assert(l == 32); start = vbe64dec(p); last = vbe64dec(p + 8); stop = vbe64dec(p + 16); olen = ObjGetLen(req->wrk, req->objcore); assert(start > 0 && start < olen * 8); assert(last > 0 && last < olen * 8); assert(stop > 0 && stop < olen * 8); assert(last >= start); assert(last < stop); /* The start bit must be byte aligned. */ AZ(start & 7); /* * XXX: optimize for the case where the 'last' * XXX: bit is in a empty copy block */ memset(tailbuf, 0xdd, sizeof tailbuf); dbits = WS_Alloc(req->ws, 8); AN(dbits); ll = 0; oi = ObjIterBegin(req->wrk, req->objcore); do { ois = ObjIter(req->objcore, oi, &sp, &sl); pp = sp; if (sl > 0) { /* Skip over the GZIP header */ dl = start / 8 - ll; if (dl > 0) { /* Before start, skip */ if (dl > sl) dl = sl; ll += dl; sl -= dl; pp += dl; } } if (sl > 0) { /* The main body of the object */ dl = last / 8 - ll; if (dl > 0) { if (dl > sl) dl = sl; if (ved_bytes(req, preq, VDP_NULL, pp, dl)) break; ll += dl; sl -= dl; pp += dl; } } if (sl > 0 && ll == last / 8) { /* Remove the "LAST" bit */ dbits[0] = *pp; dbits[0] &= ~(1U << (last & 7)); if (ved_bytes(req, preq, VDP_NULL, dbits, 1)) break; ll++; sl--; pp++; } if (sl > 0) { /* Last block */ dl = stop / 8 - ll; if (dl > 0) { if (dl > sl) dl = sl; if (ved_bytes(req, preq, VDP_NULL, pp, dl)) break; ll += dl; sl -= dl; pp += dl; } } if (sl > 0 && (stop & 7) && ll == stop / 8) { /* Add alignment to byte boundary */ dbits[1] = *pp; ll++; sl--; pp++; switch((int)(stop & 7)) { case 1: /* * x000.... * 00000000 00000000 11111111 11111111 */ case 3: /* * xxx000.. * 00000000 00000000 11111111 11111111 */ case 5: /* * xxxxx000 * 00000000 00000000 11111111 11111111 */ dbits[2] = 0x00; dbits[3] = 0x00; dbits[4] = 0xff; dbits[5] = 0xff; lpad = 5; break; case 2: /* xx010000 00000100 00000001 00000000 */ dbits[1] |= 0x08; dbits[2] = 0x20; dbits[3] = 0x80; dbits[4] = 0x00; lpad = 4; break; case 4: /* xxxx0100 00000001 00000000 */ dbits[1] |= 0x20; dbits[2] = 0x80; dbits[3] = 0x00; lpad = 3; break; case 6: /* xxxxxx01 00000000 */ dbits[1] |= 0x80; dbits[2] = 0x00; lpad = 2; break; case 7: /* * xxxxxxx0 * 00...... * 00000000 00000000 11111111 11111111 */ dbits[2] = 0x00; dbits[3] = 0x00; dbits[4] = 0x00; dbits[5] = 0xff; dbits[6] = 0xff; lpad = 6; break; case 0: /* xxxxxxxx */ default: WRONG("compiler must be broken"); } if (ved_bytes(req, preq, VDP_NULL, dbits + 1, lpad)) break; } if (sl > 0) { /* Recover GZIP tail */ dl = olen - ll; assert(dl >= 0); if (dl > sl) dl = sl; if (dl > 0) { assert(dl <= 8); l = ll - (olen - 8); assert(l >= 0); assert(l <= 8); assert(l + dl <= 8); memcpy(tailbuf + l, pp, dl); ll += dl; sl -= dl; pp += dl; } } } while (ois == OIS_DATA || ois == OIS_STREAM); ObjIterEnd(req->objcore, &oi); (void)ved_bytes(req, preq, VDP_FLUSH, NULL, 0); icrc = vle32dec(tailbuf); ilen = vle32dec(tailbuf + 4); ecx->crc = crc32_combine(ecx->crc, icrc, ilen); ecx->l_crc += ilen; } /*--------------------------------------------------------------------*/ static int __match_proto__(vdp_bytes) ved_vdp_bytes(struct req *req, enum vdp_action act, void **priv, const void *ptr, ssize_t len) { struct req *preq; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); if (act == VDP_INIT) return (0); if (act == VDP_FINI) { *priv = NULL; return (0); } CAST_OBJ_NOTNULL(preq, *priv, REQ_MAGIC); return (ved_bytes(req, preq, act, ptr, len)); } /*--------------------------------------------------------------------*/ static void __match_proto__(vtr_deliver_f) VED_Deliver(struct req *req, struct busyobj *bo, int wantbody) { int i; struct ecx *ecx; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_ORNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); CAST_OBJ_NOTNULL(ecx, req->transport_priv, ECX_MAGIC); if (wantbody == 0) return; req->res_mode |= RES_ESI_CHILD; i = ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED); if (ecx->isgzip && i && !(req->res_mode & RES_ESI)) { ved_stripgzip(req, bo); } else { if (ecx->isgzip && !i) VDP_push(req, ved_pretend_gzip, ecx, 1); else VDP_push(req, ved_vdp_bytes, ecx->preq, 1); (void)VDP_DeliverObj(req); } VDP_close(req); } varnish-4.1.1/bin/varnishd/cache/cache.h0000644000201500234410000007436212652366721014777 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ /* * This macro can be used in .h files to isolate bits that the manager * should not (need to) see, such as pthread mutexes etc. */ #define VARNISH_CACHE_CHILD 1 #include #include "common/common.h" #include "vapi/vsl_int.h" #include "vapi/vsm_int.h" #include "waiter/waiter.h" #include #include #ifdef HAVE_PTHREAD_NP_H #include #endif #include #include #include #include #include "common/params.h" /*--------------------------------------------------------------------*/ enum req_fsm_nxt { REQ_FSM_MORE, REQ_FSM_DONE, REQ_FSM_DISEMBARK, }; /*--------------------------------------------------------------------*/ enum body_status { #define BODYSTATUS(U,l) BS_##U, #include "tbl/body_status.h" #undef BODYSTATUS }; /*--------------------------------------------------------------------*/ enum req_body_state_e { #define REQ_BODY(U) REQ_BODY_##U, #include #undef REQ_BODY }; /*--------------------------------------------------------------------*/ enum sess_close { SC_NULL = 0, #define SESS_CLOSE(nm, stat, err, desc) SC_##nm, #include "tbl/sess_close.h" #undef SESS_CLOSE }; /*-------------------------------------------------------------------- * Indicies into http->hd[] */ enum { #define SLTH(tag, ind, req, resp, sdesc, ldesc) ind, #include "tbl/vsl_tags_http.h" #undef SLTH }; /*--------------------------------------------------------------------*/ struct VSC_C_lck; struct ban; struct ban_proto; struct backend; struct busyobj; struct cli; struct cli_proto; struct director; struct iovec; struct mempool; struct objcore; struct object; struct objhead; struct pool; struct poolparam; struct transport; struct req; struct sess; struct suckaddr; struct vrt_priv; struct vsb; struct waitinglist; struct worker; struct v1l; #define DIGEST_LEN 32 /*--------------------------------------------------------------------*/ typedef struct { const char *b; const char *e; } txt; /*--------------------------------------------------------------------*/ enum req_step { #define REQ_STEP(l, u, arg) R_STP_##u, #include "tbl/steps.h" #undef REQ_STEP }; enum fetch_step { #define FETCH_STEP(l, U, arg) F_STP_##U, #include "tbl/steps.h" #undef FETCH_STEP }; /*--------------------------------------------------------------------*/ struct lock { void *priv; }; // Opaque /*-------------------------------------------------------------------- * Workspace structure for quick memory allocation. */ struct ws { unsigned magic; #define WS_MAGIC 0x35fac554 char id[4]; /* identity */ char *s; /* (S)tart of buffer */ char *f; /* (F)ree/front pointer */ char *r; /* (R)eserved length */ char *e; /* (E)nd of buffer */ }; /*-------------------------------------------------------------------- * */ struct http { unsigned magic; #define HTTP_MAGIC 0x6428b5c9 uint16_t shd; /* Size of hd space */ txt *hd; unsigned char *hdf; #define HDF_FILTER (1 << 0) /* Filtered by Connection */ /* NB: ->nhd and below zeroed/initialized by http_Teardown */ uint16_t nhd; /* Next free hd */ enum VSL_tag_e logtag; /* Must be SLT_*Method */ struct vsl_log *vsl; struct ws *ws; uint16_t status; uint8_t protover; uint8_t conds; /* If-* headers present */ }; /*-------------------------------------------------------------------- * VFP filter state */ VTAILQ_HEAD(vfp_entry_s, vfp_entry); struct vfp_ctx { unsigned magic; #define VFP_CTX_MAGIC 0x61d9d3e5 struct busyobj *bo; struct worker *wrk; struct objcore *oc; int failed; struct vfp_entry_s vfp; struct vfp_entry *vfp_nxt; struct http *http; struct http *esi_req; }; /*-------------------------------------------------------------------- * HTTP Protocol connection structure * * This is the protocol independent object for a HTTP connection, used * both for backend and client sides. * */ struct http_conn { unsigned magic; #define HTTP_CONN_MAGIC 0x3e19edd1 int fd; enum sess_close doclose; unsigned maxbytes; unsigned maxhdr; enum body_status body_status; struct ws *ws; char *rxbuf_b; char *rxbuf_e; char *pipeline_b; char *pipeline_e; ssize_t content_length; struct vfp_ctx vfc[1]; void *priv; /* Timeouts */ double first_byte_timeout; double between_bytes_timeout; }; /*--------------------------------------------------------------------*/ struct acct_req { #define ACCT(foo) uint64_t foo; #include "tbl/acct_fields_req.h" #undef ACCT }; /*--------------------------------------------------------------------*/ struct acct_bereq { #define ACCT(foo) uint64_t foo; #include "tbl/acct_fields_bereq.h" #undef ACCT }; /*--------------------------------------------------------------------*/ #define L0(t, n) #define L1(t, n) t n; #define VSC_F(n,t,l,s,f,v,d,e) L##l(t, n) struct dstat { unsigned summs; #include "tbl/vsc_f_main.h" }; #undef VSC_F #undef L0 #undef L1 /*--------------------------------------------------------------------*/ struct exp { double t_origin; float ttl; float grace; float keep; }; /*--------------------------------------------------------------------*/ struct vsl_log { uint32_t *wlb, *wlp, *wle; unsigned wlr; unsigned wid; }; /*--------------------------------------------------------------------*/ struct vxid_pool { uint32_t next; uint32_t count; }; /*--------------------------------------------------------------------*/ struct vrt_privs { unsigned magic; #define VRT_PRIVS_MAGIC 0x03ba7501 VTAILQ_HEAD(,vrt_priv) privs; }; /* Worker pool stuff -------------------------------------------------*/ typedef void task_func_t(struct worker *wrk, void *priv); struct pool_task { VTAILQ_ENTRY(pool_task) list; task_func_t *func; void *priv; }; enum task_how { TASK_QUEUE_BO, TASK_QUEUE_REQ, TASK_QUEUE_VCA, TASK_QUEUE_END }; /*--------------------------------------------------------------------*/ struct worker { unsigned magic; #define WORKER_MAGIC 0x6391adcf struct pool *pool; struct objhead *nobjhead; struct objcore *nobjcore; struct waitinglist *nwaitinglist; void *nhashpriv; struct dstat stats[1]; struct vsl_log *vsl; // borrowed from req/bo struct pool_task task; double lastused; struct v1l *v1l; pthread_cond_t cond; struct vcl *vcl; struct ws aws[1]; struct vxid_pool vxid_pool; unsigned cur_method; unsigned seen_methods; unsigned handling; uintptr_t stack_start; uintptr_t stack_end; }; /* LRU ---------------------------------------------------------------*/ struct lru { unsigned magic; #define LRU_MAGIC 0x3fec7bb0 VTAILQ_HEAD(,objcore) lru_head; struct lock mtx; unsigned flags; #define LRU_F_DONTMOVE (1<<1) #define LRU_F_CONDEMMED (1<<2) unsigned n_objcore; }; /* Stored object ----------------------------------------------------- * Pointer to a stored object, and the methods it supports */ struct storeobj { unsigned magic; #define STOREOBJ_MAGIC 0x6faed850 const struct stevedore *stevedore; void *priv; uintptr_t priv2; }; /* Object core structure --------------------------------------------- * Objects have sideways references in the binary heap and the LRU list * and we want to avoid paging in a lot of objects just to move them up * or down the binheap or to move a unrelated object on the LRU list. * To avoid this we use a proxy object, objcore, to hold the relevant * housekeeping fields parts of an object. */ struct objcore { unsigned magic; #define OBJCORE_MAGIC 0x4d301302 int refcnt; struct storeobj stobj[1]; struct objhead *objhead; struct busyobj *busyobj; double timer_when; long hits; struct exp exp; uint16_t flags; #define OC_F_BUSY (1<<1) #define OC_F_PASS (1<<2) #define OC_F_INCOMPLETE (1<<3) #define OC_F_PRIVATE (1<<8) #define OC_F_FAILED (1<<9) uint16_t exp_flags; #define OC_EF_OFFLRU (1<<4) #define OC_EF_MOVE (1<<10) #define OC_EF_INSERT (1<<11) #define OC_EF_EXP (1<<12) #define OC_EF_DYING (1<<7) unsigned timer_idx; VTAILQ_ENTRY(objcore) list; VTAILQ_ENTRY(objcore) lru_list; double last_lru; VTAILQ_ENTRY(objcore) ban_list; struct ban *ban; }; /* Busy Object structure --------------------------------------------- * * The busyobj structure captures the aspects of an object related to, * and while it is being fetched from the backend. * * One of these aspects will be how much has been fetched, which * streaming delivery will make use of. */ /* * The macro-states we expose outside the fetch code */ enum busyobj_state_e { BOS_INVALID = 0, /* don't touch (yet) */ BOS_REQ_DONE, /* beresp.* can be examined */ BOS_STREAM, /* beresp.* can be examined */ BOS_FINISHED, /* object is complete */ BOS_FAILED, /* something went wrong */ }; enum director_state_e { DIR_S_NULL = 0, DIR_S_HDRS = 1, DIR_S_BODY = 2, }; struct busyobj { unsigned magic; #define BUSYOBJ_MAGIC 0x23b95567 struct lock mtx; pthread_cond_t cond; char *end; /* * All fields from refcount and down are zeroed when the busyobj * is recycled. */ unsigned refcount; int retries; struct req *req; struct worker *wrk; uint8_t *vary; struct vfp_ctx vfc[1]; enum busyobj_state_e state; struct ws ws[1]; char *ws_bo; struct http *bereq0; struct http *bereq; struct http *beresp; struct objcore *stale_oc; struct objcore *fetch_objcore; struct http_conn *htc; struct pool_task fetch_task; #define BO_FLAG(l, r, w, d) unsigned l:1; #include "tbl/bo_flags.h" #undef BO_FLAG /* Timeouts */ double connect_timeout; double first_byte_timeout; double between_bytes_timeout; /* Timers */ double t_first; /* First timestamp logged */ double t_prev; /* Previous timestamp logged */ /* Acct */ struct acct_bereq acct; const char *storage_hint; const struct director *director_req; const struct director *director_resp; enum director_state_e director_state; struct vcl *vcl; struct vsl_log vsl[1]; uint8_t digest[DIGEST_LEN]; struct vrt_privs privs[1]; }; /*--------------------------------------------------------------------*/ VTAILQ_HEAD(vdp_entry_s, vdp_entry); struct req { unsigned magic; #define REQ_MAGIC 0x2751aaa1 enum req_step req_step; volatile enum req_body_state_e req_body_status; enum sess_close doclose; int restarts; int esi_level; struct req *top; /* esi_level == 0 request */ #define REQ_FLAG(l, r, w, d) unsigned l:1; #include "tbl/req_flags.h" #undef REQ_FLAG uint16_t err_code; const char *err_reason; struct sess *sp; struct worker *wrk; struct pool_task task; const struct transport *transport; void *transport_priv; VTAILQ_ENTRY(req) w_list; struct objcore *body_oc; /* The busy objhead we sleep on */ struct objhead *hash_objhead; /* Built Vary string */ uint8_t *vary_b; uint8_t *vary_l; uint8_t *vary_e; uint8_t digest[DIGEST_LEN]; double d_ttl; ssize_t req_bodybytes; /* Parsed req bodybytes */ const struct director *director_hint; struct vcl *vcl; char *ws_req; /* WS above request data */ /* Timestamps */ double t_first; /* First timestamp logged */ double t_prev; /* Previous timestamp logged */ double t_req; /* Headers complete */ struct http_conn htc[1]; const char *client_identity; /* HTTP request */ struct http *http; struct http *http0; /* HTTP response */ struct http *resp; intmax_t resp_len; struct ws ws[1]; struct objcore *objcore; struct objcore *stale_oc; /* Deliver pipeline */ struct vdp_entry_s vdp; struct vdp_entry *vdp_nxt; unsigned vdp_errval; /* Delivery mode */ unsigned res_mode; #define RES_LEN (1<<1) #define RES_EOF (1<<2) #define RES_CHUNKED (1<<3) #define RES_ESI (1<<4) #define RES_ESI_CHILD (1<<5) #define RES_GUNZIP (1<<6) #define RES_PIPE (1<<7) /* Transaction VSL buffer */ struct vsl_log vsl[1]; /* Temporary accounting */ struct acct_req acct; }; /*-------------------------------------------------------------------- * Struct sess is a high memory-load structure because sessions typically * hang around the waiter for relatively long time. * * The size goal for struct sess + struct memitem is <512 bytes * * Getting down to the next relevant size (<256 bytes because of how malloc * works, is not realistic without a lot of code changes. */ enum sess_attr { #define SESS_ATTR(UP, low, typ, len) SA_##UP, #include "tbl/sess_attr.h" #undef SESS_ATTR SA_LAST }; struct sess { unsigned magic; #define SESS_MAGIC 0x2c2f9c5a enum sess_step sess_step; struct lock mtx; int fd; uint32_t vxid; /* Cross references ------------------------------------------*/ struct pool *pool; /* Session related fields ------------------------------------*/ struct ws ws[1]; uint16_t sattr[SA_LAST]; /* Timestamps, all on TIM_real() timescale */ double t_open; /* fd accepted */ double t_idle; /* fd accepted or resp sent */ struct vrt_privs privs[1]; }; /* Prototypes etc ----------------------------------------------------*/ /* Cross file typedefs */ typedef enum htc_status_e htc_complete_f(struct http_conn *); /* cache_ban.c */ /* for constructing bans */ struct ban_proto *BAN_Build(void); const char *BAN_AddTest(struct ban_proto *, const char *, const char *, const char *); const char *BAN_Commit(struct ban_proto *b); void BAN_Abandon(struct ban_proto *b); /* for stevedoes resurrecting bans */ void BAN_Hold(void); void BAN_Release(void); void BAN_Reload(const uint8_t *ban, unsigned len); struct ban *BAN_RefBan(struct objcore *oc, double t0); double BAN_Time(const struct ban *ban); /* cache_busyobj.c */ struct busyobj *VBO_GetBusyObj(struct worker *, const struct req *); void VBO_DerefBusyObj(struct worker *wrk, struct busyobj **busyobj); void VBO_extend(struct busyobj *, ssize_t); ssize_t VBO_waitlen(struct worker *, struct busyobj *, ssize_t l); void VBO_setstate(struct busyobj *bo, enum busyobj_state_e next); void VBO_waitstate(struct busyobj *bo, enum busyobj_state_e want); /* cache_cli.c [CLI] */ extern pthread_t cli_thread; #define ASSERT_CLI() do {assert(pthread_self() == cli_thread);} while (0) /* cache_expire.c */ void EXP_Clr(struct exp *e); double EXP_Ttl(const struct req *, const struct exp*); double EXP_When(const struct exp *exp); void EXP_Insert(struct worker *wrk, struct objcore *oc); void EXP_Inject(struct worker *wrk, struct objcore *oc, struct lru *lru); void EXP_Rearm(struct objcore *, double now, double ttl, double grace, double keep); void EXP_Touch(struct objcore *oc, double now); int EXP_NukeOne(struct worker *wrk, struct lru *lru); enum exp_event_e { EXP_INSERT, EXP_INJECT, EXP_REMOVE, }; typedef void exp_callback_f(struct worker *, struct objcore *, enum exp_event_e, void *priv); uintptr_t EXP_Register_Callback(exp_callback_f *func, void *priv); void EXP_Deregister_Callback(uintptr_t*); /* cache_fetch.c */ enum vbf_fetch_mode_e { VBF_NORMAL = 0, VBF_PASS = 1, VBF_BACKGROUND = 2, }; void VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, struct objcore *oldoc, enum vbf_fetch_mode_e); /* cache_gzip.c */ struct vgz; enum vgzret_e { VGZ_ERROR = -1, VGZ_OK = 0, VGZ_END = 1, VGZ_STUCK = 2, }; enum vgz_flag { VGZ_NORMAL, VGZ_ALIGN, VGZ_RESET, VGZ_FINISH }; // struct vgz *VGZ_NewUngzip(struct vsl_log *vsl, const char *id); struct vgz *VGZ_NewGzip(struct vsl_log *vsl, const char *id); void VGZ_Ibuf(struct vgz *, const void *, ssize_t len); int VGZ_IbufEmpty(const struct vgz *vg); void VGZ_Obuf(struct vgz *, void *, ssize_t len); int VGZ_ObufFull(const struct vgz *vg); enum vgzret_e VGZ_Gzip(struct vgz *, const void **, ssize_t *len, enum vgz_flag); // enum vgzret_e VGZ_Gunzip(struct vgz *, const void **, ssize_t *len); enum vgzret_e VGZ_Destroy(struct vgz **); enum vgz_ua_e { VUA_UPDATE, // Update start/stop/last bits if changed VUA_END_GZIP, // Record uncompressed size VUA_END_GUNZIP, // Record uncompressed size }; void VGZ_UpdateObj(const struct vfp_ctx *, struct vgz*, enum vgz_ua_e); /* cache_http.c */ unsigned HTTP_estimate(unsigned nhttp); void HTTP_Copy(struct http *to, const struct http * const fm); struct http *HTTP_create(void *p, uint16_t nhttp); const char *http_Status2Reason(unsigned); unsigned http_EstimateWS(const struct http *fm, unsigned how); void http_PutResponse(struct http *to, const char *proto, uint16_t status, const char *response); void http_FilterReq(struct http *to, const struct http *fm, unsigned how); void HTTP_Encode(const struct http *fm, uint8_t *, unsigned len, unsigned how); int HTTP_Decode(struct http *to, const uint8_t *fm); void http_ForceHeader(struct http *to, const char *hdr, const char *val); void http_PrintfHeader(struct http *to, const char *fmt, ...) __v_printflike(2, 3); void http_TimeHeader(struct http *to, const char *fmt, double now); void http_SetHeader(struct http *to, const char *hdr); void http_SetH(const struct http *to, unsigned n, const char *fm); void http_ForceField(const struct http *to, unsigned n, const char *t); 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, const char **ptr); int http_GetHdrToken(const struct http *hp, const char *hdr, const char *token, const char **pb, const char **pe); int http_GetHdrField(const struct http *hp, const char *hdr, const char *field, const char **ptr); double http_GetHdrQ(const struct http *hp, const char *hdr, const char *field); ssize_t http_GetContentLength(const struct http *hp); uint16_t http_GetStatus(const struct http *hp); int http_IsStatus(const struct http *hp, int); void http_SetStatus(struct http *to, uint16_t status); const char *http_GetMethod(const struct http *hp); int http_HdrIs(const struct http *hp, const char *hdr, const char *val); void http_CopyHome(const struct http *hp); void http_Unset(struct http *hp, const char *hdr); unsigned http_CountHdr(const struct http *hp, const char *hdr); void http_CollectHdr(struct http *hp, const char *hdr); void http_VSL_log(const struct http *hp); void HTTP_Merge(struct worker *, struct objcore *, struct http *to); uint16_t HTTP_GetStatusPack(struct worker *, struct objcore *oc); int HTTP_IterHdrPack(struct worker *, struct objcore *, const char **); #define HTTP_FOREACH_PACK(wrk, oc, ptr) \ for ((ptr) = NULL; HTTP_IterHdrPack(wrk, oc, &(ptr));) const char *HTTP_GetHdrPack(struct worker *, struct objcore *, const char *hdr); enum sess_close http_DoConnection(struct http *hp); /* cache_http1_proto.c */ htc_complete_f HTTP1_Complete; uint16_t HTTP1_DissectRequest(struct http_conn *, struct http *); uint16_t HTTP1_DissectResponse(struct http_conn *, struct http *resp, const struct http *req); unsigned HTTP1_Write(const struct worker *w, const struct http *hp, const int*); #define HTTPH(a, b, c) extern char b[]; #include "tbl/http_headers.h" #undef HTTPH extern const char H__Status[]; extern const char H__Proto[]; extern const char H__Reason[]; /* cache_main.c */ #define VXID(u) ((u) & VSL_IDENTMASK) uint32_t VXID_Get(struct worker *, uint32_t marker); extern volatile struct params * cache_param; extern pthread_key_t witness_key; /* cache_lck.c */ /* Internal functions, call only through macros below */ void Lck__Lock(struct lock *lck, const char *p, int l); void Lck__Unlock(struct lock *lck, const char *p, int l); int Lck__Trylock(struct lock *lck, const char *p, int l); void Lck__New(struct lock *lck, struct VSC_C_lck *, const char *); void Lck__Assert(const struct lock *lck, int held); /* public interface: */ void Lck_Delete(struct lock *lck); int Lck_CondWait(pthread_cond_t *cond, struct lock *lck, double); #define Lck_New(a, b) Lck__New(a, b, #b) #define Lck_Lock(a) Lck__Lock(a, __func__, __LINE__) #define Lck_Unlock(a) Lck__Unlock(a, __func__, __LINE__) #define Lck_Trylock(a) Lck__Trylock(a, __func__, __LINE__) #define Lck_AssertHeld(a) Lck__Assert(a, 1) struct VSC_C_lck *Lck_CreateClass(const char *name); #define LOCK(nam) extern struct VSC_C_lck *lck_##nam; #include "tbl/locks.h" #undef LOCK /* cache_mempool.c */ void MPL_AssertSane(void *item); struct mempool * MPL_New(const char *name, volatile struct poolparam *pp, volatile unsigned *cur_size); void MPL_Destroy(struct mempool **mpp); void *MPL_Get(struct mempool *mpl, unsigned *size); void MPL_Free(struct mempool *mpl, void *item); /* cache_obj.c */ enum objiter_status { OIS_DONE, OIS_DATA, OIS_STREAM, OIS_ERROR, }; void *ObjIterBegin(struct worker *, struct objcore *); enum objiter_status ObjIter(struct objcore *, void *, void **, ssize_t *); void ObjIterEnd(struct objcore *, void **); int ObjGetSpace(struct worker *, struct objcore *, ssize_t *sz, uint8_t **ptr); void ObjExtend(struct worker *, struct objcore *, ssize_t l); void ObjTrimStore(struct worker *, struct objcore *); unsigned ObjGetXID(struct worker *, struct objcore *); uint64_t ObjGetLen(struct worker *, struct objcore *oc); void ObjUpdateMeta(struct worker *, struct objcore *); void ObjFreeObj(struct worker *, struct objcore *); void ObjSlim(struct worker *, struct objcore *oc); struct lru *ObjGetLRU(const struct objcore *); void *ObjGetattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr, ssize_t *len); void *ObjSetattr(struct worker *, struct objcore *, enum obj_attr attr, ssize_t len, const void *); int ObjCopyAttr(struct worker *, struct objcore *, struct objcore *, enum obj_attr attr); int ObjSetDouble(struct worker *, struct objcore *, enum obj_attr, double); int ObjSetU32(struct worker *, struct objcore *, enum obj_attr, uint32_t); int ObjSetU64(struct worker *, struct objcore *, enum obj_attr, uint64_t); int ObjGetDouble(struct worker *, struct objcore *, enum obj_attr, double *); int ObjGetU32(struct worker *, struct objcore *, enum obj_attr, uint32_t *); int ObjGetU64(struct worker *, struct objcore *, enum obj_attr, uint64_t *); int ObjCheckFlag(struct worker *, struct objcore *oc, enum obj_flags of); void ObjSetFlag(struct worker *, struct objcore *, enum obj_flags of, int val); /* cache_panic.c */ const char *body_status_2str(enum body_status e); const char *sess_close_2str(enum sess_close sc, int want_desc); /* cache_pool.c */ int Pool_Task(struct pool *pp, struct pool_task *task, enum task_how how); int Pool_Task_Arg(struct worker *, task_func_t *, const void *arg, size_t arg_len); void Pool_Sumstat(struct worker *w); int Pool_TrySumstat(struct worker *wrk); void Pool_PurgeStat(unsigned nobj); int Pool_Task_Any(struct pool_task *task, enum task_how how); /* cache_range.c [VRG] */ void VRG_dorange(struct req *req, const char *r); /* cache_req.c */ struct req *Req_New(const struct worker *, struct sess *); void Req_Release(struct req *); int Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req); void Req_Fail(struct req *req, enum sess_close reason); /* cache_req_body.c */ int VRB_Ignore(struct req *req); ssize_t VRB_Cache(struct req *req, ssize_t maxsize); typedef int (req_body_iter_f)(struct req *, void *priv, void *ptr, size_t); ssize_t VRB_Iterate(struct req *req, req_body_iter_f *func, void *priv); void VRB_Free(struct req *req); /* cache_req_fsm.c [CNT] */ enum req_fsm_nxt CNT_Request(struct worker *, struct req *); void CNT_AcctLogCharge(struct dstat *, struct req *); /* cache_session.c [SES] */ struct sess *SES_New(struct pool *); void SES_Close(struct sess *sp, enum sess_close reason); void SES_Wait(struct sess *sp); void SES_Delete(struct sess *sp, enum sess_close reason, double now); void SES_NewPool(struct pool *pp, unsigned pool_no); int SES_Reschedule_Req(struct req *); task_func_t SES_Proto_Sess; task_func_t SES_Proto_Req; enum htc_status_e { HTC_S_JUNK = -5, HTC_S_CLOSE = -4, HTC_S_TIMEOUT = -3, HTC_S_OVERFLOW = -2, HTC_S_EOF = -1, HTC_S_EMPTY = 0, HTC_S_MORE = 1, HTC_S_COMPLETE = 2, HTC_S_IDLE = 3, }; void SES_RxInit(struct http_conn *htc, struct ws *ws, unsigned maxbytes, unsigned maxhdr); void SES_RxReInit(struct http_conn *htc); enum htc_status_e SES_RxStuff(struct http_conn *, htc_complete_f *, double *t1, double *t2, double ti, double tn); #define SESS_ATTR(UP, low, typ, len) \ int SES_Get_##low(const struct sess *sp, typ *dst); \ void SES_Reserve_##low(struct sess *sp, typ *dst); #include "tbl/sess_attr.h" #undef SESS_ATTR void SES_Set_String_Attr(struct sess *sp, enum sess_attr a, const char *src); const char *SES_Get_String_Attr(const struct sess *sp, enum sess_attr a); /* cache_shmlog.c */ extern struct VSC_C_main *VSC_C_main; void *VSM_Alloc(unsigned size, const char *class, const char *type, const char *ident); void VSM_Free(void *ptr); #ifdef VSL_ENDMARKER void VSL(enum VSL_tag_e tag, uint32_t vxid, const char *fmt, ...) __v_printflike(3, 4); void VSLbv(struct vsl_log *, enum VSL_tag_e tag, const char *fmt, va_list va); void VSLb(struct vsl_log *, enum VSL_tag_e tag, const char *fmt, ...) __v_printflike(3, 4); void VSLbt(struct vsl_log *, enum VSL_tag_e tag, txt t); void VSLb_ts(struct vsl_log *, const char *event, double first, double *pprev, double now); static inline void VSLb_ts_req(struct req *req, const char *event, double now) { if (isnan(req->t_first) || req->t_first == 0.) req->t_first = req->t_prev = now; VSLb_ts(req->vsl, event, req->t_first, &req->t_prev, now); } static inline void VSLb_ts_busyobj(struct busyobj *bo, const char *event, double now) { if (isnan(bo->t_first) || bo->t_first == 0.) bo->t_first = bo->t_prev = now; VSLb_ts(bo->vsl, event, bo->t_first, &bo->t_prev, now); } void VSL_Flush(struct vsl_log *, int overflow); #endif /* cache_vary.c */ int VRY_Create(struct busyobj *bo, struct vsb **psb); int VRY_Match(struct req *, const uint8_t *vary); void VRY_Prep(struct req *); void VRY_Clear(struct req *); enum vry_finish_flag { KEEP, DISCARD }; void VRY_Finish(struct req *req, enum vry_finish_flag); /* cache_vcl.c */ const char *VCL_Method_Name(unsigned); const char *VCL_Name(const struct vcl *); void VCL_Ref(struct vcl *); void VCL_Refresh(struct vcl **); void VCL_Rel(struct vcl **); const char *VCL_Return_Name(unsigned); #define VCL_MET_MAC(l,u,t,b) \ void VCL_##l##_method(struct vcl *, struct worker *, struct req *, \ struct busyobj *bo, void *specific); #include "tbl/vcl_returns.h" #undef VCL_MET_MAC /* cache_vrt.c */ /* * These prototypes go here, because we do not want to pollute vrt.h * with va_list. VCC never generates direct calls to them. */ const char *VRT_String(struct ws *ws, const char *h, const char *p, va_list ap); char *VRT_StringList(char *d, unsigned dl, const char *p, va_list ap); /* cache_wrk.c */ typedef void *bgthread_t(struct worker *, void *priv); void WRK_BgThread(pthread_t *thr, const char *name, bgthread_t *func, void *priv); /* cache_ws.c */ void WS_Init(struct ws *ws, const char *id, void *space, unsigned len); unsigned WS_Reserve(struct ws *ws, unsigned bytes); void WS_MarkOverflow(struct ws *ws); void WS_Release(struct ws *ws, unsigned bytes); void WS_ReleaseP(struct ws *ws, char *ptr); void WS_Assert(const struct ws *ws); void WS_Reset(struct ws *ws, char *p); void *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, ...) __v_printflike(2, 3); /* cache_rfc2616.c */ void RFC2616_Ttl(struct busyobj *, double now); unsigned RFC2616_Req_Gzip(const struct http *); int RFC2616_Do_Cond(const struct req *sp); void RFC2616_Weaken_Etag(struct http *hp); void RFC2616_Vary_AE(struct http *hp); /* stevedore.c */ int STV_NewObject(struct objcore *, struct worker *, const char *hint, unsigned len); struct storage *STV_alloc(const struct stevedore *, size_t size); void STV_trim(const struct stevedore *, struct storage *, size_t size, int move_ok); void STV_free(const struct stevedore *, struct storage *st); void STV_open(void); void STV_close(void); int STV_BanInfo(enum baninfo event, const uint8_t *ban, unsigned len); void STV_BanExport(const uint8_t *bans, unsigned len); /* * A normal pointer difference is signed, but we never want a negative value * so this little tool will make sure we don't get that. */ static inline unsigned pdiff(const void *b, const void *e) { assert(b <= e); return ((unsigned)((const unsigned char *)e - (const unsigned char *)b)); } static inline void Tcheck(const txt t) { AN(t.b); AN(t.e); assert(t.b <= t.e); } /* * unsigned length of a txt */ static inline unsigned Tlen(const txt t) { Tcheck(t); return ((unsigned)(t.e - t.b)); } /* * We want to cache the most recent timestamp in wrk->lastused to avoid * extra timestamps in cache_pool.c. Hide this detail with a macro */ #define W_TIM_real(w) ((w)->lastused = VTIM_real()) static inline int FEATURE(enum feature_bits x) { return (cache_param->feature_bits[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7))); } static inline int DO_DEBUG(enum debug_bits x) { return (cache_param->debug_bits[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7))); } #define DSL(debug_bit, id, ...) \ do { \ if (DO_DEBUG(debug_bit)) \ VSL(SLT_Debug, (id), __VA_ARGS__); \ } while (0) #ifdef VARNISHD_IS_NOT_A_VMOD # include "cache/cache_priv.h" #endif varnish-4.1.1/bin/varnishd/cache/cache_ban.h0000644000201500234410000001001312652366721015576 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Ban processing * * A ban consists of a number of conditions (or tests), all of which must be * satisfied. Here are some potential bans we could support: * * req.url == "/foo" * req.url ~ ".iso" && obj.size > 10MB * req.http.host ~ "web1.com" && obj.http.set-cookie ~ "USER=29293" * * We make the "&&" mandatory from the start, leaving the syntax space * for latter handling of "||" as well. * * Bans are compiled into bytestrings as follows: * 8 bytes - double: timestamp XXX: Byteorder ? * 4 bytes - be32: length * 1 byte - flags: 0x01: BAN_F_{REQ|OBJ|COMPLETED} * N tests * A test have this form: * 1 byte - arg (see ban_vars.h col 3 "BANS_ARG_XXX") * (n bytes) - http header name, canonical encoding * lump - comparison arg * 1 byte - operation (BANS_OPER_) * (lump) - compiled regexp * A lump is: * 4 bytes - be32: length * n bytes - content * * In a perfect world, we should vector through VRE to get to PCRE, * but since we rely on PCRE's ability to encode the regexp into a * byte string, that would be a little bit artificial, so this is * the exception that confirms the rule. * */ /*-------------------------------------------------------------------- * BAN string defines & magic markers */ #define BANS_TIMESTAMP 0 #define BANS_LENGTH 8 #define BANS_FLAGS 12 #define BANS_HEAD_LEN 16 #define BANS_FLAG_REQ (1<<0) #define BANS_FLAG_OBJ (1<<1) #define BANS_FLAG_COMPLETED (1<<2) #define BANS_FLAG_HTTP (1<<3) #define BANS_OPER_EQ 0x10 #define BANS_OPER_NEQ 0x11 #define BANS_OPER_MATCH 0x12 #define BANS_OPER_NMATCH 0x13 #define BANS_ARG_URL 0x18 #define BANS_ARG_REQHTTP 0x19 #define BANS_ARG_OBJHTTP 0x1a #define BANS_ARG_OBJSTATUS 0x1b /*--------------------------------------------------------------------*/ struct ban { unsigned magic; #define BAN_MAGIC 0x700b08ea unsigned flags; /* BANS_FLAG_* */ VTAILQ_ENTRY(ban) list; VTAILQ_ENTRY(ban) l_list; int64_t refcount; VTAILQ_HEAD(,objcore) objcore; uint8_t *spec; }; VTAILQ_HEAD(banhead_s,ban); bgthread_t ban_lurker; extern struct lock ban_mtx; extern int ban_shutdown; extern struct banhead_s ban_head; extern struct ban * volatile ban_start; extern pthread_cond_t ban_lurker_cond; void ban_mark_completed(struct ban *b); unsigned ban_len(const uint8_t *banspec); void ban_info(enum baninfo event, const uint8_t *ban, unsigned len); int ban_evaluate(struct worker *wrk, const uint8_t *bs, struct objcore *oc, const struct http *reqhttp, unsigned *tests); double ban_time(const uint8_t *banspec); int ban_equal(const uint8_t *bs1, const uint8_t *bs2); void BAN_Free(struct ban *b); void ban_kick_lurker(void); varnish-4.1.1/bin/varnishd/cache/cache_ws.c0000644000201500234410000001266112652366721015475 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ #include "config.h" #include #include "cache.h" void WS_Assert(const struct ws *ws) { CHECK_OBJ_NOTNULL(ws, WS_MAGIC); DSL(DBG_WORKSPACE, 0, "WS(%p = (%s, %p %u %u %u)", ws, ws->id, ws->s, pdiff(ws->s, ws->f), ws->r == NULL ? 0 : pdiff(ws->f, ws->r), pdiff(ws->s, ws->e)); assert(ws->s != NULL); assert(PAOK(ws->s)); assert(ws->e != NULL); assert(PAOK(ws->e)); assert(ws->s < ws->e); assert(ws->f >= ws->s); assert(ws->f <= ws->e); assert(PAOK(ws->f)); if (ws->r) { assert(ws->r > ws->s); assert(ws->r <= ws->e); assert(PAOK(ws->r)); } assert(*ws->e == 0x15); } /* * NB: The id must be max 3 char and lower-case. * (upper-case the first char to indicate overflow) */ void WS_Init(struct ws *ws, const char *id, void *space, unsigned len) { DSL(DBG_WORKSPACE, 0, "WS_Init(%p, \"%s\", %p, %u)", ws, id, space, len); assert(space != NULL); INIT_OBJ(ws, WS_MAGIC); ws->s = space; assert(PAOK(space)); len = PRNDDN(len - 1); ws->e = ws->s + len; *ws->e = 0x15; ws->f = ws->s; assert(id[0] & 0x20); assert(strlen(id) < sizeof ws->id); strcpy(ws->id, id); WS_Assert(ws); } void WS_MarkOverflow(struct ws *ws) { CHECK_OBJ_NOTNULL(ws, WS_MAGIC); ws->id[0] &= ~0x20; // cheesy toupper() } static void ws_ClearOverflow(struct ws *ws) { CHECK_OBJ_NOTNULL(ws, WS_MAGIC); ws->id[0] |= 0x20; // cheesy tolower() } /* * Reset a WS to start or a given pointer, likely from WS_Snapshot */ void WS_Reset(struct ws *ws, char *p) { WS_Assert(ws); DSL(DBG_WORKSPACE, 0, "WS_Reset(%p, %p)", ws, p); assert(ws->r == NULL); if (p == NULL) ws->f = ws->s; else { assert(p >= ws->s); assert(p < ws->e); ws->f = p; } ws_ClearOverflow(ws); WS_Assert(ws); } void * WS_Alloc(struct ws *ws, unsigned bytes) { char *r; WS_Assert(ws); bytes = PRNDUP(bytes); assert(ws->r == NULL); if (ws->f + bytes > ws->e) { WS_MarkOverflow(ws); WS_Assert(ws); return(NULL); } r = ws->f; ws->f += bytes; DSL(DBG_WORKSPACE, 0, "WS_Alloc(%p, %u) = %p", ws, bytes, r); WS_Assert(ws); return (r); } void * WS_Copy(struct ws *ws, const void *str, int len) { char *r; unsigned bytes; WS_Assert(ws); assert(ws->r == NULL); if (len == -1) len = strlen(str) + 1; assert(len >= 0); bytes = PRNDUP((unsigned)len); if (ws->f + bytes > ws->e) { WS_MarkOverflow(ws); WS_Assert(ws); return(NULL); } r = ws->f; ws->f += bytes; memcpy(r, str, len); DSL(DBG_WORKSPACE, 0, "WS_Copy(%p, %d) = %p", ws, len, r); WS_Assert(ws); 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); va_end(ap); if (v >= u) { WS_Release(ws, 0); WS_MarkOverflow(ws); p = NULL; } else { WS_Release(ws, v + 1); } return (p); } char * WS_Snapshot(struct ws *ws) { WS_Assert(ws); assert(ws->r == NULL); DSL(DBG_WORKSPACE, 0, "WS_Snapshot(%p) = %p", ws, ws->f); return (ws->f); } unsigned WS_Reserve(struct ws *ws, unsigned bytes) { unsigned b2; WS_Assert(ws); assert(ws->r == NULL); b2 = PRNDDN(ws->e - ws->f); if (bytes != 0 && bytes < b2) b2 = PRNDUP(bytes); xxxassert(ws->f + b2 <= ws->e); ws->r = ws->f + b2; DSL(DBG_WORKSPACE, 0, "WS_Reserve(%p, %u/%u) = %u", ws, b2, bytes, pdiff(ws->f, ws->r)); WS_Assert(ws); return (pdiff(ws->f, ws->r)); } void WS_Release(struct ws *ws, unsigned bytes) { WS_Assert(ws); bytes = PRNDUP(bytes); assert(bytes <= ws->e - ws->f); DSL(DBG_WORKSPACE, 0, "WS_Release(%p, %u)", ws, bytes); assert(ws->r != NULL); assert(ws->f + bytes <= ws->r); ws->f += bytes; ws->r = NULL; WS_Assert(ws); } void WS_ReleaseP(struct ws *ws, char *ptr) { WS_Assert(ws); DSL(DBG_WORKSPACE, 0, "WS_ReleaseP(%p, %p)", ws, ptr); assert(ws->r != NULL); assert(ptr >= ws->f); assert(ptr <= ws->r); ws->f += PRNDUP(ptr - ws->f); ws->r = NULL; WS_Assert(ws); } int WS_Overflowed(const struct ws *ws) { CHECK_OBJ_NOTNULL(ws, WS_MAGIC); if (ws->id[0] & 0x20) return (0); return (1); } varnish-4.1.1/bin/varnishd/cache/cache_main.c0000644000201500234410000001366712652366721015777 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. */ #include "config.h" #include #include #include "cache.h" #include "http1/cache_http1.h" #include "common/heritage.h" #include "vcli_priv.h" #include "vrnd.h" #include "hash/hash_slinger.h" volatile struct params *cache_param; /*-------------------------------------------------------------------- * Per thread storage for the session currently being processed by * the thread. This is used for panic messages. */ static pthread_key_t req_key; static pthread_key_t bo_key; pthread_key_t witness_key; void THR_SetBusyobj(const struct busyobj *bo) { AZ(pthread_setspecific(bo_key, bo)); } struct busyobj * THR_GetBusyobj(void) { return (pthread_getspecific(bo_key)); } void THR_SetRequest(const struct req *req) { AZ(pthread_setspecific(req_key, req)); } struct req * THR_GetRequest(void) { return (pthread_getspecific(req_key)); } /*-------------------------------------------------------------------- * Name threads if our pthreads implementation supports it. */ static pthread_key_t name_key; void THR_SetName(const char *name) { AZ(pthread_setspecific(name_key, name)); #ifdef HAVE_PTHREAD_SET_NAME_NP pthread_set_name_np(pthread_self(), name); #endif } const char * THR_GetName(void) { return (pthread_getspecific(name_key)); } /*-------------------------------------------------------------------- * VXID's are unique transaction numbers allocated with a minimum of * locking overhead via pools in the worker threads. * * VXID's are mostly for use in VSL and for that reason we never return * zero vxid, in order to reserve that for "unassociated" VSL records. */ static uint32_t vxid_base; static uint32_t vxid_chunk = 32768; static struct lock vxid_lock; uint32_t VXID_Get(struct worker *wrk, uint32_t mask) { struct vxid_pool *v; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); v = &wrk->vxid_pool; AZ(VXID(mask)); do { if (v->count == 0) { Lck_Lock(&vxid_lock); v->next = vxid_base; v->count = vxid_chunk; vxid_base = (vxid_base + v->count) & VSL_IDENTMASK; Lck_Unlock(&vxid_lock); } v->count--; v->next++; } while (v->next == 0); return (v->next | mask); } /*-------------------------------------------------------------------- * Debugging aids */ /* * Dumb down the VXID allocation to make it predictable for * varnishtest cases */ static void cli_debug_xid(struct cli *cli, const char * const *av, void *priv) { (void)priv; if (av[2] != NULL) { vxid_base = strtoul(av[2], NULL, 0); vxid_chunk = 1; } VCLI_Out(cli, "XID is %u", vxid_base); } /* * Default to seed=1, this is the only seed value POSIXl guarantees will * result in a reproducible random number sequence. */ static void cli_debug_srandom(struct cli *cli, const char * const *av, void *priv) { (void)priv; unsigned seed = 1; if (av[2] != NULL) seed = strtoul(av[2], NULL, 0); srandom(seed); srand48(random()); VCLI_Out(cli, "Random(3) seeded with %u", seed); } static struct cli_proto debug_cmds[] = { { "debug.xid", "debug.xid", "\tExamine or set XID.", 0, 1, "d", cli_debug_xid }, { "debug.srandom", "debug.srandom", "\tSeed the random(3) function.", 0, 1, "d", cli_debug_srandom }, { NULL } }; /*-------------------------------------------------------------------- * XXX: Think more about which order we start things */ #if defined(__FreeBSD__) && __FreeBSD__version >= 1000000 static void child_malloc_fail(void *p, const char *s) { VSL(SLT_Error, 0, "MALLOC ERROR: %s (%p)", s, p); fprintf(stderr, "MALLOC ERROR: %s (%p)\n", s, p); WRONG("Malloc Error"); } #endif void child_main(void) { setbuf(stdout, NULL); setbuf(stderr, NULL); printf("Child starts\n"); #if defined(__FreeBSD__) && __FreeBSD__version >= 1000000 malloc_message = child_malloc_fail; #endif cache_param = heritage.param; AZ(pthread_key_create(&req_key, NULL)); AZ(pthread_key_create(&bo_key, NULL)); AZ(pthread_key_create(&witness_key, NULL)); AZ(pthread_key_create(&name_key, NULL)); THR_SetName("cache-main"); VSM_Init(); /* First, LCK needs it. */ LCK_Init(); /* Second, locking */ Lck_New(&vxid_lock, lck_vxid); CLI_Init(); PAN_Init(); VFP_Init(); VCL_Init(); HTTP_Init(); VBO_Init(); VBP_Init(); VBE_InitCfg(); Pool_Init(); V1P_Init(); EXP_Init(); HSH_Init(heritage.hash); BAN_Init(); VCA_Init(); SMP_Init(); STV_open(); VMOD_Init(); BAN_Compile(); VRND_Seed(); srand48(random()); CLI_AddFuncs(debug_cmds); /* Wait for persistent storage to load if asked to */ if (FEATURE(FEATURE_WAIT_SILO)) SMP_Ready(); CLI_Run(); BAN_Shutdown(); STV_close(); printf("Child dies\n"); } varnish-4.1.1/bin/varnishd/cache/cache_backend_tcp.c0000644000201500234410000002301212652366721017271 00000000000000/*- * Copyright (c) 2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * TCP connection pools. * * These are really a lot more general than just backends, but backends * are all we use them for, so they live here for now. * */ #include "config.h" #include #include "cache.h" #include "vrt.h" #include "vsa.h" #include "vtcp.h" #include "vtim.h" #include "cache_director.h" #include "cache_backend.h" #include "cache_pool.h" struct tcp_pool { unsigned magic; #define TCP_POOL_MAGIC 0x28b0e42a char *name; struct suckaddr *ip4; struct suckaddr *ip6; VTAILQ_ENTRY(tcp_pool) list; int refcnt; struct lock mtx; struct waitfor waitfor; VTAILQ_HEAD(, vbc) connlist; int n_conn; VTAILQ_HEAD(, vbc) killlist; int n_kill; int n_used; }; static VTAILQ_HEAD(, tcp_pool) pools = VTAILQ_HEAD_INITIALIZER(pools); /*-------------------------------------------------------------------- * Waiter-handler */ static void __match_proto__(waiter_handle_f) tcp_handle(struct waited *w, enum wait_event ev, double now) { struct vbc *vbc; struct tcp_pool *tp; CAST_OBJ_NOTNULL(vbc, w->ptr, VBC_MAGIC); (void)ev; (void)now; CHECK_OBJ_NOTNULL(vbc->tcp_pool, TCP_POOL_MAGIC); tp = vbc->tcp_pool; Lck_Lock(&tp->mtx); switch(vbc->state) { case VBC_STATE_STOLEN: vbc->state = VBC_STATE_USED; VTAILQ_REMOVE(&tp->connlist, vbc, list); AN(vbc->cond); AZ(pthread_cond_signal(vbc->cond)); break; case VBC_STATE_AVAIL: VTCP_close(&vbc->fd); VTAILQ_REMOVE(&tp->connlist, vbc, list); tp->n_conn--; FREE_OBJ(vbc); break; case VBC_STATE_CLEANUP: VTCP_close(&vbc->fd); tp->n_kill--; VTAILQ_REMOVE(&tp->killlist, vbc, list); memset(vbc, 0x11, sizeof *vbc); free(vbc); break; default: WRONG("Wrong vbc state"); } Lck_Unlock(&tp->mtx); } /*-------------------------------------------------------------------- * Reference a TCP pool given by {ip4, ip6} pair. Create if it * doesn't exist already. */ struct tcp_pool * VBT_Ref(const struct suckaddr *ip4, const struct suckaddr *ip6) { struct tcp_pool *tp; VTAILQ_FOREACH(tp, &pools, list) { assert(tp->refcnt > 0); if (ip4 == NULL) { if (tp->ip4 != NULL) continue; } else { if (tp->ip4 == NULL) continue; if (VSA_Compare(ip4, tp->ip4)) continue; } if (ip6 == NULL) { if (tp->ip6 != NULL) continue; } else { if (tp->ip6 == NULL) continue; if (VSA_Compare(ip6, tp->ip6)) continue; } tp->refcnt++; return (tp); } ALLOC_OBJ(tp, TCP_POOL_MAGIC); AN(tp); if (ip4 != NULL) tp->ip4 = VSA_Clone(ip4); if (ip6 != NULL) tp->ip6 = VSA_Clone(ip6); tp->refcnt = 1; Lck_New(&tp->mtx, lck_backend_tcp); VTAILQ_INIT(&tp->connlist); VTAILQ_INIT(&tp->killlist); VTAILQ_INSERT_HEAD(&pools, tp, list); INIT_OBJ(&tp->waitfor, WAITFOR_MAGIC); tp->waitfor.func = tcp_handle; tp->waitfor.tmo = &cache_param->backend_idle_timeout; return (tp); } /*-------------------------------------------------------------------- * Release TCP pool, destroy if last reference. */ void VBT_Rel(struct tcp_pool **tpp) { struct tcp_pool *tp; struct vbc *vbc, *vbc2; AN(tpp); tp = *tpp; *tpp = NULL; CHECK_OBJ_NOTNULL(tp, TCP_POOL_MAGIC); assert(tp->refcnt > 0); if (--tp->refcnt > 0) return; AZ(tp->n_used); VTAILQ_REMOVE(&pools, tp, list); free(tp->name); free(tp->ip4); free(tp->ip6); Lck_Lock(&tp->mtx); VTAILQ_FOREACH_SAFE(vbc, &tp->connlist, list, vbc2) { VTAILQ_REMOVE(&tp->connlist, vbc, list); tp->n_conn--; assert(vbc->state == VBC_STATE_AVAIL); vbc->state = VBC_STATE_CLEANUP; (void)shutdown(vbc->fd, SHUT_WR); VTAILQ_INSERT_TAIL(&tp->killlist, vbc, list); tp->n_kill++; } while (tp->n_kill) { Lck_Unlock(&tp->mtx); (void)usleep(20000); Lck_Lock(&tp->mtx); } Lck_Unlock(&tp->mtx); Lck_Delete(&tp->mtx); AZ(tp->n_conn); AZ(tp->n_kill); FREE_OBJ(tp); } /*-------------------------------------------------------------------- * Open a new connection from pool. This is a distinct function since * probing cannot use a recycled connection. */ int VBT_Open(const struct tcp_pool *tp, double tmo, const struct suckaddr **sa) { int s; int msec; CHECK_OBJ_NOTNULL(tp, TCP_POOL_MAGIC); msec = (int)floor(tmo * 1000.0); if (cache_param->prefer_ipv6) { *sa = tp->ip6; s = VTCP_connect(tp->ip6, msec); if (s >= 0) return(s); } *sa = tp->ip4; s = VTCP_connect(tp->ip4, msec); if (s < 0 && !cache_param->prefer_ipv6) { *sa = tp->ip6; s = VTCP_connect(tp->ip6, msec); } return(s); } /*-------------------------------------------------------------------- * Recycle a connection. */ void VBT_Recycle(const struct worker *wrk, struct tcp_pool *tp, struct vbc **vbcp) { struct vbc *vbc; int i = 0; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(tp, TCP_POOL_MAGIC); vbc = *vbcp; *vbcp = NULL; CHECK_OBJ_NOTNULL(vbc, VBC_MAGIC); assert(vbc->state == VBC_STATE_USED); assert(vbc->fd > 0); Lck_Lock(&tp->mtx); tp->n_used--; vbc->waited->ptr = vbc; vbc->waited->fd = vbc->fd; vbc->waited->idle = VTIM_real(); vbc->state = VBC_STATE_AVAIL; vbc->waited->waitfor = &tp->waitfor; if (Wait_Enter(wrk->pool->waiter, vbc->waited)) { VTCP_close(&vbc->fd); memset(vbc, 0x33, sizeof *vbc); free(vbc); // XXX: stats vbc = NULL; } else { VTAILQ_INSERT_HEAD(&tp->connlist, vbc, list); i++; } if (vbc != NULL) tp->n_conn++; Lck_Unlock(&tp->mtx); if (i && DO_DEBUG(DBG_VTC_MODE)) { /* * In varnishtest we do not have the luxury of using * multiple backend connections, so whenever we end up * in the "pending" case, take a short nap to let the * waiter catch up and put the vbc back into circulations. * * In particular ESI:include related tests suffer random * failures without this. * * In normal operation, the only effect is that we will * have N+1 backend connections rather than N, which is * entirely harmless. */ (void)usleep(10000); } } /*-------------------------------------------------------------------- * Close a connection. */ void VBT_Close(struct tcp_pool *tp, struct vbc **vbcp) { struct vbc *vbc; CHECK_OBJ_NOTNULL(tp, TCP_POOL_MAGIC); vbc = *vbcp; *vbcp = NULL; CHECK_OBJ_NOTNULL(vbc, VBC_MAGIC); assert(vbc->state == VBC_STATE_USED); assert(vbc->fd > 0); Lck_Lock(&tp->mtx); tp->n_used--; if (vbc->state == VBC_STATE_STOLEN) { (void)shutdown(vbc->fd, SHUT_WR); vbc->state = VBC_STATE_CLEANUP; VTAILQ_INSERT_HEAD(&tp->killlist, vbc, list); tp->n_kill++; } else { assert(vbc->state == VBC_STATE_USED); VTCP_close(&vbc->fd); memset(vbc, 0x44, sizeof *vbc); free(vbc); } Lck_Unlock(&tp->mtx); } /*-------------------------------------------------------------------- * Get a connection */ struct vbc * VBT_Get(struct tcp_pool *tp, double tmo, const struct backend *be, struct worker *wrk) { struct vbc *vbc; CHECK_OBJ_NOTNULL(tp, TCP_POOL_MAGIC); CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); Lck_Lock(&tp->mtx); vbc = VTAILQ_FIRST(&tp->connlist); CHECK_OBJ_ORNULL(vbc, VBC_MAGIC); if (vbc == NULL || vbc->state == VBC_STATE_STOLEN) vbc = NULL; else { assert(vbc->tcp_pool == tp); assert(vbc->state == VBC_STATE_AVAIL); VTAILQ_REMOVE(&tp->connlist, vbc, list); VTAILQ_INSERT_TAIL(&tp->connlist, vbc, list); tp->n_conn--; VSC_C_main->backend_reuse += 1; vbc->state = VBC_STATE_STOLEN; vbc->cond = &wrk->cond; } tp->n_used++; // Opening mostly works Lck_Unlock(&tp->mtx); if (vbc != NULL) return (vbc); ALLOC_OBJ(vbc, VBC_MAGIC); AN(vbc); INIT_OBJ(vbc->waited, WAITED_MAGIC); vbc->state = VBC_STATE_USED; vbc->tcp_pool = tp; vbc->fd = VBT_Open(tp, tmo, &vbc->addr); if (vbc->fd < 0) FREE_OBJ(vbc); if (vbc == NULL) { Lck_Lock(&tp->mtx); tp->n_used--; // Nope, didn't work after all. Lck_Unlock(&tp->mtx); } return (vbc); } /*-------------------------------------------------------------------- */ void VBT_Wait(struct worker *wrk, struct vbc *vbc) { struct tcp_pool *tp; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(vbc, VBC_MAGIC); tp = vbc->tcp_pool; CHECK_OBJ_NOTNULL(tp, TCP_POOL_MAGIC); assert(vbc->cond == &wrk->cond); Lck_Lock(&tp->mtx); while (vbc->state == VBC_STATE_STOLEN) AZ(Lck_CondWait(&wrk->cond, &tp->mtx, 0)); assert(vbc->state == VBC_STATE_USED); vbc->cond = NULL; Lck_Unlock(&tp->mtx); } varnish-4.1.1/bin/varnishd/cache/cache_rfc2616.c0000644000201500234410000002102712652366721016131 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. */ #include "config.h" #include #include "cache.h" #include "vtim.h" /*-------------------------------------------------------------------- * TTL and Age calculation in Varnish * * RFC2616 has a lot to say about how caches should calculate the TTL * and expiry times of objects, but it sort of misses the case that * applies to Varnish: the server-side cache. * * A normal cache, shared or single-client, has no symbiotic relationship * with the server, and therefore must take a very defensive attitude * if the Data/Expiry/Age/max-age data does not make sense. Overall * the policy described in section 13 of RFC 2616 results in no caching * happening on the first little sign of trouble. * * Varnish on the other hand tries to offload as many transactions from * the backend as possible, and therefore just passing through everything * if there is a clock-skew between backend and Varnish is not a workable * choice. * * Varnish implements a policy which is RFC2616 compliant when there * is no clockskew, and falls as gracefully as possible otherwise. * Our "clockless cache" model is syntehsized from the bits of RFC2616 * that talks about how a cache should react to a clockless origin server, * and more or less uses the inverse logic for the opposite relationship. * */ void RFC2616_Ttl(struct busyobj *bo, double now) { unsigned max_age, age; double h_date, h_expires; const char *p; const struct http *hp; struct exp *expp; CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); expp = &bo->fetch_objcore->exp; hp = bo->beresp; assert(now != 0.0 && !isnan(now)); expp->t_origin = now; expp->ttl = cache_param->default_ttl; expp->grace = cache_param->default_grace; expp->keep = cache_param->default_keep; max_age = age = 0; h_expires = 0; h_date = 0; /* * Initial cacheability determination per [RFC2616, 13.4] * We do not support ranges to the backend yet, so 206 is out. */ if (http_GetHdr(hp, H_Age, &p)) { /* * We deliberately run with partial results, rather than * reject the Age: header outright. This will be future * compatible with fractional seconds. */ age = strtoul(p, NULL, 10); expp->t_origin -= age; } if (http_GetHdr(hp, H_Expires, &p)) h_expires = VTIM_parse(p); if (http_GetHdr(hp, H_Date, &p)) h_date = VTIM_parse(p); switch (http_GetStatus(hp)) { default: expp->ttl = -1.; break; case 302: /* Moved Temporarily */ case 307: /* Temporary Redirect */ /* * https://tools.ietf.org/html/rfc7231#section-6.1 * * Do not apply the default ttl, only set a ttl if Cache-Control * or Expires are present. Uncacheable otherwise. */ expp->ttl = -1.; /* FALL-THROUGH */ case 200: /* OK */ case 203: /* Non-Authoritative Information */ case 204: /* No Content */ case 300: /* Multiple Choices */ case 301: /* Moved Permanently */ case 304: /* Not Modified - handled like 200 */ case 404: /* Not Found */ case 410: /* Gone */ case 414: /* Request-URI Too Large */ /* * First find any relative specification from the backend * These take precedence according to RFC2616, 13.2.4 */ if ((http_GetHdrField(hp, H_Cache_Control, "s-maxage", &p) || http_GetHdrField(hp, H_Cache_Control, "max-age", &p)) && p != NULL) { if (*p == '-') max_age = 0; else max_age = strtoul(p, NULL, 0); expp->ttl = max_age; break; } /* No expire header, fall back to default */ if (h_expires == 0) break; /* If backend told us it is expired already, don't cache. */ if (h_expires < h_date) { expp->ttl = 0; break; } if (h_date == 0 || fabs(h_date - now) < cache_param->clock_skew) { /* * If we have no Date: header or if it is * sufficiently close to our clock we will * trust Expires: relative to our own clock. */ if (h_expires < now) expp->ttl = 0; else expp->ttl = h_expires - now; break; } else { /* * But even if the clocks are out of whack we can still * derive a relative time from the two headers. * (the negative ttl case is caught above) */ expp->ttl = (int)(h_expires - h_date); } } /* * RFC5861 outlines a way to control the use of stale responses. * We use this to initialize the grace period. */ if (expp->ttl >= 0 && http_GetHdrField(hp, H_Cache_Control, "stale-while-revalidate", &p) && p != NULL) { if (*p == '-') expp->grace = 0; else expp->grace = strtoul(p, NULL, 0); } VSLb(bo->vsl, SLT_TTL, "RFC %.0f %.0f %.0f %.0f %.0f %.0f %.0f %u", expp->ttl, expp->grace, -1., now, expp->t_origin, h_date, h_expires, max_age); } /*-------------------------------------------------------------------- * Find out if the request can receive a gzip'ed response */ unsigned RFC2616_Req_Gzip(const struct http *hp) { /* * "x-gzip" is for http/1.0 backwards compat, final note in 14.3 * p104 says to not do q values for x-gzip, so we just test * for its existence. */ if (http_GetHdrToken(hp, H_Accept_Encoding, "x-gzip", NULL, NULL)) return (1); /* * "gzip" is the real thing, but the 'q' value must be nonzero. * We do not care a hoot if the client prefers some other * compression more than gzip: Varnish only does gzip. */ if (http_GetHdrQ(hp, H_Accept_Encoding, "gzip") > 0.) return (1); /* Bad client, no gzip. */ return (0); } /*--------------------------------------------------------------------*/ static inline int rfc2616_strong_compare(const char *p, const char *e) { if ((p[0] == 'W' && p[1] == '/') || (e[0] == 'W' && e[1] == '/')) return (0); return (strcmp(p, e) == 0); } static inline int rfc2616_weak_compare(const char *p, const char *e) { if (p[0] == 'W' && p[1] == '/') p += 2; if (e[0] == 'W' && e[1] == '/') e += 2; return (strcmp(p, e) == 0); } int RFC2616_Do_Cond(const struct req *req) { const char *p, *e; double ims, lm; /* * We MUST ignore If-Modified-Since if we have an If-None-Match * header [RFC7232 3.3 p16]. */ if (http_GetHdr(req->http, H_If_None_Match, &p)) { if (!http_GetHdr(req->resp, H_ETag, &e)) return (0); if (http_GetHdr(req->http, H_Range, NULL)) return (rfc2616_strong_compare(p, e)); else return (rfc2616_weak_compare(p, e)); } if (http_GetHdr(req->http, H_If_Modified_Since, &p)) { ims = VTIM_parse(p); if (!ims || ims > req->t_req) /* [RFC7232 3.3 p16] */ return (0); AZ(ObjGetDouble(req->wrk, req->objcore, OA_LASTMODIFIED, &lm)); if (lm > ims) return (0); return (1); } return (0); } /*--------------------------------------------------------------------*/ void RFC2616_Weaken_Etag(struct http *hp) { const char *p; CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); if (!http_GetHdr(hp, H_ETag, &p)) return; AN(p); if (p[0] == 'W' && p[1] == '/') return; http_Unset(hp, H_ETag); http_PrintfHeader(hp, "ETag: W/%s", p); } /*--------------------------------------------------------------------*/ void RFC2616_Vary_AE(struct http *hp) { const char *vary; if (http_GetHdrToken(hp, H_Vary, "Accept-Encoding", NULL, NULL)) return; if (http_GetHdr(hp, H_Vary, &vary)) { http_Unset(hp, H_Vary); http_PrintfHeader(hp, "Vary: %s, Accept-Encoding", vary); } else { http_SetHeader(hp, "Vary: Accept-Encoding"); } } varnish-4.1.1/bin/varnishd/cache/cache_session.c0000644000201500234410000003334112652366721016525 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Session management * * This is a little bit of a mixed bag, containing both memory management * and various state-change functions. * * The overall picture is complicated by the fact that requests can * disembark their worker-threads if they hit a busy object, then come * back later in a different worker thread to continue. * XXX: I wonder if that complexity pays of any more ? * */ #include "config.h" #include #include #include #include "cache.h" #include "cache_pool.h" #include "http1/cache_http1.h" #include "vsa.h" #include "vtcp.h" #include "vtim.h" /*--------------------------------------------------------------------*/ static int ses_get_attr(const struct sess *sp, enum sess_attr a, void **dst) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); assert(a < SA_LAST); AN(dst); if (sp->sattr[a] == 0xffff) { *dst = NULL; return (-1); } else { *dst = sp->ws->s + sp->sattr[a]; return (0); } } static void ses_reserve_attr(struct sess *sp, enum sess_attr a, void **dst, int sz) { ssize_t o; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); assert(a < SA_LAST); assert(sz >= 0); AN(dst); o = WS_Reserve(sp->ws, sz); assert(o >= sz); *dst = sp->ws->f; o = sp->ws->f - sp->ws->s; WS_Release(sp->ws, sz); assert(o >= 0 && o <= 0xffff); sp->sattr[a] = (uint16_t)o; } #define SESS_ATTR(UP, low, typ, len) \ int \ SES_Get_##low(const struct sess *sp, typ *dst) \ { \ return (ses_get_attr(sp, SA_##UP, (void**)dst)); \ } \ \ void \ SES_Reserve_##low(struct sess *sp, typ *dst) \ { \ assert(len >= 0); \ ses_reserve_attr(sp, SA_##UP, (void*)dst, len); \ } #include "tbl/sess_attr.h" #undef SESS_ATTR void SES_Set_String_Attr(struct sess *sp, enum sess_attr a, const char *src) { void *q; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); AN(src); switch (a) { #define SESS_ATTR(UP, low, typ, len) case SA_##UP: assert(len < 0); break; #include "tbl/sess_attr.h" #undef SESS_ATTR default: WRONG("wrong sess_attr"); } ses_reserve_attr(sp, a, &q, strlen(src) + 1); strcpy(q, src); } const char * SES_Get_String_Attr(const struct sess *sp, enum sess_attr a) { void *q; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); switch (a) { #define SESS_ATTR(UP, low, typ, len) case SA_##UP: assert(len < 0); break; #include "tbl/sess_attr.h" #undef SESS_ATTR default: WRONG("wrong sess_attr"); } if (ses_get_attr(sp, a, &q) < 0) return (NULL); return (q); } /*--------------------------------------------------------------------*/ void SES_RxInit(struct http_conn *htc, struct ws *ws, unsigned maxbytes, unsigned maxhdr) { htc->magic = HTTP_CONN_MAGIC; htc->ws = ws; htc->maxbytes = maxbytes; htc->maxhdr = maxhdr; (void)WS_Reserve(htc->ws, htc->maxbytes); htc->rxbuf_b = ws->f; htc->rxbuf_e = ws->f; *htc->rxbuf_e = '\0'; htc->pipeline_b = NULL; htc->pipeline_e = NULL; } /*-------------------------------------------------------------------- * Start over, and recycle any pipelined input. * The WS_Reset is safe, even though the pipelined input is stored in * the ws somewhere, because WS_Reset only fiddles pointers. */ void SES_RxReInit(struct http_conn *htc) { ssize_t l; CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); (void)WS_Reserve(htc->ws, htc->maxbytes); htc->rxbuf_b = htc->ws->f; htc->rxbuf_e = htc->ws->f; if (htc->pipeline_b != NULL) { l = htc->pipeline_e - htc->pipeline_b; assert(l > 0); memmove(htc->rxbuf_b, htc->pipeline_b, l); htc->rxbuf_e += l; htc->pipeline_b = NULL; htc->pipeline_e = NULL; } *htc->rxbuf_e = '\0'; } /*---------------------------------------------------------------------- * Receive a request/packet/whatever, with timeouts * * t0 is when we start * *t1 becomes time of first non-idle rx * *t2 becomes time of complete rx * ti is when we return IDLE if nothing has arrived * tn is when we timeout on non-complete */ enum htc_status_e SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double *t1, double *t2, double ti, double tn) { double tmo; double now; enum htc_status_e hs; int i; CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); AZ(isnan(tn)); if (t1 != NULL) assert(isnan(*t1)); while (1) { now = VTIM_real(); hs = func(htc); if (hs == HTC_S_OVERFLOW || hs == HTC_S_JUNK) { WS_ReleaseP(htc->ws, htc->rxbuf_b); return (hs); } if (hs == HTC_S_COMPLETE) { WS_ReleaseP(htc->ws, htc->rxbuf_e); /* Got it, run with it */ if (t1 != NULL && isnan(*t1)) *t1 = now; if (t2 != NULL) *t2 = now; return (HTC_S_COMPLETE); } if (tn < now) { WS_ReleaseP(htc->ws, htc->rxbuf_b); return (HTC_S_TIMEOUT); } if (hs == HTC_S_MORE) { /* Working on it */ if (t1 != NULL && isnan(*t1)) *t1 = now; } else if (hs != HTC_S_EMPTY) WRONG("htc_status_e"); tmo = tn - now; if (!isnan(ti) && ti < tn) tmo = ti - now; i = (htc->ws->r - htc->rxbuf_e) - 1; /* space for NUL */ if (i <= 0) { WS_ReleaseP(htc->ws, htc->rxbuf_b); return (HTC_S_OVERFLOW); } i = VTCP_read(htc->fd, htc->rxbuf_e, i, tmo); if (i == 0 || i == -1) { WS_ReleaseP(htc->ws, htc->rxbuf_b); return (HTC_S_EOF); } else if (i > 0) { htc->rxbuf_e += i; *htc->rxbuf_e = '\0'; } else if (i == -2) { if (hs == HTC_S_EMPTY && ti < now) { WS_ReleaseP(htc->ws, htc->rxbuf_b); return (HTC_S_IDLE); } } } } /*-------------------------------------------------------------------- * Get a new session, preferably by recycling an already ready one * * Layout is: * struct sess * workspace */ struct sess * SES_New(struct pool *pp) { struct sess *sp; unsigned sz; char *p, *e; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); sp = MPL_Get(pp->mpl_sess, &sz); sp->magic = SESS_MAGIC; sp->pool = pp; memset(sp->sattr, 0xff, sizeof sp->sattr); e = (char*)sp + sz; p = (char*)(sp + 1); p = (void*)PRNDUP(p); assert(p < e); WS_Init(sp->ws, "ses", p, e - p); sp->t_open = NAN; sp->t_idle = NAN; VRTPRIV_init(sp->privs); Lck_New(&sp->mtx, lck_sess); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); return (sp); } /*-------------------------------------------------------------------- * Call protocol for this request */ void __match_proto__(task_func_t) SES_Proto_Req(struct worker *wrk, void *arg) { struct req *req; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CAST_OBJ_NOTNULL(req, arg, REQ_MAGIC); THR_SetRequest(req); AZ(wrk->aws->r); if (req->sp->sess_step < S_STP_H1_LAST) { HTTP1_Session(wrk, req); AZ(wrk->v1l); } else { WRONG("Wrong session step"); } WS_Assert(wrk->aws); THR_SetRequest(NULL); } /*-------------------------------------------------------------------- * Call protocol for this session (new or from waiter) * * When sessions are rescheduled from the waiter, a struct pool_task * is put on the reserved session workspace (for reasons of memory * conservation). This reservation is released as the first thing. * The acceptor and any other code which schedules this function * must obey this calling convention with a dummy reservation. */ void __match_proto__(task_func_t) SES_Proto_Sess(struct worker *wrk, void *arg) { struct req *req; struct sess *sp; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CAST_OBJ_NOTNULL(sp, arg, SESS_MAGIC); WS_Release(sp->ws, 0); /* * Assume we're going to receive something that will likely * involve a request... */ (void)VTCP_blocking(sp->fd); req = Req_New(wrk, sp); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); req->htc->fd = sp->fd; SES_RxInit(req->htc, req->ws, cache_param->http_req_size, cache_param->http_req_hdr_len); if (sp->sess_step < S_STP_H1_LAST) { wrk->task.func = SES_Proto_Req; wrk->task.priv = req; } else if (sp->sess_step < S_STP_PROXY_LAST) { wrk->task.func = VPX_Proto_Sess; wrk->task.priv = req; } else { WRONG("Wrong session step"); } } /*-------------------------------------------------------------------- * Reschedule a request on a work-thread from its sessions pool * * This is used to reschedule requests waiting on busy objects */ int SES_Reschedule_Req(struct req *req) { struct sess *sp; struct pool *pp; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); sp = req->sp; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); pp = sp->pool; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); req->task.func = SES_Proto_Req; req->task.priv = req; return (Pool_Task(pp, &req->task, TASK_QUEUE_REQ)); } /*-------------------------------------------------------------------- * Handle a session (from waiter) */ static void __match_proto__(waiter_handle_f) ses_handle(struct waited *wp, enum wait_event ev, double now) { struct sess *sp; struct pool *pp; struct pool_task *tp; CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC); CAST_OBJ_NOTNULL(sp, wp->ptr, SESS_MAGIC); assert((void *)sp->ws->f == wp); wp->magic = 0; wp = NULL; WS_Release(sp->ws, 0); switch (ev) { case WAITER_TIMEOUT: SES_Delete(sp, SC_RX_TIMEOUT, now); break; case WAITER_REMCLOSE: SES_Delete(sp, SC_REM_CLOSE, now); break; case WAITER_ACTION: pp = sp->pool; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); assert(sizeof *tp <= WS_Reserve(sp->ws, sizeof *tp)); tp = (void*)sp->ws->f; tp->func = SES_Proto_Sess; tp->priv = sp; if (Pool_Task(pp, tp, TASK_QUEUE_REQ)) SES_Delete(sp, SC_OVERLOAD, now); break; case WAITER_CLOSE: WRONG("Should not see WAITER_CLOSE on client side"); break; default: WRONG("Wrong event in ses_handle"); } } /*-------------------------------------------------------------------- */ void SES_Wait(struct sess *sp) { struct pool *pp; struct waited *wp; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); pp = sp->pool; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); /* * XXX: waiter_epoll prevents us from zeroing the struct because * XXX: it keeps state across calls. */ if (VTCP_nonblocking(sp->fd)) { SES_Delete(sp, SC_REM_CLOSE, NAN); return; } /* * put struct waited on the workspace */ if (WS_Reserve(sp->ws, sizeof(struct waited)) < sizeof(struct waited)) { SES_Delete(sp, SC_OVERLOAD, NAN); } wp = (void*)sp->ws->f; INIT_OBJ(wp, WAITED_MAGIC); wp->fd = sp->fd; wp->ptr = sp; wp->idle = sp->t_idle; wp->waitfor = &pp->wf; if (Wait_Enter(pp->waiter, wp)) SES_Delete(sp, SC_PIPE_OVERFLOW, NAN); } /*-------------------------------------------------------------------- * Update sc_ counters by reason * * assuming that the approximation of non-atomic global counters is sufficient. * if not: update to per-wrk */ static void ses_close_acct(enum sess_close reason) { int i = 0; assert(reason != SC_NULL); switch (reason) { #define SESS_CLOSE(reason, stat, err, desc) \ case SC_ ## reason: \ VSC_C_main->sc_ ## stat++; \ i = err; \ break; #include "tbl/sess_close.h" #undef SESS_CLOSE default: WRONG("Wrong event in ses_close_acct"); } if (i) VSC_C_main->sess_closed_err++; } /*-------------------------------------------------------------------- * Close a session's connection. * XXX: Technically speaking we should catch a t_end timestamp here * XXX: for SES_Delete() to use. */ void SES_Close(struct sess *sp, enum sess_close reason) { int i; assert(sp->fd >= 0); i = close(sp->fd); assert(i == 0 || errno != EBADF); /* XXX EINVAL seen */ sp->fd = -(int)reason; if (reason != SC_NULL) ses_close_acct(reason); } /*-------------------------------------------------------------------- * Report and dismantle a session. */ void SES_Delete(struct sess *sp, enum sess_close reason, double now) { struct pool *pp; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); pp = sp->pool; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); if (reason != SC_NULL) SES_Close(sp, reason); assert(sp->fd < 0); if (isnan(now)) now = VTIM_real(); AZ(isnan(sp->t_open)); if (reason == SC_NULL) reason = (enum sess_close)-sp->fd; assert(now >= sp->t_open); assert(VTAILQ_EMPTY(&sp->privs->privs)); VSL(SLT_SessClose, sp->vxid, "%s %.3f", sess_close_2str(reason, 0), now - sp->t_open); VSL(SLT_End, sp->vxid, "%s", ""); Lck_Delete(&sp->mtx); MPL_Free(pp->mpl_sess, sp); } /*-------------------------------------------------------------------- * Create and delete pools */ void SES_NewPool(struct pool *pp, unsigned pool_no) { char nb[8]; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); bprintf(nb, "req%u", pool_no); pp->mpl_req = MPL_New(nb, &cache_param->req_pool, &cache_param->workspace_client); bprintf(nb, "sess%u", pool_no); pp->mpl_sess = MPL_New(nb, &cache_param->sess_pool, &cache_param->workspace_session); INIT_OBJ(&pp->wf, WAITFOR_MAGIC); pp->wf.func = ses_handle; pp->wf.tmo = &cache_param->timeout_idle; pp->waiter = Waiter_New(); } varnish-4.1.1/bin/varnishd/cache/cache_hash.c0000644000201500234410000005272312652366721015772 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This is the central hash-table code, it relies on a chosen hash * implementation only for the actual hashing, all the housekeeping * happens here. * * We have two kinds of structures, objecthead and object. An objecthead * corresponds to a given (Host:, URL) tupple, and the objects hung from * the objecthead may represent various variations (ie: Vary: header, * different TTL etc) instances of that web-entity. * * Each objecthead has a mutex which locks both its own fields, the * list of objects and fields in the objects. * * The hash implementation must supply a reference count facility on * the objecthead, and return with a reference held after a lookup. * * Lookups in the hash implementation returns with a ref held and each * object hung from the objhead holds a ref as well. * * Objects have refcounts which are locked by the objecthead mutex. * * New objects are always marked busy, and they can go from busy to * not busy only once. */ #include "config.h" #include #include #include "cache.h" #include "hash/hash_slinger.h" #include "vsha256.h" #include "vtim.h" static const struct hash_slinger *hash; static struct objhead *private_oh; /*---------------------------------------------------------------------*/ static struct objcore * hsh_NewObjCore(struct worker *wrk) { struct objcore *oc; ALLOC_OBJ(oc, OBJCORE_MAGIC); XXXAN(oc); wrk->stats->n_objectcore++; oc->flags |= OC_F_BUSY | OC_F_INCOMPLETE; return (oc); } /*---------------------------------------------------------------------*/ static struct objhead * hsh_newobjhead(void) { struct objhead *oh; ALLOC_OBJ(oh, OBJHEAD_MAGIC); XXXAN(oh); oh->refcnt = 1; VTAILQ_INIT(&oh->objcs); Lck_New(&oh->mtx, lck_objhdr); return (oh); } /*---------------------------------------------------------------------*/ /* Precreate an objhead and object for later use */ static void hsh_prealloc(struct worker *wrk) { struct waitinglist *wl; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); if (wrk->nobjcore == NULL) wrk->nobjcore = hsh_NewObjCore(wrk); CHECK_OBJ_NOTNULL(wrk->nobjcore, OBJCORE_MAGIC); if (wrk->nobjhead == NULL) { wrk->nobjhead = hsh_newobjhead(); wrk->stats->n_objecthead++; } CHECK_OBJ_NOTNULL(wrk->nobjhead, OBJHEAD_MAGIC); if (wrk->nwaitinglist == NULL) { ALLOC_OBJ(wl, WAITINGLIST_MAGIC); XXXAN(wl); VTAILQ_INIT(&wl->list); wrk->nwaitinglist = wl; wrk->stats->n_waitinglist++; } CHECK_OBJ_NOTNULL(wrk->nwaitinglist, WAITINGLIST_MAGIC); if (hash->prep != NULL) hash->prep(wrk); } /*---------------------------------------------------------------------*/ struct objcore * HSH_Private(struct worker *wrk) { struct objcore *oc; CHECK_OBJ_NOTNULL(private_oh, OBJHEAD_MAGIC); oc = hsh_NewObjCore(wrk); AN(oc); oc->refcnt = 1; oc->objhead = private_oh; oc->flags |= OC_F_PRIVATE | OC_F_BUSY; Lck_Lock(&private_oh->mtx); VTAILQ_INSERT_TAIL(&private_oh->objcs, oc, list); private_oh->refcnt++; Lck_Unlock(&private_oh->mtx); return (oc); } /*---------------------------------------------------------------------*/ void HSH_Cleanup(struct worker *wrk) { if (wrk->nobjcore != NULL) { FREE_OBJ(wrk->nobjcore); wrk->stats->n_objectcore--; wrk->nobjcore = NULL; } if (wrk->nobjhead != NULL) { Lck_Delete(&wrk->nobjhead->mtx); FREE_OBJ(wrk->nobjhead); wrk->nobjhead = NULL; wrk->stats->n_objecthead--; } if (wrk->nwaitinglist != NULL) { FREE_OBJ(wrk->nwaitinglist); wrk->nwaitinglist = NULL; wrk->stats->n_waitinglist--; } if (wrk->nhashpriv != NULL) { /* XXX: If needed, add slinger method for this */ free(wrk->nhashpriv); wrk->nhashpriv = NULL; } } void HSH_DeleteObjHead(struct worker *wrk, struct objhead *oh) { AZ(oh->refcnt); assert(VTAILQ_EMPTY(&oh->objcs)); Lck_Delete(&oh->mtx); wrk->stats->n_objecthead--; FREE_OBJ(oh); } void HSH_AddString(struct req *req, void *ctx, const char *str) { CHECK_OBJ_NOTNULL(req, REQ_MAGIC); AN(ctx); if (str != NULL) { SHA256_Update(ctx, str, strlen(str)); VSLb(req->vsl, SLT_Hash, "%s", str); } else SHA256_Update(ctx, &str, 1); } /*--------------------------------------------------------------------- * This is a debugging hack to enable testing of boundary conditions * in the hash algorithm. * We trap the first 9 different digests and translate them to different * digests with edge bit conditions */ static struct hsh_magiclist { unsigned char was[SHA256_LEN]; unsigned char now[SHA256_LEN]; } hsh_magiclist[] = { { .now = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, { .now = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } }, { .now = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 } }, { .now = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40 } }, { .now = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 } }, { .now = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, { .now = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, { .now = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, { .now = { 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, }; #define HSH_NMAGIC (sizeof hsh_magiclist / sizeof hsh_magiclist[0]) static void hsh_testmagic(void *result) { int i, j; static int nused = 0; for (i = 0; i < nused; i++) if (!memcmp(hsh_magiclist[i].was, result, SHA256_LEN)) break; if (i == nused && i < HSH_NMAGIC) memcpy(hsh_magiclist[nused++].was, result, SHA256_LEN); if (i == nused) return; assert(i < HSH_NMAGIC); fprintf(stderr, "HASHMAGIC: <"); for (j = 0; j < SHA256_LEN; j++) fprintf(stderr, "%02x", ((unsigned char*)result)[j]); fprintf(stderr, "> -> <"); memcpy(result, hsh_magiclist[i].now, SHA256_LEN); for (j = 0; j < SHA256_LEN; j++) fprintf(stderr, "%02x", ((unsigned char*)result)[j]); fprintf(stderr, ">\n"); } /*--------------------------------------------------------------------- * Insert an object which magically appears out of nowhere or, more likely, * comes off some persistent storage device. * Return it with a reference held. */ void HSH_Insert(struct worker *wrk, const void *digest, struct objcore *oc) { struct objhead *oh; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AN(digest); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); hsh_prealloc(wrk); AN(wrk->nobjhead); oh = hash->lookup(wrk, digest, &wrk->nobjhead); CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); Lck_AssertHeld(&oh->mtx); assert(oh->refcnt > 0); /* Insert (precreated) objcore in objecthead */ oc->refcnt = 1; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AZ(oc->flags & OC_F_BUSY); VTAILQ_INSERT_HEAD(&oh->objcs, oc, list); /* NB: do not deref objhead the new object inherits our reference */ oc->objhead = oh; Lck_Unlock(&oh->mtx); wrk->stats->n_objectcore++; wrk->stats->n_vampireobject++; } /*--------------------------------------------------------------------- */ static struct objcore * hsh_insert_busyobj(struct worker *wrk, struct objhead *oh) { struct objcore *oc; CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); Lck_AssertHeld(&oh->mtx); oc = wrk->nobjcore; wrk->nobjcore = NULL; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AN(oc->flags & OC_F_BUSY); oc->refcnt = 1; /* Owned by busyobj */ oc->objhead = oh; VTAILQ_INSERT_TAIL(&oh->objcs, oc, list); return (oc); } /*--------------------------------------------------------------------- */ enum lookup_e HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp, int wait_for_busy, int always_insert) { struct worker *wrk; struct objhead *oh; struct objcore *oc; struct objcore *exp_oc; double exp_t_origin; int busy_found; enum lookup_e retval; uint8_t *vary; AN(ocp); *ocp = NULL; AN(bocp); *bocp = NULL; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); wrk = req->wrk; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req->http, HTTP_MAGIC); AN(hash); hsh_prealloc(wrk); if (DO_DEBUG(DBG_HASHEDGE)) hsh_testmagic(req->digest); if (req->hash_objhead != NULL) { /* * This req came off the waiting list, and brings an * oh refcnt with it. */ CHECK_OBJ_NOTNULL(req->hash_objhead, OBJHEAD_MAGIC); oh = req->hash_objhead; Lck_Lock(&oh->mtx); req->hash_objhead = NULL; } else { AN(wrk->nobjhead); oh = hash->lookup(wrk, req->digest, &wrk->nobjhead); } CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); Lck_AssertHeld(&oh->mtx); if (always_insert) { /* XXX: should we do predictive Vary in this case ? */ /* Insert new objcore in objecthead and release mutex */ *bocp = hsh_insert_busyobj(wrk, oh); /* NB: no deref of objhead, new object inherits reference */ Lck_Unlock(&oh->mtx); return (HSH_MISS); } assert(oh->refcnt > 0); busy_found = 0; exp_oc = NULL; exp_t_origin = 0.0; VTAILQ_FOREACH(oc, &oh->objcs, list) { /* Must be at least our own ref + the objcore we examine */ assert(oh->refcnt > 1); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); assert(oc->objhead == oh); if (oc->exp_flags & OC_EF_DYING) continue; if (oc->flags & OC_F_FAILED) continue; if (oc->flags & OC_F_BUSY) { CHECK_OBJ_ORNULL(oc->busyobj, BUSYOBJ_MAGIC); if (req->hash_ignore_busy) continue; if (oc->busyobj != NULL && oc->busyobj->vary != NULL && !VRY_Match(req, oc->busyobj->vary)) continue; busy_found = 1; continue; } if (oc->exp.ttl <= 0.) continue; if (BAN_CheckObject(wrk, oc, req)) continue; vary = ObjGetattr(wrk, oc, OA_VARY, NULL); if (vary != NULL && !VRY_Match(req, vary)) continue; if (EXP_Ttl(req, &oc->exp) >= req->t_req) { /* If still valid, use it */ assert(oh->refcnt > 1); assert(oc->objhead == oh); oc->refcnt++; if (oc->hits < LONG_MAX) oc->hits++; Lck_Unlock(&oh->mtx); assert(HSH_DerefObjHead(wrk, &oh)); *ocp = oc; return (HSH_HIT); } if (oc->exp.t_origin > exp_t_origin) { /* record the newest object */ exp_oc = oc; exp_t_origin = oc->exp.t_origin; } } if (exp_oc != NULL) { assert(oh->refcnt > 1); assert(exp_oc->objhead == oh); exp_oc->refcnt++; if (!busy_found) { *bocp = hsh_insert_busyobj(wrk, oh); retval = HSH_EXPBUSY; } else { AZ(req->hash_ignore_busy); retval = HSH_EXP; } if (exp_oc->hits < LONG_MAX) exp_oc->hits++; Lck_Unlock(&oh->mtx); if (retval == HSH_EXP) assert(HSH_DerefObjHead(wrk, &oh)); *ocp = exp_oc; return (retval); } if (!busy_found) { /* Insert objcore in objecthead and release mutex */ *bocp = hsh_insert_busyobj(wrk, oh); /* NB: no deref of objhead, new object inherits reference */ Lck_Unlock(&oh->mtx); return (HSH_MISS); } /* There are one or more busy objects, wait for them */ AZ(req->hash_ignore_busy); if (wait_for_busy) { CHECK_OBJ_NOTNULL(wrk->nwaitinglist, WAITINGLIST_MAGIC); if (oh->waitinglist == NULL) { oh->waitinglist = wrk->nwaitinglist; wrk->nwaitinglist = NULL; } VTAILQ_INSERT_TAIL(&oh->waitinglist->list, req, w_list); if (DO_DEBUG(DBG_WAITINGLIST)) VSLb(req->vsl, SLT_Debug, "on waiting list <%p>", oh); } else { if (DO_DEBUG(DBG_WAITINGLIST)) VSLb(req->vsl, SLT_Debug, "hit busy obj <%p>", oh); } wrk->stats->busy_sleep++; /* * The objhead reference transfers to the sess, we get it * back when the sess comes off the waiting list and * calls us again */ req->hash_objhead = oh; req->wrk = NULL; Lck_Unlock(&oh->mtx); return (HSH_BUSY); } /*--------------------------------------------------------------------- */ static void hsh_rush(struct worker *wrk, struct objhead *oh) { unsigned u; struct req *req; struct sess *sp; struct waitinglist *wl; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); Lck_AssertHeld(&oh->mtx); wl = oh->waitinglist; CHECK_OBJ_ORNULL(wl, WAITINGLIST_MAGIC); if (wl == NULL) return; for (u = 0; u < cache_param->rush_exponent; u++) { req = VTAILQ_FIRST(&wl->list); if (req == NULL) break; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); wrk->stats->busy_wakeup++; AZ(req->wrk); VTAILQ_REMOVE(&wl->list, req, w_list); DSL(DBG_WAITINGLIST, req->vsl->wid, "off waiting list"); if (SES_Reschedule_Req(req)) { /* * In case of overloads, we ditch the entire * waiting list. */ wrk->stats->busy_wakeup--; while (1) { wrk->stats->busy_killed++; AN (req->vcl); VCL_Rel(&req->vcl); sp = req->sp; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CNT_AcctLogCharge(wrk->stats, req); Req_Release(req); SES_Delete(sp, SC_OVERLOAD, NAN); req = VTAILQ_FIRST(&wl->list); if (req == NULL) break; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); VTAILQ_REMOVE(&wl->list, req, w_list); DSL(DBG_WAITINGLIST, req->vsl->wid, "kill from waiting list"); } break; } } if (VTAILQ_EMPTY(&wl->list)) { oh->waitinglist = NULL; FREE_OBJ(wl); wrk->stats->n_waitinglist--; } } /*--------------------------------------------------------------------- * Purge an entire objhead */ void HSH_Purge(struct worker *wrk, struct objhead *oh, double ttl, double grace, double keep) { struct objcore *oc, **ocp; unsigned spc, ospc, nobj, n; int more = 0; double now; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); ospc = WS_Reserve(wrk->aws, 0); assert(ospc >= sizeof *ocp); do { more = 0; spc = ospc; nobj = 0; ocp = (void*)wrk->aws->f; Lck_Lock(&oh->mtx); assert(oh->refcnt > 0); now = VTIM_real(); VTAILQ_FOREACH(oc, &oh->objcs, list) { CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); assert(oc->objhead == oh); if (oc->flags & OC_F_BUSY) { /* * We cannot purge busy objects here, because * their owners have special rights to them, * and may nuke them without concern for the * refcount, which by definition always must * be one, so they don't check. */ continue; } if (oc->exp_flags & OC_EF_DYING) continue; if (spc < sizeof *ocp) { /* Iterate if aws is not big enough */ more = 1; break; } oc->refcnt++; spc -= sizeof *ocp; ocp[nobj++] = oc; } Lck_Unlock(&oh->mtx); for (n = 0; n < nobj; n++) { oc = ocp[n]; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); EXP_Rearm(oc, now, ttl, grace, keep); (void)HSH_DerefObjCore(wrk, &oc); } } while (more); WS_Release(wrk->aws, 0); Pool_PurgeStat(nobj); } /*--------------------------------------------------------------------- * Fail an objcore */ void HSH_Fail(struct objcore *oc) { struct objhead *oh; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); oh = oc->objhead; CHECK_OBJ(oh, OBJHEAD_MAGIC); /* * We have to have either a busy bit, so that HSH_Lookup * will not consider this oc, or an object hung of the oc * so that it can consider it. */ assert((oc->flags & OC_F_BUSY) || (oc->stobj->stevedore != NULL)); Lck_Lock(&oh->mtx); oc->flags |= OC_F_FAILED; oc->flags &= ~OC_F_INCOMPLETE; oc->busyobj = NULL; Lck_Unlock(&oh->mtx); } /*--------------------------------------------------------------------- * Remove the busyobj from an objcore */ void HSH_Complete(struct objcore *oc) { struct objhead *oh; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); oh = oc->objhead; CHECK_OBJ(oh, OBJHEAD_MAGIC); Lck_Lock(&oh->mtx); oc->busyobj = NULL; oc->flags &= ~OC_F_INCOMPLETE; Lck_Unlock(&oh->mtx); } /*--------------------------------------------------------------------- * Unbusy an objcore when the object is completely fetched. */ void HSH_Unbusy(struct worker *wrk, struct objcore *oc) { struct objhead *oh; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); oh = oc->objhead; CHECK_OBJ(oh, OBJHEAD_MAGIC); AN(oc->stobj->stevedore); AN(oc->flags & OC_F_BUSY); assert(oh->refcnt > 0); if (!(oc->flags & OC_F_PRIVATE)) { BAN_NewObjCore(oc); EXP_Insert(wrk, oc); AN(oc->exp_flags & OC_EF_EXP); AN(oc->ban); } /* XXX: pretouch neighbors on oh->objcs to prevent page-on under mtx */ Lck_Lock(&oh->mtx); assert(oh->refcnt > 0); /* XXX: strictly speaking, we should sort in Date: order. */ VTAILQ_REMOVE(&oh->objcs, oc, list); VTAILQ_INSERT_HEAD(&oh->objcs, oc, list); oc->flags &= ~OC_F_BUSY; if (oh->waitinglist != NULL) hsh_rush(wrk, oh); Lck_Unlock(&oh->mtx); } /*--------------------------------------------------------------------- * Gain a reference on an objcore */ void HSH_Ref(struct objcore *oc) { struct objhead *oh; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); oh = oc->objhead; CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); Lck_Lock(&oh->mtx); assert(oc->refcnt > 0); oc->refcnt++; Lck_Unlock(&oh->mtx); } /*--------------------------------------------------------------------- * Gain a reference on the busyobj, if the objcore has one */ struct busyobj * HSH_RefBusy(const struct objcore *oc) { struct objhead *oh; struct busyobj *bo; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); oh = oc->objhead; CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); Lck_Lock(&oh->mtx); assert(oc->refcnt > 0); bo = oc->busyobj; CHECK_OBJ_ORNULL(bo, BUSYOBJ_MAGIC); if (bo != NULL) bo->refcount++; Lck_Unlock(&oh->mtx); return (bo); } /*-------------------------------------------------------------------- * Dereference objcore * * Returns zero if target was destroyed. */ int HSH_DerefObjCore(struct worker *wrk, struct objcore **ocp) { struct objcore *oc; struct objhead *oh; unsigned r; AN(ocp); oc = *ocp; *ocp = NULL; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); assert(oc->refcnt > 0); oh = oc->objhead; CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); Lck_Lock(&oh->mtx); assert(oh->refcnt > 0); r = --oc->refcnt; if (!r) VTAILQ_REMOVE(&oh->objcs, oc, list); if (oh->waitinglist != NULL) hsh_rush(wrk, oh); Lck_Unlock(&oh->mtx); if (r != 0) return (r); BAN_DestroyObj(oc); AZ(oc->ban); if (oc->stobj->stevedore != NULL) ObjFreeObj(wrk, oc); FREE_OBJ(oc); wrk->stats->n_objectcore--; /* Drop our ref on the objhead */ assert(oh->refcnt > 0); (void)HSH_DerefObjHead(wrk, &oh); return (0); } int HSH_DerefObjHead(struct worker *wrk, struct objhead **poh) { struct objhead *oh; int r; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AN(poh); oh = *poh; *poh = NULL; CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); if (oh == private_oh) { AZ(oh->waitinglist); Lck_Lock(&oh->mtx); assert(oh->refcnt > 1); oh->refcnt--; Lck_Unlock(&oh->mtx); return(1); } /* * Make absolutely certain that we do not let the final ref * disappear until the waitinglist is empty. * This is necessary because the req's on the waiting list do * not hold any ref on the objhead of their own, and we cannot * just make the hold the same ref's as objcore, that would * confuse hashers. */ while (oh->waitinglist != NULL) { Lck_Lock(&oh->mtx); assert(oh->refcnt > 0); r = oh->refcnt; hsh_rush(wrk, oh); Lck_Unlock(&oh->mtx); if (r > 1) break; usleep(100000); } assert(oh->refcnt > 0); r = hash->deref(oh); if (!r) HSH_DeleteObjHead(wrk, oh); return (r); } void HSH_Init(const struct hash_slinger *slinger) { assert(DIGEST_LEN == SHA256_LEN); /* avoid #include pollution */ hash = slinger; if (hash->start != NULL) hash->start(); private_oh = hsh_newobjhead(); private_oh->refcnt = 1; } varnish-4.1.1/bin/Makefile.in0000644000201500234410000004421212652366725012742 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Disabling building of the tools while api is in flux VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = bin DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ SUBDIRS = \ varnishadm \ varnishd \ varnishhist \ varnishlog \ varnishncsa \ varnishstat \ varnishtest \ varnishtop all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign bin/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/bin/varnishncsa/0000755000201500234410000000000012652366757013276 500000000000000varnish-4.1.1/bin/varnishncsa/varnishncsa.c0000644000201500234410000005270212652366721015676 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Anders Berg * Author: Poul-Henning Kamp * Author: Tollef Fog Heen * 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. * * Obtain log data from the shared memory log, order it by session ID, and * display it in Apache / NCSA combined log format. * * See doc/sphinx/reference/varnishncsa.rst for the supported format * specifiers. * * Note: %r is "%m http://%{Host}i%U%q %H" * */ #include "config.h" #define _WITH_GETLINE #include #include #include #include #include #include #include #include #include #include #include "base64.h" #include "vapi/vsm.h" #include "vapi/vsl.h" #include "vapi/voptget.h" #include "vas.h" #include "vdef.h" #include "vcs.h" #include "vsb.h" #include "vut.h" #include "vqueue.h" #include "miniobj.h" #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[] = "varnishncsa"; struct format; struct fragment; enum e_frag { F_H, /* %H Proto */ F_U, /* %U URL path */ F_q, /* %q Query string */ F_b, /* %b Body bytes sent */ F_h, /* %h Host name / IP Address */ F_m, /* %m Method */ F_s, /* %s Status */ F_I, /* %I Bytes recieved */ F_O, /* %O Bytes sent */ F_tstart, /* Time start */ F_tend, /* Time end */ F_ttfb, /* %{Varnish:time_firstbyte}x */ F_host, /* Host header */ F_auth, /* Authorization header */ F__MAX, }; struct fragment { unsigned gen; const char *b, *e; }; typedef int format_f(const struct format *format); struct format { unsigned magic; #define FORMAT_MAGIC 0xC3119CDA char time_type; VTAILQ_ENTRY(format) list; format_f *func; struct fragment *frag; char *string; const char *const *strptr; char *time_fmt; }; struct watch { unsigned magic; #define WATCH_MAGIC 0xA7D4005C VTAILQ_ENTRY(watch) list; char *key; unsigned keylen; struct fragment frag; }; VTAILQ_HEAD(watch_head, watch); struct ctx { /* Options */ int a_opt; char *w_arg; FILE *fo; struct vsb *vsb; unsigned gen; VTAILQ_HEAD(,format) format; /* State */ struct watch_head watch_vcl_log; struct watch_head watch_reqhdr; struct watch_head watch_resphdr; struct fragment frag[F__MAX]; const char *hitmiss; const char *handling; } CTX; static void usage(int status) { 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); } static void openout(int append) { AN(CTX.w_arg); CTX.fo = fopen(CTX.w_arg, append ? "a" : "w"); if (CTX.fo == NULL) VUT_Error(1, "Can't open output file (%s)", strerror(errno)); } static int __match_proto__(VUT_cb_f) rotateout(void) { AN(CTX.w_arg); AN(CTX.fo); fclose(CTX.fo); openout(1); AN(CTX.fo); return (0); } static int __match_proto__(VUT_cb_f) flushout(void) { AN(CTX.fo); if (fflush(CTX.fo)) return (-5); return (0); } static int vsb_esc_cat(struct vsb *sb, const char *b, const char *e) { AN(b); for (; b < e; b++) { if (isspace(*b)) { switch (*b) { case '\n': VSB_cat(sb, "\\n"); break; case '\t': VSB_cat(sb, "\\t"); break; case '\f': VSB_cat(sb, "\\f"); break; case '\r': VSB_cat(sb, "\\r"); break; case '\v': VSB_cat(sb, "\\v"); break; default: VSB_putc(sb, *b); break; } } else if (isprint(*b)) { switch (*b) { case '"': VSB_cat(sb, "\\\""); break; case '\\': VSB_cat(sb, "\\\\"); break; default: VSB_putc(sb, *b); break; } } else VSB_printf(sb, "\\x%02hhx", *b); } return (VSB_error(sb)); } static inline int vsb_fcat(struct vsb *vsb, const struct fragment *f, const char *dflt) { if (f->gen == CTX.gen) { assert(f->b <= f->e); return (vsb_esc_cat(vsb, f->b, f->e)); } if (dflt) return (vsb_esc_cat(vsb, dflt, dflt + strlen(dflt))); return (-1); } static int __match_proto__(format_f) format_string(const struct format *format) { CHECK_OBJ_NOTNULL(format, FORMAT_MAGIC); AN(format->string); AZ(VSB_cat(CTX.vsb, format->string)); return (1); } static int __match_proto__(format_f) format_strptr(const struct format *format) { CHECK_OBJ_NOTNULL(format, FORMAT_MAGIC); AN(format->strptr); AN(*format->strptr); AZ(VSB_cat(CTX.vsb, *format->strptr)); return (1); } static int __match_proto__(format_f) format_fragment(const struct format *format) { CHECK_OBJ_NOTNULL(format, FORMAT_MAGIC); AN(format->frag); if (format->frag->gen != CTX.gen) { if (format->string == NULL) return (-1); AZ(vsb_esc_cat(CTX.vsb, format->string, format->string + strlen(format->string))); return (0); } AZ(vsb_fcat(CTX.vsb, format->frag, NULL)); return (1); } static int __match_proto__(format_f) format_time(const struct format *format) { double t_start, t_end; char *p; char buf[64]; time_t t; struct tm tm; CHECK_OBJ_NOTNULL(format, FORMAT_MAGIC); if (CTX.frag[F_tstart].gen == CTX.gen) { t_start = strtod(CTX.frag[F_tstart].b, &p); if (p != CTX.frag[F_tstart].e) t_start = NAN; } else t_start = NAN; if (isnan(t_start)) { /* Missing t_start is a no go */ if (format->string == NULL) return (-1); AZ(VSB_cat(CTX.vsb, format->string)); return (0); } /* Missing t_end defaults to t_start */ if (CTX.frag[F_tend].gen == CTX.gen) { t_end = strtod(CTX.frag[F_tend].b, &p); if (p != CTX.frag[F_tend].e) t_end = t_start; } else t_end = t_start; switch (format->time_type) { case 'D': AZ(VSB_printf(CTX.vsb, "%d", (int)((t_end - t_start) * 1e6))); break; case 't': AN(format->time_fmt); t = t_start; localtime_r(&t, &tm); strftime(buf, sizeof buf, format->time_fmt, &tm); AZ(VSB_cat(CTX.vsb, buf)); break; case 'T': AZ(VSB_printf(CTX.vsb, "%d", (int)(t_end - t_start))); break; default: WRONG("Time format specifier"); } return (1); } static int __match_proto__(format_f) format_requestline(const struct format *format) { (void)format; AZ(vsb_fcat(CTX.vsb, &CTX.frag[F_m], "-")); AZ(VSB_putc(CTX.vsb, ' ')); if (CTX.frag[F_host].gen == CTX.gen) { if (strncmp(CTX.frag[F_host].b, "http://", 7)) AZ(VSB_cat(CTX.vsb, "http://")); AZ(vsb_fcat(CTX.vsb, &CTX.frag[F_host], NULL)); } else AZ(VSB_cat(CTX.vsb, "http://localhost")); AZ(vsb_fcat(CTX.vsb, &CTX.frag[F_U], "")); AZ(vsb_fcat(CTX.vsb, &CTX.frag[F_q], "")); AZ(VSB_putc(CTX.vsb, ' ')); AZ(vsb_fcat(CTX.vsb, &CTX.frag[F_H], "HTTP/1.0")); return (1); } static int __match_proto__(format_f) format_auth(const struct format *format) { char buf[128]; char *q; if (CTX.frag[F_auth].gen != CTX.gen || VB64_decode(buf, sizeof buf, CTX.frag[F_auth].b, CTX.frag[F_auth].e)) { if (format->string == NULL) return (-1); AZ(vsb_esc_cat(CTX.vsb, format->string, format->string + strlen(format->string))); return (0); } q = strchr(buf, ':'); if (q != NULL) *q = '\0'; AZ(vsb_esc_cat(CTX.vsb, buf, buf + strlen(buf))); return (1); } static int print(void) { const struct format *f; int i, r = 1; VSB_clear(CTX.vsb); VTAILQ_FOREACH(f, &CTX.format, list) { i = (f->func)(f); if (r > i) r = i; } AZ(VSB_putc(CTX.vsb, '\n')); AZ(VSB_finish(CTX.vsb)); if (r >= 0) { i = fwrite(VSB_data(CTX.vsb), 1, VSB_len(CTX.vsb), CTX.fo); if (i != VSB_len(CTX.vsb)) return (-5); } return (0); } static void addf_string(const char *str) { struct format *f; AN(str); ALLOC_OBJ(f, FORMAT_MAGIC); AN(f); f->func = &format_string; f->string = strdup(str); AN(f->string); VTAILQ_INSERT_TAIL(&CTX.format, f, list); } static void addf_strptr(const char *const *strptr) { struct format *f; AN(strptr); ALLOC_OBJ(f, FORMAT_MAGIC); AN(f); f->func = &format_strptr; f->strptr = strptr; VTAILQ_INSERT_TAIL(&CTX.format, f, list); } static void addf_fragment(struct fragment *frag, const char *str) { struct format *f; AN(frag); ALLOC_OBJ(f, FORMAT_MAGIC); AN(f); f->func = &format_fragment; f->frag = frag; if (str != NULL) { f->string = strdup(str); AN(f->string); } VTAILQ_INSERT_TAIL(&CTX.format, f, list); } static void addf_time(char type, const char *fmt, const char *str) { struct format *f; ALLOC_OBJ(f, FORMAT_MAGIC); AN(f); f->func = &format_time; f->time_type = type; if (fmt != NULL) { f->time_fmt = strdup(fmt); AN(f->time_fmt); } if (str != NULL) { f->string = strdup(str); AN(f->string); } VTAILQ_INSERT_TAIL(&CTX.format, f, list); } static void addf_requestline(void) { struct format *f; ALLOC_OBJ(f, FORMAT_MAGIC); AN(f); f->func = &format_requestline; VTAILQ_INSERT_TAIL(&CTX.format, f, list); } static void addf_vcl_log(const char *key, const char *str) { struct watch *w; struct format *f; AN(key); ALLOC_OBJ(w, WATCH_MAGIC); AN(w); w->key = strdup(key); AN(w->key); w->keylen = strlen(w->key); VTAILQ_INSERT_TAIL(&CTX.watch_vcl_log, w, list); ALLOC_OBJ(f, FORMAT_MAGIC); AN(f); f->func = &format_fragment; f->frag = &w->frag; if (str != NULL) { f->string = strdup(str); AN(f->string); } VTAILQ_INSERT_TAIL(&CTX.format, f, list); } static void addf_hdr(struct watch_head *head, const char *key, const char *str) { struct watch *w; struct format *f; AN(head); AN(key); ALLOC_OBJ(w, WATCH_MAGIC); AN(w); w->key = strdup(key); AN(w->key); w->keylen = strlen(w->key); VTAILQ_INSERT_TAIL(head, w, list); ALLOC_OBJ(f, FORMAT_MAGIC); AN(f); f->func = &format_fragment; f->frag = &w->frag; if (str != NULL) { f->string = strdup(str); AN(f->string); } VTAILQ_INSERT_TAIL(&CTX.format, f, list); } static void addf_auth(const char *str) { struct format *f; ALLOC_OBJ(f, FORMAT_MAGIC); AN(f); f->func = &format_auth; if (str != NULL) { f->string = strdup(str); AN(f->string); } VTAILQ_INSERT_TAIL(&CTX.format, f, list); } static void parse_format(const char *format) { const char *p, *q; struct vsb *vsb; char buf[256]; vsb = VSB_new_auto(); AN(vsb); for (p = format; *p != '\0'; p++) { /* Allow the most essential escape sequences in format */ if (*p == '\\') { p++; if (*p == 't') AZ(VSB_putc(vsb, '\t')); else if (*p == 'n') AZ(VSB_putc(vsb, '\n')); else if (*p != '\0') AZ(VSB_putc(vsb, *p)); continue; } if (*p != '%') { AZ(VSB_putc(vsb, *p)); continue; } if (VSB_len(vsb) > 0) { AZ(VSB_finish(vsb)); addf_string(VSB_data(vsb)); VSB_clear(vsb); } p++; switch (*p) { case 'b': /* Body bytes sent */ addf_fragment(&CTX.frag[F_b], "-"); break; case 'D': /* Float request time */ addf_time(*p, NULL, NULL); break; case 'h': /* Client host name / IP Address */ addf_fragment(&CTX.frag[F_h], "-"); break; case 'H': /* Protocol */ addf_fragment(&CTX.frag[F_H], "HTTP/1.0"); break; case 'I': /* Bytes recieved */ addf_fragment(&CTX.frag[F_I], "-"); break; case 'l': /* Client user ID (identd) always '-' */ AZ(VSB_putc(vsb, '-')); break; case 'm': /* Method */ addf_fragment(&CTX.frag[F_m], "-"); break; case 'O': /* Bytes sent */ addf_fragment(&CTX.frag[F_O], "-"); break; case 'q': /* Query string */ addf_fragment(&CTX.frag[F_q], ""); break; case 'r': /* Request line */ addf_requestline(); break; case 's': /* Status code */ addf_fragment(&CTX.frag[F_s], "-"); break; case 't': /* strftime */ addf_time(*p, TIME_FMT, NULL); break; case 'T': /* Int request time */ addf_time(*p, NULL, NULL); break; case 'u': /* Remote user from auth */ addf_auth("-"); break; case 'U': /* URL */ addf_fragment(&CTX.frag[F_U], "-"); break; case '{': p++; q = p; while (*q && *q != '}') q++; if (!*q) VUT_Error(1, "Unmatched bracket at: %s", p - 2); assert(q - p < sizeof buf - 1); strncpy(buf, p, q - p); buf[q - p] = '\0'; q++; switch (*q) { case 'i': strcat(buf, ":"); addf_hdr(&CTX.watch_reqhdr, buf, "-"); break; case 'o': strcat(buf, ":"); addf_hdr(&CTX.watch_resphdr, buf, "-"); break; case 't': addf_time(*q, buf, NULL); break; case 'x': if (!strcmp(buf, "Varnish:time_firstbyte")) { addf_fragment(&CTX.frag[F_ttfb], ""); break; } if (!strcmp(buf, "Varnish:hitmiss")) { addf_strptr(&CTX.hitmiss); break; } if (!strcmp(buf, "Varnish:handling")) { addf_strptr(&CTX.handling); break; } if (!strncmp(buf, "VCL_Log:", 8)) { addf_vcl_log(buf + 8, ""); break; } /* FALLTHROUGH */ default: VUT_Error(1, "Unknown format specifier at: %s", p - 2); } p = q; break; default: VUT_Error(1, "Unknown format specifier at: %s", p - 1); } } if (VSB_len(vsb) > 0) { /* Add any remaining static */ AZ(VSB_finish(vsb)); addf_string(VSB_data(vsb)); VSB_clear(vsb); } VSB_delete(vsb); } static int isprefix(const char *str, const char *prefix, const char *end, const char **next) { while (str < end && *str && *prefix && tolower((int)*str) == tolower((int)*prefix)) ++str, ++prefix; if (*str && *str != ' ') return (0); if (next) { while (str < end && *str && *str == ' ') ++str; *next = str; } return (1); } static void frag_fields(int force, const char *b, const char *e, ...) { va_list ap; const char *p, *q; int n, field; struct fragment *frag; AN(b); AN(e); va_start(ap, e); field = va_arg(ap, int); frag = va_arg(ap, struct fragment *); for (n = 1, q = b; q < e; n++) { assert(field > 0); AN(frag); p = q; /* Skip WS */ while (p < e && isspace(*p)) p++; q = p; /* Skip non-WS */ while (q < e && !isspace(*q)) q++; if (field == n) { if (frag->gen != CTX.gen || force) { /* We only grab the same matching field once */ frag->gen = CTX.gen; frag->b = p; frag->e = q; } field = va_arg(ap, int); if (field == 0) break; frag = va_arg(ap, struct fragment *); } } va_end(ap); } static void frag_line(int force, const char *b, const char *e, struct fragment *f) { if (f->gen == CTX.gen && !force) /* We only grab the same matching record once */ return; /* Skip leading space */ while (b < e && isspace(*b)) ++b; /* Skip trailing space */ while (e > b && isspace(*(e - 1))) --e; f->gen = CTX.gen; f->b = b; f->e = e; } static void process_hdr(const struct watch_head *head, const char *b, const char *e) { struct watch *w; VTAILQ_FOREACH(w, head, list) { if (strncasecmp(b, w->key, w->keylen)) continue; frag_line(1, b + w->keylen, e, &w->frag); } } static int __match_proto__(VSLQ_dispatch_f) dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[], void *priv) { struct VSL_transaction *t; unsigned tag; const char *b, *e, *p; struct watch *w; int i, skip; (void)vsl; (void)priv; 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 = "-"; 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); while (e > b && e[-1] == '\0') e--; switch (tag) { case SLT_HttpGarbage: skip = 1; break; case SLT_PipeAcct: frag_fields(0, b, e, 3, &CTX.frag[F_I], 4, &CTX.frag[F_O], 0, NULL); break; case SLT_ReqStart: frag_fields(0, b, e, 1, &CTX.frag[F_h], 0, NULL); break; case SLT_ReqMethod: frag_line(0, b, e, &CTX.frag[F_m]); break; case SLT_ReqURL: p = memchr(b, '?', e - b); if (p == NULL) p = e; frag_line(0, b, p, &CTX.frag[F_U]); frag_line(0, p, e, &CTX.frag[F_q]); break; case SLT_ReqProtocol: frag_line(0, b, e, &CTX.frag[F_H]); break; case SLT_RespStatus: frag_line(1, b, e, &CTX.frag[F_s]); break; case SLT_ReqAcct: frag_fields(0, b, e, 3, &CTX.frag[F_I], 5, &CTX.frag[F_b], 6, &CTX.frag[F_O], 0, NULL); break; case SLT_Timestamp: if (isprefix(b, "Start:", e, &p)) { frag_fields(0, p, e, 1, &CTX.frag[F_tstart], 0, NULL); } else if (isprefix(b, "Resp:", e, &p) || isprefix(b, "PipeSess:", e, &p)) { frag_fields(0, p, e, 1, &CTX.frag[F_tend], 0, NULL); } else if (isprefix(b, "Process:", e, &p) || isprefix(b, "Pipe:", e, &p)) { frag_fields(0, p, e, 2, &CTX.frag[F_ttfb], 0, NULL); } break; case SLT_ReqHeader: if (isprefix(b, "Host:", e, &p)) frag_line(0, p, e, &CTX.frag[F_host]); else if (isprefix(b, "Authorization:", e, &p) && isprefix(p, "basic", e, &p)) frag_line(0, p, e, &CTX.frag[F_auth]); break; case SLT_VCL_call: if (!strcasecmp(b, "recv")) { CTX.hitmiss = "-"; CTX.handling = "-"; } else if (!strcasecmp(b, "hit")) { CTX.hitmiss = "hit"; CTX.handling = "hit"; } else if (!strcasecmp(b, "miss")) { CTX.hitmiss = "miss"; CTX.handling = "miss"; } else if (!strcasecmp(b, "pass")) { CTX.hitmiss = "miss"; CTX.handling = "pass"; } else if (!strcasecmp(b, "synth")) { /* Arguably, synth isn't a hit or a miss, but miss is less wrong */ CTX.hitmiss = "miss"; CTX.handling = "synth"; } break; case SLT_VCL_return: if (!strcasecmp(b, "restart")) { skip = 1; } else if (!strcasecmp(b, "pipe")) { CTX.hitmiss = "miss"; CTX.handling = "pipe"; } break; default: break; } if (tag == SLT_VCL_Log) { VTAILQ_FOREACH(w, &CTX.watch_vcl_log, list) { CHECK_OBJ_NOTNULL(w, WATCH_MAGIC); if (strncmp(b, w->key, w->keylen)) continue; p = b + w->keylen; if (*p != ':') continue; p++; if (p > e) continue; frag_line(0, p, e, &w->frag); } } if (tag == SLT_ReqHeader) process_hdr(&CTX.watch_reqhdr, b, e); if (tag == SLT_RespHeader) process_hdr(&CTX.watch_resphdr, b, e); } if (skip) continue; i = print(); if (i) return (i); } return (0); } static int __match_proto__(VUT_cb_f) sighup(void) { return (1); } static char * read_format(const char *formatfile) { FILE *fmtfile; size_t len = 0; char *fmt = NULL; fmtfile = fopen(formatfile, "r"); if (fmtfile == NULL) VUT_Error(1, "Can't open format file (%s)", strerror(errno)); if (getline(&fmt, &len, fmtfile) == -1) { free(fmt); if (feof(fmtfile)) VUT_Error(1, "Empty format file"); else VUT_Error(1, "Can't read format from file (%s)", strerror(errno)); } fclose(fmtfile); return (fmt); } int main(int argc, char * const *argv) { signed char opt; char *format = NULL; memset(&CTX, 0, sizeof CTX); VTAILQ_INIT(&CTX.format); VTAILQ_INIT(&CTX.watch_vcl_log); VTAILQ_INIT(&CTX.watch_reqhdr); VTAILQ_INIT(&CTX.watch_resphdr); CTX.vsb = VSB_new_auto(); AN(CTX.vsb); VB64_init(); VUT_Init(progname); while ((opt = getopt(argc, argv, vopt_optstring)) != -1) { switch (opt) { case 'a': /* Append to file */ CTX.a_opt = 1; break; case 'F': /* Format string */ if (format != NULL) free(format); format = strdup(optarg); AN(format); break; case 'f': /* Format string from file */ if (format != NULL) free(format); format = read_format(optarg); AN(format); break; case 'h': /* Usage help */ usage(0); case 'w': /* Write to file */ REPLACE(CTX.w_arg, optarg); break; default: if (!VUT_Arg(opt, optarg)) usage(1); } } if (optind != argc) usage(1); if (VUT.D_opt && !CTX.w_arg) VUT_Error(1, "Missing -w option"); /* Check for valid grouping mode */ assert(VUT.g_arg < VSL_g__MAX); if (VUT.g_arg != VSL_g_vxid && VUT.g_arg != VSL_g_request) VUT_Error(1, "Invalid grouping mode: %s", VSLQ_grouping[VUT.g_arg]); /* Prepare output format */ if (format == NULL) format = strdup(FORMAT); parse_format(format); free(format); format = NULL; /* Setup output */ VUT.dispatch_f = &dispatch_f; VUT.dispatch_priv = NULL; VUT.sighup_f = sighup; if (CTX.w_arg) { openout(CTX.a_opt); AN(CTX.fo); if (VUT.D_opt) VUT.sighup_f = &rotateout; } else CTX.fo = stdout; VUT.idle_f = &flushout; VUT_Setup(); VUT_Main(); VUT_Fini(); exit(0); } varnish-4.1.1/bin/varnishncsa/Makefile.am0000644000201500234410000000146112652366721015243 00000000000000# AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include bin_PROGRAMS = varnishncsa varnishncsa_SOURCES = \ varnishncsa.c \ varnishncsa_options.h \ varnishncsa_options.c \ base64.h \ base64.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 varnishncsa_LDADD = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ ${RT_LIBS} ${LIBM} noinst_PROGRAMS = varnishncsa_opt2rst varnishncsa_opt2rst_SOURCES = \ varnishncsa_options.h \ varnishncsa_options.c \ $(top_srcdir)/lib/libvarnishtools/opt2rst.c varnish-4.1.1/bin/varnishncsa/Makefile.in0000644000201500234410000010730512652366726015265 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = varnishncsa$(EXEEXT) noinst_PROGRAMS = varnishncsa_opt2rst$(EXEEXT) subdir = bin/varnishncsa DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_varnishncsa_OBJECTS = varnishncsa.$(OBJEXT) \ varnishncsa_options.$(OBJEXT) base64.$(OBJEXT) vut.$(OBJEXT) \ vas.$(OBJEXT) flopen.$(OBJEXT) version.$(OBJEXT) vpf.$(OBJEXT) \ vtim.$(OBJEXT) vsb.$(OBJEXT) varnishncsa_OBJECTS = $(am_varnishncsa_OBJECTS) am__DEPENDENCIES_1 = varnishncsa_DEPENDENCIES = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am_varnishncsa_opt2rst_OBJECTS = varnishncsa_options.$(OBJEXT) \ opt2rst.$(OBJEXT) varnishncsa_opt2rst_OBJECTS = $(am_varnishncsa_opt2rst_OBJECTS) varnishncsa_opt2rst_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(varnishncsa_SOURCES) $(varnishncsa_opt2rst_SOURCES) DIST_SOURCES = $(varnishncsa_SOURCES) $(varnishncsa_opt2rst_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include varnishncsa_SOURCES = \ varnishncsa.c \ varnishncsa_options.h \ varnishncsa_options.c \ base64.h \ base64.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 varnishncsa_LDADD = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ ${RT_LIBS} ${LIBM} varnishncsa_opt2rst_SOURCES = \ varnishncsa_options.h \ varnishncsa_options.c \ $(top_srcdir)/lib/libvarnishtools/opt2rst.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/varnishncsa/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign bin/varnishncsa/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list varnishncsa$(EXEEXT): $(varnishncsa_OBJECTS) $(varnishncsa_DEPENDENCIES) $(EXTRA_varnishncsa_DEPENDENCIES) @rm -f varnishncsa$(EXEEXT) $(AM_V_CCLD)$(LINK) $(varnishncsa_OBJECTS) $(varnishncsa_LDADD) $(LIBS) varnishncsa_opt2rst$(EXEEXT): $(varnishncsa_opt2rst_OBJECTS) $(varnishncsa_opt2rst_DEPENDENCIES) $(EXTRA_varnishncsa_opt2rst_DEPENDENCIES) @rm -f varnishncsa_opt2rst$(EXEEXT) $(AM_V_CCLD)$(LINK) $(varnishncsa_opt2rst_OBJECTS) $(varnishncsa_opt2rst_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flopen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opt2rst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishncsa.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishncsa_options.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vas.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vpf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vtim.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vut.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< vut.o: $(top_srcdir)/lib/libvarnishtools/vut.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vut.o -MD -MP -MF $(DEPDIR)/vut.Tpo -c -o vut.o `test -f '$(top_srcdir)/lib/libvarnishtools/vut.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/vut.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vut.Tpo $(DEPDIR)/vut.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/vut.c' object='vut.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vut.o `test -f '$(top_srcdir)/lib/libvarnishtools/vut.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/vut.c vut.obj: $(top_srcdir)/lib/libvarnishtools/vut.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vut.obj -MD -MP -MF $(DEPDIR)/vut.Tpo -c -o vut.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/vut.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/vut.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/vut.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vut.Tpo $(DEPDIR)/vut.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/vut.c' object='vut.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vut.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/vut.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/vut.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/vut.c'; fi` vas.o: $(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vas.o -MD -MP -MF $(DEPDIR)/vas.Tpo -c -o vas.o `test -f '$(top_srcdir)/lib/libvarnish/vas.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vas.Tpo $(DEPDIR)/vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vas.c' object='vas.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vas.o `test -f '$(top_srcdir)/lib/libvarnish/vas.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vas.c vas.obj: $(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vas.obj -MD -MP -MF $(DEPDIR)/vas.Tpo -c -o vas.obj `if test -f '$(top_srcdir)/lib/libvarnish/vas.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vas.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vas.Tpo $(DEPDIR)/vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vas.c' object='vas.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vas.obj `if test -f '$(top_srcdir)/lib/libvarnish/vas.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vas.c'; fi` flopen.o: $(top_srcdir)/lib/libvarnish/flopen.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT flopen.o -MD -MP -MF $(DEPDIR)/flopen.Tpo -c -o flopen.o `test -f '$(top_srcdir)/lib/libvarnish/flopen.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/flopen.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/flopen.Tpo $(DEPDIR)/flopen.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/flopen.c' object='flopen.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o flopen.o `test -f '$(top_srcdir)/lib/libvarnish/flopen.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/flopen.c flopen.obj: $(top_srcdir)/lib/libvarnish/flopen.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT flopen.obj -MD -MP -MF $(DEPDIR)/flopen.Tpo -c -o flopen.obj `if test -f '$(top_srcdir)/lib/libvarnish/flopen.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/flopen.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/flopen.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/flopen.Tpo $(DEPDIR)/flopen.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/flopen.c' object='flopen.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o flopen.obj `if test -f '$(top_srcdir)/lib/libvarnish/flopen.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/flopen.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/flopen.c'; fi` version.o: $(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT version.o -MD -MP -MF $(DEPDIR)/version.Tpo -c -o version.o `test -f '$(top_srcdir)/lib/libvarnish/version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/version.Tpo $(DEPDIR)/version.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/version.c' object='version.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o version.o `test -f '$(top_srcdir)/lib/libvarnish/version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/version.c version.obj: $(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT version.obj -MD -MP -MF $(DEPDIR)/version.Tpo -c -o version.obj `if test -f '$(top_srcdir)/lib/libvarnish/version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/version.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/version.Tpo $(DEPDIR)/version.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/version.c' object='version.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o version.obj `if test -f '$(top_srcdir)/lib/libvarnish/version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/version.c'; fi` vpf.o: $(top_srcdir)/lib/libvarnish/vpf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vpf.o -MD -MP -MF $(DEPDIR)/vpf.Tpo -c -o vpf.o `test -f '$(top_srcdir)/lib/libvarnish/vpf.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vpf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vpf.Tpo $(DEPDIR)/vpf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vpf.c' object='vpf.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vpf.o `test -f '$(top_srcdir)/lib/libvarnish/vpf.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vpf.c vpf.obj: $(top_srcdir)/lib/libvarnish/vpf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vpf.obj -MD -MP -MF $(DEPDIR)/vpf.Tpo -c -o vpf.obj `if test -f '$(top_srcdir)/lib/libvarnish/vpf.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vpf.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vpf.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vpf.Tpo $(DEPDIR)/vpf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vpf.c' object='vpf.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vpf.obj `if test -f '$(top_srcdir)/lib/libvarnish/vpf.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vpf.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vpf.c'; fi` vtim.o: $(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vtim.o -MD -MP -MF $(DEPDIR)/vtim.Tpo -c -o vtim.o `test -f '$(top_srcdir)/lib/libvarnish/vtim.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vtim.Tpo $(DEPDIR)/vtim.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vtim.c' object='vtim.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vtim.o `test -f '$(top_srcdir)/lib/libvarnish/vtim.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vtim.c vtim.obj: $(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vtim.obj -MD -MP -MF $(DEPDIR)/vtim.Tpo -c -o vtim.obj `if test -f '$(top_srcdir)/lib/libvarnish/vtim.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vtim.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vtim.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vtim.Tpo $(DEPDIR)/vtim.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vtim.c' object='vtim.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vtim.obj `if test -f '$(top_srcdir)/lib/libvarnish/vtim.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vtim.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vtim.c'; fi` vsb.o: $(top_srcdir)/lib/libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vsb.o -MD -MP -MF $(DEPDIR)/vsb.Tpo -c -o vsb.o `test -f '$(top_srcdir)/lib/libvarnish/vsb.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vsb.Tpo $(DEPDIR)/vsb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vsb.c' object='vsb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vsb.o `test -f '$(top_srcdir)/lib/libvarnish/vsb.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vsb.c vsb.obj: $(top_srcdir)/lib/libvarnish/vsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vsb.obj -MD -MP -MF $(DEPDIR)/vsb.Tpo -c -o vsb.obj `if test -f '$(top_srcdir)/lib/libvarnish/vsb.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vsb.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vsb.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vsb.Tpo $(DEPDIR)/vsb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vsb.c' object='vsb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vsb.obj `if test -f '$(top_srcdir)/lib/libvarnish/vsb.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vsb.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vsb.c'; fi` opt2rst.o: $(top_srcdir)/lib/libvarnishtools/opt2rst.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT opt2rst.o -MD -MP -MF $(DEPDIR)/opt2rst.Tpo -c -o opt2rst.o `test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/opt2rst.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/opt2rst.Tpo $(DEPDIR)/opt2rst.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/opt2rst.c' object='opt2rst.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o opt2rst.o `test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/opt2rst.c opt2rst.obj: $(top_srcdir)/lib/libvarnishtools/opt2rst.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT opt2rst.obj -MD -MP -MF $(DEPDIR)/opt2rst.Tpo -c -o opt2rst.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/opt2rst.Tpo $(DEPDIR)/opt2rst.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/opt2rst.c' object='opt2rst.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o opt2rst.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/bin/varnishncsa/varnishncsa_options.c0000644000201500234410000000305412652366721017445 00000000000000/*- * Copyright (c) 2013-2015 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 varnishlog */ #include #define VOPT_DEFINITION #define VOPT_INC "varnishncsa_options.h" #include "vapi/voptget.h" varnish-4.1.1/bin/varnishncsa/varnishncsa_options.h0000644000201500234410000000533312652366721017454 00000000000000/*- * Copyright (c) 2013 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. */ #include "vapi/vapi_options.h" #include "vut_options.h" #define NCSA_OPT_a \ VOPT("a", "[-a]", "Append to file", \ "When writing output to a file, append to it rather than" \ " overwrite it." \ ) #define NCSA_OPT_F \ VOPT("F:", "[-F format]", "Set output format", \ "Set the output log format string." \ ) #define NCSA_OPT_f \ VOPT("f:", "[-f formatfile]", "Read output format from file", \ "Read output format from a file. Will read a single line" \ " from the specified file, and use that line as the" \ " format." \ ) #define NCSA_OPT_g \ VOPT("g:", "[-g ]", "Grouping mode (default: vxid)", \ "The grouping of the log records. The default is to group" \ " by vxid." \ ) #define NCSA_OPT_w \ VOPT("w:", "[-w filename]", "Output filename", \ "Redirect output to file. The file will be overwritten" \ " unless the -a option was specified. If the application" \ " receives a SIGHUP in daemon mode the file will be" \ " reopened allowing the old one to be rotated away. This" \ " option is required when running in daemon mode." \ ) NCSA_OPT_a VSL_OPT_C VUT_OPT_d VUT_OPT_D NCSA_OPT_F NCSA_OPT_f NCSA_OPT_g VUT_OPT_h VUT_OPT_n VUT_OPT_N VUT_OPT_P VUT_OPT_q VUT_OPT_r VUT_OPT_t VUT_OPT_V NCSA_OPT_w varnish-4.1.1/bin/varnishncsa/base64.h0000644000201500234410000000301612652366721014442 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ void VB64_init(void); int VB64_decode(char *d, unsigned dlen, const char *s, const char *e); varnish-4.1.1/bin/varnishncsa/base64.c0000644000201500234410000000306412652366721014440 00000000000000/* * Written by Poul-Henning Kamp * * This file is in the public domain. */ #include "config.h" #include #include #include "base64.h" static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static char i64[256]; void VB64_init(void) { int i; const char *p; for (i = 0; i < 256; i++) i64[i] = -1; for (p = b64, i = 0; *p; p++, i++) i64[(int)*p] = (char)i; i64['='] = 0; } int VB64_decode(char *d, unsigned dlen, const char *s, const char *e) { unsigned u, v, l; int i; if (e == NULL) e = s + strlen(s); u = 0; l = 0; while (s < e) { for (v = 0; s < e && v < 4; v++) { i = i64[(int)*s++]; if (i < 0) return (-1); u <<= 6; u |= i; } for (v = 0; v < 3; v++) { if (l >= dlen - 1) return (-1); *d = (u >> 16) & 0xff; u <<= 8; l++; d++; } } *d = '\0'; return (0); } #ifdef TEST_DRIVER #include // for test-prog const char *test1 = "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz" "IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg" "dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu" "dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo" "ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4="; int main(int argc, char **argv) { int i; char buf[BUFSIZ]; unsigned l; (void)argc; (void)argv; VB64_init(); l = sizeof buf; VB64_decode(buf, l, test1, NULL); printf("%s\n", buf); return (0); } #endif varnish-4.1.1/bin/varnishhist/0000755000201500234410000000000012652366757013321 500000000000000varnish-4.1.1/bin/varnishhist/varnishhist_options.c0000644000201500234410000000305012652366721017507 00000000000000/*- * 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 varnishhist */ #include #define VOPT_DEFINITION #define VOPT_INC "varnishhist_options.h" #include "vapi/voptget.h" varnish-4.1.1/bin/varnishhist/Makefile.am0000644000201500234410000000141412652366721015264 00000000000000# AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include bin_PROGRAMS = varnishhist varnishhist_SOURCES = varnishhist.c \ varnishhist_options.h \ varnishhist_options.c \ $(top_srcdir)/lib/libvarnish/vas.c \ $(top_srcdir)/lib/libvarnish/version.c \ $(top_srcdir)/lib/libvarnish/vpf.c \ $(top_srcdir)/lib/libvarnish/vtim.c \ $(top_srcdir)/lib/libvarnish/flopen.c \ $(top_srcdir)/lib/libvarnishtools/vut.c varnishhist_LDADD = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ -lm \ @CURSES_LIB@ ${RT_LIBS} ${PTHREAD_LIBS} noinst_PROGRAMS = varnishhist_opt2rst varnishhist_opt2rst_SOURCES = \ varnishhist_options.h \ varnishhist_options.c \ $(top_srcdir)/lib/libvarnishtools/opt2rst.c varnish-4.1.1/bin/varnishhist/varnishhist_options.h0000644000201500234410000000473112652366721017523 00000000000000/*- * Copyright (c) 2014-2015 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 varnishhist */ #include "vapi/vapi_options.h" #include "vut_options.h" #define HIS_OPT_g \ VOPT("g:", "[-g ]", "Grouping mode (default: vxid)", \ "The grouping of the log records. The default is to group" \ " by vxid." \ ) #define HIS_OPT_p \ VOPT("p:", "[-p period]", "Refresh period", \ "Specified the number of seconds between screen refreshes." \ " Default is 1 second, and can be changed at runtime by" \ " pressing the [1-9] keys." \ ) #define HIS_OPT_P \ VOPT("P:", "[-P ]", \ "Profile definition", \ "Either specify \"size\" or \"responsetime\" profile or" \ " create a new one. Define the tag we'll look for, and the" \ " field number of the value we are interested in. min and" \ " max are the boundaries of the graph (these are power of" \ " tens)." \ ) VSL_OPT_C VUT_OPT_d HIS_OPT_g VUT_OPT_h VSL_OPT_L VUT_OPT_n VUT_OPT_N HIS_OPT_p HIS_OPT_P VUT_OPT_q VUT_OPT_r VUT_OPT_t VSL_OPT_T VUT_OPT_V varnish-4.1.1/bin/varnishhist/Makefile.in0000644000201500234410000010317712652366726015313 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = varnishhist$(EXEEXT) noinst_PROGRAMS = varnishhist_opt2rst$(EXEEXT) subdir = bin/varnishhist DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_varnishhist_OBJECTS = varnishhist.$(OBJEXT) \ varnishhist_options.$(OBJEXT) vas.$(OBJEXT) version.$(OBJEXT) \ vpf.$(OBJEXT) vtim.$(OBJEXT) flopen.$(OBJEXT) vut.$(OBJEXT) varnishhist_OBJECTS = $(am_varnishhist_OBJECTS) am__DEPENDENCIES_1 = varnishhist_DEPENDENCIES = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am_varnishhist_opt2rst_OBJECTS = varnishhist_options.$(OBJEXT) \ opt2rst.$(OBJEXT) varnishhist_opt2rst_OBJECTS = $(am_varnishhist_opt2rst_OBJECTS) varnishhist_opt2rst_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(varnishhist_SOURCES) $(varnishhist_opt2rst_SOURCES) DIST_SOURCES = $(varnishhist_SOURCES) $(varnishhist_opt2rst_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include varnishhist_SOURCES = varnishhist.c \ varnishhist_options.h \ varnishhist_options.c \ $(top_srcdir)/lib/libvarnish/vas.c \ $(top_srcdir)/lib/libvarnish/version.c \ $(top_srcdir)/lib/libvarnish/vpf.c \ $(top_srcdir)/lib/libvarnish/vtim.c \ $(top_srcdir)/lib/libvarnish/flopen.c \ $(top_srcdir)/lib/libvarnishtools/vut.c varnishhist_LDADD = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ -lm \ @CURSES_LIB@ ${RT_LIBS} ${PTHREAD_LIBS} varnishhist_opt2rst_SOURCES = \ varnishhist_options.h \ varnishhist_options.c \ $(top_srcdir)/lib/libvarnishtools/opt2rst.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/varnishhist/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign bin/varnishhist/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list varnishhist$(EXEEXT): $(varnishhist_OBJECTS) $(varnishhist_DEPENDENCIES) $(EXTRA_varnishhist_DEPENDENCIES) @rm -f varnishhist$(EXEEXT) $(AM_V_CCLD)$(LINK) $(varnishhist_OBJECTS) $(varnishhist_LDADD) $(LIBS) varnishhist_opt2rst$(EXEEXT): $(varnishhist_opt2rst_OBJECTS) $(varnishhist_opt2rst_DEPENDENCIES) $(EXTRA_varnishhist_opt2rst_DEPENDENCIES) @rm -f varnishhist_opt2rst$(EXEEXT) $(AM_V_CCLD)$(LINK) $(varnishhist_opt2rst_OBJECTS) $(varnishhist_opt2rst_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flopen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opt2rst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishhist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishhist_options.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vas.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vpf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vtim.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vut.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< vas.o: $(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vas.o -MD -MP -MF $(DEPDIR)/vas.Tpo -c -o vas.o `test -f '$(top_srcdir)/lib/libvarnish/vas.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vas.Tpo $(DEPDIR)/vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vas.c' object='vas.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vas.o `test -f '$(top_srcdir)/lib/libvarnish/vas.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vas.c vas.obj: $(top_srcdir)/lib/libvarnish/vas.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vas.obj -MD -MP -MF $(DEPDIR)/vas.Tpo -c -o vas.obj `if test -f '$(top_srcdir)/lib/libvarnish/vas.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vas.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vas.Tpo $(DEPDIR)/vas.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vas.c' object='vas.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vas.obj `if test -f '$(top_srcdir)/lib/libvarnish/vas.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vas.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vas.c'; fi` version.o: $(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT version.o -MD -MP -MF $(DEPDIR)/version.Tpo -c -o version.o `test -f '$(top_srcdir)/lib/libvarnish/version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/version.Tpo $(DEPDIR)/version.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/version.c' object='version.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o version.o `test -f '$(top_srcdir)/lib/libvarnish/version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/version.c version.obj: $(top_srcdir)/lib/libvarnish/version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT version.obj -MD -MP -MF $(DEPDIR)/version.Tpo -c -o version.obj `if test -f '$(top_srcdir)/lib/libvarnish/version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/version.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/version.Tpo $(DEPDIR)/version.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/version.c' object='version.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o version.obj `if test -f '$(top_srcdir)/lib/libvarnish/version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/version.c'; fi` vpf.o: $(top_srcdir)/lib/libvarnish/vpf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vpf.o -MD -MP -MF $(DEPDIR)/vpf.Tpo -c -o vpf.o `test -f '$(top_srcdir)/lib/libvarnish/vpf.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vpf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vpf.Tpo $(DEPDIR)/vpf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vpf.c' object='vpf.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vpf.o `test -f '$(top_srcdir)/lib/libvarnish/vpf.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vpf.c vpf.obj: $(top_srcdir)/lib/libvarnish/vpf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vpf.obj -MD -MP -MF $(DEPDIR)/vpf.Tpo -c -o vpf.obj `if test -f '$(top_srcdir)/lib/libvarnish/vpf.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vpf.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vpf.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vpf.Tpo $(DEPDIR)/vpf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vpf.c' object='vpf.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vpf.obj `if test -f '$(top_srcdir)/lib/libvarnish/vpf.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vpf.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vpf.c'; fi` vtim.o: $(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vtim.o -MD -MP -MF $(DEPDIR)/vtim.Tpo -c -o vtim.o `test -f '$(top_srcdir)/lib/libvarnish/vtim.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vtim.Tpo $(DEPDIR)/vtim.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vtim.c' object='vtim.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vtim.o `test -f '$(top_srcdir)/lib/libvarnish/vtim.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/vtim.c vtim.obj: $(top_srcdir)/lib/libvarnish/vtim.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vtim.obj -MD -MP -MF $(DEPDIR)/vtim.Tpo -c -o vtim.obj `if test -f '$(top_srcdir)/lib/libvarnish/vtim.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vtim.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vtim.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vtim.Tpo $(DEPDIR)/vtim.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/vtim.c' object='vtim.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vtim.obj `if test -f '$(top_srcdir)/lib/libvarnish/vtim.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/vtim.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/vtim.c'; fi` flopen.o: $(top_srcdir)/lib/libvarnish/flopen.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT flopen.o -MD -MP -MF $(DEPDIR)/flopen.Tpo -c -o flopen.o `test -f '$(top_srcdir)/lib/libvarnish/flopen.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/flopen.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/flopen.Tpo $(DEPDIR)/flopen.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/flopen.c' object='flopen.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o flopen.o `test -f '$(top_srcdir)/lib/libvarnish/flopen.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnish/flopen.c flopen.obj: $(top_srcdir)/lib/libvarnish/flopen.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT flopen.obj -MD -MP -MF $(DEPDIR)/flopen.Tpo -c -o flopen.obj `if test -f '$(top_srcdir)/lib/libvarnish/flopen.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/flopen.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/flopen.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/flopen.Tpo $(DEPDIR)/flopen.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnish/flopen.c' object='flopen.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o flopen.obj `if test -f '$(top_srcdir)/lib/libvarnish/flopen.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnish/flopen.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnish/flopen.c'; fi` vut.o: $(top_srcdir)/lib/libvarnishtools/vut.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vut.o -MD -MP -MF $(DEPDIR)/vut.Tpo -c -o vut.o `test -f '$(top_srcdir)/lib/libvarnishtools/vut.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/vut.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vut.Tpo $(DEPDIR)/vut.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/vut.c' object='vut.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vut.o `test -f '$(top_srcdir)/lib/libvarnishtools/vut.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/vut.c vut.obj: $(top_srcdir)/lib/libvarnishtools/vut.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vut.obj -MD -MP -MF $(DEPDIR)/vut.Tpo -c -o vut.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/vut.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/vut.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/vut.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vut.Tpo $(DEPDIR)/vut.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/vut.c' object='vut.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vut.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/vut.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/vut.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/vut.c'; fi` opt2rst.o: $(top_srcdir)/lib/libvarnishtools/opt2rst.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT opt2rst.o -MD -MP -MF $(DEPDIR)/opt2rst.Tpo -c -o opt2rst.o `test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/opt2rst.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/opt2rst.Tpo $(DEPDIR)/opt2rst.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/opt2rst.c' object='opt2rst.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o opt2rst.o `test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libvarnishtools/opt2rst.c opt2rst.obj: $(top_srcdir)/lib/libvarnishtools/opt2rst.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT opt2rst.obj -MD -MP -MF $(DEPDIR)/opt2rst.Tpo -c -o opt2rst.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/opt2rst.Tpo $(DEPDIR)/opt2rst.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/lib/libvarnishtools/opt2rst.c' object='opt2rst.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o opt2rst.obj `if test -f '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/libvarnishtools/opt2rst.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/bin/varnishhist/varnishhist.c0000644000201500234410000002364012652366721015743 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * 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 * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Log tailer for Varnish */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include "vdef.h" #include "vcurses.h" #include "vapi/vsl.h" #include "vapi/vsm.h" #include "vapi/voptget.h" #include "vas.h" #include "vcs.h" #include "vut.h" #define HIST_N 2000 /* how far back we remember */ #define HIST_RES 100 /* bucket resolution */ static const char progname[] = "varnishhist"; static int hist_low; static int hist_high; static int hist_range; static int hist_buckets; static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; static int end_of_file = 0; static int delay = 1; static unsigned rr_hist[HIST_N]; static unsigned nhist; static unsigned next_hist; static unsigned *bucket_miss; static unsigned *bucket_hit; static char *format; static int match_tag; static double log_ten; static int scales[] = { 1, 2, 3, 4, 5, 10, 15, 20, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000, INT_MAX }; struct profile { const char *name; enum VSL_tag_e tag; const char *prefix; int field; int hist_low; int hist_high; } profiles[] = { { .name = "responsetime", .tag = SLT_Timestamp, .prefix = "Process:", .field = 3, .hist_low = -6, .hist_high = 3 }, { .name = "size", .tag = SLT_ReqAcct, .prefix = NULL, .field = 5, .hist_low = 1, .hist_high = 8 }, { .name = 0, } }; static struct profile *active_profile; static void update(void) { unsigned w = COLS / hist_range; unsigned n = w * hist_range; unsigned bm[n], bh[n]; unsigned max; unsigned i, j, scale; int k, l; erase(); /* Draw horizontal axis */ w = COLS / hist_range; n = w * hist_range; for (i = 0; i < n; ++i) (void)mvaddch(LINES - 2, i, '-'); for (k = 0, l = hist_low; k < hist_range; ++k, ++l) { (void)mvaddch(LINES - 2, w * k, '+'); mvprintw(LINES - 1, w * k, "|1e%d", l); } if (end_of_file) mvprintw(0, 0, "%*s", COLS - 1, "EOF"); else mvprintw(0, 0, "%*s", COLS - 1, VUT.name); /* count our flock */ for (i = 0; i < n; ++i) bm[i] = bh[i] = 0; for (k = 0, max = 1; k < hist_buckets; ++k) { l = k * n / hist_buckets; bm[l] += bucket_miss[k]; bh[l] += bucket_hit[k]; if (bm[l] + bh[l] > max) max = bm[l] + bh[l]; } /* scale */ assert(LINES - 3 >= 0); for (i = 0; max / scales[i] > (unsigned)(LINES - 3); ++i) /* nothing */ ; scale = scales[i]; mvprintw(0, 0, "1:%d, n = %d", scale, nhist); /* show them */ for (i = 0; i < n; ++i) { for (j = 0; j < bm[i] / scale; ++j) (void)mvaddch(LINES - 3 - j, i, '#'); for (; j < (bm[i] + bh[i]) / scale; ++j) (void)mvaddch(LINES - 3 - j, i, '|'); } refresh(); } static int /*__match_proto__ (VSLQ_dispatch_f)*/ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[], void *priv) { int i, tag, skip, match, hit; unsigned u; double value; struct VSL_transaction *tr; (void)vsl; (void)priv; for (tr = pt[0]; tr != NULL; tr = *++pt) { if (tr->type != VSL_t_req) /* Only look at client requests */ continue; if (tr->reason == VSL_r_esi) /* Skip ESI requests */ continue; hit = 0; skip = 0; match = 0; while (skip == 0 && 1 == VSL_Next(tr->c)) { /* get the value we want, and register if it's a hit*/ tag = VSL_TAG(tr->c->rec.ptr); switch (tag) { case SLT_Hit: hit = 1; break; case SLT_VCL_return: if (!strcasecmp(VSL_CDATA(tr->c->rec.ptr), "restart")) skip = 1; break; default: if (tag != match_tag) break; if (active_profile->prefix && strncmp(VSL_CDATA(tr->c->rec.ptr), active_profile->prefix, strlen(active_profile->prefix)) != 0) break; i = sscanf(VSL_CDATA(tr->c->rec.ptr), format, &value); if (i != 1) break; match = 1; break; } } if (skip || !match) continue; /* select bucket */ i = HIST_RES * (log(value) / log_ten); if (i < hist_low * HIST_RES) i = hist_low * HIST_RES; if (i >= hist_high * HIST_RES) i = hist_high * HIST_RES - 1; i -= hist_low * HIST_RES; assert(i >= 0); assert(i < hist_buckets); pthread_mutex_lock(&mtx); /* phase out old data */ if (nhist == HIST_N) { u = rr_hist[next_hist]; if (u >= hist_buckets) { u -= hist_buckets; assert(u < hist_buckets); assert(bucket_hit[u] > 0); bucket_hit[u]--; } else { assert(bucket_miss[u] > 0); bucket_miss[u]--; } } else { ++nhist; } /* phase in new data */ if (hit) { bucket_hit[i]++; rr_hist[next_hist] = i + hist_buckets; } else { bucket_miss[i]++; rr_hist[next_hist] = i; } if (++next_hist == HIST_N) { next_hist = 0; } pthread_mutex_unlock(&mtx); } return (0); } static int __match_proto__(VUT_cb_f) sighup(void) { return (1); } static void * do_curses(void *arg) { int ch; (void)arg; initscr(); raw(); noecho(); nonl(); intrflush(stdscr, FALSE); curs_set(0); erase(); for (;;) { pthread_mutex_lock(&mtx); update(); pthread_mutex_unlock(&mtx); timeout(delay * 1000); switch ((ch = getch())) { case ERR: break; #ifdef KEY_RESIZE case KEY_RESIZE: erase(); break; #endif case '\014': /* Ctrl-L */ case '\024': /* Ctrl-T */ redrawwin(stdscr); refresh(); break; case '\032': /* Ctrl-Z */ endwin(); raise(SIGTSTP); break; case '\003': /* Ctrl-C */ case '\021': /* Ctrl-Q */ case 'Q': case 'q': raise(SIGINT); endwin(); pthread_exit(NULL); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': delay = 1 << (ch - '0'); break; default: beep(); break; } } pthread_exit(NULL); } /*--------------------------------------------------------------------*/ static void usage(int status) { 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 main(int argc, char **argv) { int i; char *colon; const char *profile = "responsetime"; pthread_t thr; int fnum = -1; struct profile cli_p = {0}; cli_p.name = 0; VUT_Init(progname); if (0) (void)usage; /* only client requests */ assert(VUT_Arg('c', NULL)); while ((i = getopt(argc, argv, vopt_optstring)) != -1) { switch (i) { case 'P': colon = strchr(optarg, ':'); /* no colon, take the profile as a name*/ if (colon == NULL) { profile = optarg; break; } /* else it's a definition, we hope */ if (sscanf(colon+1, "%d:%d:%d", &cli_p.field, &cli_p.hist_low, &cli_p.hist_high) != 3) { fprintf(stderr, "-P: '%s' is not a valid" " profile name or definition\n", optarg); exit(1); } match_tag = VSL_Name2Tag(optarg, colon - optarg); if (match_tag < 0) { fprintf(stderr, "-P: '%s' is not a valid tag name\n", optarg); exit(1); } cli_p.name = "custom"; cli_p.tag = match_tag; profile = NULL; active_profile = &cli_p; break; default: if (!VUT_Arg(i, optarg)) usage(1); } } /* Check for valid grouping mode */ assert(VUT.g_arg < VSL_g__MAX); if (VUT.g_arg != VSL_g_vxid && VUT.g_arg != VSL_g_request) VUT_Error(1, "Invalid grouping mode: %s" " (only vxid and request are supported)", VSLQ_grouping[VUT.g_arg]); if (profile) { for (active_profile = profiles; active_profile->name; active_profile++) { if (strcmp(active_profile->name, profile) == 0) { break; } } } if (! active_profile->name) { fprintf(stderr, "-P: No such profile '%s'\n", profile); exit(1); } match_tag = active_profile->tag; fnum = active_profile->field; hist_low = active_profile->hist_low; hist_high = active_profile->hist_high; hist_range = hist_high - hist_low; hist_buckets = hist_range * HIST_RES; bucket_hit = calloc(sizeof *bucket_hit, hist_buckets); bucket_miss = calloc(sizeof *bucket_miss, hist_buckets); format = malloc(4 * fnum); for (i = 0; i < fnum-1; i++) { strcpy(format + 4*i, "%*s "); } strcpy(format + 4*(fnum-1), "%lf"); log_ten = log(10.0); VUT_Setup(); if (pthread_create(&thr, NULL, do_curses, NULL) != 0) { fprintf(stderr, "pthread_create(): %s\n", strerror(errno)); exit(1); } VUT.dispatch_f = &accumulate; VUT.dispatch_priv = NULL; VUT.sighup_f = sighup; VUT_Main(); end_of_file = 1; AZ(pthread_join(thr, NULL)); VUT_Fini(); exit(0); } varnish-4.1.1/bin/varnishtest/0000755000201500234410000000000012652366757013331 500000000000000varnish-4.1.1/bin/varnishtest/vtc_log.c0000644000201500234410000001562512652366721015052 00000000000000/*- * Copyright (c) 2008-2011 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. */ #include "config.h" #include #include #include #include #include "vtc.h" #include "vtim.h" static pthread_mutex_t vtclog_mtx; static char *vtclog_buf; static unsigned vtclog_left; struct vtclog { unsigned magic; #define VTCLOG_MAGIC 0x82731202 const char *id; struct vsb *vsb; pthread_mutex_t mtx; int act; }; static pthread_key_t log_key; static double t0; /**********************************************************************/ void vtc_loginit(char *buf, unsigned buflen) { t0 = VTIM_mono(); vtclog_buf = buf; vtclog_left = buflen; AZ(pthread_mutex_init(&vtclog_mtx, NULL)); AZ(pthread_key_create(&log_key, NULL)); } /**********************************************************************/ struct vtclog * vtc_logopen(const char *id) { struct vtclog *vl; ALLOC_OBJ(vl, VTCLOG_MAGIC); AN(vl); vl->id = id; vl->vsb = VSB_new_auto(); AZ(pthread_mutex_init(&vl->mtx, NULL)); AZ(pthread_setspecific(log_key, vl)); return (vl); } void vtc_logclose(struct vtclog *vl) { CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC); if (pthread_getspecific(log_key) == vl) AZ(pthread_setspecific(log_key, NULL)); VSB_delete(vl->vsb); AZ(pthread_mutex_destroy(&vl->mtx)); FREE_OBJ(vl); } static const char * const lead[] = { "----", "* ", "** ", "*** ", "****" }; #define NLEAD (sizeof(lead)/sizeof(lead[0])) static void vtc_log_emit(const struct vtclog *vl, int lvl) { int l; if (lvl < 0) lvl = 0; l = VSB_len(vl->vsb); AZ(pthread_mutex_lock(&vtclog_mtx)); assert(vtclog_left > l); memcpy(vtclog_buf,VSB_data(vl->vsb), l); vtclog_buf += l; *vtclog_buf = '\0'; vtclog_left -= l; AZ(pthread_mutex_unlock(&vtclog_mtx)); } //lint -e{818} void vtc_log(struct vtclog *vl, int lvl, const char *fmt, ...) { double tx; CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC); tx = VTIM_mono() - t0; AZ(pthread_mutex_lock(&vl->mtx)); vl->act = 1; assert(lvl < (int)NLEAD); VSB_clear(vl->vsb); VSB_printf(vl->vsb, "%s %-4s %4.1f ", lead[lvl < 0 ? 1: lvl], vl->id, tx); va_list ap; va_start(ap, fmt); (void)VSB_vprintf(vl->vsb, fmt, ap); va_end(ap); VSB_putc(vl->vsb, '\n'); AZ(VSB_finish(vl->vsb)); vtc_log_emit(vl, lvl); VSB_clear(vl->vsb); vl->act = 0; AZ(pthread_mutex_unlock(&vl->mtx)); if (lvl > 0) return; if (lvl == 0) vtc_error = 1; if (pthread_self() != vtc_thread) pthread_exit(NULL); } /********************************************************************** * Dump a string */ //lint -e{818} void vtc_dump(struct vtclog *vl, int lvl, const char *pfx, const char *str, int len) { int nl = 1, olen; unsigned l; double tx; CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC); tx = VTIM_mono() - t0; assert(lvl >= 0); assert(lvl < NLEAD); AZ(pthread_mutex_lock(&vl->mtx)); vl->act = 1; VSB_clear(vl->vsb); if (pfx == NULL) pfx = ""; if (str == NULL) VSB_printf(vl->vsb, "%s %-4s %4.1f %s(null)\n", lead[lvl], vl->id, tx, pfx); else { olen = len; if (len < 0) len = strlen(str); for (l = 0; l < len; l++, str++) { if (l > 1024 && olen != -2) { VSB_printf(vl->vsb, "..."); break; } if (nl) { VSB_printf(vl->vsb, "%s %-4s %4.1f %s| ", lead[lvl], vl->id, tx, pfx); nl = 0; } if (*str == '\r') VSB_printf(vl->vsb, "\\r"); else if (*str == '\t') VSB_printf(vl->vsb, "\\t"); else if (*str == '\n') { VSB_printf(vl->vsb, "\\n\n"); nl = 1; } else if (*str < 0x20 || *str > 0x7e) VSB_printf(vl->vsb, "\\x%02x", (*str) & 0xff); else VSB_printf(vl->vsb, "%c", *str); } } if (!nl) VSB_printf(vl->vsb, "\n"); AZ(VSB_finish(vl->vsb)); vtc_log_emit(vl, lvl); VSB_clear(vl->vsb); vl->act = 0; AZ(pthread_mutex_unlock(&vl->mtx)); if (lvl == 0) { vtc_error = 1; if (pthread_self() != vtc_thread) pthread_exit(NULL); } } /********************************************************************** * Hexdump */ //lint -e{818} void vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx, const unsigned char *str, int len) { int nl = 1; unsigned l; double tx; CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC); tx = VTIM_mono() - t0; assert(len >= 0); assert(lvl >= 0); assert(lvl < NLEAD); AZ(pthread_mutex_lock(&vl->mtx)); vl->act = 1; VSB_clear(vl->vsb); if (pfx == NULL) pfx = ""; if (str == NULL) VSB_printf(vl->vsb, "%s %-4s %4.1f %s| (null)", lead[lvl], vl->id, tx, pfx); else { for (l = 0; l < len; l++, str++) { if (l > 512) { VSB_printf(vl->vsb, "..."); break; } if (nl) { VSB_printf(vl->vsb, "%s %-4s %4.1f %s| ", lead[lvl], vl->id, tx, pfx); nl = 0; } VSB_printf(vl->vsb, " %02x", *str); if ((l & 0xf) == 0xf) { VSB_printf(vl->vsb, "\n"); nl = 1; } } } if (!nl) VSB_printf(vl->vsb, "\n"); AZ(VSB_finish(vl->vsb)); vtc_log_emit(vl, lvl); VSB_clear(vl->vsb); vl->act = 0; AZ(pthread_mutex_unlock(&vl->mtx)); if (lvl == 0) { vtc_error = 1; if (pthread_self() != vtc_thread) pthread_exit(NULL); } } /**********************************************************************/ static void __attribute__((__noreturn__)) vtc_log_VAS_Fail(const char *func, const char *file, int line, const char *cond, enum vas_e why) { struct vtclog *vl; (void)why; vl = pthread_getspecific(log_key); if (vl == NULL || vl->act) { fprintf(stderr, "Assert error in %s(), %s line %d:\n" " Condition(%s) not true.\n", func, file, line, cond); } else { vtc_log(vl, 0, "Assert error in %s(), %s line %d:" " Condition(%s) not true.\n", func, file, line, cond); } abort(); } vas_f *VAS_Fail __attribute__((__noreturn__)) = vtc_log_VAS_Fail; varnish-4.1.1/bin/varnishtest/vtc_http.c0000644000201500234410000007673512652366721015261 00000000000000/*- * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include "vtc.h" #include "vct.h" #include "vgz.h" #include "vnum.h" #include "vre.h" #include "vtcp.h" #define MAX_HDR 50 struct http { unsigned magic; #define HTTP_MAGIC 0x2f02169c int fd; int *sfd; int timeout; struct vtclog *vl; struct vsb *vsb; int nrxbuf; char *rxbuf; char *rem_ip; char *rem_port; int prxbuf; char *body; unsigned bodyl; char bodylen[20]; char chunklen[20]; char *req[MAX_HDR]; char *resp[MAX_HDR]; int gziplevel; int gzipresidual; int fatal; }; #define ONLY_CLIENT(hp, av) \ do { \ if (hp->sfd != NULL) \ vtc_log(hp->vl, 0, \ "\"%s\" only possible in client", av[0]); \ } while (0) #define ONLY_SERVER(hp, av) \ do { \ if (hp->sfd == NULL) \ vtc_log(hp->vl, 0, \ "\"%s\" only possible in server", av[0]); \ } while (0) /* XXX: we may want to vary this */ static const char * const nl = "\r\n"; /********************************************************************** * Generate a synthetic body */ static char * synth_body(const char *len, int rnd) { int i, j, k, l; char *b; AN(len); i = strtoul(len, NULL, 0); assert(i > 0); b = malloc(i + 1L); AN(b); l = k = '!'; for (j = 0; j < i; j++) { if ((j % 64) == 63) { b[j] = '\n'; k++; if (k == '~') k = '!'; l = k; } else if (rnd) { b[j] = (random() % 95) + ' '; } else { b[j] = (char)l; if (++l == '~') l = '!'; } } b[i - 1] = '\n'; b[i] = '\0'; return (b); } /********************************************************************** * Finish and write the vsb to the fd */ static void http_write(const struct http *hp, int lvl, const char *pfx) { ssize_t l; AZ(VSB_finish(hp->vsb)); vtc_dump(hp->vl, lvl, pfx, VSB_data(hp->vsb), VSB_len(hp->vsb)); l = write(hp->fd, VSB_data(hp->vsb), VSB_len(hp->vsb)); if (l != VSB_len(hp->vsb)) vtc_log(hp->vl, hp->fatal, "Write failed: (%zd vs %zd) %s", l, VSB_len(hp->vsb), strerror(errno)); } /********************************************************************** * find header */ static char * http_find_header(char * const *hh, const char *hdr) { int n, l; char *r; l = strlen(hdr); for (n = 3; hh[n] != NULL; n++) { if (strncasecmp(hdr, hh[n], l) || hh[n][l] != ':') continue; for (r = hh[n] + l + 1; vct_issp(*r); r++) continue; return (r); } return (NULL); } /********************************************************************** * count header */ static int http_count_header(char * const *hh, const char *hdr) { int n, l, r = 0; l = strlen(hdr); for (n = 3; hh[n] != NULL; n++) { if (strncasecmp(hdr, hh[n], l) || hh[n][l] != ':') continue; r++; } return (r); } /********************************************************************** * Expect */ static const char * cmd_var_resolve(struct http *hp, char *spec) { char **hh, *hdr; if (!strcmp(spec, "remote.ip")) return(hp->rem_ip); if (!strcmp(spec, "remote.port")) return(hp->rem_port); if (!strcmp(spec, "req.method")) return(hp->req[0]); if (!strcmp(spec, "req.url")) return(hp->req[1]); if (!strcmp(spec, "req.proto")) return(hp->req[2]); if (!strcmp(spec, "resp.proto")) return(hp->resp[0]); if (!strcmp(spec, "resp.status")) return(hp->resp[1]); if (!strcmp(spec, "resp.msg")) return(hp->resp[2]); if (!strcmp(spec, "resp.chunklen")) return(hp->chunklen); if (!strcmp(spec, "req.bodylen")) return(hp->bodylen); if (!strcmp(spec, "resp.bodylen")) return(hp->bodylen); if (!strcmp(spec, "resp.body")) return(hp->body != NULL ? hp->body : spec); if (!memcmp(spec, "req.http.", 9)) { hh = hp->req; hdr = spec + 9; } else if (!memcmp(spec, "resp.http.", 10)) { hh = hp->resp; hdr = spec + 10; } else return (spec); hdr = http_find_header(hh, hdr); return (hdr); } static void cmd_http_expect(CMD_ARGS) { struct http *hp; const char *lhs, *clhs; char *cmp; const char *rhs, *crhs; vre_t *vre; const char *error; int erroroffset; int i, retval = -1; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AZ(strcmp(av[0], "expect")); av++; AN(av[0]); AN(av[1]); AN(av[2]); AZ(av[3]); lhs = cmd_var_resolve(hp, av[0]); cmp = av[1]; rhs = cmd_var_resolve(hp, av[2]); clhs = lhs ? lhs : ""; crhs = rhs ? rhs : ""; if (!strcmp(cmp, "~") || !strcmp(cmp, "!~")) { vre = VRE_compile(crhs, 0, &error, &erroroffset); if (vre == NULL) vtc_log(hp->vl, 0, "REGEXP error: %s (@%d) (%s)", error, erroroffset, crhs); i = VRE_exec(vre, clhs, strlen(clhs), 0, 0, NULL, 0, 0); retval = (i >= 0 && *cmp == '~') || (i < 0 && *cmp == '!'); VRE_free(&vre); } else if (!strcmp(cmp, "==")) { retval = strcmp(clhs, crhs) == 0; } else if (!strcmp(cmp, "!=")) { retval = strcmp(clhs, crhs) != 0; } else if (lhs == NULL || rhs == NULL) { // fail inequality comparisons if either side is undef'ed retval = 0; } else if (!strcmp(cmp, "<")) { retval = isless(VNUM(lhs), VNUM(rhs)); } else if (!strcmp(cmp, ">")) { retval = isgreater(VNUM(lhs), VNUM(rhs)); } else if (!strcmp(cmp, "<=")) { retval = islessequal(VNUM(lhs), VNUM(rhs)); } else if (!strcmp(cmp, ">=")) { retval = isgreaterequal(VNUM(lhs), VNUM(rhs)); } if (retval == -1) vtc_log(hp->vl, 0, "EXPECT %s (%s) %s %s (%s) test not implemented", av[0], clhs, av[1], av[2], crhs); else vtc_log(hp->vl, retval ? 4 : 0, "EXPECT %s (%s) %s \"%s\" %s", av[0], clhs, cmp, crhs, retval ? "match" : "failed"); } /********************************************************************** * Split a HTTP protocol header */ static void http_splitheader(struct http *hp, int req) { char *p, *q, **hh; int n; char buf[20]; CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); if (req) { memset(hp->req, 0, sizeof hp->req); hh = hp->req; } else { memset(hp->resp, 0, sizeof hp->resp); hh = hp->resp; } n = 0; p = hp->rxbuf; /* REQ/PROTO */ while (vct_islws(*p)) p++; hh[n++] = p; while (!vct_islws(*p)) p++; AZ(vct_iscrlf(p)); *p++ = '\0'; /* URL/STATUS */ while (vct_issp(*p)) /* XXX: H space only */ p++; AZ(vct_iscrlf(p)); hh[n++] = p; while (!vct_islws(*p)) p++; if (vct_iscrlf(p)) { hh[n++] = NULL; q = p; p += vct_skipcrlf(p); *q = '\0'; } else { *p++ = '\0'; /* PROTO/MSG */ while (vct_issp(*p)) /* XXX: H space only */ p++; hh[n++] = p; while (!vct_iscrlf(p)) p++; q = p; p += vct_skipcrlf(p); *q = '\0'; } assert(n == 3); while (*p != '\0') { assert(n < MAX_HDR); if (vct_iscrlf(p)) break; hh[n++] = p++; while (*p != '\0' && !vct_iscrlf(p)) p++; q = p; p += vct_skipcrlf(p); *q = '\0'; } p += vct_skipcrlf(p); assert(*p == '\0'); for (n = 0; n < 3 || hh[n] != NULL; n++) { sprintf(buf, "http[%2d] ", n); vtc_dump(hp->vl, 4, buf, hh[n], -1); } } /********************************************************************** * Receive another character */ static int http_rxchar(struct http *hp, int n, int eof) { int i; struct pollfd pfd[1]; while (n > 0) { pfd[0].fd = hp->fd; pfd[0].events = POLLIN; pfd[0].revents = 0; i = poll(pfd, 1, hp->timeout); if (i < 0 && errno == EINTR) continue; if (i == 0) vtc_log(hp->vl, hp->fatal, "HTTP rx timeout (fd:%d %u ms)", hp->fd, hp->timeout); if (i < 0) vtc_log(hp->vl, hp->fatal, "HTTP rx failed (fd:%d poll: %s)", hp->fd, strerror(errno)); assert(i > 0); assert(hp->prxbuf + n < hp->nrxbuf); i = read(hp->fd, hp->rxbuf + hp->prxbuf, n); if (!(pfd[0].revents & POLLIN)) vtc_log(hp->vl, 4, "HTTP rx poll (fd:%d revents: %x n=%d, i=%d)", hp->fd, pfd[0].revents, n, i); if (i == 0 && eof) return (i); if (i == 0) vtc_log(hp->vl, hp->fatal, "HTTP rx EOF (fd:%d read: %s)", hp->fd, strerror(errno)); if (i < 0) vtc_log(hp->vl, hp->fatal, "HTTP rx failed (fd:%d read: %s)", hp->fd, strerror(errno)); hp->prxbuf += i; hp->rxbuf[hp->prxbuf] = '\0'; n -= i; } return (1); } static int http_rxchunk(struct http *hp) { char *q; int l, i; l = hp->prxbuf; do (void)http_rxchar(hp, 1, 0); while (hp->rxbuf[hp->prxbuf - 1] != '\n'); vtc_dump(hp->vl, 4, "len", hp->rxbuf + l, -1); i = strtoul(hp->rxbuf + l, &q, 16); bprintf(hp->chunklen, "%d", i); if ((q == hp->rxbuf + l) || (*q != '\0' && !vct_islws(*q))) { vtc_log(hp->vl, hp->fatal, "chunked fail %02x @ %td", *q, q - (hp->rxbuf + l)); } assert(q != hp->rxbuf + l); assert(*q == '\0' || vct_islws(*q)); hp->prxbuf = l; if (i > 0) { (void)http_rxchar(hp, i, 0); vtc_dump(hp->vl, 4, "chunk", hp->rxbuf + l, i); } l = hp->prxbuf; (void)http_rxchar(hp, 2, 0); if(!vct_iscrlf(hp->rxbuf + l)) vtc_log(hp->vl, hp->fatal, "Wrong chunk tail[0] = %02x", hp->rxbuf[l] & 0xff); if(!vct_iscrlf(hp->rxbuf + l + 1)) vtc_log(hp->vl, hp->fatal, "Wrong chunk tail[1] = %02x", hp->rxbuf[l + 1] & 0xff); hp->prxbuf = l; hp->rxbuf[l] = '\0'; return (i); } /********************************************************************** * Swallow a HTTP message body */ static void http_swallow_body(struct http *hp, char * const *hh, int body) { char *p; int i, l, ll; hp->body = hp->rxbuf + hp->prxbuf; ll = 0; p = http_find_header(hh, "transfer-encoding"); if (p != NULL && !strcasecmp(p, "chunked")) { while (http_rxchunk(hp) != 0) continue; vtc_dump(hp->vl, 4, "body", hp->body, ll); ll = hp->rxbuf + hp->prxbuf - hp->body; hp->bodyl = ll; sprintf(hp->bodylen, "%d", ll); return; } p = http_find_header(hh, "content-length"); if (p != NULL) { l = strtoul(p, NULL, 10); (void)http_rxchar(hp, l, 0); vtc_dump(hp->vl, 4, "body", hp->body, l); hp->bodyl = l; bprintf(hp->bodylen, "%d", l); return; } if (body) { do { i = http_rxchar(hp, 1, 1); ll += i; } while (i > 0); vtc_dump(hp->vl, 4, "rxeof", hp->body, ll); } hp->bodyl = ll; sprintf(hp->bodylen, "%d", ll); } /********************************************************************** * Receive a HTTP protocol header */ static void http_rxhdr(struct http *hp) { int i; char *p; CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); hp->prxbuf = 0; hp->body = NULL; bprintf(hp->bodylen, "%s", ""); while (1) { (void)http_rxchar(hp, 1, 0); p = hp->rxbuf + hp->prxbuf - 1; for (i = 0; p > hp->rxbuf; p--) { if (*p != '\n') break; if (p - 1 > hp->rxbuf && p[-1] == '\r') p--; if (++i == 2) break; } if (i == 2) break; } vtc_dump(hp->vl, 4, "rxhdr", hp->rxbuf, -1); vtc_log(hp->vl, 4, "rxhdrlen = %zd", strlen(hp->rxbuf)); } /********************************************************************** * Receive a response */ static void cmd_http_rxresp(CMD_ARGS) { struct http *hp; int has_obj = 1; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); ONLY_CLIENT(hp, av); AZ(strcmp(av[0], "rxresp")); av++; for(; *av != NULL; av++) if (!strcmp(*av, "-no_obj")) has_obj = 0; else vtc_log(hp->vl, 0, "Unknown http rxresp spec: %s\n", *av); http_rxhdr(hp); http_splitheader(hp, 0); if (http_count_header(hp->resp, "Content-Length") > 1) vtc_log(hp->vl, 0, "Multiple Content-Length headers.\n"); if (!has_obj) return; else if (!strcmp(hp->resp[1], "200")) http_swallow_body(hp, hp->resp, 1); else http_swallow_body(hp, hp->resp, 0); vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen); } static void cmd_http_rxresphdrs(CMD_ARGS) { struct http *hp; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); ONLY_CLIENT(hp, av); AZ(strcmp(av[0], "rxresphdrs")); av++; for(; *av != NULL; av++) vtc_log(hp->vl, 0, "Unknown http rxreq spec: %s\n", *av); http_rxhdr(hp); http_splitheader(hp, 0); if (http_count_header(hp->resp, "Content-Length") > 1) vtc_log(hp->vl, 0, "Multiple Content-Length headers.\n"); } /********************************************************************** * Ungzip rx'ed body */ #define TRUST_ME(ptr) ((void*)(uintptr_t)(ptr)) #define OVERHEAD 64L static void cmd_http_gunzip_body(CMD_ARGS) { int i; z_stream vz; struct http *hp; char *p; unsigned l; (void)av; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); memset(&vz, 0, sizeof vz); AN(hp->body); if (hp->body[0] != (char)0x1f || hp->body[1] != (char)0x8b) vtc_log(hp->vl, hp->fatal, "Gunzip error: Body lacks gzip magics"); vz.next_in = TRUST_ME(hp->body); vz.avail_in = hp->bodyl; l = hp->bodyl * 10; p = calloc(l, 1); AN(p); vz.next_out = TRUST_ME(p); vz.avail_out = l; assert(Z_OK == inflateInit2(&vz, 31)); i = inflate(&vz, Z_FINISH); assert(vz.total_out < l); hp->bodyl = vz.total_out; memcpy(hp->body, p, hp->bodyl); free(p); vtc_log(hp->vl, 3, "new bodylen %u", hp->bodyl); vtc_dump(hp->vl, 4, "body", hp->body, hp->bodyl); bprintf(hp->bodylen, "%u", hp->bodyl); vtc_log(hp->vl, 4, "startbit = %ju %ju/%ju", (uintmax_t)vz.start_bit, (uintmax_t)vz.start_bit >> 3, (uintmax_t)vz.start_bit & 7); vtc_log(hp->vl, 4, "lastbit = %ju %ju/%ju", (uintmax_t)vz.last_bit, (uintmax_t)vz.last_bit >> 3, (uintmax_t)vz.last_bit & 7); vtc_log(hp->vl, 4, "stopbit = %ju %ju/%ju", (uintmax_t)vz.stop_bit, (uintmax_t)vz.stop_bit >> 3, (uintmax_t)vz.stop_bit & 7); if (i != Z_STREAM_END) vtc_log(hp->vl, hp->fatal, "Gunzip error = %d (%s) in:%jd out:%jd", i, vz.msg, (intmax_t)vz.total_in, (intmax_t)vz.total_out); assert(Z_OK == inflateEnd(&vz)); hp->body[hp->bodyl] = '\0'; } /********************************************************************** * Create a gzip'ed body */ static void gzip_body(const struct http *hp, const char *txt, char **body, int *bodylen) { int l, i; z_stream vz; memset(&vz, 0, sizeof vz); l = strlen(txt); *body = calloc(l + OVERHEAD, 1); AN(*body); vz.next_in = TRUST_ME(txt); vz.avail_in = l; vz.next_out = TRUST_ME(*body); vz.avail_out = l + OVERHEAD; assert(Z_OK == deflateInit2(&vz, hp->gziplevel, Z_DEFLATED, 31, 9, Z_DEFAULT_STRATEGY)); assert(Z_STREAM_END == deflate(&vz, Z_FINISH)); i = vz.stop_bit & 7; if (hp->gzipresidual >= 0 && hp->gzipresidual != i) vtc_log(hp->vl, hp->fatal, "Wrong gzip residual got %d wanted %d", i, hp->gzipresidual); *bodylen = vz.total_out; vtc_log(hp->vl, 4, "startbit = %ju %ju/%ju", (uintmax_t)vz.start_bit, (uintmax_t)vz.start_bit >> 3, (uintmax_t)vz.start_bit & 7); vtc_log(hp->vl, 4, "lastbit = %ju %ju/%ju", (uintmax_t)vz.last_bit, (uintmax_t)vz.last_bit >> 3, (uintmax_t)vz.last_bit & 7); vtc_log(hp->vl, 4, "stopbit = %ju %ju/%ju", (uintmax_t)vz.stop_bit, (uintmax_t)vz.stop_bit >> 3, (uintmax_t)vz.stop_bit & 7); assert(Z_OK == deflateEnd(&vz)); } /********************************************************************** * Handle common arguments of a transmited request or response */ static char* const * http_tx_parse_args(char * const *av, struct vtclog *vl, struct http *hp, char* body) { int bodylen = 0; char *b, *c; char *nullbody = NULL; int nolen = 0; (void)vl; nullbody = body; for(; *av != NULL; av++) { if (!strcmp(*av, "-nolen")) { nolen = 1; } else if (!strcmp(*av, "-hdr")) { VSB_printf(hp->vsb, "%s%s", av[1], nl); av++; } else break; } for(; *av != NULL; av++) { if (!strcmp(*av, "-body")) { assert(body == nullbody); REPLACE(body, av[1]); AN(body); av++; bodylen = strlen(body); for (b = body; *b != '\0'; b++) { if(*b == '\\' && b[1] == '0') { *b = '\0'; for(c = b+1; *c != '\0'; c++) { *c = c[1]; } b++; bodylen--; } } } else if (!strcmp(*av, "-bodylen")) { assert(body == nullbody); body = synth_body(av[1], 0); bodylen = strlen(body); av++; } else if (!strcmp(*av, "-gzipresidual")) { hp->gzipresidual = strtoul(av[1], NULL, 0); av++; } else if (!strcmp(*av, "-gziplevel")) { hp->gziplevel = strtoul(av[1], NULL, 0); av++; } else if (!strcmp(*av, "-gziplen")) { assert(body == nullbody); b = synth_body(av[1], 1); gzip_body(hp, b, &body, &bodylen); VSB_printf(hp->vsb, "Content-Encoding: gzip%s", nl); // vtc_hexdump(hp->vl, 4, "gzip", (void*)body, bodylen); av++; } else if (!strcmp(*av, "-gzipbody")) { assert(body == nullbody); gzip_body(hp, av[1], &body, &bodylen); VSB_printf(hp->vsb, "Content-Encoding: gzip%s", nl); // vtc_hexdump(hp->vl, 4, "gzip", (void*)body, bodylen); av++; } else break; } if (body != NULL && !nolen) VSB_printf(hp->vsb, "Content-Length: %d%s", bodylen, nl); VSB_cat(hp->vsb, nl); if (body != NULL) { VSB_bcat(hp->vsb, body, bodylen); free(body); } return (av); } /********************************************************************** * Transmit a response */ static void cmd_http_txresp(CMD_ARGS) { struct http *hp; const char *proto = "HTTP/1.1"; const char *status = "200"; const char *msg = "OK"; char* body = NULL; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); ONLY_SERVER(hp, av); AZ(strcmp(av[0], "txresp")); av++; VSB_clear(hp->vsb); for(; *av != NULL; av++) { if (!strcmp(*av, "-proto")) { proto = av[1]; av++; } else if (!strcmp(*av, "-status")) { status = av[1]; av++; } else if (!strcmp(*av, "-msg")) { msg = av[1]; av++; continue; } else break; } VSB_printf(hp->vsb, "%s %s %s%s", proto, status, msg, nl); /* send a "Content-Length: 0" header unless something else happens */ REPLACE(body, ""); av = http_tx_parse_args(av, vl, hp, body); if (*av != NULL) vtc_log(hp->vl, 0, "Unknown http txresp spec: %s\n", *av); http_write(hp, 4, "txresp"); } /********************************************************************** * Receive a request */ static void cmd_http_rxreq(CMD_ARGS) { struct http *hp; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); ONLY_SERVER(hp, av); AZ(strcmp(av[0], "rxreq")); av++; for(; *av != NULL; av++) vtc_log(hp->vl, 0, "Unknown http rxreq spec: %s\n", *av); http_rxhdr(hp); http_splitheader(hp, 1); if (http_count_header(hp->req, "Content-Length") > 1) vtc_log(hp->vl, 0, "Multiple Content-Length headers.\n"); http_swallow_body(hp, hp->req, 0); vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen); } static void cmd_http_rxreqhdrs(CMD_ARGS) { struct http *hp; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AZ(strcmp(av[0], "rxreqhdrs")); av++; for(; *av != NULL; av++) vtc_log(hp->vl, 0, "Unknown http rxreq spec: %s\n", *av); http_rxhdr(hp); http_splitheader(hp, 1); if (http_count_header(hp->req, "Content-Length") > 1) vtc_log(hp->vl, 0, "Multiple Content-Length headers.\n"); } static void cmd_http_rxreqbody(CMD_ARGS) { struct http *hp; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); ONLY_SERVER(hp, av); AZ(strcmp(av[0], "rxreqbody")); av++; for(; *av != NULL; av++) vtc_log(hp->vl, 0, "Unknown http rxreq spec: %s\n", *av); http_swallow_body(hp, hp->req, 0); vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen); } static void cmd_http_rxrespbody(CMD_ARGS) { struct http *hp; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); ONLY_CLIENT(hp, av); AZ(strcmp(av[0], "rxrespbody")); av++; for(; *av != NULL; av++) vtc_log(hp->vl, 0, "Unknown http rxreq spec: %s\n", *av); http_swallow_body(hp, hp->resp, 0); vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen); } static void cmd_http_rxchunk(CMD_ARGS) { struct http *hp; int ll, i; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); ONLY_CLIENT(hp, av); i = http_rxchunk(hp); if (i == 0) { ll = hp->rxbuf + hp->prxbuf - hp->body; hp->bodyl = ll; sprintf(hp->bodylen, "%d", ll); vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen); } } /********************************************************************** * Transmit a request */ static void cmd_http_txreq(CMD_ARGS) { struct http *hp; const char *req = "GET"; const char *url = "/"; const char *proto = "HTTP/1.1"; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); ONLY_CLIENT(hp, av); AZ(strcmp(av[0], "txreq")); av++; VSB_clear(hp->vsb); for(; *av != NULL; av++) { if (!strcmp(*av, "-url")) { url = av[1]; av++; } else if (!strcmp(*av, "-proto")) { proto = av[1]; av++; } else if (!strcmp(*av, "-req")) { req = av[1]; av++; } else break; } VSB_printf(hp->vsb, "%s %s %s%s", req, url, proto, nl); av = http_tx_parse_args(av, vl, hp, NULL); if (*av != NULL) vtc_log(hp->vl, 0, "Unknown http txreq spec: %s\n", *av); http_write(hp, 4, "txreq"); } /********************************************************************** * Receive N characters */ static void cmd_http_recv(CMD_ARGS) { struct http *hp; int i, n; char u[32]; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AZ(av[2]); n = strtoul(av[1], NULL, 0); while (n > 0) { i = read(hp->fd, u, n > 32 ? 32 : n); if (i > 0) vtc_dump(hp->vl, 4, "recv", u, i); else vtc_log(hp->vl, hp->fatal, "recv() got %d (%s)", i, strerror(errno)); n -= i; } } /********************************************************************** * Send a string */ static void cmd_http_send(CMD_ARGS) { struct http *hp; int i; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AZ(av[2]); vtc_dump(hp->vl, 4, "send", av[1], -1); i = write(hp->fd, av[1], strlen(av[1])); if (i != strlen(av[1])) vtc_log(hp->vl, hp->fatal, "Write error in http_send(): %s", strerror(errno)); } /********************************************************************** * Send a string many times */ static void cmd_http_send_n(CMD_ARGS) { struct http *hp; int i, n, l; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AN(av[2]); AZ(av[3]); n = strtoul(av[1], NULL, 0); vtc_dump(hp->vl, 4, "send_n", av[2], -1); l = strlen(av[2]); while (n--) { i = write(hp->fd, av[2], l); if (i != l) vtc_log(hp->vl, hp->fatal, "Write error in http_send(): %s", strerror(errno)); } } /********************************************************************** * Send an OOB urgent message */ static void cmd_http_send_urgent(CMD_ARGS) { struct http *hp; int i; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AZ(av[2]); vtc_dump(hp->vl, 4, "send_urgent", av[1], -1); i = send(hp->fd, av[1], strlen(av[1]), MSG_OOB); if (i != strlen(av[1])) vtc_log(hp->vl, hp->fatal, "Write error in http_send_urgent(): %s", strerror(errno)); } /********************************************************************** * Send a hex string */ static void cmd_http_sendhex(CMD_ARGS) { struct http *hp; char buf[3], *q; uint8_t *p; int i, j, l; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AZ(av[2]); l = strlen(av[1]) / 2; p = malloc(l); AN(p); q = av[1]; for (i = 0; i < l; i++) { while (vct_issp(*q)) q++; if (*q == '\0') break; memcpy(buf, q, 2); q += 2; buf[2] = '\0'; if (!vct_ishex(buf[0]) || !vct_ishex(buf[1])) vtc_log(hp->vl, 0, "Illegal Hex char \"%c%c\"", buf[0], buf[1]); p[i] = (uint8_t)strtoul(buf, NULL, 16); } vtc_hexdump(hp->vl, 4, "sendhex", (void*)p, i); j = write(hp->fd, p, i); assert(j == i); free(p); } /********************************************************************** * Send a string as chunked encoding */ static void cmd_http_chunked(CMD_ARGS) { struct http *hp; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AZ(av[2]); VSB_clear(hp->vsb); VSB_printf(hp->vsb, "%jx%s%s%s", (uintmax_t)strlen(av[1]), nl, av[1], nl); http_write(hp, 4, "chunked"); } static void cmd_http_chunkedlen(CMD_ARGS) { unsigned len; unsigned u, v; char buf[16384]; struct http *hp; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AZ(av[2]); VSB_clear(hp->vsb); len = atoi(av[1]); if (len == 0) { VSB_printf(hp->vsb, "0%s%s", nl, nl); } else { for (u = 0; u < sizeof buf; u++) buf[u] = (u & 7) + '0'; VSB_printf(hp->vsb, "%x%s", len, nl); for (u = 0; u < len; u += v) { v = len - u; if (v > sizeof buf) v = sizeof buf; VSB_bcat(hp->vsb, buf, v); } VSB_printf(hp->vsb, "%s", nl); } http_write(hp, 4, "chunked"); } /********************************************************************** * set the timeout */ static void cmd_http_timeout(CMD_ARGS) { struct http *hp; double d; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AZ(av[2]); d = VNUM(av[1]); if (isnan(d)) vtc_log(vl, 0, "timeout is not a number (%s)", av[1]); hp->timeout = (int)(d * 1000.0); } /********************************************************************** * expect other end to close (server only) */ static void cmd_http_expect_close(CMD_ARGS) { struct http *hp; struct pollfd fds[1]; char c; int i; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AZ(av[1]); vtc_log(vl, 4, "Expecting close (fd = %d)", hp->fd); while (1) { fds[0].fd = hp->fd; fds[0].events = POLLIN | POLLERR; fds[0].revents = 0; i = poll(fds, 1, hp->timeout); if (i < 0 && errno == EINTR) continue; if (i == 0) vtc_log(vl, hp->fatal, "Expected close: timeout"); if (i != 1 || !(fds[0].revents & (POLLIN|POLLERR))) vtc_log(vl, hp->fatal, "Expected close: poll = %d, revents = 0x%x", i, fds[0].revents); i = read(hp->fd, &c, 1); if (VTCP_Check(i)) break; if (i == 1 && vct_islws(c)) continue; vtc_log(vl, hp->fatal, "Expecting close: read = %d, c = 0x%02x", i, c); } vtc_log(vl, 4, "fd=%d EOF, as expected", hp->fd); } /********************************************************************** * close a new connection (server only) */ static void cmd_http_close(CMD_ARGS) { struct http *hp; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AZ(av[1]); assert(hp->sfd != NULL); assert(*hp->sfd >= 0); VTCP_close(&hp->fd); vtc_log(vl, 4, "Closed"); } /********************************************************************** * close and accept a new connection (server only) */ static void cmd_http_accept(CMD_ARGS) { struct http *hp; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AZ(av[1]); assert(hp->sfd != NULL); assert(*hp->sfd >= 0); if (hp->fd >= 0) VTCP_close(&hp->fd); vtc_log(vl, 4, "Accepting"); hp->fd = accept(*hp->sfd, NULL, NULL); if (hp->fd < 0) vtc_log(vl, hp->fatal, "Accepted failed: %s", strerror(errno)); vtc_log(vl, 3, "Accepted socket fd is %d", hp->fd); } /********************************************************************** * loop operator */ static void cmd_http_loop(CMD_ARGS) { struct http *hp; unsigned n, m; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AN(av[2]); AZ(av[3]); n = strtoul(av[1], NULL, 0); for (m = 1 ; m <= n; m++) { vtc_log(vl, 4, "Loop #%u", m); parse_string(av[2], cmd, hp, vl); } } /********************************************************************** * Control fatality */ static void cmd_http_fatal(CMD_ARGS) { struct http *hp; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AZ(av[1]); if (!strcmp(av[0], "fatal")) hp->fatal = 0; else if (!strcmp(av[0], "non-fatal")) hp->fatal = -1; else { vtc_log(vl, 0, "XXX: fatal %s", cmd->name); } } /********************************************************************** * Execute HTTP specifications */ static const struct cmds http_cmds[] = { { "timeout", cmd_http_timeout }, { "txreq", cmd_http_txreq }, { "rxreq", cmd_http_rxreq }, { "rxreqhdrs", cmd_http_rxreqhdrs }, { "rxreqbody", cmd_http_rxreqbody }, { "rxchunk", cmd_http_rxchunk }, { "txresp", cmd_http_txresp }, { "rxresp", cmd_http_rxresp }, { "rxresphdrs", cmd_http_rxresphdrs }, { "rxrespbody", cmd_http_rxrespbody }, { "gunzip", cmd_http_gunzip_body }, { "expect", cmd_http_expect }, { "recv", cmd_http_recv }, { "send", cmd_http_send }, { "send_n", cmd_http_send_n }, { "send_urgent", cmd_http_send_urgent }, { "sendhex", cmd_http_sendhex }, { "chunked", cmd_http_chunked }, { "chunkedlen", cmd_http_chunkedlen }, { "delay", cmd_delay }, { "sema", cmd_sema }, { "expect_close", cmd_http_expect_close }, { "close", cmd_http_close }, { "accept", cmd_http_accept }, { "loop", cmd_http_loop }, { "fatal", cmd_http_fatal }, { "non-fatal", cmd_http_fatal }, { NULL, NULL } }; int http_process(struct vtclog *vl, const char *spec, int sock, int *sfd) { struct http *hp; int retval; (void)sfd; ALLOC_OBJ(hp, HTTP_MAGIC); AN(hp); hp->fd = sock; hp->timeout = vtc_maxdur * 1000 / 2; hp->nrxbuf = 2048*1024; hp->rxbuf = malloc(hp->nrxbuf); /* XXX */ AN(hp->rxbuf); hp->vsb = VSB_new_auto(); AN(hp->vsb); hp->sfd = sfd; hp->rem_ip = malloc(VTCP_ADDRBUFSIZE); AN(hp->rem_ip); hp->rem_port = malloc(VTCP_PORTBUFSIZE); AN(hp->rem_port); hp->vl = vl; hp->gziplevel = 0; hp->gzipresidual = -1; VTCP_hisname(sock, hp->rem_ip, VTCP_ADDRBUFSIZE, hp->rem_port, VTCP_PORTBUFSIZE); parse_string(spec, http_cmds, hp, vl); retval = hp->fd; VSB_delete(hp->vsb); free(hp->rxbuf); free(hp->rem_ip); free(hp->rem_port); free(hp); return (retval); } /********************************************************************** * Magic test routine * * This function brute-forces some short strings through gzip(9) to * find candidates for all possible 8 bit positions of the stopbit. * * Here is some good short output strings: * * 0 184 * 1 257 <1ea86e6cf31bf4ec3d7a86> * 2 106 <10> * 3 163 * 4 180 <71c5d18ec5d5d1> * 5 189 <39886d28a6d2988> * 6 118 <80000> * 7 151 <386811868> * */ #if 0 void xxx(void); void xxx(void) { z_stream vz; int n; char ibuf[200]; char obuf[200]; int fl[8]; int i, j; for (n = 0; n < 8; n++) fl[n] = 9999; memset(&vz, 0, sizeof vz); for(n = 0; n < 999999999; n++) { *ibuf = 0; for (j = 0; j < 7; j++) { sprintf(strchr(ibuf, 0), "%x", (unsigned)random() & 0xffff); vz.next_in = TRUST_ME(ibuf); vz.avail_in = strlen(ibuf); vz.next_out = TRUST_ME(obuf); vz.avail_out = sizeof obuf; assert(Z_OK == deflateInit2(&vz, 9, Z_DEFLATED, 31, 9, Z_DEFAULT_STRATEGY)); assert(Z_STREAM_END == deflate(&vz, Z_FINISH)); i = vz.stop_bit & 7; if (fl[i] > strlen(ibuf)) { printf("%d %jd <%s>\n", i, vz.stop_bit, ibuf); fl[i] = strlen(ibuf); } assert(Z_OK == deflateEnd(&vz)); } } printf("FOO\n"); } #endif varnish-4.1.1/bin/varnishtest/Makefile.am0000644000201500234410000000217412652366721015300 00000000000000# VTC_LOG_COMPILER = ./varnishtest -v -i TEST_EXTENSIONS = .vtc TESTS = @VTC_TESTS@ # Make sure we run check-local first check: check-am check-local check-am: check-local # See if list of checks have changed, recheck check-local: if [ "$$(cd $(srcdir) && echo tests/*.vtc)" != "@VTC_TESTS@" ]; then \ cd $(top_builddir) && ./config.status --recheck ; \ fi DISTCLEANFILES = _.ok AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ -I$(top_srcdir)/lib/libvgz bin_PROGRAMS = varnishtest varnishtest_SOURCES = \ vtc.c \ vtc.h \ vmods.h \ programs.h \ vtc_client.c \ vtc_http.c \ vtc_main.c \ vtc_log.c \ vtc_sema.c \ vtc_server.c \ vtc_varnish.c \ vtc_logexp.c \ vtc_process.c varnishtest_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(top_builddir)/lib/libvgz/libvgz.la \ ${LIBM} ${PTHREAD_LIBS} varnishtest_CFLAGS = \ -DTOP_BUILDDIR='"${top_builddir}"' EXTRA_DIST = $(top_srcdir)/bin/varnishtest/tests/*.vtc \ $(top_srcdir)/bin/varnishtest/tests/README varnish-4.1.1/bin/varnishtest/vtc.c0000644000201500234410000003527412652366721014213 00000000000000/*- * Copyright (c) 2008-2011 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. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include "vtc.h" #include "vav.h" #include "vnum.h" #include "vre.h" #include "vtim.h" #define MAX_TOKENS 200 volatile sig_atomic_t vtc_error; /* Error encountered */ int vtc_stop; /* Stops current test without error */ pthread_t vtc_thread; static struct vtclog *vltop; unsigned vtc_maxdur; /* Max duration of any test */ /********************************************************************** * Macro facility */ struct macro { VTAILQ_ENTRY(macro) list; char *name; char *val; }; static VTAILQ_HEAD(,macro) macro_list = VTAILQ_HEAD_INITIALIZER(macro_list); static pthread_mutex_t macro_mtx; static void init_macro(void) { AZ(pthread_mutex_init(¯o_mtx, NULL)); } void macro_def(struct vtclog *vl, const char *instance, const char *name, const char *fmt, ...) { char buf1[256]; char buf2[256]; struct macro *m; va_list ap; AN(fmt); if (instance != NULL) { bprintf(buf1, "%s_%s", instance, name); name = buf1; } AZ(pthread_mutex_lock(¯o_mtx)); VTAILQ_FOREACH(m, ¯o_list, list) if (!strcmp(name, m->name)) break; if (m == NULL) { m = calloc(sizeof *m, 1); AN(m); REPLACE(m->name, name); VTAILQ_INSERT_TAIL(¯o_list, m, list); } AN(m); va_start(ap, fmt); free(m->val); m->val = NULL; vbprintf(buf2, fmt, ap); va_end(ap); m->val = strdup(buf2); AN(m->val); vtc_log(vl, 4, "macro def %s=%s", name, m->val); AZ(pthread_mutex_unlock(¯o_mtx)); } void macro_undef(struct vtclog *vl, const char *instance, const char *name) { char buf1[256]; struct macro *m; if (instance != NULL) { bprintf(buf1, "%s_%s", instance, name); name = buf1; } AZ(pthread_mutex_lock(¯o_mtx)); VTAILQ_FOREACH(m, ¯o_list, list) if (!strcmp(name, m->name)) break; if (m != NULL) { vtc_log(vl, 4, "macro undef %s", name); VTAILQ_REMOVE(¯o_list, m, list); free(m->name); free(m->val); free(m); } AZ(pthread_mutex_unlock(¯o_mtx)); } static char * macro_get(const char *b, const char *e) { struct macro *m; int l; char *retval = NULL; l = e - b; if (l == 4 && !memcmp(b, "date", l)) { double t = VTIM_real(); retval = malloc(64); AN(retval); VTIM_format(t, retval); return (retval); } AZ(pthread_mutex_lock(¯o_mtx)); VTAILQ_FOREACH(m, ¯o_list, list) if (!memcmp(b, m->name, l) && m->name[l] == '\0') break; if (m != NULL) retval = strdup(m->val); AZ(pthread_mutex_unlock(¯o_mtx)); return (retval); } struct vsb * macro_expand(struct vtclog *vl, const char *text) { struct vsb *vsb; const char *p, *q; char *m; vsb = VSB_new_auto(); AN(vsb); while (*text != '\0') { p = strstr(text, "${"); if (p == NULL) { VSB_cat(vsb, text); break; } VSB_bcat(vsb, text, p - text); q = strchr(p, '}'); if (q == NULL) { VSB_cat(vsb, text); break; } assert(p[0] == '$'); assert(p[1] == '{'); assert(q[0] == '}'); p += 2; m = macro_get(p, q); if (m == NULL) { VSB_delete(vsb); vtc_log(vl, 0, "Macro ${%.*s} not found", (int)(q - p), p); return (NULL); } VSB_printf(vsb, "%s", m); free(m); text = q + 1; } AZ(VSB_finish(vsb)); return (vsb); } /* extmacro is a list of macro's that are defined from the command line and are applied to the macro list of each test instance. No locking is required as they are set before any tests are started. */ struct extmacro { VTAILQ_ENTRY(extmacro) list; char *name; char *val; }; static VTAILQ_HEAD(, extmacro) extmacro_list = VTAILQ_HEAD_INITIALIZER(extmacro_list); void extmacro_def(const char *name, const char *fmt, ...) { char buf[256]; struct extmacro *m; va_list ap; VTAILQ_FOREACH(m, &extmacro_list, list) if (!strcmp(name, m->name)) break; if (m == NULL && fmt != NULL) { m = calloc(sizeof *m, 1); AN(m); REPLACE(m->name, name); VTAILQ_INSERT_TAIL(&extmacro_list, m, list); } if (fmt != NULL) { AN(m); va_start(ap, fmt); free(m->val); vbprintf(buf, fmt, ap); va_end(ap); m->val = strdup(buf); AN(m->val); } else if (m != NULL) { VTAILQ_REMOVE(&extmacro_list, m, list); free(m->name); free(m->val); free(m); } } /********************************************************************** * Parse a string * * We make a copy of the string and deliberately leak it, so that all * the cmd functions we call don't have to strdup(3) all over the place. * * Static checkers like Coverity may bitch about this, but we don't care. */ void parse_string(const char *spec, const struct cmds *cmd, void *priv, struct vtclog *vl) { char *token_s[MAX_TOKENS], *token_e[MAX_TOKENS]; struct vsb *token_exp[MAX_TOKENS]; char *p, *q, *f, *buf; int nest_brace; int tn; const struct cmds *cp; AN(spec); buf = strdup(spec); AN(buf); for (p = buf; *p != '\0'; p++) { if (vtc_error || vtc_stop) break; /* Start of line */ if (isspace(*p)) continue; if (*p == '\n') continue; if (*p == '#') { for (; *p != '\0' && *p != '\n'; p++) ; if (*p == '\0') break; continue; } q = strchr(p, '\n'); if (q == NULL) q = strchr(p, '\0'); if (q - p > 60) vtc_log(vl, 2, "=== %.60s...", p); else vtc_log(vl, 2, "=== %.*s", (int)(q - p), p); /* First content on line, collect tokens */ tn = 0; f = p; while (*p != '\0') { assert(tn < MAX_TOKENS); if (*p == '\n') { /* End on NL */ break; } if (isspace(*p)) { /* Inter-token whitespace */ p++; continue; } if (*p == '\\' && p[1] == '\n') { /* line-cont */ p += 2; continue; } if (*p == '"') { /* quotes */ token_s[tn] = ++p; q = p; for (; *p != '\0'; p++) { if (*p == '"') break; if (*p == '\\') { p += VAV_BackSlash(p, q) - 1; q++; } else { if (*p == '\n') vtc_log(vl, 0, "Unterminated quoted string in line: %*.*s", (int)(p - f), (int)(p - f), f); assert(*p != '\n'); *q++ = *p; } } token_e[tn++] = q; p++; } else if (*p == '{') { /* Braces */ nest_brace = 0; token_s[tn] = p + 1; for (; *p != '\0'; p++) { if (*p == '{') nest_brace++; else if (*p == '}') { if (--nest_brace == 0) break; } } assert(*p == '}'); token_e[tn++] = p++; } else { /* other tokens */ token_s[tn] = p; for (; *p != '\0' && !isspace(*p); p++) ; token_e[tn++] = p; } } assert(tn < MAX_TOKENS); token_s[tn] = NULL; for (tn = 0; token_s[tn] != NULL; tn++) { token_exp[tn] = NULL; AN(token_e[tn]); /*lint !e771 */ *token_e[tn] = '\0'; /*lint !e771 */ if (NULL == strstr(token_s[tn], "${")) continue; token_exp[tn] = macro_expand(vl, token_s[tn]); if (vtc_error) { return; } token_s[tn] = VSB_data(token_exp[tn]); token_e[tn] = strchr(token_s[tn], '\0'); } for (cp = cmd; cp->name != NULL; cp++) if (!strcmp(token_s[0], cp->name)) break; if (cp->name == NULL) { vtc_log(vl, 0, "Unknown command: \"%s\"", token_s[0]); return; } assert(cp->cmd != NULL); cp->cmd(token_s, priv, cmd, vl); } } /********************************************************************** * Reset commands (between tests) */ static void reset_cmds(const struct cmds *cmd) { for (; cmd->name != NULL; cmd++) cmd->cmd(NULL, NULL, NULL, NULL); } /********************************************************************** * Output test description */ static void cmd_varnishtest(CMD_ARGS) { (void)priv; (void)cmd; (void)vl; if (av == NULL) return; AZ(strcmp(av[0], "varnishtest")); vtc_log(vl, 1, "TEST %s", av[1]); AZ(av[2]); } /********************************************************************** * Shell command execution */ static void cmd_shell(CMD_ARGS) { (void)priv; (void)cmd; int r, s; if (av == NULL) return; AN(av[1]); AZ(av[2]); vtc_dump(vl, 4, "shell", av[1], -1); r = system(av[1]); s = WEXITSTATUS(r); if (s != 0) vtc_log(vl, 0, "CMD '%s' failed with status %d (%s)", av[1], s, strerror(errno)); } /********************************************************************** * Shell command execution */ static void cmd_err_shell(CMD_ARGS) { (void)priv; (void)cmd; struct vsb *vsb; FILE *fp; int r, c; if (av == NULL) return; AN(av[1]); AN(av[2]); AZ(av[3]); vsb = VSB_new_auto(); AN(vsb); vtc_dump(vl, 4, "cmd", av[2], -1); fp = popen(av[2], "r"); if (fp == NULL) vtc_log(vl, 0, "popen fails: %s", strerror(errno)); do { c = getc(fp); if (c != EOF) VSB_putc(vsb, c); } while (c != EOF); r = pclose(fp); vtc_log(vl, 4, "Status = %d", WEXITSTATUS(r)); if (WIFSIGNALED(r)) vtc_log(vl, 4, "Signal = %d", WTERMSIG(r)); if (WEXITSTATUS(r) == 0) { vtc_log(vl, 0, "expected error from shell"); } AZ(VSB_finish(vsb)); vtc_dump(vl, 4, "stdout", VSB_data(vsb), VSB_len(vsb)); if (strstr(VSB_data(vsb), av[1]) == NULL) vtc_log(vl, 0, "Did not find expected string: (\"%s\")", av[1]); else vtc_log(vl, 4, "Found expected string: (\"%s\")", av[1]); VSB_delete(vsb); } /********************************************************************** * Dump command arguments */ void cmd_delay(CMD_ARGS) { double f; (void)priv; (void)cmd; if (av == NULL) return; AN(av[1]); AZ(av[2]); f = VNUM(av[1]); vtc_log(vl, 3, "delaying %g second(s)", f); VTIM_sleep(f); } /********************************************************************** * Check random generator */ #define NRNDEXPECT 12 static const unsigned long random_expect[NRNDEXPECT] = { 1804289383, 846930886, 1681692777, 1714636915, 1957747793, 424238335, 719885386, 1649760492, 596516649, 1189641421, 1025202362, 1350490027 }; #define RND_NEXT_1K 0x3bdcbe30 static void cmd_random(CMD_ARGS) { uint32_t l; int i; (void)cmd; (void)priv; if (av == NULL) return; srandom(1); for (i = 0; i < NRNDEXPECT; i++) { l = random(); if (l == random_expect[i]) continue; vtc_log(vl, 4, "random[%d] = 0x%x (expect 0x%lx)", i, l, random_expect[i]); vtc_log(vl, 1, "SKIPPING test: unknown srandom(1) sequence."); vtc_stop = 1; break; } l = 0; for (i = 0; i < 1000; i++) l += random(); if (l != RND_NEXT_1K) { vtc_log(vl, 4, "sum(random[%d...%d]) = 0x%x (expect 0x%x)", NRNDEXPECT, NRNDEXPECT + 1000, l, RND_NEXT_1K); vtc_log(vl, 1, "SKIPPING test: unknown srandom(1) sequence."); vtc_stop = 1; } } /********************************************************************** * Check features. */ static void cmd_feature(CMD_ARGS) { int i; (void)priv; (void)cmd; if (av == NULL) return; for (i = 1; av[i] != NULL; i++) { #ifdef SO_RCVTIMEO_WORKS if (!strcmp(av[i], "SO_RCVTIMEO_WORKS")) continue; #endif if (sizeof(void*) == 8 && !strcmp(av[i], "64bit")) continue; if (!strcmp(av[i], "pcre_jit") && VRE_has_jit) continue; if (!strcmp(av[i], "!OSX")) { #if !defined(__APPLE__) || !defined(__MACH__) continue; #endif } if (!strcmp(av[i], "dns") && feature_dns) continue; if (!strcmp(av[i], "topbuild") && iflg) continue; if (!strcmp(av[i], "root") && !geteuid()) continue; if (!strcmp(av[i], "user_varnish") && getpwnam("varnish") != NULL) continue; if (!strcmp(av[i], "user_vcache") && getpwnam("vcache") != NULL) continue; if (!strcmp(av[i], "group_varnish") && getgrnam("varnish") != NULL) continue; vtc_log(vl, 1, "SKIPPING test, missing feature: %s", av[i]); vtc_stop = 1; return; } } /********************************************************************** * Execute a file */ static const struct cmds cmds[] = { { "server", cmd_server }, { "client", cmd_client }, { "varnish", cmd_varnish }, { "delay", cmd_delay }, { "varnishtest",cmd_varnishtest }, { "shell", cmd_shell }, { "err_shell", cmd_err_shell }, { "sema", cmd_sema }, { "random", cmd_random }, { "feature", cmd_feature }, { "logexpect", cmd_logexp }, { "process", cmd_process }, { NULL, NULL } }; int exec_file(const char *fn, const char *script, const char *tmpdir, char *logbuf, unsigned loglen) { unsigned old_err; FILE *f; struct extmacro *m; (void)signal(SIGPIPE, SIG_IGN); vtc_loginit(logbuf, loglen); vltop = vtc_logopen("top"); AN(vltop); init_macro(); init_sema(); init_server(); /* Apply extmacro definitions */ VTAILQ_FOREACH(m, &extmacro_list, list) macro_def(vltop, NULL, m->name, "%s", m->val); /* * We need an IP number which will not repond, ever, and that is a * lot harder than it sounds. This IP# is from RFC5737 and a * C-class broadcast at that. * If tests involving ${bad_ip} fails and you run linux, you should * check your /proc/sys/net/ipv4/ip_nonlocal_bind setting. */ macro_def(vltop, NULL, "bad_ip", "192.0.2.255"); /* Move into our tmpdir */ AZ(chdir(tmpdir)); macro_def(vltop, NULL, "tmpdir", "%s", tmpdir); /* Drop file to tell what was going on here */ f = fopen("INFO", "w"); AN(f); fprintf(f, "Test case: %s\n", fn); AZ(fclose(f)); vtc_stop = 0; vtc_log(vltop, 1, "TEST %s starting", fn); vtc_thread = pthread_self(); parse_string(script, cmds, NULL, vltop); old_err = vtc_error; vtc_stop = 1; vtc_log(vltop, 1, "RESETTING after %s", fn); reset_cmds(cmds); vtc_error |= old_err; if (vtc_error) vtc_log(vltop, 1, "TEST %s FAILED", fn); else vtc_log(vltop, 1, "TEST %s completed", fn); return (vtc_error); } varnish-4.1.1/bin/varnishtest/Makefile.in0000644000201500234410000014121312652366726015314 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = varnishtest$(EXEEXT) subdir = bin/varnishtest DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_varnishtest_OBJECTS = varnishtest-vtc.$(OBJEXT) \ varnishtest-vtc_client.$(OBJEXT) \ varnishtest-vtc_http.$(OBJEXT) varnishtest-vtc_main.$(OBJEXT) \ varnishtest-vtc_log.$(OBJEXT) varnishtest-vtc_sema.$(OBJEXT) \ varnishtest-vtc_server.$(OBJEXT) \ varnishtest-vtc_varnish.$(OBJEXT) \ varnishtest-vtc_logexp.$(OBJEXT) \ varnishtest-vtc_process.$(OBJEXT) varnishtest_OBJECTS = $(am_varnishtest_OBJECTS) am__DEPENDENCIES_1 = varnishtest_DEPENDENCIES = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(top_builddir)/lib/libvgz/libvgz.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent varnishtest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(varnishtest_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(varnishtest_SOURCES) DIST_SOURCES = $(varnishtest_SOURCES) ETAGS = etags CTAGS = ctags # If stdout is a non-dumb tty, use colors. If test -t is not supported, # then this fails; a conservative approach. Of course do not redirect # stdout here, just stderr. am__tty_colors = \ red=; grn=; lgn=; blu=; std=; \ test "X$(AM_COLOR_TESTS)" != Xno \ && test "X$$TERM" != Xdumb \ && { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \ && { \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ std=''; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } # Restructured Text title and section. am__rst_title = sed 's/.*/ & /;h;s/./=/g;p;x;p;g;p;s/.*//' am__rst_section = sed 'p;s/./=/g;p;g' # Put stdin (possibly several lines separated by ". ") in a box. # Prefix each line by 'col' and terminate each with 'std', for coloring. # Multi line coloring is problematic with "less -R", so we really need # to color each line individually. am__text_box = $(AWK) '{ \ n = split($$0, lines, "\\. "); max = 0; \ for (i = 1; i <= n; ++i) \ if (max < length(lines[i])) \ max = length(lines[i]); \ for (i = 0; i < max; ++i) \ line = line "="; \ print col line std; \ for (i = 1; i <= n; ++i) \ if (lines[i]) \ print col lines[i] std; \ print col line std; \ }' # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log, and passes # TESTS_ENVIRONMENT. Save and restore TERM around use of # TESTS_ENVIRONMENT, in case that unsets it. am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ srcdir=$(srcdir); export srcdir; \ rm -f $@-t; \ am__trap='rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st'; \ trap "st=129; $$am__trap" 1; trap "st=130; $$am__trap" 2; \ trap "st=141; $$am__trap" 13; trap "st=143; $$am__trap" 15; \ am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`; \ test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; __SAVED_TERM=$$TERM; \ $(TESTS_ENVIRONMENT) # To be appended to the command running the test. Handle the stdout # and stderr redirection, and catch the exit status. am__check_post = \ >$@-t 2>&1; \ estatus=$$?; \ if test -n '$(DISABLE_HARD_ERRORS)' \ && test $$estatus -eq 99; then \ estatus=1; \ fi; \ TERM=$$__SAVED_TERM; export TERM; \ $(am__tty_colors); \ xfailed=PASS; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ xfailed=XFAIL;; \ esac; \ case $$estatus.$$xfailed in \ 0.XFAIL) col=$$red; res=XPASS;; \ 0.*) col=$$grn; res=PASS ;; \ 77.*) col=$$blu; res=SKIP ;; \ 99.*) col=$$red; res=FAIL ;; \ *.XFAIL) col=$$lgn; res=XFAIL;; \ *.*) col=$$red; res=FAIL ;; \ esac; \ echo "$${col}$$res$${std}: $$f"; \ echo "$$res: $$f (exit: $$estatus)" | \ $(am__rst_section) >$@; \ cat $@-t >>$@; \ rm -f $@-t RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck check-html recheck-html TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html) TEST_SUITE_LOG = test-suite.log am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.vtc.log=.log) VTC_LOG_COMPILE = $(VTC_LOG_COMPILER) $(AM_VTC_LOG_FLAGS) \ $(VTC_LOG_FLAGS) TEST_LOGS_TMP = $(TEST_LOGS:.log=.log-t) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ VTC_LOG_COMPILER = ./varnishtest -v -i TEST_EXTENSIONS = .vtc TESTS = @VTC_TESTS@ DISTCLEANFILES = _.ok AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ -I$(top_srcdir)/lib/libvgz varnishtest_SOURCES = \ vtc.c \ vtc.h \ vmods.h \ programs.h \ vtc_client.c \ vtc_http.c \ vtc_main.c \ vtc_log.c \ vtc_sema.c \ vtc_server.c \ vtc_varnish.c \ vtc_logexp.c \ vtc_process.c varnishtest_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(top_builddir)/lib/libvgz/libvgz.la \ ${LIBM} ${PTHREAD_LIBS} varnishtest_CFLAGS = \ -DTOP_BUILDDIR='"${top_builddir}"' EXTRA_DIST = $(top_srcdir)/bin/varnishtest/tests/*.vtc \ $(top_srcdir)/bin/varnishtest/tests/README all: all-am .SUFFIXES: .SUFFIXES: .c .html .lo .log .o .obj .vtc .vtc$(EXEEXT) $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/varnishtest/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign bin/varnishtest/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list varnishtest$(EXEEXT): $(varnishtest_OBJECTS) $(varnishtest_DEPENDENCIES) $(EXTRA_varnishtest_DEPENDENCIES) @rm -f varnishtest$(EXEEXT) $(AM_V_CCLD)$(varnishtest_LINK) $(varnishtest_OBJECTS) $(varnishtest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishtest-vtc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishtest-vtc_client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishtest-vtc_http.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishtest-vtc_log.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishtest-vtc_logexp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishtest-vtc_main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishtest-vtc_process.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishtest-vtc_sema.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishtest-vtc_server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varnishtest-vtc_varnish.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< varnishtest-vtc.o: vtc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc.o -MD -MP -MF $(DEPDIR)/varnishtest-vtc.Tpo -c -o varnishtest-vtc.o `test -f 'vtc.c' || echo '$(srcdir)/'`vtc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc.Tpo $(DEPDIR)/varnishtest-vtc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc.c' object='varnishtest-vtc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc.o `test -f 'vtc.c' || echo '$(srcdir)/'`vtc.c varnishtest-vtc.obj: vtc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc.obj -MD -MP -MF $(DEPDIR)/varnishtest-vtc.Tpo -c -o varnishtest-vtc.obj `if test -f 'vtc.c'; then $(CYGPATH_W) 'vtc.c'; else $(CYGPATH_W) '$(srcdir)/vtc.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc.Tpo $(DEPDIR)/varnishtest-vtc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc.c' object='varnishtest-vtc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc.obj `if test -f 'vtc.c'; then $(CYGPATH_W) 'vtc.c'; else $(CYGPATH_W) '$(srcdir)/vtc.c'; fi` varnishtest-vtc_client.o: vtc_client.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_client.o -MD -MP -MF $(DEPDIR)/varnishtest-vtc_client.Tpo -c -o varnishtest-vtc_client.o `test -f 'vtc_client.c' || echo '$(srcdir)/'`vtc_client.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_client.Tpo $(DEPDIR)/varnishtest-vtc_client.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_client.c' object='varnishtest-vtc_client.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_client.o `test -f 'vtc_client.c' || echo '$(srcdir)/'`vtc_client.c varnishtest-vtc_client.obj: vtc_client.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_client.obj -MD -MP -MF $(DEPDIR)/varnishtest-vtc_client.Tpo -c -o varnishtest-vtc_client.obj `if test -f 'vtc_client.c'; then $(CYGPATH_W) 'vtc_client.c'; else $(CYGPATH_W) '$(srcdir)/vtc_client.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_client.Tpo $(DEPDIR)/varnishtest-vtc_client.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_client.c' object='varnishtest-vtc_client.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_client.obj `if test -f 'vtc_client.c'; then $(CYGPATH_W) 'vtc_client.c'; else $(CYGPATH_W) '$(srcdir)/vtc_client.c'; fi` varnishtest-vtc_http.o: vtc_http.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_http.o -MD -MP -MF $(DEPDIR)/varnishtest-vtc_http.Tpo -c -o varnishtest-vtc_http.o `test -f 'vtc_http.c' || echo '$(srcdir)/'`vtc_http.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_http.Tpo $(DEPDIR)/varnishtest-vtc_http.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_http.c' object='varnishtest-vtc_http.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_http.o `test -f 'vtc_http.c' || echo '$(srcdir)/'`vtc_http.c varnishtest-vtc_http.obj: vtc_http.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_http.obj -MD -MP -MF $(DEPDIR)/varnishtest-vtc_http.Tpo -c -o varnishtest-vtc_http.obj `if test -f 'vtc_http.c'; then $(CYGPATH_W) 'vtc_http.c'; else $(CYGPATH_W) '$(srcdir)/vtc_http.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_http.Tpo $(DEPDIR)/varnishtest-vtc_http.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_http.c' object='varnishtest-vtc_http.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_http.obj `if test -f 'vtc_http.c'; then $(CYGPATH_W) 'vtc_http.c'; else $(CYGPATH_W) '$(srcdir)/vtc_http.c'; fi` varnishtest-vtc_main.o: vtc_main.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_main.o -MD -MP -MF $(DEPDIR)/varnishtest-vtc_main.Tpo -c -o varnishtest-vtc_main.o `test -f 'vtc_main.c' || echo '$(srcdir)/'`vtc_main.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_main.Tpo $(DEPDIR)/varnishtest-vtc_main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_main.c' object='varnishtest-vtc_main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_main.o `test -f 'vtc_main.c' || echo '$(srcdir)/'`vtc_main.c varnishtest-vtc_main.obj: vtc_main.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_main.obj -MD -MP -MF $(DEPDIR)/varnishtest-vtc_main.Tpo -c -o varnishtest-vtc_main.obj `if test -f 'vtc_main.c'; then $(CYGPATH_W) 'vtc_main.c'; else $(CYGPATH_W) '$(srcdir)/vtc_main.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_main.Tpo $(DEPDIR)/varnishtest-vtc_main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_main.c' object='varnishtest-vtc_main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_main.obj `if test -f 'vtc_main.c'; then $(CYGPATH_W) 'vtc_main.c'; else $(CYGPATH_W) '$(srcdir)/vtc_main.c'; fi` varnishtest-vtc_log.o: vtc_log.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_log.o -MD -MP -MF $(DEPDIR)/varnishtest-vtc_log.Tpo -c -o varnishtest-vtc_log.o `test -f 'vtc_log.c' || echo '$(srcdir)/'`vtc_log.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_log.Tpo $(DEPDIR)/varnishtest-vtc_log.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_log.c' object='varnishtest-vtc_log.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_log.o `test -f 'vtc_log.c' || echo '$(srcdir)/'`vtc_log.c varnishtest-vtc_log.obj: vtc_log.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_log.obj -MD -MP -MF $(DEPDIR)/varnishtest-vtc_log.Tpo -c -o varnishtest-vtc_log.obj `if test -f 'vtc_log.c'; then $(CYGPATH_W) 'vtc_log.c'; else $(CYGPATH_W) '$(srcdir)/vtc_log.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_log.Tpo $(DEPDIR)/varnishtest-vtc_log.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_log.c' object='varnishtest-vtc_log.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_log.obj `if test -f 'vtc_log.c'; then $(CYGPATH_W) 'vtc_log.c'; else $(CYGPATH_W) '$(srcdir)/vtc_log.c'; fi` varnishtest-vtc_sema.o: vtc_sema.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_sema.o -MD -MP -MF $(DEPDIR)/varnishtest-vtc_sema.Tpo -c -o varnishtest-vtc_sema.o `test -f 'vtc_sema.c' || echo '$(srcdir)/'`vtc_sema.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_sema.Tpo $(DEPDIR)/varnishtest-vtc_sema.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_sema.c' object='varnishtest-vtc_sema.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_sema.o `test -f 'vtc_sema.c' || echo '$(srcdir)/'`vtc_sema.c varnishtest-vtc_sema.obj: vtc_sema.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_sema.obj -MD -MP -MF $(DEPDIR)/varnishtest-vtc_sema.Tpo -c -o varnishtest-vtc_sema.obj `if test -f 'vtc_sema.c'; then $(CYGPATH_W) 'vtc_sema.c'; else $(CYGPATH_W) '$(srcdir)/vtc_sema.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_sema.Tpo $(DEPDIR)/varnishtest-vtc_sema.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_sema.c' object='varnishtest-vtc_sema.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_sema.obj `if test -f 'vtc_sema.c'; then $(CYGPATH_W) 'vtc_sema.c'; else $(CYGPATH_W) '$(srcdir)/vtc_sema.c'; fi` varnishtest-vtc_server.o: vtc_server.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_server.o -MD -MP -MF $(DEPDIR)/varnishtest-vtc_server.Tpo -c -o varnishtest-vtc_server.o `test -f 'vtc_server.c' || echo '$(srcdir)/'`vtc_server.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_server.Tpo $(DEPDIR)/varnishtest-vtc_server.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_server.c' object='varnishtest-vtc_server.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_server.o `test -f 'vtc_server.c' || echo '$(srcdir)/'`vtc_server.c varnishtest-vtc_server.obj: vtc_server.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_server.obj -MD -MP -MF $(DEPDIR)/varnishtest-vtc_server.Tpo -c -o varnishtest-vtc_server.obj `if test -f 'vtc_server.c'; then $(CYGPATH_W) 'vtc_server.c'; else $(CYGPATH_W) '$(srcdir)/vtc_server.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_server.Tpo $(DEPDIR)/varnishtest-vtc_server.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_server.c' object='varnishtest-vtc_server.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_server.obj `if test -f 'vtc_server.c'; then $(CYGPATH_W) 'vtc_server.c'; else $(CYGPATH_W) '$(srcdir)/vtc_server.c'; fi` varnishtest-vtc_varnish.o: vtc_varnish.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_varnish.o -MD -MP -MF $(DEPDIR)/varnishtest-vtc_varnish.Tpo -c -o varnishtest-vtc_varnish.o `test -f 'vtc_varnish.c' || echo '$(srcdir)/'`vtc_varnish.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_varnish.Tpo $(DEPDIR)/varnishtest-vtc_varnish.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_varnish.c' object='varnishtest-vtc_varnish.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_varnish.o `test -f 'vtc_varnish.c' || echo '$(srcdir)/'`vtc_varnish.c varnishtest-vtc_varnish.obj: vtc_varnish.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_varnish.obj -MD -MP -MF $(DEPDIR)/varnishtest-vtc_varnish.Tpo -c -o varnishtest-vtc_varnish.obj `if test -f 'vtc_varnish.c'; then $(CYGPATH_W) 'vtc_varnish.c'; else $(CYGPATH_W) '$(srcdir)/vtc_varnish.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_varnish.Tpo $(DEPDIR)/varnishtest-vtc_varnish.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_varnish.c' object='varnishtest-vtc_varnish.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_varnish.obj `if test -f 'vtc_varnish.c'; then $(CYGPATH_W) 'vtc_varnish.c'; else $(CYGPATH_W) '$(srcdir)/vtc_varnish.c'; fi` varnishtest-vtc_logexp.o: vtc_logexp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_logexp.o -MD -MP -MF $(DEPDIR)/varnishtest-vtc_logexp.Tpo -c -o varnishtest-vtc_logexp.o `test -f 'vtc_logexp.c' || echo '$(srcdir)/'`vtc_logexp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_logexp.Tpo $(DEPDIR)/varnishtest-vtc_logexp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_logexp.c' object='varnishtest-vtc_logexp.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_logexp.o `test -f 'vtc_logexp.c' || echo '$(srcdir)/'`vtc_logexp.c varnishtest-vtc_logexp.obj: vtc_logexp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_logexp.obj -MD -MP -MF $(DEPDIR)/varnishtest-vtc_logexp.Tpo -c -o varnishtest-vtc_logexp.obj `if test -f 'vtc_logexp.c'; then $(CYGPATH_W) 'vtc_logexp.c'; else $(CYGPATH_W) '$(srcdir)/vtc_logexp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_logexp.Tpo $(DEPDIR)/varnishtest-vtc_logexp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_logexp.c' object='varnishtest-vtc_logexp.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_logexp.obj `if test -f 'vtc_logexp.c'; then $(CYGPATH_W) 'vtc_logexp.c'; else $(CYGPATH_W) '$(srcdir)/vtc_logexp.c'; fi` varnishtest-vtc_process.o: vtc_process.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_process.o -MD -MP -MF $(DEPDIR)/varnishtest-vtc_process.Tpo -c -o varnishtest-vtc_process.o `test -f 'vtc_process.c' || echo '$(srcdir)/'`vtc_process.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_process.Tpo $(DEPDIR)/varnishtest-vtc_process.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_process.c' object='varnishtest-vtc_process.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_process.o `test -f 'vtc_process.c' || echo '$(srcdir)/'`vtc_process.c varnishtest-vtc_process.obj: vtc_process.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -MT varnishtest-vtc_process.obj -MD -MP -MF $(DEPDIR)/varnishtest-vtc_process.Tpo -c -o varnishtest-vtc_process.obj `if test -f 'vtc_process.c'; then $(CYGPATH_W) 'vtc_process.c'; else $(CYGPATH_W) '$(srcdir)/vtc_process.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/varnishtest-vtc_process.Tpo $(DEPDIR)/varnishtest-vtc_process.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtc_process.c' object='varnishtest-vtc_process.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(varnishtest_CFLAGS) $(CFLAGS) -c -o varnishtest-vtc_process.obj `if test -f 'vtc_process.c'; then $(CYGPATH_W) 'vtc_process.c'; else $(CYGPATH_W) '$(srcdir)/vtc_process.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__sh_e_setup); \ list='$(TEST_LOGS)'; \ results=`for f in $$list; do \ test -r $$f && read line < $$f && echo "$$line" \ || echo FAIL; \ done`; \ all=`echo "$$results" | sed '/^$$/d' | wc -l | sed -e 's/^[ ]*//'`; \ fail=`echo "$$results" | grep -c '^FAIL'`; \ pass=`echo "$$results" | grep -c '^PASS'`; \ skip=`echo "$$results" | grep -c '^SKIP'`; \ xfail=`echo "$$results" | grep -c '^XFAIL'`; \ xpass=`echo "$$results" | grep -c '^XPASS'`; \ failures=`expr $$fail + $$xpass`; \ all=`expr $$all - $$skip`; \ if test "$$all" -eq 1; then tests=test; All=; \ else tests=tests; All="All "; fi; \ case fail=$$fail:xpass=$$xpass:xfail=$$xfail in \ fail=0:xpass=0:xfail=0) \ msg="$$All$$all $$tests passed. "; \ exit=true;; \ fail=0:xpass=0:xfail=*) \ msg="$$All$$all $$tests behaved as expected"; \ if test "$$xfail" -eq 1; then xfailures=failure; \ else xfailures=failures; fi; \ msg="$$msg ($$xfail expected $$xfailures). "; \ exit=true;; \ fail=*:xpass=0:xfail=*) \ msg="$$fail of $$all $$tests failed. "; \ exit=false;; \ fail=*:xpass=*:xfail=*) \ msg="$$failures of $$all $$tests did not behave as expected"; \ if test "$$xpass" -eq 1; then xpasses=pass; \ else xpasses=passes; fi; \ msg="$$msg ($$xpass unexpected $$xpasses). "; \ exit=false;; \ *) \ echo >&2 "incorrect case"; exit 4;; \ esac; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ msg="$$msg($$skip test was not run). "; \ else \ msg="$$msg($$skip tests were not run). "; \ fi; \ fi; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ echo "$$msg"; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for f in $$list; do \ test -r $$f && read line < $$f || line=; \ case $$line in \ PASS:*|XFAIL:*);; \ *) echo; cat $$f;; \ esac; \ done; \ } >$(TEST_SUITE_LOG).tmp; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if test "$$failures" -ne 0; then \ msg="$${msg}See $(subdir)/$(TEST_SUITE_LOG). "; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ msg="$${msg}Please report to $(PACKAGE_BUGREPORT). "; \ fi; \ fi; \ test x"$$VERBOSE" = x || $$exit || cat $(TEST_SUITE_LOG); \ $(am__tty_colors); \ if $$exit; then \ col="$$grn"; \ else \ col="$$red"; \ fi; \ echo "$$msg" | $(am__text_box) "col=$$col" "std=$$std"; \ $$exit || exit 1 check-TESTS recheck: @if test $@ != recheck; then \ list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list; \ fi @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @list='' list2='$(TEST_LOGS)'; for f in $$list2; do \ test .log = $$f && continue; \ if test $@ = recheck; then \ test -f $$f || continue; \ if test -r $$f && read line < $$f; then \ case $$line in FAIL*|XPASS*) : ;; *) continue;; esac; \ fi; \ fi; \ if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \ done; \ if test $@ = recheck && test -n "$$list"; then \ echo "am--clean: ; rm -f $$list" \ | $(MAKE) $(AM_MAKEFLAGS) -f - am--clean || exit 1; \ fi; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list" recheck: am--mostlyclean-test-html: list='$(TEST_LOGS:.log=.html)'; test -z "$$list" || rm -f $$list rm -f $(TEST_SUITE_HTML) .log.html: @list='$(RST2HTML) $$RST2HTML rst2html rst2html.py'; \ for r2h in $$list; do \ if ($$r2h --version) >/dev/null 2>&1; then \ R2H=$$r2h; \ fi; \ done; \ if test -z "$$R2H"; then \ echo >&2 "cannot find rst2html, cannot create $@"; \ exit 2; \ fi; \ $$R2H $< >$@.tmp @mv $@.tmp $@ # Be sure to run check first, and then to convert the result. # Beware of concurrent executions. Run "check" not "check-TESTS", as # check-SCRIPTS and other dependencies are rebuilt by the former only. # And expect check to fail. check-html recheck-html: @target=`echo $@ | sed 's/-html$$//'`; \ rv=0; $(MAKE) $(AM_MAKEFLAGS) $$target || rv=$$?; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) TEST_LOGS= || exit 4; \ exit $$rv .vtc.log: @p='$<'; $(am__check_pre) $(VTC_LOG_COMPILE) "$$tst" $(am__check_post) @am__EXEEXT_TRUE@.vtc$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; $(am__check_pre) $(VTC_LOG_COMPILE) "$$tst" $(am__check_post) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS_TMP)" || rm -f $(TEST_LOGS_TMP) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: am--mostlyclean-test-html mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: check-am check-html install-am install-strip recheck-html .PHONY: CTAGS GTAGS all all-am am--mostlyclean-test-html check \ check-TESTS check-am check-html check-local clean \ clean-binPROGRAMS clean-generic clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck recheck-html tags uninstall uninstall-am \ uninstall-binPROGRAMS # Make sure we run check-local first check: check-am check-local check-am: check-local # See if list of checks have changed, recheck check-local: if [ "$$(cd $(srcdir) && echo tests/*.vtc)" != "@VTC_TESTS@" ]; then \ cd $(top_builddir) && ./config.status --recheck ; \ fi # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/bin/varnishtest/vtc_main.c0000644000201500234410000003142712652366721015213 00000000000000/*- * Copyright (c) 2008-2011 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. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "vtc.h" #include "vev.h" #include "vfil.h" #include "vnum.h" #include "vqueue.h" #include "vrnd.h" #include "vsa.h" #include "vss.h" #include "vsub.h" #include "vtcp.h" #include "vtim.h" #define MAX_FILESIZE (1024 * 1024) struct vtc_tst { unsigned magic; #define TST_MAGIC 0x618d8b88 VTAILQ_ENTRY(vtc_tst) list; const char *filename; char *script; unsigned ntodo; }; struct vtc_job { unsigned magic; #define JOB_MAGIC 0x1b5fc419 struct vtc_tst *tst; pid_t child; struct vev *ev; struct vev *evt; char *buf; char *tmpdir; unsigned bufsiz; double t0; }; int iflg = 0; unsigned vtc_maxdur = 60; unsigned vtc_bufsiz = 512 * 1024; static VTAILQ_HEAD(, vtc_tst) tst_head = VTAILQ_HEAD_INITIALIZER(tst_head); static struct vev_base *vb; static int njob = 0; static int npar = 1; /* Number of parallel tests */ static int vtc_continue; /* Continue on error */ static int vtc_verbosity = 1; /* Verbosity Level */ static int vtc_good; static int vtc_fail; static char *tmppath; static char *cwd = NULL; int leave_temp; int vtc_witness = 0; int feature_dns; /********************************************************************** * Parse a -D option argument into a name/val pair, and insert * into extmacro list */ static int parse_D_opt(char *arg) { char *p, *q; p = arg; q = strchr(p, '='); if (!q) return (0); *q++ = '\0'; extmacro_def(p, "%s", q); return (1); } /********************************************************************** * Print usage */ static void usage(void) { fprintf(stderr, "usage: varnishtest [options] file ...\n"); #define FMT " %-28s # %s\n" fprintf(stderr, FMT, "-b size", "Set internal buffer size (default: 512K)"); fprintf(stderr, FMT, "-D name=val", "Define macro"); fprintf(stderr, FMT, "-i", "Find varnishd in build tree"); fprintf(stderr, FMT, "-j jobs", "Run this many tests in parallel"); fprintf(stderr, FMT, "-k", "Continue on test failure"); fprintf(stderr, FMT, "-L", "Always leave temporary vtc.*"); fprintf(stderr, FMT, "-l", "Leave temporary vtc.* if test fails"); fprintf(stderr, FMT, "-n iterations", "Run tests this many times"); fprintf(stderr, FMT, "-q", "Quiet mode: report only failures"); fprintf(stderr, FMT, "-t duration", "Time tests out after this long"); fprintf(stderr, FMT, "-v", "Verbose mode: always report test log"); fprintf(stderr, FMT, "-W", "Enable the witness facility for locking"); fprintf(stderr, "\n"); exit(1); } /********************************************************************** * CallBack */ static int tst_cb(const struct vev *ve, int what) { struct vtc_job *jp; char buf[BUFSIZ]; int i, stx; pid_t px; double t; FILE *f; CAST_OBJ_NOTNULL(jp, ve->priv, JOB_MAGIC); // printf("%p %s %d\n", ve, jp->tst->filename, what); if (what == 0) AZ(kill(jp->child, SIGKILL)); /* XXX: Timeout */ else assert(what & (EV_RD | EV_HUP)); *buf = '\0'; i = read(ve->fd, buf, sizeof buf - 1); if (i > 0) { buf[i] = '\0'; printf("######## %s ########\n%s", jp->tst->filename, buf); } if (i == 0) { njob--; px = wait4(jp->child, &stx, 0, NULL); assert(px == jp->child); t = VTIM_mono() - jp->t0; AZ(close(ve->fd)); if (stx && vtc_verbosity) printf("%s\n", jp->buf); else if (vtc_verbosity > 1) printf("%s\n", jp->buf); if (stx) vtc_fail++; else vtc_good++; if (leave_temp == 0 || (leave_temp == 1 && !stx)) { bprintf(buf, "rm -rf %s", jp->tmpdir); AZ(system(buf)); } else { bprintf(buf, "%s/LOG", jp->tmpdir); f = fopen(buf, "w"); AN(f); (void)fprintf(f, "%s\n", jp->buf); AZ(fclose(f)); } free(jp->tmpdir); if (stx) { printf("# top TEST %s FAILED (%.3f)", jp->tst->filename, t); if (WIFSIGNALED(stx)) printf(" signal=%d", WTERMSIG(stx)); printf(" exit=%d\n", WEXITSTATUS(stx)); if (!vtc_continue) { /* XXX kill -9 other jobs ? */ exit(2); } } else if (vtc_verbosity) { printf("# top TEST %s passed (%.3f)\n", jp->tst->filename, t); } AZ(munmap(jp->buf, jp->bufsiz)); if (jp->evt != NULL) vev_del(vb, jp->evt); FREE_OBJ(jp); return (1); } return (0); } /********************************************************************** * Start Test */ static void start_test(void) { struct vtc_tst *tp; int p[2], retval; struct vtc_job *jp; char tmpdir[PATH_MAX]; ALLOC_OBJ(jp, JOB_MAGIC); AN(jp); jp->bufsiz = vtc_bufsiz; jp->buf = mmap(NULL, jp->bufsiz, PROT_READ|PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); assert(jp->buf != MAP_FAILED); memset(jp->buf, 0, jp->bufsiz); VRND_Seed(); bprintf(tmpdir, "%s/vtc.%d.%08x", tmppath, (int)getpid(), (unsigned)random()); AZ(mkdir(tmpdir, 0711)); tp = VTAILQ_FIRST(&tst_head); CHECK_OBJ_NOTNULL(tp, TST_MAGIC); AN(tp->ntodo); tp->ntodo--; VTAILQ_REMOVE(&tst_head, tp, list); if (tp->ntodo >0) VTAILQ_INSERT_TAIL(&tst_head, tp, list); jp->tst = tp; jp->tmpdir = strdup(tmpdir); AN(jp->tmpdir); AZ(pipe(p)); assert(p[0] > STDERR_FILENO); assert(p[1] > STDERR_FILENO); jp->t0 = VTIM_mono(); jp->child = fork(); assert(jp->child >= 0); if (jp->child == 0) { AZ(close(STDIN_FILENO)); assert(open("/dev/null", O_RDONLY) == STDIN_FILENO); assert(dup2(p[1], STDOUT_FILENO) == STDOUT_FILENO); assert(dup2(p[1], STDERR_FILENO) == STDERR_FILENO); VSUB_closefrom(STDERR_FILENO + 1); retval = exec_file(jp->tst->filename, jp->tst->script, jp->tmpdir, jp->buf, jp->bufsiz); exit(retval); } AZ(close(p[1])); jp->ev = vev_new(); AN(jp->ev); jp->ev->fd_flags = EV_RD | EV_HUP | EV_ERR; jp->ev->fd = p[0]; jp->ev->priv = jp; jp->ev->callback = tst_cb; AZ(vev_add(vb, jp->ev)); jp->evt = vev_new(); AN(jp->evt); jp->evt->fd = -1; jp->evt->timeout = vtc_maxdur; jp->evt->priv = jp; jp->evt->callback = tst_cb; AZ(vev_add(vb, jp->evt)); } /********************************************************************** * i-mode = "we're inside a src-tree" * * Find the abs path to top of source dir from Makefile, if that * fails, fall back on "../../" * * Set path to all programs build directories * */ static void i_mode(void) { const char *sep; struct vsb *vsb; char *p, *q; char *topbuild; /* * This code has a rather intimate knowledge of auto* generated * makefiles. */ vsb = VSB_new_auto(); q = p = VFIL_readfile(NULL, "Makefile", NULL); if (p == NULL) { fprintf(stderr, "No Makefile to search for -i flag.\n"); VSB_printf(vsb, "%s/../..", cwd); AZ(VSB_finish(vsb)); topbuild = strdup(VSB_data(vsb)); VSB_clear(vsb); } else { p = strstr(p, "\nabs_top_builddir"); if (p == NULL) { fprintf(stderr, "could not find 'abs_top_builddir' in Makefile\n"); exit(2); } topbuild = strchr(p + 1, '\n'); if (topbuild == NULL) { fprintf(stderr, "No NL after 'abs_top_builddir' in Makefile\n"); exit(2); } *topbuild = '\0'; topbuild = strchr(p, '/'); if (topbuild == NULL) { fprintf(stderr, "No '/' after 'abs_top_builddir' in Makefile\n"); exit(2); } topbuild = strdup(topbuild); free(q); } AN(topbuild); extmacro_def("topbuild", "%s", topbuild); /* * Build $PATH which can find all programs in the build tree */ AN(vsb); VSB_printf(vsb, "PATH="); sep = ""; #define VTC_PROG(l) \ do { \ VSB_printf(vsb, "%s%s/bin/%s/", sep, topbuild, #l); \ sep = ":"; \ } while (0); #include "programs.h" #undef VTC_PROG VSB_printf(vsb, ":%s", getenv("PATH")); AZ(VSB_finish(vsb)); AZ(putenv(strdup(VSB_data(vsb)))); /* * Redefine VMOD macros */ #define VTC_VMOD(l) \ do { \ VSB_clear(vsb); \ VSB_printf(vsb, \ "%s from \"%s/lib/libvmod_%s/.libs/libvmod_%s.so\"", \ #l, topbuild, #l, #l); \ AZ(VSB_finish(vsb)); \ extmacro_def("vmod_" #l, "%s", VSB_data(vsb)); \ } while (0); #include "vmods.h" #undef VTC_VMOD free(topbuild); VSB_delete(vsb); } /********************************************************************** * Most test-cases use only numeric IP#'s but a few requires non-demented * DNS services. This is a basic sanity check for those. */ static int __match_proto__(vss_resolved_f) dns_cb(void *priv, const struct suckaddr *sa) { char abuf[VTCP_ADDRBUFSIZE]; char pbuf[VTCP_PORTBUFSIZE]; int *ret = priv; VTCP_name(sa, abuf, sizeof abuf, pbuf, sizeof pbuf); if (strcmp(abuf, "130.225.244.222")) { fprintf(stderr, "DNS-test: Wrong response: %s\n", abuf); *ret = -1; } else if (*ret == 0) *ret = 1; return (0); } static int dns_works(void) { int ret = 0, error; const char *msg; error = VSS_resolver("phk.freebsd.dk", NULL, dns_cb, &ret, &msg); if (error || msg != NULL || ret != 1) return (0); return (1); } /********************************************************************** * Main */ int main(int argc, char * const *argv) { int ch, i; int ntest = 1; /* Run tests this many times */ struct vtc_tst *tp; char *p; uintmax_t bufsiz; /* Default names of programs */ #define VTC_PROG(l) extmacro_def(#l, #l); #include "programs.h" #undef VTC_PROG /* Default import spec of vmods */ #define VTC_VMOD(l) extmacro_def("vmod_" #l, #l); #include "vmods.h" #undef VTC_VMOD if (getenv("TMPDIR") != NULL) tmppath = strdup(getenv("TMPDIR")); else tmppath = strdup("/tmp"); cwd = getcwd(NULL, PATH_MAX); extmacro_def("pwd", "%s", cwd); setbuf(stdout, NULL); setbuf(stderr, NULL); while ((ch = getopt(argc, argv, "b:D:hij:kLln:qt:vW")) != -1) { switch (ch) { case 'b': if (VNUM_2bytes(optarg, &bufsiz, 0)) { fprintf(stderr, "Cannot parse b opt '%s'\n", optarg); exit(2); } if (bufsiz > UINT_MAX) { fprintf(stderr, "Invalid b opt '%s'\n", optarg); exit(2); } vtc_bufsiz = (unsigned)bufsiz; break; case 'D': if (!parse_D_opt(optarg)) { fprintf(stderr, "Cannot parse D opt '%s'\n", optarg); exit(2); } break; case 'i': iflg = 1; break; case 'j': npar = strtoul(optarg, NULL, 0); break; case 'L': leave_temp = 2; break; case 'l': leave_temp = 1; break; case 'k': vtc_continue = !vtc_continue; break; case 'n': ntest = strtoul(optarg, NULL, 0); break; case 'q': if (vtc_verbosity > 0) vtc_verbosity--; break; case 't': vtc_maxdur = strtoul(optarg, NULL, 0); break; case 'v': if (vtc_verbosity < 2) vtc_verbosity++; break; case 'W': vtc_witness++; break; default: usage(); } } argc -= optind; argv += optind; for (;argc > 0; argc--, argv++) { p = VFIL_readfile(NULL, *argv, NULL); if (p == NULL) { fprintf(stderr, "Cannot stat file \"%s\": %s\n", *argv, strerror(errno)); if (vtc_continue) continue; exit(2); } ALLOC_OBJ(tp, TST_MAGIC); AN(tp); tp->filename = *argv; tp->script = p; tp->ntodo = ntest; VTAILQ_INSERT_TAIL(&tst_head, tp, list); } feature_dns = dns_works(); if (iflg) i_mode(); vb = vev_new_base(); i = 0; while(!VTAILQ_EMPTY(&tst_head) || i) { if (!VTAILQ_EMPTY(&tst_head) && njob < npar) { start_test(); njob++; /* Stagger ramp-up */ if (njob < npar) (void)usleep(random() % 100000L); i = 1; continue; } i = vev_schedule_one(vb); } if (vtc_continue) fprintf(stderr, "%d tests failed, %d tests passed\n", vtc_fail, vtc_good); if (vtc_fail) return (1); return (0); } varnish-4.1.1/bin/varnishtest/vmods.h0000644000201500234410000000267012652366721014546 00000000000000/*- * Copyright (c) 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. * */ VTC_VMOD(std) VTC_VMOD(debug) VTC_VMOD(directors) varnish-4.1.1/bin/varnishtest/tests/0000755000201500234410000000000012652366760014465 500000000000000varnish-4.1.1/bin/varnishtest/tests/r00325.vtc0000644000201500234410000000101212652366721015745 00000000000000varnishtest "Check lack of response-string" server s1 { rxreq send "HTTP/1.0 200 \r\n" send "Connection: close\r\n" send "\r\n" send "\r\n" send "FOO\r\n" } -start varnish v1 -vcl+backend {} -start client c1 { txreq -url /bar rxresp expect resp.status == 200 expect resp.msg == OK } -run server s1 { rxreq send "HTTP/1.0 200\r\n" send "Connection: close\r\n" send "\r\n" send "\r\n" send "FOO\r\n" } -start client c1 { txreq -url /foo rxresp expect resp.status == 200 expect resp.msg == OK } -run varnish-4.1.1/bin/varnishtest/tests/r00306.vtc0000644000201500234410000000150712652366721015755 00000000000000varnishtest "Regression test for ticket #306, random director ignoring good backend" server s1 { rxreq expect req.url == /foo txresp -body "foo1" rxreq expect req.url == /bar txresp -body "bar1" } -start server s2 { rxreq txresp -status 404 } -start varnish v1 -vcl { import ${vmod_directors}; backend s1 { .host = "${s1_addr}"; .port = "${s1_port}"; } backend s2 { .host = "${s2_addr}"; .port = "${s2_port}"; } sub vcl_init { new foo = directors.random(); foo.add_backend(s1, 1); foo.add_backend(s2, 1); } sub vcl_backend_fetch { set bereq.backend = foo.backend(); } } -start varnish v1 -cliok "backend.set_health s2 sick" varnish v1 -cliok "backend.list" client c1 { timeout 10 txreq -url "/foo" rxresp expect resp.status == 200 txreq -url "/bar" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/v00024.vtc0000644000201500234410000000072712652366721015761 00000000000000varnishtest "Test that headers can be compared" server s1 { rxreq expect req.url == "/foo" txresp -status 200 -body "1" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.http.etag == req.http.if-none-match) { return(synth(400,"FOO")); } } } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 1 txreq -url "/foo" -hdr {etag: "foo"} -hdr {if-none-match: "foo"} rxresp expect resp.status == 400 } -run varnish-4.1.1/bin/varnishtest/tests/c00018.vtc0000644000201500234410000000055612652366721015741 00000000000000varnishtest "Check Expect headers" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { } -start client c1 { txreq -url "/" -req POST -hdr "Expect: 100-continue " -body "foo" rxresp expect resp.status == 100 rxresp expect resp.status == 200 txreq -url "/" -req POST -hdr "Expect: 101-continue" -body "foo" rxresp expect resp.status == 417 } -run varnish-4.1.1/bin/varnishtest/tests/r00806.vtc0000644000201500234410000000077412652366721015767 00000000000000varnishtest "Content-Length in pass'ed 304 does not trigger body fetch" server s1 { rxreq txresp -status 304 \ -nolen \ -hdr "Date: Mon, 25 Oct 2010 06:34:06 GMT" \ -hdr "Connection: close" \ -hdr "Content-Length: 100" } -start varnish v1 -vcl+backend { sub vcl_recv { return(pass);} sub vcl_deliver { set resp.http.CL = resp.http.content-length; unset resp.http.content-length; } } -start client c1 { txreq rxresp -no_obj expect resp.status == 304 expect resp.http.cl == 100 } -run varnish-4.1.1/bin/varnishtest/tests/c00024.vtc0000644000201500234410000000056712652366721015740 00000000000000varnishtest "Test restart in vcl_synth" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.restarts == 0) { return (synth(701, "FOO")); } } sub vcl_synth { if (req.restarts < 1) { return (restart); } else { set resp.status = 201; } } } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/d00007.vtc0000644000201500234410000000063412652366721015735 00000000000000varnishtest "Test dynamic backends" server s1 { rxreq txresp } -start varnish v1 -vcl { import ${vmod_debug}; backend dummy { .host = "${bad_ip}"; .port = "9080"; } sub vcl_init { new s1 = debug.dyn("${s1_addr}", "${s1_port}"); } sub vcl_recv { set req.backend_hint = s1.backend(); } } -start varnish v1 -expect MAIN.n_backend == 2 client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r00730.vtc0000644000201500234410000000101612652366721015751 00000000000000varnishtest "Check that HEAD returns Content-Length if backend provides it" server s1 { rxreq txresp -bodylen 5 rxreq txresp -nolen -hdr "Content-Length: 6" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.url == "/2") { return (pass); } } sub vcl_backend_response { set beresp.do_stream = false; } } -start client c1 { txreq -req HEAD rxresp -no_obj expect resp.http.content-length == 5 } -run client c1 { txreq -req HEAD -url /2 rxresp -no_obj expect resp.http.content-length == 6 } -run varnish-4.1.1/bin/varnishtest/tests/r01598.vtc0000644000201500234410000000073212652366721015772 00000000000000varnishtest "#1598 - Missing ':' in server response headers" server s1 { rxreq txresp -hdr "ETag: \"tag\"" -hdr "foo" accept rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.ttl = 1s; set beresp.grace = 0s; set beresp.keep = 60s; } } -start varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq rxresp expect resp.status == 503 } -run delay .1 client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01442.vtc0000644000201500234410000000115012652366721015751 00000000000000varnishtest "ESI + IMS" server s1 { rxreq txresp -hdr "Last-Modified: Thu, 26 Jun 2008 12:00:01 GMT" \ -body {bla bla bla} rxreq expect req.http.if-modified-since == "Thu, 26 Jun 2008 12:00:01 GMT" txresp -status "304" -hdr "Last-Modified: Thu, 26 Jun 2008 12:00:01 GMT" -nolen } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; set beresp.grace = 0s; set beresp.keep = 60s; set beresp.ttl = 1s; } } -start client c1 { txreq rxresp expect resp.bodylen == 13 delay 3 txreq rxresp expect resp.bodylen == 13 } -run varnish-4.1.1/bin/varnishtest/tests/r00769.vtc0000644000201500234410000000134512652366721015772 00000000000000varnishtest "Test that set status code is readable again for obj.status and beresp.status" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.url ~ "^/test1") { return (synth(700)); } } sub vcl_backend_response { set beresp.status = 404; set beresp.http.X-status = beresp.status; return (deliver); } sub vcl_synth { if (resp.status == 700) { set resp.status=404; set resp.http.X-status = resp.status; return (deliver); } } } -start client c1 { txreq -url "/test1" rxresp expect resp.status == 404 expect resp.http.X-status == 404 } client c2 { txreq -url "/test2" rxresp expect resp.status == 404 expect resp.http.X-status == 404 } client c1 -run client c2 -run varnish-4.1.1/bin/varnishtest/tests/r00984.vtc0000644000201500234410000000324212652366721015767 00000000000000varnishtest "Status other than 200,203,300,301,302,307,410 and 404 should not be cached" server s1 { rxreq txresp -status 500 rxreq txresp -status 200 -body "11" rxreq txresp -status 200 -body "ban" rxreq txresp -status 503 rxreq txresp -status 200 -body "11" rxreq txresp -status 200 -body "ban" rxreq txresp -status 502 rxreq txresp -status 200 -body "11" rxreq txresp -status 200 -body "ban" rxreq txresp -status 405 rxreq txresp -status 200 -body "11" rxreq txresp -status 200 -body "ban" rxreq txresp -status 200 -body "11" } -start varnish v1 -arg "-t 300" -vcl+backend { sub vcl_recv { if (req.url == "/ban") { ban("req.url ~ /"); } } } -start client c1 { txreq -url "/" rxresp expect resp.status == 500 txreq -url "/" rxresp expect resp.status == 200 expect resp.bodylen == 2 txreq -url "/ban" rxresp expect resp.status == 200 expect resp.bodylen == 3 txreq -url "/" rxresp expect resp.status == 503 txreq -url "/" rxresp expect resp.status == 200 expect resp.bodylen == 2 txreq -url "/ban" rxresp expect resp.status == 200 expect resp.bodylen == 3 txreq -url "/" rxresp expect resp.status == 502 txreq -url "/" rxresp expect resp.status == 200 expect resp.bodylen == 2 txreq -url "/ban" rxresp expect resp.status == 200 expect resp.bodylen == 3 txreq -url "/" rxresp expect resp.status == 405 txreq -url "/" rxresp expect resp.status == 200 expect resp.bodylen == 2 txreq -url "/ban" rxresp expect resp.status == 200 expect resp.bodylen == 3 txreq -url "/" rxresp expect resp.status == 200 expect resp.bodylen == 2 txreq -url "/" rxresp expect resp.status == 200 expect resp.bodylen == 2 } -run varnish-4.1.1/bin/varnishtest/tests/r01501.vtc0000644000201500234410000000041512652366721015750 00000000000000varnishtest "director fails to pick backend" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_recv { set req.backend_hint = debug.no_backend(); } } -start client c1 { txreq rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/e00009.vtc0000644000201500234410000000120512652366721015733 00000000000000varnishtest "ESI binary detector" server s1 { rxreq txresp -body { Before include bar } rxreq txresp -body { Before include bar } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 57 } -run varnish v1 -cli "param.set feature +esi_disable_xml_check" client c1 { txreq -url bar rxresp expect resp.status == 200 expect resp.bodylen == 22 expect resp.http.transfer-encoding == "chunked" } -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/d00000.vtc0000644000201500234410000000232312652366721015723 00000000000000varnishtest "Test round robin director" server s1 { rxreq txresp -body "1" } -start server s2 { rxreq txresp -body "22" } -start server s3 { rxreq txresp -body "333" } -start server s4 { rxreq txresp -body "4444" } -start varnish v1 -vcl+backend { import ${vmod_directors}; sub vcl_init { new rr = directors.round_robin(); rr.add_backend(s1); rr.add_backend(s2); rr.add_backend(s3); rr.add_backend(s4); } sub vcl_recv { if (req.method == "DELETE") { rr.remove_backend(s1); rr.remove_backend(s2); rr.remove_backend(s3); return(synth(204)); } } sub vcl_backend_fetch { set bereq.backend = rr.backend(); } } -start client c1 { timeout 3 txreq -url "/foo1" rxresp expect resp.bodylen == 1 txreq -url "/foo2" rxresp expect resp.bodylen == 2 txreq -url "/foo3" rxresp expect resp.bodylen == 3 txreq -url "/foo4" rxresp expect resp.bodylen == 4 } -run server s1 -start server s2 -start client c2 { timeout 3 txreq -url "/foo11" rxresp expect resp.bodylen == 1 txreq -url "/foo22" rxresp expect resp.bodylen == 2 } -run server s4 -start client c3 { txreq -req "DELETE" rxresp expect resp.status == 204 txreq -url "/foo31" rxresp expect resp.bodylen == 4 } -run varnish-4.1.1/bin/varnishtest/tests/v00033.vtc0000644000201500234410000000175312652366721015761 00000000000000varnishtest "Stevedore variables and BYTES type test" server s1 { rxreq txresp -bodylen 4 rxreq txresp -bodylen 5 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.foo = storage.nowhere.free_space + 1 B + 1 KB + 1 MB + 1GB + 1TB; if (bereq.url == "/foo") { set beresp.storage_hint = "Transient"; } } sub vcl_deliver { set resp.http.bar = storage.Transient.used_space > 0B; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.http.foo == 1100586419201.000 expect resp.http.bar == false txreq -url /foo rxresp expect resp.status == 200 expect resp.http.foo == 1100586419201.000 expect resp.http.bar == true } -run varnish v1 -errvcl {Expected BYTES unit (B, KB, MB...) got '"X"'} { sub vcl_recv { if (storage.nowhere.free_space > 4 "X") { } } } varnish v1 -errvcl {Unknown BYTES unit 'X'. Legal are 'B', 'KB', 'MB', 'GB' and 'TB'} { sub vcl_recv { if (storage.nowhere.free_space > 4 X) { } } } varnish-4.1.1/bin/varnishtest/tests/r01030.vtc0000644000201500234410000000230712652366721015747 00000000000000varnishtest "Test ban_lurker_sleep vs failed ban lurker" # The idea here is that the ban lurker should always wait 1 second when it # can't proceed, as per documentation and original intent. The # ban_lurker_sleep should not affect sleep-times when the lurker fails. server s1 { rxreq txresp -status 200 rxreq txresp -status 200 } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.method == "BAN") { ban("obj.http.url ~ /"); return (synth(201,"banned")); } return (hash); } sub vcl_backend_response { set beresp.http.url = bereq.url; } } -start varnish v1 -cliok "param.set ban_lurker_age 0" varnish v1 -expect bans_tests_tested == 0 delay 0.01 client c1 { txreq -req GET rxresp expect resp.status == 200 txreq -req BAN rxresp expect resp.status == 201 } -run #delay 0.1 #varnish v1 -expect bans_lurker_tests_tested == 0 #delay 1.5 varnish v1 -expect bans_lurker_tests_tested >= 1 varnish v1 -cliok "param.set ban_lurker_sleep 5.01" client c2 { txreq -req GET rxresp expect resp.status == 200 txreq -req BAN rxresp expect resp.status == 201 } -run #delay 0.1 #varnish v1 -expect bans_lurker_tests_tested == 1 #delay 1.1 varnish v1 -expect bans_lurker_tests_tested == 2 varnish-4.1.1/bin/varnishtest/tests/r00972.vtc0000644000201500234410000000054612652366721015770 00000000000000varnishtest "Test conditional delivery and do_stream" 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.etag == {"foo"} } -run varnish-4.1.1/bin/varnishtest/tests/b00005.vtc0000644000201500234410000000053612652366721015732 00000000000000varnishtest "Check that -s works" server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" } -start varnish v1 \ -arg "-s file,${tmpdir}/varnishtest_backing,10M" \ -vcl+backend {} -start client c1 { txreq -url "/" rxresp expect resp.status == 200 } -run server s1 -wait varnish v1 -stop shell "rm ${tmpdir}/varnishtest_backing" varnish-4.1.1/bin/varnishtest/tests/j00001.vtc0000644000201500234410000000060212652366721015730 00000000000000varnishtest "Run worker with different uid in UNIX jail" # The "vrun" user must have login group "varnish" feature user_varnish feature user_vcache feature group_varnish feature root server s1 { rxreq txresp } -start varnish v1 \ -jail "-junix,user=varnish,ccgroup=varnish,workuser=vcache" \ -vcl+backend { } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/b00026.vtc0000644000201500234410000000157212652366721015736 00000000000000varnishtest "Check the precedence for timeouts" feature SO_RCVTIMEO_WORKS server s1 { rxreq expect req.url == "from_backend" delay 1; txresp } -start server s2 { rxreq expect req.url == "from_vcl" delay 1.5; txresp } -start varnish v1 -vcl { backend b1 { .host = "${s1_addr}"; .port = "${s1_port}"; .first_byte_timeout = 2s; } backend b2 { .host = "${s2_addr}"; .port = "${s2_port}"; .first_byte_timeout = 1s; } sub vcl_recv { if (req.url == "from_backend") { return(pass); } } sub vcl_backend_fetch { set bereq.first_byte_timeout = 2s; if (bereq.url == "from_backend") { set bereq.backend = b1; } else { set bereq.backend = b2; } } } -start varnish v1 -cliok "param.set first_byte_timeout 0.5" client c1 { txreq -url "from_backend" rxresp expect resp.status == 200 txreq -url "from_vcl" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01826.vtc0000644000201500234410000000053312652366721015763 00000000000000varnishtest "Check we ignore a zero C-L with a 204" server s1 { rxreq txresp -status 204 -bodylen 5 expect_close accept rxreq txresp -status 204 } -start varnish v1 -vcl+backend { } -start client c1 { txreq rxresp expect resp.status == 503 txreq rxresp expect resp.status == 204 expect resp.http.content-length == } -run varnish-4.1.1/bin/varnishtest/tests/v00015.vtc0000644000201500234410000000054512652366721015757 00000000000000varnishtest "Check function calls with no action return" server s1 { rxreq expect req.url == "/" expect req.http.foobar == "snafu" txresp -body "slash" } -start varnish v1 -vcl+backend { sub vcl_recv { call some_subr; } sub some_subr { set req.http.foobar = "snafu"; } } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01145.vtc0000644000201500234410000000114312652366721015753 00000000000000varnishtest "Test fileread for std VMOD" shell { printf "File One" > "${tmpdir}/one" printf "File Two" > "${tmpdir}/two" printf "File Three" > "${tmpdir}/three" } server s1 { loop 3 { rxreq txresp } } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.foo = std.fileread("${tmpdir}" + req.url); } } -start client c1 { txreq -url "/one" rxresp expect resp.http.foo == "File One" txreq -url "/two" rxresp expect resp.http.foo == "File Two" txreq -url "/three" rxresp expect resp.http.foo == "File Three" } -run client c1 -run client c1 -run varnish-4.1.1/bin/varnishtest/tests/r00255.vtc0000644000201500234410000000112512652366721015754 00000000000000varnishtest "Regression test for #255: Segfault on header token separation" server s1 { rxreq txresp \ -hdr "Date: Thu, 19 Jun 2008 21:14:49 GMT" \ -hdr "Expires: Thu, 19 Jun 2008 21:14:49 GMT" \ -hdr "Last-Modified: Sun, 27 Nov 2005 05:41:47 GMT" \ -hdr "Cache-Control: max-age =0" \ -body "012345\n" } -start varnish v1 -vcl+backend { sub vcl_backend_fetch { set bereq.backend = s1; } } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" expect resp.http.Cache-Control == "max-age =0" } client c1 -run varnish-4.1.1/bin/varnishtest/tests/v00011.vtc0000644000201500234410000000220312652366721015744 00000000000000varnishtest "Test vcl purging" server s1 { rxreq txresp -body "foo" rxreq txresp -body "foo" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.method == "PURGE") { ban(""); ban("req.url"); ban("req.url //"); ban("req.url // bar"); ban("req.url == bar //"); ban("foo == bar //"); ban("req.url ~ ^/$"); return (synth(209,"foo")); } } } -start client c1 { txreq rxresp expect resp.http.X-Varnish == "1001" } -run logexpect l1 -v v1 -d 1 -g vxid { expect * 1004 VCL_Error {ban[(][)]: No ban conditions found[.]} expect * 1004 VCL_Error {ban[(][)]: Expected comparison operator[.]} expect * 1004 VCL_Error {ban[(][)]: Expected second operand[.]} expect * 1004 VCL_Error {ban[(][)]: expected conditional [(]~, !~, == or !=[)] got "//"} expect * 1004 VCL_Error {ban[(][)]: Expected && between conditions, found .//.} expect * 1004 VCL_Error {ban[(][)]: Unknown or unsupported field .foo.} } -start client c1 { txreq -req "PURGE" rxresp expect resp.http.X-Varnish == "1004" expect resp.status == 209 } -run logexpect l1 -wait client c1 { txreq rxresp expect resp.http.X-Varnish == "1006" } -run varnish-4.1.1/bin/varnishtest/tests/r01086.vtc0000644000201500234410000000242312652366721015761 00000000000000varnishtest "#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" delay .2 chunked "FOOBAR" non-fatal 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" rxresphdrs expect resp.status == 200 expect_close } -run delay .1 server s1 -wait { fatal # 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" delay .2 chunked "FOOBAR" non-fatal chunkedlen 0 } -start client c1 { txreq -hdr "Cookie: BAR" rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/d00004.vtc0000644000201500234410000000240712652366721015732 00000000000000varnishtest "Deeper test of random director" random server s1 { rxreq txresp -body "1" } -start server s2 { rxreq txresp -body "22" rxreq txresp -body "22" rxreq txresp -body "22" rxreq txresp -body "22" } -start server s3 { rxreq txresp -body "333" } -start server s4 { rxreq txresp -body "4444" rxreq txresp -body "4444" rxreq txresp -body "4444" rxreq txresp -body "4444" } -start varnish v1 -vcl+backend { import ${vmod_directors}; sub vcl_init { new foo = directors.random(); foo.add_backend(s1, 1); foo.add_backend(s2, 1); foo.add_backend(s3, 1); foo.add_backend(s4, 1); } sub vcl_recv { return(pass); } sub vcl_backend_fetch { set bereq.backend = foo.backend(); } } -start # NB: Do not change the number 1 # NB: Only srandom(1) is standardized as deterministic. varnish v1 -cliok "debug.srandom 1" client c1 { txreq rxresp expect resp.bodylen == 2 txreq rxresp expect resp.bodylen == 4 txreq rxresp expect resp.bodylen == 4 txreq rxresp expect resp.bodylen == 4 txreq rxresp expect resp.bodylen == 1 txreq rxresp expect resp.bodylen == 2 txreq rxresp expect resp.bodylen == 4 txreq rxresp expect resp.bodylen == 2 txreq rxresp expect resp.bodylen == 3 txreq rxresp expect resp.bodylen == 2 } -run varnish-4.1.1/bin/varnishtest/tests/r00400.vtc0000644000201500234410000000043712652366721015751 00000000000000varnishtest "Regression test for ticket 409" server s1 { rxreq expect req.url == "/" send "HTTP/1.0 400 Not funny\r\n" send "\r\n" send "12345\r\n" } -start varnish v1 -vcl+backend { } -start client c1 { txreq rxresp expect resp.status == 400 expect resp.bodylen == 7 } -run varnish-4.1.1/bin/varnishtest/tests/c00062.vtc0000644000201500234410000000065512652366721015740 00000000000000varnishtest "Check that aborted backend body aborts client in streaming mode" server s1 { rxreq txresp -nolen -hdr "Transfer-encoding: chunked" chunked {} sema r1 sync 2 chunked {} sema r1 sync 2 } -start varnish v1 -cliok "param.set debug +syncvsl" -vcl+backend { } -start client c1 { txreq rxresphdrs expect resp.status == 200 rxchunk sema r1 sync 2 rxchunk sema r1 sync 2 expect_close } -run varnish-4.1.1/bin/varnishtest/tests/r01164.vtc0000644000201500234410000000053112652366721015754 00000000000000varnishtest "Regression test for #1163: allow backends to be named storage*" varnish v1 -vcl { backend storage_foo { .host = "127.0.0.1"; } sub vcl_backend_fetch { set bereq.backend = storage_foo; } } varnish v1 -vcl { backend storagefoo { .host = "127.0.0.1"; } sub vcl_backend_fetch { set bereq.backend = storagefoo; } } varnish-4.1.1/bin/varnishtest/tests/r00979.vtc0000644000201500234410000000102412652366721015767 00000000000000varnishtest "r00979.vtc Test restart when do_stream in vcl_deliver" server s1 { rxreq txresp -hdr "Connection: close" -gzipbody "1" expect_close accept rxreq txresp -body "11" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = true; set beresp.uncacheable = true; } sub vcl_deliver { if (req.restarts == 0) { return (restart); } } } -start varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 2 } -run varnish-4.1.1/bin/varnishtest/tests/r00742.vtc0000644000201500234410000000052212652366721015755 00000000000000varnishtest "% escapes in VCL source and vcl.show" server s1 { rxreq txresp } -start varnish v1 -cliok "param.set vcc_allow_inline_c true" -vcl+backend { C{ #include }C sub vcl_recv { C{ printf("%s %s %s", "foo", "bar", "barf"); }C } } -start client c1 { txreq rxresp } -run varnish v1 -cliok "vcl.show vcl1" varnish-4.1.1/bin/varnishtest/tests/c00060.vtc0000644000201500234410000000167212652366721015736 00000000000000varnishtest "Backend IMS header merging" server s1 { rxreq txresp -hdr "Last-Modified: Thu, 26 Jun 2008 12:00:01 GMT" \ -hdr "Foobar: foo" \ -hdr "Snafu: 1" \ -bodylen 13 rxreq expect req.http.if-modified-since == "Thu, 26 Jun 2008 12:00:01 GMT" txresp -status "304" \ -hdr "Last-Modified: Thu, 26 Jun 2008 12:00:01 GMT" \ -hdr "Snafu: 2" \ -hdr "Grifle: 3" \ -nolen } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.grace = 0s; set beresp.keep = 60s; set beresp.ttl = 1s; if (beresp.http.foobar == "foo") { set beresp.http.foobar = "foo0"; } if (beresp.http.snafu == "2") { set beresp.http.snafu = "2a"; } } } -start client c1 { txreq rxresp expect resp.bodylen == 13 expect resp.http.foobar == foo0 expect resp.http.snafu == 1 delay 3 txreq rxresp expect resp.bodylen == 13 expect resp.http.foobar == foo0 expect resp.http.grifle == 3 expect resp.http.snafu == 2a } -run varnish-4.1.1/bin/varnishtest/tests/r01478.vtc0000644000201500234410000000161012652366721015763 00000000000000varnishtest "panic due to hash_ignore_busy" server s1 { rxreq txresp -nolen -hdr "Transfer-Encoding: chunked" chunkedlen 10 delay .5 sema r1 sync 2 delay .5 chunkedlen 10 delay .5 sema r2 sync 2 delay .5 chunkedlen 10 delay .5 sema r3 sync 2 delay .5 chunkedlen 10 delay .5 sema r4 sync 2 delay .5 chunkedlen 10 delay .5 chunkedlen 0 } -start varnish v1 -vcl+backend { sub vcl_recv { set req.hash_ignore_busy = true; return(hash); } sub vcl_backend_response { # we assume streaming for all objects as default: set beresp.do_stream = true; set beresp.ttl = 2s; } } -start client c1 { txreq -hdr "client: c1" rxresp } -start sema r1 sync 2 client c2 { txreq -hdr "client: c2" sema r2 sync 2 rxresp } -start sema r3 sync 2 client c3 { txreq -hdr "client: c3" sema r4 sync 2 rxresp } -start client c1 -wait client c2 -wait client c3 -wait varnish-4.1.1/bin/varnishtest/tests/b00029.vtc0000644000201500234410000000052612652366721015737 00000000000000varnishtest "Test orderly connection closure" server s1 { rxreq txresp -nolen -hdr "Transfer-encoding: chunked" delay .2 chunkedlen 30000 delay .2 chunkedlen 100000 delay .2 chunkedlen 0 } -start varnish v1 -vcl+backend { } -start client c1 { txreq -hdr "Connection: close" delay 3 rxresp expect resp.bodylen == 130000 } -run varnish-4.1.1/bin/varnishtest/tests/r00679.vtc0000644000201500234410000000031312652366721015764 00000000000000varnishtest "pass + HEAD" server s1 { rxreq expect req.method == "HEAD" txresp } -start varnish v1 -vcl+backend {} -start client c1 { txreq -req HEAD -hdr "Cookie: foo=bar" rxresp -no_obj } -run varnish-4.1.1/bin/varnishtest/tests/r00524.vtc0000644000201500234410000000104412652366721015753 00000000000000varnishtest "Regression test for 524: HTTP/1.0 and ESI" server s1 { rxreq expect req.url == "/" txresp -body { } rxreq txresp -body "" } -start varnish v1 -vcl+backend { sub vcl_recv { // return (pass); } sub vcl_backend_response { set beresp.do_esi = true; } } -cliok "param.set timeout_idle 60" -start client c1 { txreq -proto HTTP/1.0 -hdr "Connection: kEep-alive" rxresp expect resp.status == 200 expect resp.bodylen == 16 } -run varnish-4.1.1/bin/varnishtest/tests/c00015.vtc0000644000201500234410000000225212652366721015731 00000000000000varnishtest "Test switching VCLs" server s1 { rxreq expect req.url == "/foo" txresp -body "foobar" rxreq expect req.url == "/foo" txresp -body "foobar1" } -start varnish v1 -vcl+backend { } -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } } varnish v1 -cli "vcl.list" varnish v1 -cli "vcl.use vcl1" client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 6 expect resp.http.x-varnish == "1001" } -run varnish v1 -cli "vcl.use vcl2" client c2 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 7 expect resp.http.x-varnish == "1004" } -run varnish v1 -cli "vcl.use vcl1" client c3 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 6 expect resp.http.x-varnish == "1007 1002" } -run varnish v1 -cli "vcl.show vcl2" varnish v1 -cli "vcl.show -v vcl2" varnish v1 -cli "vcl.discard vcl2" varnish v1 -cli "vcl.list" varnish v1 -clierr 104 "vcl.show -v" varnish v1 -clierr 106 "vcl.show -x nowhere" varnish v1 -clierr 106 "vcl.show nothere" varnish v1 -clierr 106 "vcl.use nothere" varnish v1 -clierr 106 "vcl.discard nowhere" varnish v1 -clierr 106 "vcl.discard vcl1" varnish-4.1.1/bin/varnishtest/tests/e00012.vtc0000644000201500234410000000124312652366721015727 00000000000000varnishtest "ESI includes for pre HTTP/1.1 cannot used chunked encoding" server s1 { rxreq expect req.url == "/foo/bar" txresp -body { Before include After include } rxreq expect req.url == "/foo/body" txresp -body { Included file } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq -url /foo/bar -proto HTTP/1.1 rxresp expect resp.status == 200 expect resp.bodylen == 67 } -run client c1 { txreq -url /foo/bar -proto HTTP/1.0 rxresp expect resp.status == 200 expect resp.bodylen == 67 } -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/r01648.vtc0000644000201500234410000000315312652366721015766 00000000000000varnishtest "#1648 - corrupt object in cache through IMS update" # This server sends a broken response body server s1 { rxreq txresp -nolen -hdr "Transfer-Encoding: chunked" -hdr "Etag: \"foo\"" -hdr "Server: s1" sema r1 sync 3 delay 1 chunked "abc" } -start # This server validates the streaming response from s1 as it hasn't failed yet server s2 { rxreq expect req.http.If-None-Match == "\"foo\"" sema r1 sync 3 txresp -status 304 -nolen -hdr "Server: s2" } -start # This server sends the proper response body server s3 { rxreq txresp -hdr "Server: s3" -body "abcdef" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.http.client == "c1") { set req.backend_hint = s1; } else if (req.http.client == "c2") { set req.backend_hint = s2; } else if (req.http.client == "c3") { set req.backend_hint = s3; } } sub vcl_backend_response { if (bereq.http.client == "c1") { set beresp.ttl = 0.1s; set beresp.grace = 0s; set beresp.keep = 60s; } } } -start varnish v1 -cliok "param.set debug +syncvsl" # This client gets a streaming failing result from s1 client c1 { txreq -hdr "Client: c1" rxresphdrs expect resp.status == 200 expect resp.http.transfer-encoding == "chunked" } -start delay 1 # This client gets a streaming failing result from s1 through # IMS update by s2 client c2 { txreq -hdr "Client: c2" sema r1 sync 3 rxresphdrs expect resp.status == 200 expect resp.http.transfer-encoding == "chunked" } -run delay 1 # This client should get a fresh fetch from s3 client c3 { txreq -hdr "Client: c3" rxresp expect resp.status == 200 expect resp.body == "abcdef" } -run varnish-4.1.1/bin/varnishtest/tests/e00002.vtc0000644000201500234410000000065412652366721015733 00000000000000varnishtest "ESI CDATA" server s1 { rxreq txresp -body { ]]> This is a test: Unseen University This is a test: Hello world } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 35 } client c1 -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/e00025.vtc0000644000201500234410000000100412652366721015726 00000000000000varnishtest "Test that esi+gzip correctly bypasses Vary: accept-encoding" server s1 { rxreq expect req.http.accept-encoding == gzip txresp -hdr "Vary: Accept-encoding" -gzipbody {FOO} } -start varnish v1 -vcl+backend { } -start client c1 { txreq -hdr "Accept-encoding: gzip" rxresp expect resp.http.content-encoding == gzip expect resp.status == 200 gunzip expect resp.bodylen == 3 txreq rxresp expect resp.http.content-encoding == expect resp.status == 200 expect resp.bodylen == 3 } -run varnish-4.1.1/bin/varnishtest/tests/r00902.vtc0000644000201500234410000000100112652366721015744 00000000000000varnishtest "Ticket #902 http_CollectHdr() failure on consequitive headers" server s1 { rxreq txresp \ -hdr "Server: Microsoft-IIS/5.0" \ -hdr "Cache-Control: A" \ -hdr "Cache-Control: B" \ -hdr "Cache-Control: C" \ -hdr "Cache-Control: D" \ -hdr "Foo: bar" \ -bodylen 5 } -start varnish v1 -vcl+backend { } -start varnish v1 -cliok "param.set debug +req_state" client c1 { txreq -hdr "foo: /foo" rxresp expect resp.http.cache-control == "A, B, C, D" expect resp.http.foo == "bar" } -run varnish-4.1.1/bin/varnishtest/tests/r00495.vtc0000644000201500234410000000120712652366721015763 00000000000000varnishtest "HTTP 1.0 backend not getting reused" server s1 { rxreq txresp -proto HTTP/1.0 -status 201 -hdr "Connection: keep-alive" -body foo rxreq txresp -proto HTTP/1.0 -status 202 -hdr "Connection: close" -body foo expect_close accept rxreq txresp -proto HTTP/1.0 -status 203 -body foo expect_close accept rxreq txresp -proto HTTP/1.0 -status 205 -body bar } -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } } -start client c1 { txreq rxresp expect resp.status == 201 txreq rxresp expect resp.status == 202 txreq rxresp expect resp.status == 203 txreq rxresp expect resp.status == 205 } -run varnish-4.1.1/bin/varnishtest/tests/r00262.vtc0000644000201500234410000000072112652366721015753 00000000000000varnishtest "Test that inter-request whitespace trimming works" server s1 { rxreq txresp \ -hdr "Connection: close" \ -body "012345\n" } -start varnish v1 -arg "-p timeout_linger=20" -vcl+backend { } -start client c1 { send "GET / HTTP/1.1\r\n\r\n\r\n" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" send "GET / HTTP/1.1\r\n\r\n" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1003 1002" } client c1 -run varnish-4.1.1/bin/varnishtest/tests/r00667.vtc0000644000201500234410000000132512652366721015765 00000000000000varnishtest "things stuck on busy object" server s1 { rxreq sema r1 sync 2 sema r1 sync 2 # There is a race in varnish between the first request releasing # the backend connection, and the second request trying to get it # which makes reuse of backend connection sometimes work and # sometimes not. Solve by never reusing the backend connection. txresp -hdr "Connection: close" -bodylen 2 accept rxreq txresp -bodylen 5 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.ttl = 0s; } } -start client c1 { txreq rxresp expect resp.bodylen == 2 } -start client c2 { sema r1 sync 2 txreq sema r1 sync 2 rxresp expect resp.bodylen == 5 } -start client c1 -wait client c2 -wait varnish-4.1.1/bin/varnishtest/tests/c00040.vtc0000644000201500234410000000323412652366721015730 00000000000000varnishtest "request resp and hdr length limits" server s1 { rxreq expect req.url == "/1" txresp \ -hdr "1...5: ..0....5....0....5....0....5....0" \ -bodylen 1 rxreq expect req.url == "/2" txresp \ -hdr "1...5: ..0....5....0....5....0....5....0." \ -bodylen 2 accept rxreq expect req.url == "/3" txresp \ -hdr "1...5: ..0....5....0\n ..5....0....5....0" \ -bodylen 3 rxreq expect req.url == "/4" txresp \ -hdr "1...5: ..0....5....0\n ..5....0....5....0." \ -bodylen 4 accept rxreq expect req.url == "/5" txresp \ -hdr "1...5: ..0....5....0....5....0....5....0" \ -hdr "1...5: ..0....5....0....5....0....5....0" \ -hdr "1...5: ..0....5....0....5....0....5....0" \ -hdr "1...5: ..0....5....0....5....0....5....0" \ -hdr "1...5: ..0....5....0....5....0....5" \ -hdr "1...5: ..0" \ -bodylen 5 rxreq expect req.url == "/6" txresp \ -hdr "1...5: ..0....5....0....5....0....5....0" \ -hdr "1...5: ..0....5....0....5....0....5....0" \ -hdr "1...5: ..0....5....0....5....0....5....0" \ -hdr "1...5: ..0....5....0....5....0....5....0" \ -hdr "1...5: ..0....5....0....5....0....5" \ -hdr "1...5: ..0." \ -bodylen 6 } -start varnish v1 \ -vcl+backend { } -start varnish v1 -cliok "param.set http_resp_size 256" varnish v1 -cliok "param.set http_resp_hdr_len 40" client c1 { txreq -url "/1" rxresp expect resp.status == 200 txreq -url "/2" rxresp expect resp.status == 503 } -run client c1 { txreq -url "/3" rxresp expect resp.status == 200 txreq -url "/4" rxresp expect resp.status == 503 } -run client c1 { txreq -url "/5" rxresp expect resp.status == 200 txreq -url "/6" rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/r01073.vtc0000644000201500234410000000162412652366721015757 00000000000000varnishtest "Test that hash_always_miss also implies hash_ignore_busy. Ticket #1073." server s1 { rxreq sema r1 sync 2 sema r2 sync 2 delay 1 txresp -hdr "Server: 1" } -start server s2 { rxreq sema r2 sync 2 txresp -hdr "Server: 2" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.http.x-hash-always-miss == "1") { set req.hash_always_miss = true; } } sub vcl_backend_fetch { if (bereq.http.x-client == "1") { set bereq.backend = s1; } if (bereq.http.x-client == "2") { set bereq.backend = s2; } } } -start client c1 { txreq -url "/" -hdr "x-client: 1" rxresp expect resp.status == 200 expect resp.http.Server == "1" } -start client c2 { sema r1 sync 2 txreq -url "/" -hdr "x-client: 2" -hdr "x-hash-always-miss: 1" txreq -url "/" -hdr "x-client: 2" rxresp expect resp.status == 200 expect resp.http.Server == "2" } -start client c1 -wait client c2 -wait varnish-4.1.1/bin/varnishtest/tests/b00011.vtc0000644000201500234410000000052312652366721015723 00000000000000varnishtest "Check HTTP/1.0 EOF transmission" server s1 { rxreq send "HTTP/1.0 200 OK\n" send "Connection: close\n" send "\n" send "Body line 1\n" send "Body line 2\n" send "Body line 3\n" } -start varnish v1 -vcl+backend {} -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.bodylen == 36 } -run varnish-4.1.1/bin/varnishtest/tests/e00013.vtc0000644000201500234410000000070512652366721015732 00000000000000varnishtest "All white-space object, in multiple storage segments" server s1 { rxreq expect req.url == "/foo" txresp -nolen -hdr "Transfer-Encoding: chunked" chunked { } chunkedlen 0 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start varnish v1 -cliok "debug.fragfetch 4" client c1 { txreq -url /foo rxresp } -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/r01499.vtc0000644000201500234410000000072112652366721015770 00000000000000varnishtest "#1499 - objcore ref leak on IMS update" server s1 { rxreq txresp -hdr {Etag: "foo"} rxreq expect req.http.if-none-match == {"foo"} txresp -hdr "X-Resp: 2" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.ttl = 0.0001s; set beresp.grace = 0s; set beresp.keep = 2s; } } -start client c1 { txreq rxresp delay 0.5 txreq rxresp expect resp.http.x-resp == "2" } -run delay 3 varnish v1 -expect n_object == 0 varnish-4.1.1/bin/varnishtest/tests/r01566.vtc0000644000201500234410000000026112652366721015762 00000000000000varnishtest "escape issue in regexp" varnish v1 -vcl { backend b1 { .host = "127.0.0.1"; } sub vcl_recv { set req.url = regsuball(req.url, "\??(p|pi)=.*?(&|$)", ""); } } varnish-4.1.1/bin/varnishtest/tests/r00776.vtc0000644000201500234410000000046412652366721015771 00000000000000varnishtest "Edge case of chunked encoding, trimming storage to length." server s1 { rxreq txresp -nolen -hdr "Transfer-encoding: chunked" chunkedlen 4096 chunkedlen 0 } -start varnish v1 \ -arg "-p fetch_chunksize=4k" \ -arg "-s malloc,1m" -vcl+backend { } -start client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/d00008.vtc0000644000201500234410000000154712652366721015742 00000000000000varnishtest "Test dynamic backends hot swap" server s1 { rxreq expect req.url == "/foo" txresp } -start server s2 { rxreq expect req.url == "/bar" txresp } -start varnish v1 -vcl { import ${vmod_debug}; backend dummy { .host = "${bad_ip}"; .port = "9080"; } sub vcl_init { new s1 = debug.dyn("${s1_addr}", "${s1_port}"); } sub vcl_recv { if (req.method == "SWAP") { s1.refresh(req.http.X-Addr, req.http.X-Port); return (synth(200)); } set req.backend_hint = s1.backend(); } } -start varnish v1 -expect MAIN.n_backend == 2 client c1 { txreq -url "/foo" rxresp expect resp.status == 200 txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" rxresp expect resp.status == 200 txreq -url "/bar" rxresp expect resp.status == 200 } -run delay 1 varnish v1 -cli backend.list # varnish v1 -expect MAIN.n_backend == 2 varnish-4.1.1/bin/varnishtest/tests/r01312.vtc0000644000201500234410000000061712652366721015754 00000000000000varnishtest "acl miscompile" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { acl foo { "127.0.0.2"; "127.0.1"/19; } acl bar { "127.0.1.2"; "127.0.1"/19; } sub vcl_deliver { set resp.http.ACLfoo = client.ip ~ foo; set resp.http.ACLbar = client.ip ~ bar; } } -start client c1 { txreq rxresp expect resp.http.aclfoo == true expect resp.http.aclbar == true } -run varnish-4.1.1/bin/varnishtest/tests/r01255.vtc0000644000201500234410000000045712652366721015764 00000000000000varnishtest "Test RFC2616 5.2 compliance" server s1 { rxreq txresp -hdr "Foo: 1" } -start varnish v1 -vcl+backend { sub vcl_deliver { set resp.http.rxhost = req.http.host; } } -start client c1 { txreq -url http://www.example.com/bar rxresp expect resp.http.rxhost == www.example.com } -run varnish-4.1.1/bin/varnishtest/tests/r00936.vtc0000644000201500234410000000041612652366721015764 00000000000000varnishtest "synthetic is only allowed in error" server s1 { rxreq txresp } -start varnish v1 -errvcl {'synthetic': not a valid action in method 'vcl_recv'} { backend foo { .host = "127.0.0.1"; } sub vcl_recv { synthetic("HELLOO"); return (synth(503)); } } varnish-4.1.1/bin/varnishtest/tests/g00006.vtc0000644000201500234410000000346412652366721015743 00000000000000varnishtest "Backend IMS'ing g[un]zip'ed objects" server s1 { rxreq expect req.url == /1 txresp -hdr "Last-Modified: Wed, 11 Sep 2013 13:36:55 GMT" \ -hdr {ETag: "foozle"} \ -bodylen 20 rxreq expect req.url == /1 expect req.http.if-modified-since == "Wed, 11 Sep 2013 13:36:55 GMT" txresp -status 304 \ -hdr {ETag: "fizle"} \ -nolen rxreq expect req.url == /2 txresp -hdr "Last-Modified: Wed, 11 Sep 2013 13:36:55 GMT" \ -hdr {ETag: "foobar"} \ -gzipbody "012345678901234567" rxreq expect req.url == /2 expect req.http.if-modified-since == "Wed, 11 Sep 2013 13:36:55 GMT" txresp -status 304 -hdr "Content-Encoding: gzip,rot13" \ -hdr {ETag: "snafu"} \ -nolen } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.foobar = beresp.http.content-encoding; if (bereq.url == "/1") { set beresp.do_gzip = true; } else { set beresp.do_gunzip = true; } set beresp.ttl = 1s; set beresp.grace = 0s; set beresp.keep = 60s; } } -start client c1 { txreq -url /1 -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == "gzip" expect resp.http.foobar == "" expect resp.http.etag == {W/"foozle"} gunzip expect resp.bodylen == 20 delay 1 txreq -url /1 -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == "gzip" expect resp.http.foobar == "gzip" expect resp.http.etag == {W/"fizle"} gunzip expect resp.bodylen == 20 delay .2 txreq -url /2 rxresp expect resp.http.content-encoding == "" expect resp.http.foobar == "gzip" expect resp.bodylen == 18 expect resp.http.etag == {W/"foobar"} delay 1 txreq -url /2 rxresp expect resp.http.content-encoding == "" # Here we see the C-E of the IMS OBJ expect resp.http.foobar == "" expect resp.http.etag == {W/"snafu"} expect resp.bodylen == 18 } -run varnish-4.1.1/bin/varnishtest/tests/m00001.vtc0000644000201500234410000000231112652366721015732 00000000000000varnishtest "Test std vmod" server s1 { rxreq txresp -hdr "foo: bAr" -hdr "bar: fOo" -bodylen 4 } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.foo = std.toupper(resp.http.foo); set resp.http.bar = std.tolower(resp.http.bar); std.set_ip_tos(32); } } -start varnish v1 -cliok "param.set debug +vclrel" client c1 { txreq -url "/bar" rxresp expect resp.status == 200 expect resp.bodylen == "4" expect resp.http.foo == "BAR" expect resp.http.bar == "foo" } -run varnish v1 -vcl+backend { } client c1 { txreq -url "/bar" rxresp expect resp.status == 200 expect resp.bodylen == "4" expect resp.http.foo == "bAr" expect resp.http.bar == "fOo" } -run varnish v1 -cliok "debug.vmod" varnish v1 -cliok "vcl.list" varnish v1 -expect vmods == 1 varnish v1 -cliok "vcl.discard vcl1" varnish v1 -cliok "vcl.list" varnish v1 -cliok "debug.vmod" varnish v1 -errvcl {Module std already imported.} { import ${vmod_std}; import ${vmod_std}; } varnish v1 -errvcl {Symbol not found: 'std' (expected type BOOL):} { import ${vmod_std}; sub vcl_recv { if (std == 2) { } } } varnish v1 -cliok "debug.vmod" varnish v1 -cliok "vcl.list" varnish v1 -expect vmods == 0 varnish-4.1.1/bin/varnishtest/tests/a00011.vtc0000644000201500234410000000070612652366721015725 00000000000000varnishtest "test vtc gzip support" server s1 { rxreq expect req.http.content-length == "26" expect req.bodylen == "26" gunzip expect req.bodylen == "3" expect req.http.content-encoding == "gzip" txresp -gzipbody FOO } -start client c1 -connect ${s1_sock} { txreq -gzipbody FOO rxresp expect resp.http.content-length == "26" expect resp.bodylen == "26" gunzip expect resp.bodylen == "3" expect resp.http.content-encoding == "gzip" } -run varnish-4.1.1/bin/varnishtest/tests/c00007.vtc0000644000201500234410000000016312652366721015731 00000000000000varnishtest "Test banning a hash" varnish v1 -arg "-b 127.0.0.1:80" -start varnish v1 -clierr 101 "ban.hash foo" varnish-4.1.1/bin/varnishtest/tests/b00036.vtc0000644000201500234410000000071112652366721015731 00000000000000varnishtest "builtin purge from vcl_recv{}" server s1 { rxreq txresp -hdr "foo: 1" rxreq txresp -hdr "foo: 2" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.method == "PURGE") { return (purge); } } } -start client c1 { txreq rxresp expect resp.http.foo == 1 txreq rxresp expect resp.http.foo == 1 txreq -req PURGE rxresp expect resp.msg == "Purged" } -run client c1 { txreq rxresp expect resp.http.foo == 2 } -run varnish-4.1.1/bin/varnishtest/tests/r00921.vtc0000644000201500234410000000061112652366721015753 00000000000000varnishtest "VCC type issue in regsub arg 1" server s1 { rxreq expect req.http.foo == "127.0.0.1" expect req.http.bar == "127.0.0.1" txresp } -start varnish v1 -vcl+backend { sub vcl_recv { set req.http.bar = regsub(req.url, ".*", client.ip); set req.http.foo = regsub(client.ip, ":.*", client.ip); } } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/b00040.vtc0000644000201500234410000000116012652366721015723 00000000000000varnishtest "test certain mailformed reqests" server s1 { rxreq # expect req.url == /3 txresp } -start varnish v1 -vcl+backend { } -start client c1 { send "GET /1 HTTP/1.1\r\n" send " Host: foo\r\n" send "\r\n" rxresp expect resp.status == 400 } -run delay .1 client c1 { send "GET /2 HTTP/1.1\r\n" send " Host: foo\r\n" send "\r\n" rxresp expect resp.status == 400 } -run delay .1 client c1 { send "GET /3 HTTP/1.1\r\n" send "\rHost: foo\r\n" send "\r\n" rxresp expect resp.status == 400 } -run delay .1 client c1 { send "GET /4 HTTP/1.1\r\n" send "\r\n" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01518.vtc0000644000201500234410000000103512652366721015757 00000000000000varnishtest "304 body handling with ESI" server s1 { rxreq txresp -hdr "Last-Modified: Wed, 04 Jun 2014 08:48:52 GMT" \ -body {} rxreq expect req.url == "/bar" txresp -body {} } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.bodylen == 12 expect resp.status == 200 txreq -hdr "If-Modified-Since: Wed, 04 Jun 2014 08:48:52 GMT" rxresp expect resp.status == 304 expect resp.bodylen == 0 } -run varnish-4.1.1/bin/varnishtest/tests/r00704.vtc0000644000201500234410000000052412652366721015755 00000000000000varnishtest "Range bug" server s1 { rxreq txresp -bodylen 100 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; } } -start varnish v1 -cliok "param.set http_range_support on" client c1 { txreq -hdr "Range: bytes=-20" rxresp expect resp.status == 206 expect resp.bodylen == 20 } -run varnish-4.1.1/bin/varnishtest/tests/v00027.vtc0000644000201500234410000000073712652366721015765 00000000000000varnishtest "Check that backend named 'default' is the default" server s1 { rxreq txresp -bodylen 25 } -start server s2 { rxreq txresp -bodylen 52 } -start varnish v1 -vcl { backend s1 { .host = "${s1_addr}"; .port = "${s1_port}"; } backend default { .host = "${s2_addr}"; .port = "${s2_port}"; } sub vcl_backend_fetch { if (bereq.url != bereq.url) { set bereq.backend = s1; } } } -start client c1 { txreq rxresp expect resp.bodylen == 52 } -run varnish-4.1.1/bin/varnishtest/tests/r00894.vtc0000644000201500234410000000041512652366721015766 00000000000000varnishtest "Ticket #894" server s1 { rxreq txresp -body {} } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.bodylen == 10 } -run varnish-4.1.1/bin/varnishtest/tests/c00026.vtc0000644000201500234410000000212012652366721015725 00000000000000varnishtest "Test client If-None-Match and If-Modified-Since together" server s1 { rxreq expect req.url == / txresp -hdr {ETag: "123456789"} \ -hdr "Last-Modified: Thu, 26 Jun 2008 12:00:01 GMT" \ -bodylen 10 rxreq expect req.url == /other txresp -hdr "Last-Modified: Thu, 26 Jun 2008 12:00:01 GMT" \ -bodylen 10 } -start varnish v1 -vcl+backend { } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 10 expect resp.http.etag == {"123456789"} txreq -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:00 GMT" \ -hdr {If-None-Match: "123456789"} rxresp -no_obj expect resp.status == 304 txreq -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:01 GMT" \ -hdr {If-None-Match: "12345678"} rxresp expect resp.status == 200 txreq -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:01 GMT" \ -hdr {If-None-Match: "123456789"} rxresp -no_obj expect resp.status == 304 txreq -url /other \ -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:01 GMT" \ -hdr {If-None-Match: "123456789"} rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/v00018.vtc0000644000201500234410000000544412652366721015765 00000000000000varnishtest "VCL compiler coverage test: vcc_action.c" varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_hit { return (restart) ; } sub vcl_miss { rollback; return (restart); } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_miss { return(synth(100,req.url)); } sub vcl_hit { return(synth(100,"the butter please")); } } varnish v1 -errvcl {Variable 'now' is read only.} { backend b { .host = "127.0.0.1"; } sub vcl_miss { set now = 1000; } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { set beresp.ttl /= 2; } } varnish v1 -errvcl {Expected '=' got '>>'} { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { set beresp.ttl >>= 2; } } varnish v1 -errvcl {Expected '=' got '+='} { backend b { .host = "127.0.0.1"; } sub vcl_backend_fetch { set bereq.backend += b; } } varnish v1 -errvcl {Expected '=' got '+='} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.url += now; } } varnish v1 -errvcl {Expected ';' got 'if'} { backend b { .host = "127.0.0.1"; } /* XXX: This should not really be an synth */ sub vcl_recv { set req.url = "foo" if "bar"; } } varnish v1 -errvcl {Symbol not found: 'req.hash' (expected type STRING_LIST):} { backend b { .host = "127.0.0.1"; } sub vcl_hash { hash_data(req.hash); } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.url = 1; } } varnish v1 -errvcl {Expected '=' got '+='} { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { set beresp.do_gzip += 1; } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { set beresp.do_gzip = true; } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { set beresp.do_gzip = false; } } varnish v1 -errvcl {Symbol not found: 'mu' (expected type BOOL):} { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { set beresp.do_gzip = mu; } } varnish v1 -errvcl {Only HTTP header variables can be unset.} { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { unset beresp.do_gzip; } } varnish v1 -errvcl {Unknown token '<<' when looking for STRING} { backend b { .host = "127.0.0.1"; } sub vcl_recv { ban (<<); } } varnish v1 -errvcl {Expected an action, 'if', '{' or '}'} { backend b { .host = "127.0.0.1"; } sub vcl_recv { ban_hash (if); } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_recv { ban ("req.url ~ foo"); } } varnish v1 -errvcl {Expected an action, 'if', '{' or '}'} { backend b { .host = "127.0.0.1"; } sub vcl_recv { kluf ; } } varnish v1 -errvcl {Unknown token '<<' when looking for STRING_LIST} { backend b { .host = "127.0.0.1"; } sub vcl_synth { synthetic( << "foo"; } } varnish v1 -errvcl {Syntax has changed, use:} { backend b { .host = "127.0.0.1"; } sub vcl_recv { return(synth); } } varnish-4.1.1/bin/varnishtest/tests/c00043.vtc0000644000201500234410000000122112652366721015725 00000000000000varnishtest "predictive vary" server s1 { rxreq txresp -hdr "Vary: foo" -bodylen 1 rxreq sema r2 sync 2 sema r1 sync 2 txresp -hdr "Vary: foo" -bodylen 2 } -start server s2 { rxreq txresp -hdr "Vary: foo" -bodylen 3 } -start varnish v1 -vcl+backend { sub vcl_backend_fetch { if (bereq.http.bar) { set bereq.backend = s2; } } } -start client c1 { txreq -hdr "Foo: vary1" rxresp expect resp.bodylen == 1 txreq -hdr "Foo: vary2" rxresp expect resp.bodylen == 2 } -start client c2 { sema r2 sync 2 txreq -hdr "Foo: vary3" -hdr "bar: yes" rxresp sema r1 sync 2 expect resp.bodylen == 3 } -start client c1 -wait client c2 -wait varnish-4.1.1/bin/varnishtest/tests/e00018.vtc0000644000201500234410000000134512652366721015740 00000000000000varnishtest "Test XML 1.0 entity references" server s1 { rxreq expect req.url == "/" txresp -body { } rxreq expect req.url == "/&" txresp -body "1" rxreq expect req.url == "/<" txresp -body "22" rxreq expect req.url == "/>" txresp -body "333" rxreq expect req.url == {/'} txresp -body "4444" rxreq expect req.url == {/"} txresp -body "55555" } -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 32 } -run varnish-4.1.1/bin/varnishtest/tests/r01140.vtc0000644000201500234410000000207112652366721015747 00000000000000varnishtest "Transient-salvaged objects ttl should be shortened - #1140" server s1 { # This response should almost completely fill the storage rxreq expect req.url == /url1 txresp -bodylen 1048408 # The next one should not fit in the storage, ending up in transient # with zero ttl (=shortlived) rxreq expect req.url == /url2 txresp -bodylen 1024 # And therefore this one should be fetched next rxreq expect req.url == /url2 txresp -bodylen 1025 } -start varnish v1 -arg "-p nuke_limit=0 -p shortlived=0" \ -arg "-smalloc,1m" -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; # Unset Date header to not change the object sizes unset beresp.http.Date; } } -start client c1 { txreq -url /url1 rxresp expect resp.status == 200 expect resp.bodylen == 1048408 } -run delay .1 varnish v1 -expect SMA.s0.g_space < 1000 client c1 { txreq -url /url2 rxresp expect resp.status == 200 expect resp.bodylen == 1024 } -run delay .1 client c1 { txreq -url /url2 rxresp expect resp.status == 200 expect resp.bodylen == 1025 } -run varnish-4.1.1/bin/varnishtest/tests/g00001.vtc0000644000201500234410000000152712652366721015734 00000000000000varnishtest "test basic gunzip for client" server s1 { rxreq expect req.http.accept-encoding == "gzip" txresp -gzipbody FOO } -start varnish v1 -cliok "param.set http_gzip_support true" -vcl+backend { } -start client c1 { txreq rxresp expect resp.bodylen == "3" expect resp.http.content-encoding == txreq -hdr "Accept-encoding: gzip;q=0.1" rxresp expect resp.http.content-encoding == "gzip" gunzip expect resp.bodylen == "3" } -run delay .1 client c1 { txreq -proto HTTP/1.0 rxresp expect resp.bodylen == "3" expect resp.http.content-encoding == } -run delay .1 client c1 { txreq -req HEAD rxresp -no_obj expect resp.http.content-encoding == txreq -req HEAD -hdr "Accept-encoding: gzip;q=0.1" rxresp -no_obj expect resp.http.content-length == "26" expect resp.http.content-encoding == "gzip" } -run varnish-4.1.1/bin/varnishtest/tests/g00004.vtc0000644000201500234410000000133712652366721015736 00000000000000varnishtest "truncated gzip from backend" server s1 -repeat 2 { rxreq txresp -nolen \ -hdr "Content-Encoding: gzip" \ -hdr "Transfer-Encoding: Chunked" send "18\r\n" # A truncate gzip file sendhex "1f8b" sendhex "08" sendhex "00" sendhex "f5 64 ae 4e 02 03 f3 cd cf 53 f0 4f" sendhex "2e 51 30 36 54 30 b0 b4" send "\r\n" chunkedlen 0 } -start varnish v1 \ -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; if (bereq.url == "/gunzip") { set beresp.do_gunzip = true; } } } varnish v1 -cliok "param.set debug +syncvsl" varnish v1 -start client c1 { txreq rxresp expect resp.status == 503 } -run client c1 { txreq -url /gunzip rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/r00345.vtc0000644000201500234410000000101412652366721015751 00000000000000varnishtest "#345, ESI waitinglist trouble" server s1 { rxreq txresp -body {} rxreq sema r1 sync 2 delay 1 txresp -body {DATA} } -start varnish v1 -arg "-p debug=+workspace" -vcl+backend { sub vcl_backend_response { if (bereq.url == "/") { set beresp.do_esi = true; } } } -start client c1 { txreq rxresp expect resp.bodylen == 4 } -start client c2 { txreq sema r1 sync 2 rxresp expect resp.bodylen == 4 } -run client c1 { txreq rxresp expect resp.bodylen == 4 } -run varnish-4.1.1/bin/varnishtest/tests/r01332.vtc0000644000201500234410000000060012652366721015746 00000000000000varnishtest "#1332 - Check enum as argument in vmod object" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_init { new obj = debug.obj("don't care"); } sub vcl_deliver { obj.enum(martin); set resp.http.foo = obj.foo(""); } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.http.foo == "BOO" } -run varnish-4.1.1/bin/varnishtest/tests/a00000.vtc0000644000201500234410000000026112652366721015717 00000000000000varnishtest "basic default HTTP transactions" server s1 { rxreq txresp } server s1 -start client c1 -connect ${s1_sock} { txreq rxresp } client c1 -run server s1 -wait varnish-4.1.1/bin/varnishtest/tests/p00000.vtc0000644000201500234410000000136012652366721015737 00000000000000varnishtest "Test Basic persistence" server s1 { rxreq txresp accept rxreq txresp -status 700 } -start shell "rm -f ${tmpdir}/_.per" varnish v1 \ -arg "-pfeature=+wait_silo" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per,10m" \ -vcl+backend { } -start varnish v1 -stop varnish v1 -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" } -run varnish v1 -cliok "storage.list" varnish v1 -cliok "debug.persistent s0 dump" varnish v1 -cliok "debug.persistent s0 sync" varnish v1 -stop varnish v1 -start varnish v1 -cliok "debug.xid 1999" client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "2001 1002" } -run # shell "rm -f /tmp/__v1/_.per" varnish-4.1.1/bin/varnishtest/tests/m00007.vtc0000644000201500234410000000205712652366721015747 00000000000000varnishtest "Test std.integer()" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.gtzero = (std.integer(req.http.foo, 0) > 0); set resp.http.ltzero = (std.integer(req.http.foo, 0) < 0); set resp.http.iszero = (std.integer(req.http.foo, 0) == 0); set resp.http.converted = std.integer(req.http.foo, 0); } } -start client c1 { txreq -hdr "foo: 1" rxresp expect resp.http.gtzero == true expect resp.http.ltzero == false expect resp.http.iszero == false expect resp.http.converted == 1 txreq -hdr "foo: -1" rxresp expect resp.http.gtzero == false expect resp.http.ltzero == true expect resp.http.iszero == false expect resp.http.converted == -1 txreq -hdr "foo: 0" rxresp expect resp.http.gtzero == false expect resp.http.ltzero == false expect resp.http.iszero == true expect resp.http.converted == 0 txreq -hdr "foo: bar" rxresp expect resp.http.gtzero == false expect resp.http.ltzero == false expect resp.http.iszero == true expect resp.http.converted == 0 } -run varnish-4.1.1/bin/varnishtest/tests/c00023.vtc0000644000201500234410000000570612652366721015737 00000000000000varnishtest "Test -h critbit for digest edges" server s1 { rxreq expect req.url == "/1" txresp -body "\n" rxreq expect req.url == "/2" txresp -body "x\n" rxreq expect req.url == "/3" txresp -body "xx\n" rxreq expect req.url == "/4" txresp -body "xxx\n" rxreq expect req.url == "/5" txresp -body "xxxx\n" rxreq expect req.url == "/6" txresp -body "xxxxx\n" rxreq expect req.url == "/7" txresp -body "xxxxxx\n" rxreq expect req.url == "/8" txresp -body "xxxxxxx\n" rxreq expect req.url == "/9" txresp -body "xxxxxxxx\n" } -start varnish v1 -arg "-hcritbit" -vcl+backend { } -start varnish v1 -cliok "param.set debug +hashedge" client c1 { txreq -url "/1" rxresp expect resp.status == 200 expect resp.bodylen == 1 expect resp.http.X-Varnish == "1001" txreq -url "/2" rxresp expect resp.bodylen == 2 expect resp.status == 200 expect resp.http.X-Varnish == "1003" txreq -url "/3" rxresp expect resp.bodylen == 3 expect resp.status == 200 expect resp.http.X-Varnish == "1005" txreq -url "/4" rxresp expect resp.bodylen == 4 expect resp.status == 200 expect resp.http.X-Varnish == "1007" txreq -url "/5" rxresp expect resp.bodylen == 5 expect resp.status == 200 expect resp.http.X-Varnish == "1009" txreq -url "/6" rxresp expect resp.bodylen == 6 expect resp.status == 200 expect resp.http.X-Varnish == "1011" txreq -url "/7" rxresp expect resp.bodylen == 7 expect resp.status == 200 expect resp.http.X-Varnish == "1013" txreq -url "/8" rxresp expect resp.bodylen == 8 expect resp.status == 200 expect resp.http.X-Varnish == "1015" txreq -url "/9" rxresp expect resp.bodylen == 9 expect resp.status == 200 expect resp.http.X-Varnish == "1017" } -run client c1 { txreq -url "/1" rxresp expect resp.status == 200 expect resp.bodylen == 1 expect resp.http.X-Varnish == "1020 1002" txreq -url "/2" rxresp expect resp.bodylen == 2 expect resp.status == 200 expect resp.http.X-Varnish == "1021 1004" txreq -url "/3" rxresp expect resp.bodylen == 3 expect resp.status == 200 expect resp.http.X-Varnish == "1022 1006" txreq -url "/4" rxresp expect resp.bodylen == 4 expect resp.status == 200 expect resp.http.X-Varnish == "1023 1008" txreq -url "/5" rxresp expect resp.bodylen == 5 expect resp.status == 200 expect resp.http.X-Varnish == "1024 1010" txreq -url "/6" rxresp expect resp.bodylen == 6 expect resp.status == 200 expect resp.http.X-Varnish == "1025 1012" txreq -url "/7" rxresp expect resp.bodylen == 7 expect resp.status == 200 expect resp.http.X-Varnish == "1026 1014" txreq -url "/8" rxresp expect resp.bodylen == 8 expect resp.status == 200 expect resp.http.X-Varnish == "1027 1016" txreq -url "/9" rxresp expect resp.bodylen == 9 expect resp.status == 200 expect resp.http.X-Varnish == "1028 1018" } -run varnish v1 -cliok "hcb.dump" varnish v1 -expect sess_conn == 2 varnish v1 -expect cache_hit == 9 varnish v1 -expect cache_miss == 9 varnish v1 -expect client_req == 18 varnish-4.1.1/bin/varnishtest/tests/r00942.vtc0000644000201500234410000000233712652366721015765 00000000000000varnishtest "#942 junk after gzip from backend" server s1 { rxreq txresp -nolen \ -hdr "Content-Encoding: gzip" \ -hdr "Connection: close" \ -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" non-fatal chunkedlen 0 } -start varnish v1 \ -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; if (bereq.http.foo == "foo") { set beresp.do_gunzip = true; } } } varnish v1 -cliok "param.set debug +syncvsl" varnish v1 -start client c1 { txreq -url /1 rxresp expect resp.status == 503 } -run server s1 -wait { fatal rxreq txresp -nolen \ -hdr "Content-Encoding: gzip" \ -hdr "Connection: close" \ -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" non-fatal chunkedlen 0 } -start client c1 { txreq -url /2 -hdr "Foo: foo" rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/c00044.vtc0000644000201500234410000000371712652366721015742 00000000000000varnishtest "Object/LRU/Stevedores" server s1 { rxreq txresp -bodylen 1048290 rxreq txresp -bodylen 1048291 rxreq txresp -bodylen 1048292 rxreq txresp -bodylen 1047293 rxreq txresp -bodylen 1047294 } -start varnish v1 \ -arg "-smalloc,1m" \ -arg "-smalloc,1m" \ -arg "-smalloc,1m" \ -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; set beresp.storage_hint = "invalid"; # Unset Date header to not change the object sizes unset beresp.http.Date; } } -start client c1 { txreq -url /foo rxresp expect resp.status == 200 expect resp.bodylen == 1048290 } -run varnish v1 -expect SMA.Transient.g_bytes == 0 varnish v1 -expect SMA.s0.g_bytes == 0 varnish v1 -expect SMA.s0.g_space > 1000000 varnish v1 -expect SMA.s1.g_bytes > 1000000 varnish v1 -expect SMA.s1.g_space < 200 varnish v1 -expect SMA.s2.g_bytes == 0 varnish v1 -expect SMA.s2.g_space > 1000000 client c1 { txreq -url /bar rxresp expect resp.status == 200 expect resp.bodylen == 1048291 } -run varnish v1 -expect SMA.Transient.g_bytes == 0 varnish v1 -expect SMA.s0.g_bytes == 0 varnish v1 -expect SMA.s0.g_space > 1000000 varnish v1 -expect SMA.s1.g_bytes > 1000000 varnish v1 -expect SMA.s1.g_space < 200 varnish v1 -expect SMA.s2.g_bytes > 1000000 varnish v1 -expect SMA.s2.g_space < 200 client c1 { txreq -url /burp rxresp expect resp.status == 200 expect resp.bodylen == 1048292 } -run varnish v1 -expect SMA.Transient.g_bytes == 0 varnish v1 -expect SMA.s0.g_bytes > 1000000 varnish v1 -expect SMA.s0.g_space < 200 varnish v1 -expect SMA.s1.g_bytes > 1000000 varnish v1 -expect SMA.s1.g_space < 200 varnish v1 -expect SMA.s2.g_bytes > 1000000 varnish v1 -expect SMA.s2.g_space < 200 client c1 { txreq -url /foo1 rxresp expect resp.status == 200 expect resp.bodylen == 1047293 } -run varnish v1 -expect n_lru_nuked == 1 client c1 { txreq -url /foo rxresp expect resp.status == 200 expect resp.bodylen == 1047294 } -run varnish v1 -expect n_lru_nuked == 2 varnish-4.1.1/bin/varnishtest/tests/v00020.vtc0000644000201500234410000001323312652366721015751 00000000000000varnishtest "VCL compiler coverage test: vcc_parse.c & vcc_expr.c" varnish v1 -cliok "param.set vcc_allow_inline_c true" -vcl { backend b { .host = "127.0.0.1"; } C{ #include }C } varnish v1 -errvcl {Found: '0' at} { 0; } # The next test issues a quite confusing error message: # Expected an action, 'if', '{' or '}'\n # ('Default' Line 42 Pos 1)\n # sub vcl_recv {\n # ###-----------\n # \n # It's actually complaining about the first token in # the default.vcl which is appended after the proffered # VCLs tokenstream. # XXX: A better error message would be desirable varnish v1 -errvcl {Expected an action, 'if', } " sub vcl_recv { { } { " varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { set beresp.ttl = 1w; set beresp.ttl *= 1.5; set beresp.ttl = 1.5 s * 2.5; set beresp.ttl = 1.5 s / 2.5; set beresp.ttl = 1.5h + 1.5s; set beresp.ttl = 1.5h - 1.5s; } } varnish v1 -errvcl {Comparison of different types: INT '!=' STRING} { sub vcl_recv { if (!req.restarts != req.url) { set req.http.foo = "foo"; } } } varnish v1 -errvcl {Symbol not found: 'vcl_recv' (expected type STRING_LIST)} { sub vcl_recv { set req.http.foo = vcl_recv; } } # XXX: not obvious if this actually fails for the desired reason ? varnish v1 -errvcl {Unknown token '-' when looking for DURATION} { sub vcl_recv { if (req.ttl < -3s || req.ttl) { set req.http.foo = vcl_recv; } } } varnish v1 -errvcl {'&&' must be followed by BOOL, found DURATION.} { sub vcl_recv { if (req.ttl < 3s && req.ttl) { set req.http.foo = vcl_recv; } } } varnish v1 -errvcl {Operator * not possible on type STRING.} { sub vcl_recv { set req.http.foo = "bla" * "foo"; } } varnish v1 -errvcl {DURATION + INT not possible.} { sub vcl_backend_response { set req.ttl = req.ttl + beresp.status; } } varnish v1 -errvcl {'!' must be followed by BOOL, found DURATION.} { sub vcl_backend_response { if (! req.ttl) { } } } varnish v1 -errvcl {BOOL + BOOL not possible.} { sub vcl_backend_response { if (beresp.do_gzip + beresp.do_gunzip) { } } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.http.foo = "foo" + "bar"; set req.http.foo = "foo" + 1; set req.http.foo = "foo" + 1.5; set req.http.foo = "foo" + now; set req.http.foo = now + 1s; set req.http.foo = now - 1s; set req.http.foo = now - now; set req.http.foo = 1 + 1; set req.http.foo = 1 - 1; set req.ttl = 1s; } } # XXX: not the most clear error message varnish v1 -errvcl {STRING - STRING not possible.} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.http.foo = "foo" - "bar"; } } varnish v1 -errvcl {TIME + STRING not possible.} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.ttl = now + "foo"; } } varnish v1 -errvcl {TIME + TIME not possible.} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.ttl = now + now; } } # XXX: error message should say something about DURATION varnish v1 -errvcl {Expected ID got ';'} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.http.foo = now + 1; } } varnish v1 -errvcl {INT + STRING not possible.} { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { set beresp.status = 1 + "foo"; } } varnish v1 -errvcl {INT + TIME not possible.} { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { set beresp.status = 1 + now; } } # XXX: error message should spot DURATION varnish v1 -errvcl {Expected ';' got 's'} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.http.foo = 1 + 1s; } } # XXX: should spot DURATION varnish v1 -errvcl {Expected ';' got 's'} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.http.foo = 1s; } } # XXX: should spot DURATION varnish v1 -errvcl {Expected ';' got 's'} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.http.foo = 1s + 1; } } # XXX: should spot DURATION varnish v1 -errvcl {Expected ';' got 's'} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.http.foo = 1s + now; } } # XXX: should spot DURATION varnish v1 -errvcl {Expected ';' got 's'} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.http.foo = 1s + "foo"; } } # XXX: should spot DURATION varnish v1 -errvcl {Expected ';' got 's'} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.http.foo = "foo" + 1s; } } # XXX: should spot DURATION varnish v1 -errvcl {Expected ID got ';'} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.ttl = 1s + 1; } } varnish v1 -errvcl {DURATION + TIME not possible.} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.ttl = 1s + now; } } varnish v1 -errvcl {DURATION + STRING not possible.} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set req.ttl = 1s + "foo"; } } varnish v1 -errvcl {'||' must be followed by BOOL, found DURATION.} { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { if (req.url || beresp.ttl) { } } } varnish v1 -errvcl {'&&' must be followed by BOOL, found DURATION.} { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { if (req.url && beresp.ttl) { } } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_miss { if (!req.url) { } } } varnish v1 -errvcl {Names of VCL sub's cannot contain '-'} { backend b { .host = "127.0.0.1"; } sub foo-bar { } sub vcl_recv { call foo-bar; } } varnish v1 -errvcl {VCL sub's named 'vcl*' are reserved names.} { backend b { .host = "127.0.0.1"; } sub vcl_bar { } sub vcl_recv { call vcl_bar; } } varnish v1 -errvcl {Names of VCL acl's cannot contain '-'} { backend b { .host = "127.0.0.1"; } acl foo-bar { } sub vcl_recv { if (client.ip ~ foo.bar) { } } } varnish-4.1.1/bin/varnishtest/tests/r01266.vtc0000644000201500234410000000146312652366721015764 00000000000000varnishtest "#1266 - Check persisted truncated completed bans" # Test that bans which has been completed, truncated and persisted works shell "rm -f ${tmpdir}/_.per1" server s1 { rxreq txresp -hdr "x-foo: foo" } -start varnish v1 \ -arg "-pfeature=+wait_silo" \ -arg "-pban_lurker_sleep=0.01" \ -arg "-sper1=deprecated_persistent,${tmpdir}/_.per1,10m" \ -vcl+backend { } varnish v1 -start # Add a ban that will (with lurker help) become a truncated completed ban last # in the list varnish v1 -cliok "ban obj.http.x-foo == bar" delay 1 # Add an object that will point to our ban client c1 { txreq rxresp expect resp.http.x-foo == "foo" } -run # Force a reload varnish v1 -stop varnish v1 -start # Check that our object is still there client c1 { txreq rxresp expect resp.http.x-foo == "foo" } -run varnish-4.1.1/bin/varnishtest/tests/r00795.vtc0000644000201500234410000000140312652366721015764 00000000000000varnishtest "Content-Length in pass'ed 304 does not trigger body fetch" # XXX: Description doesn't make sense relative to actual goings on... server s1 { rxreq txresp -hdr "Last-Modified: ${date}" -body "FOO" rxreq expect req.url == "/bar" txresp -body "FOOBAR" } -start varnish v1 -vcl+backend { } -start # First load the objects into cache client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 3 txreq -url "/bar" rxresp expect resp.status == 200 expect resp.bodylen == 6 } -run # Wait, so we know ${date} to be higher delay 1 client c1 { txreq -hdr "If-Modified-Since: ${date}" rxresp -no_obj expect resp.status == 304 txreq -url "/bar" -hdr "If-Modified-Since: ${date}" rxresp -no_obj expect resp.status == 304 } -run varnish-4.1.1/bin/varnishtest/tests/m00011.vtc0000644000201500234410000000132612652366721015740 00000000000000varnishtest "Test std.ip()" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.foo0 = std.ip("8.8.8.*", client.ip); set resp.http.foo1 = std.ip("9.9.9.*", server.ip); set resp.http.foo2 = std.ip("1.2.3.*", "127.0.0.2"); set resp.http.foo3 = std.ip("1.2.3.5", "127.0.0.3"); set resp.http.foo4 = std.ip("2001:db8::", "[::1]"); set resp.http.foo5 = std.ip("2001::db8::", "[::1]"); } } -start client c1 { txreq rxresp expect resp.http.foo0 == "127.0.0.1" expect resp.http.foo1 == "127.0.0.1" expect resp.http.foo2 == "127.0.0.2" expect resp.http.foo3 == "1.2.3.5" expect resp.http.foo4 == "2001:db8::" expect resp.http.foo5 == "::1" } -run varnish-4.1.1/bin/varnishtest/tests/a00002.vtc0000644000201500234410000000066512652366721015731 00000000000000varnishtest "basic default HTTP transactions with expect and options" server s1 { rxreq expect req.method == PUT expect req.proto == HTTP/1.0 expect req.url == "/foo" txresp -proto HTTP/1.2 -status 201 -msg Foo } server s1 -start client c1 -connect ${s1_sock} { txreq -req PUT -proto HTTP/1.0 -url /foo rxresp expect resp.proto == HTTP/1.2 expect resp.status == 201 expect resp.msg == Foo } client c1 -run server s1 -wait varnish-4.1.1/bin/varnishtest/tests/c00070.vtc0000644000201500234410000000177512652366721015743 00000000000000varnishtest "Test workspace functions in vmod_debug" server s1 { rxreq txresp rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_backend_response { set beresp.http.free_backend = debug.workspace_free(backend); } sub vcl_deliver { set resp.http.free_session = debug.workspace_free(session); set resp.http.free_thread = debug.workspace_free(thread); set resp.http.overflowed = debug.workspace_overflowed(client); debug.workspace_allocate(client, 2048); if (req.url == "/bar") { debug.workspace_overflow(client); } } } -start logexpect l1 -v v1 -d 1 -g vxid -q "Error ~ 'overflow'" { expect 0 * Begin expect * = Error "workspace_client overflow" expect * = End } -start client c1 { txreq -url /foo rxresp expect resp.http.overflowed == "false" expect resp.http.free_backend > 9000 expect resp.http.free_session >= 240 expect resp.http.free_thread > 2000 } -run client c2 { txreq -url /bar rxresp expect resp.status == 500 } -run logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/p00003.vtc0000644000201500234410000000165212652366721015746 00000000000000varnishtest "Ban a persistent object" shell "rm -f ${tmpdir}/_.per" server s1 { rxreq txresp -hdr "Foo: foo" } -start varnish v1 \ -arg "-pfeature=+wait_silo" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per,10m" \ -arg "-pban_lurker_sleep=0" \ -vcl+backend { } -start varnish v1 -cliok ban.list client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" expect resp.http.foo == "foo" } -run varnish v1 -cliok "ban req.url == /" varnish v1 -cliok ban.list varnish v1 -stop server s1 -wait server s1 { rxreq txresp -hdr "Foo: bar" } -start varnish v1 -vcl+backend {} -start varnish v1 -cliok ban.list # Count of 2 here, because the "magic" ban is also there" # varnish v1 -expect n_ban == 2 client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" expect resp.http.foo == "bar" } -run varnish v1 -cliok ban.list varnish v1 -stop varnish-4.1.1/bin/varnishtest/tests/r01801.vtc0000644000201500234410000000267512652366721015765 00000000000000varnishtest "Test parsing IP constants" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.foo1 = std.ip("..", "1.2.3.4"); set resp.http.foo2 = std.ip("..", "1.2.3.4:8000"); set resp.http.foo3 = std.ip("..", "1.2.3.4 8000"); set resp.http.foo4 = std.ip("..", "::1"); set resp.http.foo5 = std.ip("..", "[::1]"); set resp.http.foo6 = std.ip("..", "[::1]:8000"); set resp.http.bar1 = std.port("1.2.3.4"); set resp.http.bar2 = std.port("1.2.3.4:8000"); set resp.http.bar3 = std.port("1.2.3.4 8000"); set resp.http.bar4 = std.port("::1"); set resp.http.bar5 = std.port("[::1]"); set resp.http.bar6 = std.port("[::1]:8000"); } } -start client c1 { txreq rxresp expect resp.http.foo1 == "1.2.3.4" expect resp.http.foo2 == "1.2.3.4" expect resp.http.foo3 == "1.2.3.4" expect resp.http.foo4 == "::1" expect resp.http.foo5 == "::1" expect resp.http.foo6 == "::1" expect resp.http.bar1 == "80" expect resp.http.bar2 == "8000" expect resp.http.bar3 == "8000" expect resp.http.bar4 == "80" expect resp.http.bar5 == "80" expect resp.http.bar6 == "8000" } -run varnish v1 -errvcl "could not be resolved to an IP address" { import ${vmod_std}; sub vcl_deliver { set resp.http.foo = std.ip("..", "::1::2"); } } varnish v1 -errvcl "could not be resolved to an IP address" { import ${vmod_std}; sub vcl_deliver { set resp.http.foo = std.ip("..", "1.2.3.4::80"); } } varnish-4.1.1/bin/varnishtest/tests/r00251.vtc0000644000201500234410000000106212652366721015750 00000000000000varnishtest "Regression test for #251: segfault on regsub on missing http header" server s1 { rxreq txresp \ -hdr "Foobar: _barf_" \ -hdr "Connection: close" \ -body "012345\n" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.Snafu1 = "zoom" + regsub(beresp.http.Foomble, "ar", "\0\0") + "box"; } } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" expect resp.http.foobar == "_barf_" expect resp.http.snafu1 == "zoombox" } client c1 -run varnish-4.1.1/bin/varnishtest/tests/r01761.vtc0000644000201500234410000000101512652366721015755 00000000000000varnishtest "204 response with body" server s1 { rxreq txresp -status 204 -body "HiHo" } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (beresp.http.foo == "bar") { set beresp.status = 204; } } } -start client c1 { txreq rxresp expect resp.status == 503 } -run server s1 { rxreq txresp -hdr "Foo: bar" -body "HiHo" } -start client c1 { txreq -url /2 rxresp expect resp.status == 204 expect resp.http.content-length == "" expect resp.http.transfer-encoding == "" } -run varnish-4.1.1/bin/varnishtest/tests/m00014.vtc0000644000201500234410000000140512652366721015741 00000000000000varnishtest "Test std.querysort" server s1 -repeat 6 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.url = std.querysort(req.url); } } -start client c1 { txreq -url "/foo/bar?t=0&b=0&p=0&c=5" rxresp expect resp.http.url == "/foo/bar?b=0&c=5&p=0&t=0" delay .1 txreq -url "/foo/bar?coa=0&co=0" rxresp expect resp.http.url == "/foo/bar?co=0&coa=0" delay .1 txreq -url "/foo/bar?a=0&&&&&" rxresp expect resp.http.url == "/foo/bar?a=0" txreq -url "/foo/bar?&a=0&&&&&z&w&x&" rxresp expect resp.http.url == "/foo/bar?a=0&w&x&z" delay .1 txreq -url "/foo/bar?&" rxresp expect resp.http.url == "/foo/bar?" delay .1 txreq -url "/foo/bar" rxresp expect resp.http.url == "/foo/bar" } -run varnish-4.1.1/bin/varnishtest/tests/c00046.vtc0000644000201500234410000000341112652366721015733 00000000000000varnishtest "Object/LRU/Stevedores with hinting and body alloc failures" server s1 { rxreq txresp -hdr "Connection: close" -bodylen 1000000 } -start varnish v1 \ -arg "-smalloc,1m" \ -arg "-smalloc,1m" \ -arg "-smalloc,1m" \ -vcl+backend { sub vcl_backend_response { set beresp.storage_hint = "s0"; } } -start client c1 { txreq -url /foo rxresp expect resp.status == 200 expect resp.bodylen == 1000000 } -run varnish v1 -expect SMA.Transient.g_bytes == 0 varnish v1 -expect SMA.s0.g_bytes > 1000000 varnish v1 -expect SMA.s0.g_space < 100000 varnish v1 -expect SMA.s1.g_bytes == 0 varnish v1 -expect SMA.s1.g_space > 1000000 varnish v1 -expect SMA.s2.g_bytes == 0 varnish v1 -expect SMA.s2.g_space > 1000000 server s1 -wait { rxreq non-fatal txresp -hdr "Connection: close" -bodylen 1000001 } -start client c1 { txreq -url /bar rxresp expect resp.status == 200 expect resp.bodylen == 1000001 } -run varnish v1 -expect n_lru_nuked == 1 varnish v1 -expect SMA.Transient.g_bytes == 0 varnish v1 -expect SMA.s0.g_bytes > 1000000 varnish v1 -expect SMA.s0.g_space < 100000 varnish v1 -expect SMA.s1.g_bytes == 0 varnish v1 -expect SMA.s1.g_space > 1000000 varnish v1 -expect SMA.s2.g_bytes == 0 varnish v1 -expect SMA.s2.g_space > 1000000 server s1 -wait { rxreq # non-fatal txresp -hdr "Connection: close" -bodylen 1000002 } -start client c1 { txreq -url /foo rxresp expect resp.status == 200 expect resp.bodylen == 1000002 } -run varnish v1 -expect n_lru_nuked == 2 varnish v1 -expect SMA.Transient.g_bytes == 0 varnish v1 -expect SMA.s0.g_bytes > 1000000 varnish v1 -expect SMA.s0.g_space < 100000 varnish v1 -expect SMA.s1.g_bytes == 0 varnish v1 -expect SMA.s1.g_space > 1000000 varnish v1 -expect SMA.s2.g_bytes == 0 varnish v1 -expect SMA.s2.g_space > 1000000 varnish-4.1.1/bin/varnishtest/tests/r01320.vtc0000644000201500234410000000035012652366721015745 00000000000000varnishtest "#1320 zero-length gzip" server s1 { rxreq txresp -hdr "Content-Encoding: gzip" } -start varnish v1 -vcl+backend { } -start client c1 { txreq -hdr "Accept-Encoding: gzip" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01157.vtc0000644000201500234410000000062712652366721015764 00000000000000varnishtest "#1157 - Connection close on pass and do_stream" server s1 { rxreq txresp expect req.url == "/" rxreq txresp expect req.url == "/" } -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_response { set beresp.do_stream = true; } } -start client c1 { txreq -url / rxresp expect resp.status == 200 txreq -url / rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r00962.vtc0000644000201500234410000000222112652366721015757 00000000000000varnishtest "Test address remapping" # VM-remapping is to random on OSX feature !OSX server s1 { rxreq txresp } -start shell "rm -f ${tmpdir}/_.per?" varnish v1 \ -arg "-pfeature=+wait_silo" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per1,10m" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per2,10m" \ -vcl+backend { sub vcl_backend_response { set beresp.storage_hint = "s0"; } } -start varnish v1 -stop varnish v1 -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" } -run varnish v1 -cliok "storage.list" varnish v1 -cliok "debug.persistent s0 dump" varnish v1 -cliok "debug.persistent s0 sync" varnish v1 -stop server s1 { rxreq txresp -status 400 -msg "Persistent Object Not Found" } -start varnish v2 \ -arg "-pfeature=+wait_silo" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per2,10m" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per1,10m" \ -vcl+backend { } -start client c1 -connect ${v2_sock} { txreq -url "/" rxresp expect resp.msg != "Persistent Object Not Found" expect resp.status == 200 expect resp.http.X-Varnish == "1001 1002" } -run # shell "rm -f /tmp/__v1/_.per" varnish-4.1.1/bin/varnishtest/tests/b00030.vtc0000644000201500234410000000060312652366721015723 00000000000000varnishtest "Test formatting of timestamps" # We can't test the value of x-timestamp, but this should fail # if we can't set the header at all. server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_recv { return (synth(200,req.ttl)); } sub vcl_synth { set resp.http.x-timestamp = now; } } -start client c1 { txreq rxresp expect resp.msg == "-1.000" } -run varnish-4.1.1/bin/varnishtest/tests/s00002.vtc0000644000201500234410000000221512652366721015744 00000000000000varnishtest "Check grace with sick backends" server s1 { rxreq expect req.url == "/" txresp -proto HTTP/1.0 -hdr "nbr: 1" -body "hi" accept rxreq expect req.url == "/" txresp -proto HTTP/1.0 -hdr "nbr: 2" -body "hi" sema r1 sync 2 accept rxreq expect req.url == "/" txresp -proto HTTP/1.0 -hdr "nbr: 3" -hdr "foo: bar" -body "hi" accept rxreq expect req.url == "/" txresp -proto HTTP/1.0 -status 400 -hdr "nbr: 4" -body "hi" accept accept rxreq expect req.url == "/" txresp -proto HTTP/1.0 -status 400 -hdr "nbr: 5" -body "hi" accept sema r1 sync 2 } -start varnish v1 -vcl { backend b { .host = "${s1_addr}"; .port = "${s1_port}"; .probe = { .url = "/"; .timeout = 30ms; .interval = 1s; .window = 2; .threshold = 1; .initial = 0; } } sub vcl_backend_response { set beresp.ttl = 1s; set beresp.grace = 1m; } } -start sema r1 sync 2 client c1 { txreq -url "/" rxresp expect resp.http.foo == "bar" expect resp.status == 200 } -run sema r1 sync 2 client c2 { txreq -url "/" rxresp expect resp.http.foo == "bar" expect resp.status == 200 expect resp.http.x-varnish == "1004 1002" } -run varnish-4.1.1/bin/varnishtest/tests/r00318.vtc0000644000201500234410000000043212652366721015754 00000000000000varnishtest "ESI with no body in response" server s1 { rxreq txresp -status 302 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; set beresp.uncacheable = true; } } -start client c1 { txreq rxresp expect resp.status == 302 } -run varnish-4.1.1/bin/varnishtest/tests/r01156.vtc0000644000201500234410000000136512652366721015763 00000000000000varnishtest "Don't retry if backend ever sent anything" server s1 { rxreq expect req.url == /1 txresp -bodylen 1 rxreq expect req.url == /2 close accept rxreq expect req.url == /2 txresp -bodylen 2 rxreq expect req.url == /3 send "200 " delay .1 close accept rxreq expect req.url == /4 txresp -bodylen 4 } -start varnish v1 -vcl+backend {} -start client c1 { txreq -url /1 rxresp expect resp.status == 200 expect resp.bodylen == 1 # This one should get retried txreq -url /2 rxresp expect resp.status == 200 expect resp.bodylen == 2 # This one should not get retried txreq -url /3 rxresp expect resp.status == 503 } -run client c1 { txreq -url /4 rxresp expect resp.status == 200 expect resp.bodylen == 4 } -run varnish-4.1.1/bin/varnishtest/tests/r01688.vtc0000644000201500234410000000201112652366721015762 00000000000000varnishtest "ESI-included, compressed synthetic responses" server s1 { rxreq expect req.url == "/bar" txresp -gzipbody {} rxreq expect req.url == "/baz" txresp -gzipbody {} } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.url == "/foo" || req.url == "/quux") { return(synth(998, "included synthetic reponse")); } } sub vcl_synth { if (resp.status == 998) { synthetic("this is the body of an included synthetic response"); return(deliver); } } sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq -url /bar rxresp expect resp.status == 200 delay .1 expect resp.body == "this is the body of an included synthetic response" txreq -url /baz -hdr "Accept-Encoding: gzip" timeout 2 rxresp expect resp.status == 200 expect resp.http.Content-Encoding == "gzip" gunzip expect resp.body == "this is the body of an included synthetic response" } -run varnish-4.1.1/bin/varnishtest/tests/r01092.vtc0000644000201500234410000000076212652366721015762 00000000000000varnishtest "Test case for #1092 - esi:remove and comments" server s1 { rxreq txresp -body { Keep-1 Remove-1 Remove-4444 Keep-4444 } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.bodylen == 80 } client c1 -run varnish v1 -expect esi_errors == 1 varnish-4.1.1/bin/varnishtest/tests/b00000.vtc0000644000201500234410000000142212652366721015720 00000000000000varnishtest "Does anything get through at all ?" server s1 { rxreq txresp -body "012345\n" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; } } -start varnish v1 -cliok "param.set debug +workspace" varnish v1 -cliok "param.set debug +witness" varnish v1 -expect n_object == 0 varnish v1 -expect sess_conn == 0 varnish v1 -expect client_req == 0 varnish v1 -expect cache_miss == 0 client c1 { txreq -url "/" rxresp expect resp.status == 200 } -run varnish v1 -expect n_object == 1 varnish v1 -expect sess_conn == 1 varnish v1 -expect client_req == 1 varnish v1 -expect cache_miss == 1 varnish v1 -expect s_sess == 1 varnish v1 -expect s_req == 1 varnish v1 -expect s_resp_bodybytes == 7 varnish v1 -expect s_resp_hdrbytes == 167 varnish-4.1.1/bin/varnishtest/tests/r01638.vtc0000644000201500234410000000143512652366721015766 00000000000000varnishtest "Test retry of straight insufficient bytes pass-fetch : do_stream = false" server s1 { rxreq txresp -hdr "Content-Length: 10000" -nolen -bodylen 5000 } server s2 { rxreq txresp -bodylen 5 } server s1 -start server s2 -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_fetch { set bereq.between_bytes_timeout = 10s; if (bereq.retries == 0) { set bereq.backend = s1; } else { set bereq.backend = s2; } } sub vcl_backend_response { set beresp.do_stream = false; } sub vcl_backend_error { if (bereq.retries == 0) { return (retry); } else { return (deliver); } } } -start client c1 { timeout 10 txreq -url "/" rxresp expect resp.status == 200 expect resp.bodylen == 5 } -run server s1 -wait server s2 -wait varnish-4.1.1/bin/varnishtest/tests/b00041.vtc0000644000201500234410000000025112652366721015724 00000000000000varnishtest "Test varnishadm and the Telnet CLI" varnish v1 -vcl {backend foo { .host = "127.0.0.1"; } } -start shell "${varnishadm} -n ${tmpdir}/v1 help > /dev/null" varnish-4.1.1/bin/varnishtest/tests/s00003.vtc0000644000201500234410000000122612652366721015746 00000000000000varnishtest "Coverage test for -sfile" server s1 { rxreq txresp -nolen -hdr "Transfer-encoding: chunked" chunkedlen 65536 chunkedlen 65536 chunkedlen 65536 chunkedlen 65536 chunkedlen 1 chunkedlen 0 rxreq txresp -nolen -hdr "Transfer-encoding: chunked" chunkedlen 262 chunkedlen 0 } -start varnish v1 \ -arg "-sTransient=file,${tmpdir}/_.file,10m" \ -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; set beresp.ttl = 0.1s; set beresp.grace = 0.1s; set beresp.keep = 0.1s; } } \ -start client c1 { txreq rxresp expect resp.bodylen == 262145 delay 2 txreq rxresp expect resp.bodylen == 262 } -run varnish-4.1.1/bin/varnishtest/tests/r00763.vtc0000644000201500234410000000057012652366721015763 00000000000000varnishtest "Vary header with extra colon" server s1 { rxreq txresp -hdr "Vary:: foo" -hdr "Foo: bar" -bodylen 9 rxreq txresp -hdr "Vary:: foo" -hdr "Foo: bar" -bodylen 8 } -start varnish v1 -vcl+backend {} -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 9 txreq rxresp expect resp.status == 200 expect resp.bodylen == 8 } -run varnish-4.1.1/bin/varnishtest/tests/b00004.vtc0000644000201500234410000000062212652366721015725 00000000000000varnishtest "Torture Varnish with start/stop commands" server s1 { rxreq } -start varnish v1 -vcl+backend { } varnish v1 -start varnish v1 -stop varnish v1 -start varnish v1 -stop varnish v1 -start varnish v1 -stop varnish v1 -cliok start varnish v1 -clierr 300 start varnish v1 -clierr 300 start varnish v1 -cliok stop varnish v1 -clierr 300 stop varnish v1 -clierr 300 stop varnish v1 -wait varnish-4.1.1/bin/varnishtest/tests/r00506.vtc0000644000201500234410000000030312652366721015750 00000000000000varnishtest "Illegal HTTP status from backend" server s1 { rxreq send "HTTP/1.1 1000\n\nFoo" } -start varnish v1 -vcl+backend { sub vcl_recv { } } -start client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/v00012.vtc0000644000201500234410000000074512652366721015756 00000000000000varnishtest "Check backend connection limit" server s1 { rxreq sema r1 sync 2 sema r2 sync 2 txresp } -start varnish v1 -vcl { backend default { .host = "${s1_addr}"; .port = "${s1_port}"; .max_connections = 1; } sub vcl_recv { return(pass); } } -start client c1 { txreq rxresp expect resp.status == 200 } -start client c2 { sema r1 sync 2 txreq rxresp expect resp.status == 503 } -run sema r2 sync 2 client c1 -wait varnish v1 -expect backend_busy == 1 varnish-4.1.1/bin/varnishtest/tests/c00022.vtc0000644000201500234410000000534412652366721015734 00000000000000varnishtest "Test banning a url with VCL ban" server s1 { rxreq expect req.url == "/foo" txresp -hdr "foo: bar5" -body "1111\n" rxreq expect req.url == "/foo" txresp -hdr "foo: bar6" -body "11111\n" rxreq expect req.url == "/foo" txresp -hdr "foo: bar7" -body "111111\n" rxreq expect req.url == "/foo" txresp -hdr "foo: bar8" -body "1111111\n" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.method == "PURGE") { ban ("req.url == " + req.url); return (synth(410)); } if (req.method == "PURGESTR") { ban ("" + req.http.ban); return (synth(410)); } } } -start # Fetch into cache client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar5 expect resp.bodylen == 5 } -run # Ban: something else client c1 { txreq -req PURGE -url /foox rxresp expect resp.status == 410 } -run varnish v1 -cliok "ban.list" # Still in cache client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar5 expect resp.bodylen == 5 } -run # Ban: it client c1 { txreq -req PURGE -url /foo rxresp expect resp.status == 410 } -run varnish v1 -cliok "ban.list" # New obj client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar6 expect resp.bodylen == 6 } -run # Ban: everything else client c1 { txreq -req PURGESTR -hdr "ban: req.url != /foo" rxresp expect resp.status == 410 } -run varnish v1 -cliok "ban.list" # still there client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar6 expect resp.bodylen == 6 } -run # Ban: it client c1 { txreq -req PURGESTR -hdr "Ban: obj.http.foo == bar6" rxresp expect resp.status == 410 } -run varnish v1 -cliok "ban.list" # New one client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar7 expect resp.bodylen == 7 } -run # Ban: something else client c1 { txreq -req PURGESTR -hdr "Ban: obj.http.foo == bar6" rxresp expect resp.status == 410 } -run varnish v1 -cliok "ban.list" # Still there client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar7 expect resp.bodylen == 7 } -run # Header match client c1 { txreq -req PURGESTR -hdr "Ban: req.http.foo == barcheck" rxresp expect resp.status == 410 } -run varnish v1 -cliok "ban.list" client c1 { txreq -url "/foo" -hdr "foo: barcheck" rxresp expect resp.status == 200 expect resp.http.foo == bar8 expect resp.bodylen == 8 } -run # Header match client c1 { txreq -req PURGESTR -hdr "Ban: obj.http.foo == barcheck" rxresp expect resp.status == 410 } -run varnish v1 -cliok "ban.list" client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar8 expect resp.bodylen == 8 } -run varnish-4.1.1/bin/varnishtest/tests/r00590.vtc0000644000201500234410000000321212652366721015755 00000000000000varnishtest "Regression test for 590" server s1 { rxreq expect req.url == "/" txresp -body { } rxreq txresp -body "foo" } -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 140 } -run varnish-4.1.1/bin/varnishtest/tests/r01557.vtc0000644000201500234410000000046112652366721015764 00000000000000varnishtest "Test case for #1557" server s1 { rxreq expect req.url == "/?foobar=2" txresp } -start varnish v1 -vcl+backend { sub vcl_recv { set req.url = regsuball(req.url, "(?<=[&\?])(foo|bar)=[^&]+(?:&|$)", ""); } } -start client c1 { txreq -url "/?foo=0&bar=1&foobar=2" rxresp } -run varnish-4.1.1/bin/varnishtest/tests/m00012.vtc0000644000201500234410000000130112652366721015732 00000000000000varnishtest "Test VMOD BLOBS" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_deliver { set resp.http.foo = debug.blob2hex(debug.str2blob("gunk")); } } -start client c1 { txreq rxresp expect resp.http.foo == 67756e6b } -run delay .1 varnish v1 -errvcl {BLOBs can only be used as arguments to VMOD functions.} { backend b1 {.host = "127.0.0.1";} import ${vmod_debug}; sub vcl_deliver { set resp.http.foo = debug.str2blob("gunk"); } } varnish v1 -errvcl {Wrong argument type. Expected BLOB. Got STRING.} { backend b1 {.host = "127.0.0.1";} import ${vmod_debug}; sub vcl_deliver { set resp.http.foo = debug.blob2hex("gunk"); } } varnish-4.1.1/bin/varnishtest/tests/v00040.vtc0000644000201500234410000000046612652366721015757 00000000000000varnishtest "test failing in vcl_init{}" server s1 { rxreq txresp } -start varnish v1 -vcl+backend {} -start client c1 { txreq rxresp } -run varnish v1 -errvcl {VCL "vcl2" Failed initialization} { sub vcl_init { return (fail); } backend b1 { .host = "${s1_addr}"; } } varnish v1 -cliok vcl.list varnish-4.1.1/bin/varnishtest/tests/r00409.vtc0000644000201500234410000000033312652366721015755 00000000000000varnishtest "Regression test for ticket 409" varnish v1 -errvcl {Expected CSTR got '!'} { backend b { .host = "127.0.0.1"; } sub vcl_recv { if ( req.url ~ ! "\.(png|jpg|gif|js|css)$" ) { return (pass); } } } varnish-4.1.1/bin/varnishtest/tests/r00887.vtc0000644000201500234410000000042712652366721015773 00000000000000varnishtest "Ticket #887" server s1 { rxreq txresp -hdr "Cache-control: max-age=-1000" -body "FOO" rxreq txresp -body "FOOBAR" } -start varnish v1 -vcl+backend { } -start client c1 { txreq rxresp expect resp.bodylen == 3 txreq rxresp expect resp.bodylen == 6 } -run varnish-4.1.1/bin/varnishtest/tests/b00002.vtc0000644000201500234410000000106212652366721015722 00000000000000varnishtest "Check that a pass transaction works" server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" } -start varnish v1 -vcl+backend { sub vcl_recv { return(pass); } } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 } -run # Give varnish a chance to update stats delay .1 varnish v1 -expect n_object == 0 varnish v1 -expect SMA.Transient.g_alloc == 0 varnish v1 -expect sess_conn == 1 varnish v1 -expect client_req == 1 varnish v1 -expect s_sess == 1 varnish v1 -expect s_req == 1 varnish v1 -expect s_pass == 1 varnish-4.1.1/bin/varnishtest/tests/r01813.vtc0000644000201500234410000000022012652366721015750 00000000000000varnishtest "Duplicate -a arguments" err_shell {have same address} "${varnishd} -d -a 127.0.0.1:38484 -a 127.0.0.1:38484 -b localhost:80 2>&1" varnish-4.1.1/bin/varnishtest/tests/r01762.vtc0000644000201500234410000000404612652366721015765 00000000000000varnishtest "test vsl api handling of incomplete vtxes combined with bad vxids" server s1 { rxreq txresp accept rxreq delay 5 txresp } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (bereq.url == "/retry" && bereq.retries == 0) { return (retry); } } sub vcl_deliver { if (req.url == "/restart" && req.restarts == 0) { return (restart); } } } -start # xid spill into client marker emitting a bad SLT_Link for bereq retry # triggering vtx_force by way of a timeout # # VSLb(bo->vsl, SLT_Link, "bereq %u retry", wid); varnish v1 -cliok "param.set debug +syncvsl" # vxid wrap at 1<<30 varnish v1 -cliok "debug.xid 1073741823" logexpect l1 -v v1 -g request -T 2 { expect 0 1 Begin "req 0" expect * = ReqStart expect 0 = ReqMethod GET expect 0 = ReqURL / expect 0 = ReqProtocol HTTP/1.1 expect * = ReqHeader "Foo: bar" expect * = Link "bereq 2 fetch" expect * = VSL "timeout" expect * = End "synth" expect 0 2 Begin "bereq 1" expect * 2 Link "bereq 3 retry" expect * = End expect 0 3 Begin "bereq 2 retry" expect * = End } -start client c1 { txreq -url "/retry" -hdr "Foo: bar" rxresp expect resp.status == 200 } -run logexpect l1 -wait ################################################################################ # case xid spill into client marker emitting a bad SLT_Link for restart # # VSLb(req->vsl, SLT_Link, "req %u restart", wid); server s1 { rxreq txresp } -start varnish v1 -cliok "param.set debug +syncvsl" # vxid wrap at 1<<30 varnish v1 -cliok "debug.xid 1073741823" logexpect l1 -v v1 -g request { expect 0 1 Begin "req 0" expect * = ReqStart expect 0 = ReqMethod GET expect 0 = ReqURL / expect 0 = ReqProtocol HTTP/1.1 expect * = ReqHeader "Foo: bar" expect * = Link "bereq 2 fetch" expect * = Link "req 3 restart" expect * = End expect 0 2 Begin "bereq 1" expect * = End expect 0 3 Begin "req 1 restart" expect * = End } -start client c1 { txreq -url "/restart" -hdr "Foo: bar" rxresp expect resp.status == 200 } -run logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/r01737.vtc0000644000201500234410000000152112652366721015762 00000000000000varnishtest "#1737 - ESI sublevel session close" # Build a esi request tree that fails on flush before include at two different # levels. Synchronize a client close after the response headers have been # received by the client. This produces write erros for the body parts in all # fragments. server s1 { rxreq txresp -body {} sema r1 sync 2 rxreq delay 1 txresp -body {22} rxreq txresp -body {1} rxreq expect req.url == "/check" rxresp } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start # Send request, read response headers then close connection client c1 { txreq rxresp -no_obj sema r1 sync 2 } -run delay 3 # Check that Varnish is alive client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/c00004.vtc0000644000201500234410000000300012652366721015717 00000000000000varnishtest "Test Vary functionality" server s1 { rxreq expect req.http.foobar == "1" txresp -hdr "Vary: Foobar" -hdr "Snafu: 1" -body "1111\n" rxreq expect req.http.foobar == "2" txresp -hdr "Vary: Foobar" -hdr "Snafu: 2" -body "2222\n" rxreq expect req.http.foobar == "3" txresp -hdr "Vary: Foobar" -hdr "Snafu: 3" -body "3333\n" rxreq expect req.http.foobar == txresp -hdr "Vary: Foobar" -hdr "Snafu: 4" -body "4444\n" rxreq expect req.http.foobar == "" txresp -hdr "Vary: Foobar" -hdr "Snafu: 5" -body "5555\n" } -start varnish v1 -vcl+backend {} -start client c1 { txreq -hdr "Foobar: 1" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" expect resp.http.snafu == "1" txreq -hdr "Foobar: 2" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1003" expect resp.http.snafu == "2" txreq -hdr "Foobar: 3" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1005" expect resp.http.snafu == "3" txreq rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1007" expect resp.http.snafu == "4" txreq -hdr "Foobar: 1 " rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1009 1002" expect resp.http.snafu == "1" txreq -hdr "Foobar: 1 " rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1010 1002" expect resp.http.snafu == "1" # empty header != no header txreq -hdr "Foobar: " rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1011" expect resp.http.snafu == "5" } -run varnish-4.1.1/bin/varnishtest/tests/r01417.vtc0000644000201500234410000000034512652366721015760 00000000000000varnishtest "vcl_backend_response abandon" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_backend_response { return (abandon); } } -start client c1 { txreq rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/r01804.vtc0000644000201500234410000000124512652366721015760 00000000000000varnishtest "#1804: varnishapi transaction grouping fails for PROXY" server s1 { rxreq txresp } -start varnish v1 -proto "PROXY" -vcl+backend { } -start logexpect l1 -v v1 -d 0 -g session { expect * * Begin {^sess .* PROXY$} expect * = Proxy {^1 } expect * * Begin {^req} expect * * Begin {^sess .* PROXY$} expect * = Proxy {^2 } expect * * Begin {^req} } -start client c1 { send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678\r\n" txreq rxresp } -run client c2 { # good IPv4 sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a" sendhex "21 11 00 0c" sendhex "01 02 03 04" sendhex "05 06 07 08" sendhex "09 0a" sendhex "0b 0c" txreq rxresp } -run logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/m00004.vtc0000644000201500234410000000362312652366721015744 00000000000000varnishtest "Test fileread for std VMOD" shell { printf "File One" > "${tmpdir}/m00004_file_one" printf "File Two" > "${tmpdir}/m00004_file_two" printf "File Three" > "${tmpdir}/m00004_file_three" } server s1 { loop 3 { rxreq txresp -hdr "foo: bar" -bodylen 4 } } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { if (req.url == "/one") { set resp.http.one = std.fileread("${tmpdir}/m00004_file_one"); } else if (req.url == "/two") { set resp.http.two = std.fileread("${tmpdir}/m00004_file_two"); } else if (req.url == "/three") { set resp.http.three = std.fileread("${tmpdir}/m00004_file_three"); } } } -start client c1 { txreq -url "/one" rxresp expect resp.status == 200 expect resp.bodylen == "4" expect resp.http.foo == "bar" expect resp.http.one == "File One" txreq -url "/two" rxresp expect resp.status == 200 expect resp.bodylen == "4" expect resp.http.foo == "bar" expect resp.http.two == "File Two" txreq -url "/three" rxresp expect resp.status == 200 expect resp.bodylen == "4" expect resp.http.foo == "bar" expect resp.http.three == "File Three" } -run varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { if (req.url == "/one") { set resp.http.one = std.fileread("${tmpdir}/m00004_file_one"); } else if (req.url == "/two") { set resp.http.two = std.fileread("${tmpdir}/m00004_file_two"); } else if (req.url == "/three") { set resp.http.three = std.fileread("${tmpdir}/m00004_file_three"); } } } varnish v1 -cli "vcl.list" varnish v1 -cli "vcl.use vcl2" client c1 -run client c1 -run varnish v1 -cli "vcl.list" varnish v1 -cli "vcl.discard vcl1" varnish v1 -vcl+backend { } varnish v1 -cli "vcl.use vcl3" client c1 { txreq -url "/one" rxresp txreq -url "/two" rxresp txreq -url "/three" rxresp } -run varnish v1 -cli "vcl.list" varnish v1 -cli "vcl.discard vcl2" client c1 -run varnish v1 -cli "vcl.list" varnish-4.1.1/bin/varnishtest/tests/c00001.vtc0000644000201500234410000000241412652366721015724 00000000000000varnishtest "Test VCL regsub()" server s1 { rxreq txresp \ -hdr "Foobar: _barf_" \ -hdr "Connection: close" \ -body "012345\n" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.Snafu1 = regsub(beresp.http.Foobar, "ar", "\0\0"); set beresp.http.Snafu2 = regsub(beresp.http.Foobar, "(b)(a)(r)(f)", "\4\3\2p"); set beresp.http.Snafu3 = regsub(beresp.http.Foobar, "(b)(a)(r)(f)", "\4\\\3\2p"); set beresp.http.Snafu4 = regsub(beresp.http.Foobar, "(b)(a)(r)(f)", "\4\&\3\2p"); set beresp.http.Snafu5 = regsub(beresp.http.Foobar, "(b)(a)(r)(f)", "\0\4\3\2\\p"); set beresp.http.Snafu6 = regsub(beresp.http.Foobar, "(b)(a)(r)(f)", "\4\&\3\2p\"); set beresp.http.Snafu7 = regsub(beresp.http.Foobar, "ar", bereq.http.nosuchheader); } } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" expect resp.http.foobar == "_barf_" expect resp.http.snafu1 == "_bararf_" expect resp.http.snafu2 == "_frap_" expect resp.http.snafu3 == "_f\\rap_" expect resp.http.snafu4 == "_f&rap_" # NB: have to escape the \\ in the next two lines expect resp.http.snafu5 == "_barffra\\p_" expect resp.http.snafu6 == "_f&rap\\_" expect resp.http.snafu7 == "_bf_" } -run varnish-4.1.1/bin/varnishtest/tests/p00002.vtc0000644000201500234410000000137512652366721015747 00000000000000varnishtest "Ban a persistent object" shell "rm -f ${tmpdir}/_.per[12]" server s1 { rxreq txresp -hdr "Foo: foo" } -start varnish v1 \ -arg "-pfeature=+wait_silo" \ -arg "-pban_lurker_sleep=0" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per1,10m" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per2,10m" \ -vcl+backend { } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" expect resp.http.foo == "foo" } -run varnish v1 -cliok "ban req.url == / && req.http.jam != session" varnish v1 -stop server s1 -wait server s1 { rxreq txresp -hdr "Foo: bar" } -start varnish v1 -start varnish v1 -cliok ban.list # Count of 3 here, because two "magic" bans are also there" varnish v1 -expect bans == 3 varnish-4.1.1/bin/varnishtest/tests/r01337.vtc0000644000201500234410000000233512652366721015762 00000000000000varnishtest "Bogus backend status" server s1 { rxreq expect req.url == /small txresp -status 99 accept rxreq expect req.url == /low txresp -status 099 accept rxreq expect req.url == /high txresp -status 1000 accept rxreq expect req.url == /X txresp -status X99 accept rxreq expect req.url == /Y txresp -status 9X9 accept rxreq expect req.url == /Z txresp -status 99X accept rxreq expect req.url == /x txresp -status %99 accept rxreq expect req.url == /y txresp -status 9%9 accept rxreq expect req.url == /z txresp -status 99% } -start varnish v1 -vcl+backend {} -start 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 } -run varnish-4.1.1/bin/varnishtest/tests/v00038.vtc0000644000201500234410000000277112652366721015767 00000000000000varnishtest "VCL compiler coverage test: vcc_backend.c" varnish v1 -errvcl "IPv6 address lacks ']'" { backend b1 { .host = "[0:0:0:0"; } } varnish v1 -errvcl "IPv6 address has wrong port separator" { backend b1 { .host = "[0:0:0:0]/0"; } } varnish v1 -errvcl "with exactly three digits" { backend b1 { .host = "127.0.0.1"; .probe = { .expected_response = 1000; } } } varnish v1 -errvcl "Must specify .threshold with .window" { backend b1 { .host = "127.0.0.1"; .probe = { .window = 32; } } } varnish v1 -errvcl "Threshold must be 64 or less" { backend b1 { .host = "127.0.0.1"; .probe = { .threshold = 65; } } } varnish v1 -errvcl "Window must be 64 or less" { backend b1 { .host = "127.0.0.1"; .probe = { .window = 65; .threshold = 64; } } } varnish v1 -errvcl "Threshold can not be greater than window" { backend b1 { .host = "127.0.0.1"; .probe = { .window = 63; .threshold = 64; } } } varnish v1 -errvcl "NB: Backend Syntax has changed:" { backend b1 { set .host = "127.0.0.1"; } } varnish v1 -errvcl "Expected '{' or name of probe, got" { backend b1 { .host = "127.0.0.1"; .probe = "NONE"; } } varnish v1 -errvcl "Field 'port' redefined at:" { backend b1 { .host = "127.0.0.1"; .port = "NONE"; .port = "NONE"; } } varnish v1 -errvcl "Unknown field:" { backend b1 { .host = "127.0.0.1"; .fourscoreandsevenyearsago = "NONE"; } } varnish v1 -errvcl "Mandatory field 'host' missing." { backend b1 { .port = "NONE"; } } varnish-4.1.1/bin/varnishtest/tests/r00476.vtc0000644000201500234410000000121212652366721015756 00000000000000varnishtest "zero length ESI include segments with chunked encoding" server s1 { rxreq expect req.url == "/" txresp -body {\0c} rxreq expect req.url == "/bar" txresp rxreq expect req.url == "/comment" txresp -body {\0c} rxreq expect req.url == "/nullbefore" txresp -body {\0c} } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.bodylen == 8 txreq -url /comment rxresp expect resp.bodylen == 13 txreq -url /nullbefore rxresp expect resp.bodylen == 8 } -run varnish-4.1.1/bin/varnishtest/tests/r00427.vtc0000644000201500234410000000106412652366721015757 00000000000000varnishtest "client close in ESI delivery" server s1 { rxreq txresp -body { } rxreq expect req.url == "/foo" sema r1 sync 2 sema r1 sync 2 txresp -body "[foo]" rxreq expect req.url == "/bar" txresp -body "[bar]" rxreq expect req.url == "/barf" txresp -body "[barf]" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq sema r1 sync 2 } -run client c1 { sema r1 sync 2 txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/e00019.vtc0000644000201500234410000000250212652366721015735 00000000000000varnishtest "Push corners in new ESI parser" server s1 { rxreq txresp -nolen -hdr "Transfer-encoding: chunked" chunked {<1><1>} chunked {<2><2>} chunked {<3><3>} chunked {<4><4>} chunked {

} chunkedlen 256 chunked {

} chunked {

} chunkedlen 65536 chunked {

} chunked {} chunkedlen 256 chunked {} chunkedlen 65536 chunked {} chunkedlen 0 } -start # The included object gets served from a different backend. # This is to avoid a race between when a backend connection # gets put up for reuse because of background fetches in # Varnish 4 server s2 { rxreq expect req.url == "bar/foo" txresp -body {} } -start varnish v1 -vcl+backend { sub vcl_backend_fetch { if (bereq.url != "bar") { set bereq.backend = s2; } } sub vcl_backend_response { if (bereq.url == "bar") { set beresp.do_esi = true; } } } -start varnish v1 -cliok "param.set debug +esi_chop" varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq -url bar rxresp expect resp.status == 200 expect resp.bodylen == 65840 } -run varnish v1 -expect esi_errors == 4 varnish v1 -expect esi_warnings == 1 varnish-4.1.1/bin/varnishtest/tests/l00001.vtc0000644000201500234410000000776312652366721015751 00000000000000varnishtest "Test VSL query operators" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_deliver { set resp.http.x-test = "123 321"; } } -start logexpect l1 -v v1 client c1 { txreq -hdr "Foo: bar" rxresp expect resp.status == 200 } -run # Test 'eq' operator logexpect l1 -d 1 -g vxid -q "Begin eq 'req 1000 rxreq'" { expect 0 * Begin req expect * = End } -run # Test 'ne' operator logexpect l1 -d 1 -g vxid -q "ReqProtocol ne 'HTTP/1.0'" { expect 0 * Begin req expect * = End } -run # Test '==' operator on integers logexpect l1 -d 1 -g vxid -q "RespStatus == 200" { expect 0 * Begin req expect * = End } -run # Test '==' operator on floats logexpect l1 -d 1 -g vxid -q "RespStatus == 200." { expect 0 * Begin req expect * = End } -run # Test '!=' operator on integers logexpect l1 -d 1 -g vxid -q "RespStatus != 503" { expect 0 * Begin req expect * = End } -run # Test '!=' operator on floats logexpect l1 -d 1 -g vxid -q "RespStatus != 503." { expect 0 * Begin req expect * = End } -run # Test '<' operator on integers logexpect l1 -d 1 -g vxid -q "RespStatus < 201" { expect 0 * Begin req expect * = End } -run # Test '<' operator on floats logexpect l1 -d 1 -g vxid -q "RespStatus < 201." { expect 0 * Begin req expect * = End } -run # Test '>' operator on integers logexpect l1 -d 1 -g vxid -q "RespStatus > 199" { expect 0 * Begin req expect * = End } -run # Test '>' operator on floats logexpect l1 -d 1 -g vxid -q "RespStatus > 199." { expect 0 * Begin req expect * = End } -run # Test '<=' operator on integers logexpect l1 -d 1 -g vxid -q "RespStatus <= 200" { expect 0 * Begin req expect * = End } -run # Test '<=' operator on floats logexpect l1 -d 1 -g vxid -q "RespStatus <= 200." { expect 0 * Begin req expect * = End } -run # Test '>=' operator on integers logexpect l1 -d 1 -g vxid -q "RespStatus >= 200" { expect 0 * Begin req expect * = End } -run # Test '>=' operator on floats logexpect l1 -d 1 -g vxid -q "RespStatus >= 200." { expect 0 * Begin req expect * = End } -run # Test '~' operator logexpect l1 -d 1 -g vxid -q "RespStatus ~ '^200$'" { expect 0 * Begin req expect * = End } -run # Test '!~' operator logexpect l1 -d 1 -g vxid -q "RespStatus !~ '^404$'" { expect 0 * Begin req expect * = End } -run # Test boolean and logexpect l1 -d 1 -g vxid -q "RespStatus == 200 and RespStatus ~ '^200$'" { expect 0 * Begin req expect * = End } -run # Test boolean or logexpect l1 -d 1 -g vxid -q "RespStatus == 404 or RespStatus ~ '^200$'" { expect 0 * Begin req expect * = End } -run # Test boolean not logexpect l1 -d 1 -g vxid -q "RespStatus == 404 or not RespStatus ~ '^404$'" { expect 0 * Begin req expect * = End } -run # Test grouping logexpect l1 -d 1 -g vxid -q "(RespStatus == 200 or RespStatus == 404) and RespStatus == 200" { expect 0 * Begin req expect * = End } -run # Test and/or precedence logexpect l1 -d 1 -g vxid -q "RespStatus == 200 or RespStatus == 503 and RespStatus == 404" { expect 0 * Begin req expect * = End } -run # Test field logexpect l1 -d 1 -g vxid -q "RespHeader[2] == 123" { expect 0 * Begin req expect * = End } -run # Test field on floats logexpect l1 -d 1 -g vxid -q "RespHeader[2] == 123." { expect 0 * Begin req expect * = End } -run # Test taglists logexpect l1 -d 1 -g vxid -q "Debug,Resp* == 200" { expect 0 * Begin req expect * = End } -run # Test record prefix logexpect l1 -d 1 -g vxid -q "Resp*:x-test eq '123 321'" { expect 0 * Begin req expect * = End } -run # Test tag presence (no operator) logexpect l1 -d 1 -g vxid -q "RespStatus" { expect 0 * Begin req expect * = End } -run # Test level limits equal logexpect l1 -d 1 -g vxid -q "{1}Begin ~ req" { expect 0 * Begin req expect * = End } -run # Test level limits less than or equal logexpect l1 -d 1 -g vxid -q "{2-}Begin ~ req" { expect 0 * Begin req expect * = End } -run # Test level limits greater than or equal logexpect l1 -d 1 -g vxid -q "{0+}Begin ~ req" { expect 0 * Begin req expect * = End } -run varnish-4.1.1/bin/varnishtest/tests/r01395.vtc0000644000201500234410000000044212652366721015763 00000000000000varnishtest "Test vcl_synth is called even if vcl_backend_fetch failed" varnish v1 -vcl { backend default { .host = "${bad_ip}"; .port = "9090"; } sub vcl_backend_error { set beresp.status = 299; } } -start client c1 { txreq -url "/" rxresp expect resp.status == 299 } -run varnish-4.1.1/bin/varnishtest/tests/r01349.vtc0000644000201500234410000000205512652366721015764 00000000000000varnishtest "Exact matching for varnishadm backend.set_health" server s1 -repeat 2 { rxreq txresp -hdr "Backend: b1" } -start server s2 -repeat 2 { rxreq txresp -hdr "Backend: b" } -start varnish v1 -vcl { backend b1 { .host = "${s1_addr}"; .port = "${s1_port}"; } backend b { .host = "${s2_addr}"; .port = "${s2_port}"; } sub vcl_recv { return(pass); } sub vcl_backend_fetch { if (bereq.http.backend == "b1") { set bereq.backend = b1; } else { set bereq.backend = b; } } } -start varnish v1 -cliok "backend.list b" client c1 { txreq -hdr "Backend: b1" rxresp expect resp.status == 200 expect resp.http.backend == "b1" txreq -hdr "Backend: b" rxresp expect resp.status == 200 expect resp.http.backend == "b" } -run varnish v1 -cliok "backend.set_health b sick" client c1 { txreq -hdr "Backend: b1" rxresp expect resp.status == 200 expect resp.http.backend == "b1" txreq -hdr "Backend: b" rxresp expect resp.status == 503 } -run varnish v1 -clierr 106 "backend.set_health b(1.2.3.4:) healthy" varnish-4.1.1/bin/varnishtest/tests/r01002.vtc0000644000201500234410000000032312652366721015742 00000000000000varnishtest "Real relational comparisons" varnish v1 -vcl { import ${vmod_std}; backend foo { .host = "${bad_ip}"; .port = "9080"; } sub vcl_recv { if (std.random(0,5) < 1.0) { return (pipe); } } } varnish-4.1.1/bin/varnishtest/tests/b00024.vtc0000644000201500234410000000063412652366721015732 00000000000000varnishtest "Check that the first_byte_timeout works from vcl" feature SO_RCVTIMEO_WORKS server s1 { rxreq delay 1.5 txresp } -start varnish v1 -vcl+backend { sub vcl_backend_fetch { set bereq.first_byte_timeout = 1s; } } -start client c1 { txreq rxresp expect resp.status == 503 } -run server s1 { rxreq delay 0.5 txresp } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r00965.vtc0000644000201500234410000000170512652366721015770 00000000000000varnishtest "restart in vcl_miss #965" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.http.X-Banned == "check") { unset req.http.X-Banned; } elseif (req.restarts == 0) { set req.http.X-Banned = "check"; if (req.http.x-pass) { return (pass); } else { return (hash); } } } sub vcl_hash { ## Check if they have a ban in the cache, or if they are going to be banned in cache. if (req.http.X-Banned) { hash_data(client.ip); return (lookup); } } sub vcl_synth { if (resp.status == 988) { return (restart); } } sub vcl_miss { if (req.http.X-Banned == "check") { return (synth(988,"restarting")); } } sub vcl_pass { if (req.http.X-Banned == "check") { return (synth(988,"restarting")); } } } -start client c1 { txreq rxresp expect resp.status == 200 txreq rxresp expect resp.status == 200 txreq -hdr "X-Pass: 1" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01355.vtc0000644000201500234410000000177512652366721015771 00000000000000varnishtest "Test ESI ignoring BOMs" server s1 { rxreq expect req.url == /1 txresp -body "\xeb\xbb\xbf blabla" rxreq expect req.url == /2 txresp -body "\xeb\xbb\xbf blabla" rxreq expect req.url == /3 txresp -body "\xeb\xbb\xbf\xeb\xbb\xbf blabla" rxreq expect req.url == /4 txresp -body "\xeb\xbc blabla" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { # No ESI processing txreq -url /1 rxresp expect resp.bodylen == 47 } -run varnish v1 -cliok "param.set feature +esi_remove_bom" client c1 { # BOM removed, ESI processing txreq -url /2 rxresp expect resp.bodylen == 13 } -run client c1 { # BOMs removed, ESI processing txreq -url /3 rxresp expect resp.bodylen == 13 } -run client c1 { # Not a BOM, no ESI processing txreq -url /4 rxresp expect resp.bodylen == 46 } -run varnish-4.1.1/bin/varnishtest/tests/v00000.vtc0000644000201500234410000000057312652366721015752 00000000000000varnishtest "VCL/VRT: req.grace, obj.ttl and obj.grace" server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" } server s1 -start varnish v1 -vcl+backend { sub vcl_recv { set req.ttl += 1 s; } sub vcl_backend_response { set beresp.ttl += 1 m; set beresp.grace += 1 h; } } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/e00010.vtc0000644000201500234410000000063512652366721015731 00000000000000varnishtest "Ignoring non esi elements" server s1 { rxreq txresp -body { bar foo } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start -cli "param.set feature +esi_ignore_other_elements" client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 21 } -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/a00001.vtc0000644000201500234410000000053512652366721015724 00000000000000varnishtest "basic default HTTP transactions with expect" server s1 { rxreq expect req.method == GET expect req.proto == HTTP/1.1 expect req.url == "/" txresp } server s1 -start client c1 -connect ${s1_sock} { txreq rxresp expect resp.proto == HTTP/1.1 expect resp.status == 200 expect resp.msg == OK } client c1 -run server s1 -wait varnish-4.1.1/bin/varnishtest/tests/r00861.vtc0000644000201500234410000000351112652366721015760 00000000000000varnishtest "Regression test for ESI/Gzip issues in #861" server s1 { rxreq expect req.url == "/1" txresp -body {

} rxreq expect req.url == "/foo" txresp -body rxreq expect req.url == "/bar" txresp -body rxreq expect req.url == "/barf" txresp -body {[{"program":true,"id":972389,"vendorId":"15451701","starttime":1297777500000,"endtime":1297783500000,"title":"Swimming Pool","oTitle":"true","genre":"0x10x0","timeshiftEnabled":true},{"program":true,"id":972391,"vendorId":"15451702","starttime":1297783500000,"endtime":1297785000000,"title":"Fashion -Trends","oTitle":null,"genre":"0x30x0","timeshiftEnabled":true},{"program":true,"id":972384,"vendorId":"15451703","starttime":1297785000000,"endtime":1297786500000,"title":"Fashion - mænd","oTitle":null,"genre":"0x30x0","timeshiftEnabled":true},{"program":true,"id":972388,"vendorId":"15451704","starttime":1297786500000,"endtime":1297789800000,"title":"The Day Before","oTitle":"true","genre":"0x30x0","timeshiftEnabled":true},{"program":true,"id":972393,"vendorId":"15451705","starttime":1297789800000,"endtime":1297793100000,"title":"Kessels øje","oTitle":null,"genre":"0x20x3","timeshiftEnabled":true}]} rxreq expect req.url == "/2" txresp -body { } } -start varnish v1 \ -vcl+backend { sub vcl_backend_response { if (bereq.url == "/1" || bereq.url == "/2") { set beresp.do_esi = true; set beresp.do_gzip = true; } } } -start client c1 { txreq -url "/1" rxresp expect resp.http.Content-Encoding == expect resp.bodylen == 22 txreq -url "/barf" -hdr "Accept-Encoding: gzip" rxresp expect resp.http.Content-Encoding == expect resp.bodylen == 909 txreq -url "/2" -hdr "Accept-Encoding: gzip" rxresp gunzip expect resp.bodylen == 910 } -run varnish-4.1.1/bin/varnishtest/tests/a00012.vtc0000644000201500234410000000031012652366721015715 00000000000000varnishtest "Ensure that we can test non-existence of headers (#1062)" server s1 { rxreq txresp } -start client c1 -connect ${s1_sock} { txreq rxresp expect resp.http.X-Test == } -run varnish-4.1.1/bin/varnishtest/tests/r01175.vtc0000644000201500234410000000063512652366721015763 00000000000000varnishtest "#1175 - -smalloc c_fail incremented by allocations, not bytes" server s1 { rxreq txresp -nolen -hdr "Content-Length: 1048576" } -start varnish v1 -arg "-s test=malloc,1M" -vcl+backend { sub vcl_backend_response { set beresp.storage_hint = "test"; set beresp.do_stream = false; } } -start client c1 { txreq rxresp expect resp.status == 503 } -run varnish v1 -expect SMA.test.c_fail < 5 varnish-4.1.1/bin/varnishtest/tests/c00035.vtc0000644000201500234410000000114412652366721015732 00000000000000varnishtest "Dropping polling of a backend" server s1 -repeat 40 { rxreq txresp } -start varnish v1 -vcl { probe default { .window = 8; .initial = 7; .threshold = 8; .interval = 0.1s; } backend s1 { .host = "${s1_addr}"; .port = "${s1_port}"; } } -start delay 1 varnish v1 -vcl+backend { } -cliok "vcl.use vcl2" -cliok "vcl.discard vcl1" delay 1 varnish v1 -cliok "vcl.list" varnish v1 -cliok "backend.list -p" server s1 -break { rxreq expect req.url == /foo txresp -bodylen 4 } -start client c1 { txreq -url /foo rxresp expect resp.status == 200 expect resp.bodylen == 4 } -run varnish-4.1.1/bin/varnishtest/tests/b00021.vtc0000644000201500234410000000134412652366721015726 00000000000000varnishtest "Check the between_bytes_timeout behaves from vcl" feature SO_RCVTIMEO_WORKS server s1 { rxreq send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 4.0 send "Baba\n" } -start varnish v1 -vcl+backend { sub vcl_backend_fetch { set bereq.between_bytes_timeout = 2s; } sub vcl_backend_response { set beresp.do_stream = false; } } -start client c1 { txreq rxresp expect resp.status == 503 } -run server s1 { rxreq send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 1.0 send "Baba\n" delay 1.0 send "Baba\n" delay 1.0 send "Baba\n" delay 1.0 send "Baba\n" delay 1.0 send "Baba\n" } -start client c1 { txreq timeout 10 rxresp expect resp.status == 200 expect resp.bodylen == 25 } -run varnish-4.1.1/bin/varnishtest/tests/v00017.vtc0000644000201500234410000000504212652366721015756 00000000000000varnishtest "VCL compiler coverage test: vcc_acl.c" varnish v1 -errvcl {Too wide mask (33) for IPv4 address} { backend b { .host = "127.0.0.1"; } acl a { "10.1.2.3"/33; } sub vcl_recv { if (client.ip ~ a) { return(pass); } } } varnish v1 -errvcl {Too wide mask (129) for IPv6 address} { backend b { .host = "127.0.0.1"; } acl a { "1::2"/129; } sub vcl_recv { if (client.ip ~ a) { return(pass); } } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } acl a { "1.2.3.4"/31; "1.2.3.4"/31; } sub vcl_recv { if (client.ip ~ a) { return(pass); } } } varnish v1 -errvcl {Conflicting ACL entries:} { backend b { .host = "127.0.0.1"; } acl a { "1.2.3.4"; !"1.2.3.4"; } sub vcl_recv { if (client.ip ~ a) { return(pass); } } } varnish v1 -errvcl {DNS lookup(...com): } { backend b { .host = "127.0.0.1"; } acl a { "...com"; } sub vcl_recv { if (client.ip ~ a) { return(pass); } } } varnish v1 -errvcl {DNS lookup(10.1..2): } { backend b { .host = "127.0.0.1"; } acl a { "10.1..2"; } sub vcl_recv { if (client.ip ~ a) { return(pass); } } } varnish v1 -errvcl {Expected ')' got ';'} { backend b { .host = "127.0.0.1"; } acl a { ( "10.1.2"; } sub vcl_recv { if (client.ip ~ a) { return(pass); } } } varnish v1 -errvcl {Expected ';' got ')'} { backend b { .host = "127.0.0.1"; } acl a { "10.1.2" ); } sub vcl_recv { if (client.ip ~ a) { return(pass); } } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } acl a { ! "10.1.3"; ("...com" / 22); (!"...com"); } sub vcl_recv { if (client.ip ~ a) { return(pass); } } } varnish v1 -errvcl {'client.ip': Not available in method 'vcl_backend_response'} { backend b { .host = "127.0.0.1"; } sub vcl_recv { if (client.ip == "127.0.0.1") { return(pass); } } sub vcl_backend_response { if (client.ip != "127.0.0.1") { return(retry); } } } varnish v1 -errvcl {Operator > not possible on IP} { backend b { .host = "127.0.0.1"; } sub vcl_recv { if (client.ip > "127.0.0.1") { return(pass); } } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } acl a { "10.1.1"/25; "10.1.3"/26; "10.1.3"/25; "10.1.2"/25; "10.1.2"/26; "10.1.4"/25; "10.2.66"/23; ! "10.2.64"/23; "10.2.68"/23; } sub vcl_recv { if (client.ip ~ a) { return(pass); } } } varnish v1 -errvcl {.../mask is not numeric.} { backend b { .host = "127.0.0.1"; } acl a { "10.0.1.0/1bc"; } sub vcl_recv { if (client.ip ~ a) { return(pass); } } } varnish v1 -errvcl {/mask only allowed once} { backend b { .host = "127.0.0.1"; } acl a { "10.0.1.0/22" / 22; } sub vcl_recv { if (client.ip ~ a) { return(pass); } } } varnish-4.1.1/bin/varnishtest/tests/README0000644000201500234410000000201612652366721015261 00000000000000Test-scripts for varnishtest ============================ Naming scheme ------------- The intent is to be able to run all script sin lexicographic order and get a sensible failure mode. This requires more basic tests to be earlier and more complex tests to be later in the test sequence, we do this with the prefix/id letter: [id]%05d.vtc id ~ [a] --> varnishtest(1) tests id ~ [b] --> Basic functionality tests id ~ [c] --> Complex functionality tests id ~ [d] --> Director VMOD tests id ~ [e] --> ESI tests id ~ [g] --> GZIP tests id ~ [j] --> JAIL tests id ~ [l] --> VSL tests id ~ [m] --> VMOD tests excluding director id ~ [o] --> prOxy protocol id ~ [p] --> Persistent tests id ~ [r] --> Regression tests, same number as ticket id ~ [s] --> Slow tests, expiry, grace etc. id ~ [t] --> sTreaming tests id ~ [u] --> Unusual background processes id ~ [v] --> VCL tests: execute VRT functions Private test scope ------------------ Test cases matching [id]1%04d.vtc are reserved for private tests. varnish-4.1.1/bin/varnishtest/tests/d00002.vtc0000644000201500234410000000235312652366721015730 00000000000000varnishtest "Test random director" server s1 { rxreq txresp -body "foo1" rxreq txresp -body "bar1" } -start varnish v1 -vcl+backend { import ${vmod_directors}; sub vcl_init { new foo = directors.random(); foo.add_backend(s1, 1); foo.add_backend(s1, 1); } sub vcl_backend_fetch { set bereq.backend = foo.backend(); } sub vcl_backend_response { set beresp.http.where = bereq.backend + "-->" + beresp.backend; } } -start client c1 { txreq -url "/foo" rxresp expect resp.http.where == "foo-->s1" txreq -url "/bar" rxresp expect resp.http.where == "foo-->s1" } -run server s1 -start server s2 { loop 20 { rxreq txresp } } -start varnish v1 -vcl+backend { import ${vmod_directors}; sub vcl_init { new foo = directors.random(); foo.add_backend(s1, 1); foo.add_backend(s2, 1); } sub vcl_recv { if (req.method == "DELETE") { foo.remove_backend(s1); return(synth(204)); } set req.backend_hint = foo.backend(); return (pass); } sub vcl_backend_response { set beresp.http.where = bereq.backend + "-->" + beresp.backend; } } client c1 { txreq -req "DELETE" rxresp expect resp.status == 204 loop 20 { txreq rxresp expect resp.status == 200 expect resp.http.where == "foo-->s2" } } -run varnish-4.1.1/bin/varnishtest/tests/b00032.vtc0000644000201500234410000000100512652366721015722 00000000000000varnishtest "CLI coverage test" varnish v1 -cliok storage.list server s1 { rxreq txresp } -start varnish v1 -vcl+backend {} varnish v1 -vcl+backend {} varnish v1 -cliok vcl.list varnish v1 -cliok start varnish v1 -cliok "vcl.use vcl1" varnish v1 -clierr 106 "vcl.discard vcl1" varnish v1 -clierr 106 "vcl.discard vcl0" varnish v1 -clierr 106 {vcl.inline vcl2 "vcl 4.0; backend foo {.host = \"127.0.0.1\";} "} varnish v1 -clierr 106 {vcl.load vcl3 ./nonexistent.vcl} varnish v1 -cliok "vcl.discard vcl2" varnish-4.1.1/bin/varnishtest/tests/b00019.vtc0000644000201500234410000000203312652366721015731 00000000000000varnishtest "Check that max_restarts works and that we don't fall over" server s1 { rxreq txresp -body "012345\n" accept rxreq txresp -body "012345\n" accept rxreq txresp -body "012345\n" accept rxreq txresp -body "012345\n" accept rxreq txresp -body "012345\n" accept rxreq txresp -body "012345\n" } -start varnish v1 -vcl+backend { sub vcl_hit { return (restart); } sub vcl_synth { if (req.restarts == 2) { set resp.status = 200; set resp.reason = "restart=2"; } elsif (req.restarts > 2) { set resp.status = 501; set resp.reason = "restart>2"; } elsif (req.restarts < 2) { set resp.status = 500; set resp.reason = "restart<2"; } } } -start varnish v1 -cliok "param.set max_restarts 2" client c1 { txreq -url "/" rxresp expect resp.status == 200 } -run varnish v1 -cliok "param.set max_restarts 3" client c1 { txreq -url "/" rxresp expect resp.status == 501 } -run varnish v1 -cliok "param.set max_restarts 1" client c1 { txreq -url "/" rxresp expect resp.status == 500 } -run varnish-4.1.1/bin/varnishtest/tests/r01029.vtc0000644000201500234410000000111012652366721015746 00000000000000varnishtest "#1029" server s1 { rxreq expect req.url == "/bar" txresp -gzipbody {[bar]} rxreq expect req.url == "/foo" txresp -body {

FOOBARF

} } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; if (bereq.url == "/foo") { set beresp.ttl = 0s; } else { set beresp.ttl = 10m; } } } -start client c1 { txreq -url "/bar" -hdr "Accept-Encoding: gzip,foo" rxresp gunzip expect resp.bodylen == 5 txreq -url "/foo" -hdr "Accept-Encoding: gzip,foo" rxresp expect resp.bodylen == 21 } -run varnish-4.1.1/bin/varnishtest/tests/m00008.vtc0000644000201500234410000000126412652366721015747 00000000000000varnishtest "Test std vmod vs. unsafe_path" feature topbuild server s1 { rxreq txresp -hdr "foo: bAr" -hdr "bar: fOo" -bodylen 4 } -start varnish v1 -vcl+backend { import ${vmod_std}; } varnish v1 -cliok "param.set vcc_unsafe_path off" varnish v1 -errvcl {'import ... from path ...' is unsafe.} { backend default { .host = "${s1_sock}"; } import ${vmod_std}; } varnish v1 -cliok "param.set vmod_dir /nowhere:${topbuild}/lib/libvmod_std/.libs/:/else" varnish v1 -vcl+backend { import std; } varnish v1 -cliok "param.set vcc_unsafe_path on" varnish v1 -cliok "param.set vmod_dir /nowhere:/else" varnish v1 -vcl+backend { import std from "${topbuild}/lib/libvmod_std/.libs/"; } varnish-4.1.1/bin/varnishtest/tests/p00007.vtc0000644000201500234410000000252412652366721015751 00000000000000varnishtest "test reload of object spanning incomplete segment" server s1 { rxreq expect req.url == "/1" send "HTTP/1.1 200 OK\n" send "Transfer-encoding: chunked\n" send "\n" chunkedlen 32 # Tell top-level that it can sync the stevedore sema r1 sync 2 # Top-level tells us it has synched the stevedore sema r1 sync 2 chunkedlen 32 chunkedlen 0 accept rxreq expect req.url == "/2" txresp -bodylen 100 rxreq expect req.url == "/1" txresp -bodylen 48 } -start varnish v1 -arg "-sdeprecated_persistent,${tmpdir}/_.per,10m" \ -vcl+backend {} -start varnish v1 -cliok "debug.fragfetch 32" client c1 { txreq -url "/1" rxresp expect resp.bodylen == 64 } -start # Wait for first chunk to have been sent sema r1 sync 2 delay .2 # Sync the stevedore, so the next chunk ends up i segment 2 varnish v1 -cliok "debug.persistent s0 sync" # Tell server to continue sema r1 sync 2 # Get the result client c1 -wait varnish v1 -cliok "debug.persistent s0 dump" # Panic worker so second segment does not get closed varnish v1 -clierr 400 "debug.panic.worker" delay 0.5 # start again varnish v1 -start client c1 { # Make sure there is not a valid "struct storage" in second seg. txreq -url "/2" rxresp expect resp.bodylen == 100 # Fetch the vampire object and see how that goes... txreq -url "/1" rxresp expect resp.bodylen == 48 } -run varnish-4.1.1/bin/varnishtest/tests/c00027.vtc0000644000201500234410000001325112652366721015735 00000000000000varnishtest "Test eviction" server s1 { rxreq expect req.url == "/1" txresp -body "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" rxreq expect req.url == "/2" txresp -body "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" rxreq expect req.url == "/3" txresp -body "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" rxreq expect req.url == "/4" txresp -body "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" rxreq expect req.url == "/5" txresp -body "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" } -start varnish v1 -arg "-s malloc,1M" -vcl+backend { sub vcl_backend_response { set beresp.ttl = 10m; } } -start client c1 { txreq -url "/1" rxresp expect resp.status == 200 txreq -url "/2" rxresp expect resp.status == 200 txreq -url "/3" rxresp expect resp.status == 200 txreq -url "/4" rxresp expect resp.status == 200 txreq -url "/5" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01176.vtc0000644000201500234410000000031112652366721015753 00000000000000varnishtest "-s Transient=malloc crash" server s1 { rxreq txresp } -start varnish v1 -arg "-s Transient=malloc" -vcl+backend {} -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/g00005.vtc0000644000201500234410000000135712652366721015741 00000000000000varnishtest "test gunzip for client + Range" server s1 { rxreq expect req.http.accept-encoding == "gzip" txresp -gzipbody FOOBARBARF } -start varnish v1 -cliok "param.set http_gzip_support true" -vcl+backend { } -start client c1 { txreq rxresp expect resp.bodylen == "10" expect resp.http.content-encoding == txreq -hdr "Accept-encoding: gzip;q=0.1" rxresp expect resp.http.content-encoding == "gzip" gunzip expect resp.bodylen == "10" # This delay attempts to ensure that the busyobj # is completed before we attempt the range request delay .2 txreq -hdr "Range: bytes=3-5" rxresp expect resp.status == 206 expect resp.http.content-encoding == "" expect resp.bodylen == "3" expect resp.body == "BAR" } -run varnish-4.1.1/bin/varnishtest/tests/u00001.vtc0000644000201500234410000000145412652366721015751 00000000000000varnishtest "varnishncsa log file rotation" server s1 { rxreq expect req.url == "/foo" txresp -status 200 rxreq expect req.url == "/bar" txresp -status 404 } -start varnish v1 -vcl+backend "" -start shell "${varnishncsa} -D -P ${tmpdir}/ncsa.pid -n ${v1_name} -w ${tmpdir}/ncsa.log -F %s" # give varnishncsa enough time to open the VSM delay 2 client c1 { txreq -url "/foo" rxresp } -run # give varnishncsa enough time to write delay 2 # rotate logs shell "mv ${tmpdir}/ncsa.log ${tmpdir}/ncsa.old.log >/dev/null 2>&1" shell "kill -HUP `cat ${tmpdir}/ncsa.pid`" client c1 { txreq -url "/bar" rxresp } -run # give varnishncsa enough time to write delay 2 shell "kill `cat ${tmpdir}/ncsa.pid`" shell "grep 200 ${tmpdir}/ncsa.old.log >/dev/null" shell "grep 404 ${tmpdir}/ncsa.log >/dev/null" varnish-4.1.1/bin/varnishtest/tests/a00008.vtc0000644000201500234410000000112712652366721015731 00000000000000varnishtest "Sema operations" server s1 { rxreq sema r1 sync 4 delay .9 txresp } -start server s2 { rxreq sema r1 sync 4 delay .6 txresp } -start server s3 { rxreq sema r1 sync 4 delay .2 txresp } -start client c1 -connect ${s1_sock} { delay .2 txreq rxresp sema r1 sync 4 } -start client c2 -connect ${s2_sock} { delay .6 txreq rxresp sema r1 sync 4 } -start client c3 -connect ${s3_sock} { delay .9 txreq rxresp sema r1 sync 4 } -start # Wait for all servers to have received requests sema r1 sync 4 # Wait for all clients to have received responses sema r1 sync 4 varnish-4.1.1/bin/varnishtest/tests/r00310.vtc0000644000201500234410000000031412652366721015743 00000000000000varnishtest "Test obj.http.x-cache in vcl_hit" varnish v1 -errvcl {Variable 'obj.http.x-cache' is read only.} { backend foo { .host = "127.0.0.1"; } sub vcl_hit { set obj.http.x-cache = "hit"; } } varnish-4.1.1/bin/varnishtest/tests/r01644.vtc0000644000201500234410000000067612652366721015771 00000000000000varnishtest "test access to cache_param from vmod" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_deliver { set resp.http.foo = debug.vre_limit(); } } -start varnish v1 -cliok "param.set pcre_match_limit 100" client c1 { txreq rxresp expect resp.http.foo == 100 } -run varnish v1 -cliok "param.set pcre_match_limit 200" client c1 { txreq rxresp expect resp.http.foo == 200 } -run varnish-4.1.1/bin/varnishtest/tests/b00001.vtc0000644000201500234410000000070312652366721015722 00000000000000varnishtest "Check that a pipe transaction works" server s1 -repeat 1 { rxreq txresp -body "012345\n" } -start varnish v1 -vcl+backend { sub vcl_recv { return(pipe); } } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 } -run varnish v1 -expect n_object == 0 varnish v1 -expect sess_conn == 1 varnish v1 -expect client_req == 1 varnish v1 -expect s_sess == 1 varnish v1 -expect s_req == 1 varnish v1 -expect s_pipe == 1 varnish-4.1.1/bin/varnishtest/tests/r01612.vtc0000644000201500234410000000163312652366721015756 00000000000000varnishtest "Missing Content-Length/T-E on passed empty chunked responses." server s1 { # Empty c-l response is OK. rxreq expect req.url == "/0" txresp # Nonzero chunked response is OK. rxreq expect req.url == "/1" send "HTTP/1.1 200 OK\n" send "Transfer-encoding: chunked\n" send "\n" chunkedlen 20 chunkedlen 0 # Empty chunked response is not. rxreq expect req.url == "/2" send "HTTP/1.1 200 OK\n" send "Transfer-encoding: chunked\n" send "\n" chunkedlen 0 } -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_response { set beresp.do_stream = false; } } -start client c1 { txreq -url "/0" rxresp expect resp.bodylen == 0 expect resp.http.Content-Length == "0" txreq -url "/1" rxresp expect resp.bodylen == 20 expect resp.http.Content-Length == "20" txreq -url "/2" rxresp expect resp.bodylen == 0 expect resp.http.Content-Length == "0" } -run varnish-4.1.1/bin/varnishtest/tests/v00043.vtc0000644000201500234410000000217412652366721015760 00000000000000varnishtest "Test PRIV_TOP" # same as v00042.vtc, but the priv remains the same across esi includes server s1 { rxreq expect req.url == "/a" expect req.http.x0 == "/a0" expect req.http.x1 == "/a0" txresp -body { } rxreq expect req.url == "/foo" expect req.http.x0 == "/a0" expect req.http.x1 == "/a0" txresp -body { } rxreq expect req.url == "/bar" expect req.http.x0 == "/a0" expect req.http.x1 == "/a0" txresp rxreq expect req.url == "/b" expect req.http.x0 == "/b0" expect req.http.x1 == "/b0" txresp } -start varnish v1 -cliok "param.set debug +syncvsl" -vcl+backend { import ${vmod_debug}; sub vcl_recv { set req.http.x0 = debug.test_priv_top(req.url + req.esi_level); } sub vcl_miss { set req.http.x1 = debug.test_priv_top(""); } sub vcl_backend_response { set beresp.do_esi = true; } sub vcl_deliver { set resp.http.x1 = debug.test_priv_top(""); } } -start client c1 { txreq -url /a rxresp expect resp.http.x1 == "/a0" txreq -url /b rxresp expect resp.http.x1 == "/b0" } -run varnish v1 -expect s_req == 2 varnish-4.1.1/bin/varnishtest/tests/r01218.vtc0000644000201500234410000000054612652366721015762 00000000000000varnishtest "regression for NULL string concatenation" server s1 { rxreq expect req.http.Candy == "FOOBAR" expect req.http.Cookie == "FOOBAR" txresp } -start varnish v1 -vcl+backend { sub vcl_recv { set req.http.Candy = " FOOBAR" + req.http.Cookie; set req.http.Cookie = req.http.Cookie + " FOOBAR"; } } -start client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/c00031.vtc0000644000201500234410000000034112652366721015724 00000000000000varnishtest "Worker thread stack size setting" server s1 { rxreq txresp } -start varnish v1 -arg "-p thread_pool_stack=262144" -vcl+backend {} -start client c1 { txreq -url "/" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01038.vtc0000644000201500234410000000245012652366721015756 00000000000000varnishtest "ticket 1038 regression test" server s1 { rxreq txresp -nolen -hdr "Transfer-encoding: chunked" chunked {} chunked {} chunked {} chunked {} chunked {} chunked {} chunked {} chunked {} chunked {} chunked {} chunkedlen 0 rxreq expect req.url == "/xxx0.htm" txresp -body "foo0" rxreq expect req.url == "/xxx1.htm" txresp -body "foo1" rxreq expect req.url == "/xxx2.htm" txresp -body "foo2" rxreq expect req.url == "/xxx3.htm" txresp -body "foo3" rxreq expect req.url == "/xxx4.htm" txresp -body "foo4" rxreq expect req.url == "/xxx5.htm" txresp -body "foo5" rxreq expect req.url == "/xxx6.htm" txresp -body "foo6" rxreq expect req.url == "/xxx7.htm" txresp -body "foo7" rxreq expect req.url == "/xxx8.htm" txresp -body "foo8" } -start varnish v1 -arg "-p workspace_backend=10k" -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.bodylen == 42 txreq rxresp expect resp.bodylen == 42 } -run varnish v1 -expect losthdr == 0 varnish-4.1.1/bin/varnishtest/tests/r00733.vtc0000644000201500234410000000034412652366721015757 00000000000000varnishtest "HTTP/1.1 Backend sends no length hint" server s1 { rxreq send "HTTP/1.0 200 OK\n" send "\n" send "12345" } -start varnish v1 -vcl+backend {} -start client c1 { txreq rxresp expect resp.bodylen == 5 } -run varnish-4.1.1/bin/varnishtest/tests/r01578.vtc0000644000201500234410000000136512652366721015773 00000000000000varnishtest "max-age and age" server s1 { rxreq txresp -hdr "Cache-Control: max-age=23" -hdr "Age: 4" -bodylen 40 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.x-ttl = beresp.ttl; } sub vcl_hit { set req.http.x-remaining-ttl = obj.ttl; } sub vcl_deliver { set resp.http.x-remaining-ttl = req.http.x-remaining-ttl; } } -start client c1 { txreq rxresp expect resp.bodylen == 40 expect resp.http.x-ttl == 19.000 expect resp.http.Age == 4 delay 2 txreq rxresp expect resp.bodylen == 40 expect resp.http.x-ttl == 19.000 expect resp.http.x-remaining-ttl <= 17.000 delay 2 txreq rxresp expect resp.bodylen == 40 expect resp.http.x-ttl == 19.000 expect resp.http.x-remaining-ttl <= 15.000 } -run varnish-4.1.1/bin/varnishtest/tests/b00014.vtc0000644000201500234410000000076312652366721015734 00000000000000varnishtest "Check -f command line arg" server s1 { rxreq expect req.url == "/foo" txresp -body "foo" rxreq expect req.url == "/bar" txresp -body "bar" } -start shell "echo 'vcl 4.0; backend foo { .host = \"${s1_addr}\"; .port = \"${s1_port}\"; }' > ${tmpdir}/_b00014.vcl" varnish v1 -arg "-f ${tmpdir}/_b00014.vcl" -start client c1 { txreq -url /foo rxresp } -run varnish v1 -cliok "vcl.load foo ${tmpdir}/_b00014.vcl" -cliok "vcl.use foo" client c1 { txreq -url /bar rxresp } -run varnish-4.1.1/bin/varnishtest/tests/b00033.vtc0000644000201500234410000000111312652366721015723 00000000000000varnishtest "classic hash code coverage" server s1 { rxreq expect req.url == /1 txresp -bodylen 5 rxreq expect req.url == /2 txresp -bodylen 6 rxreq expect req.url == /1 txresp -bodylen 7 rxreq expect req.url == /2 txresp -bodylen 8 } -start varnish v1 -arg "-hclassic,11" -vcl+backend {} -start client c1 { txreq -url /1 rxresp expect resp.bodylen == 5 txreq -url /2 rxresp expect resp.bodylen == 6 } -run varnish v1 -cliok "ban req.url ~ ." client c1 { txreq -url /1 rxresp expect resp.bodylen == 7 txreq -url /2 rxresp expect resp.bodylen == 8 } -run varnish-4.1.1/bin/varnishtest/tests/c00045.vtc0000644000201500234410000000327612652366721015743 00000000000000varnishtest "Object/LRU/Stevedores with hinting" server s1 { rxreq txresp -bodylen 1048288 rxreq txresp -bodylen 1047289 rxreq txresp -bodylen 1047290 } -start varnish v1 \ -arg "-smalloc,1m" \ -arg "-smalloc,1m" \ -arg "-smalloc,1m" \ -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; set beresp.storage_hint = "s0"; # Unset Date header to not change the object sizes unset beresp.http.Date; } } -start client c1 { txreq -url /foo rxresp expect resp.status == 200 expect resp.bodylen == 1048288 } -run varnish v1 -expect SMA.Transient.g_bytes == 0 varnish v1 -expect SMA.s0.g_bytes > 1000000 varnish v1 -expect SMA.s0.g_space < 193 varnish v1 -expect SMA.s1.g_bytes == 0 varnish v1 -expect SMA.s1.g_space > 1000000 varnish v1 -expect SMA.s2.g_bytes == 0 varnish v1 -expect SMA.s2.g_space > 1000000 client c1 { txreq -url /bar rxresp expect resp.status == 200 expect resp.bodylen == 1047289 } -run varnish v1 -expect n_lru_nuked == 1 varnish v1 -expect SMA.Transient.g_bytes == 0 varnish v1 -expect SMA.s0.g_bytes > 1000000 varnish v1 -expect SMA.s0.g_space < 1192 varnish v1 -expect SMA.s1.g_bytes == 0 varnish v1 -expect SMA.s1.g_space > 1000000 varnish v1 -expect SMA.s2.g_bytes == 0 varnish v1 -expect SMA.s2.g_space > 1000000 client c1 { txreq -url /foo rxresp expect resp.status == 200 expect resp.bodylen == 1047290 } -run varnish v1 -expect n_lru_nuked == 2 varnish v1 -expect SMA.Transient.g_bytes == 0 varnish v1 -expect SMA.s0.g_bytes > 1000000 varnish v1 -expect SMA.s0.g_space < 1194 varnish v1 -expect SMA.s1.g_bytes == 0 varnish v1 -expect SMA.s1.g_space > 1000000 varnish v1 -expect SMA.s2.g_bytes == 0 varnish v1 -expect SMA.s2.g_space > 1000000 varnish-4.1.1/bin/varnishtest/tests/c00055.vtc0000644000201500234410000000276712652366721015750 00000000000000varnishtest "test caching of req.body" server s1 { rxreq expect req.bodylen == 3 txresp -hdr "Connection: close" -hdr "Foo: BAR" -body "1234" accept rxreq expect req.bodylen == 3 txresp -hdr "Foo: Foo" -body "56" } -start varnish v1 -cliok "param.set vcc_allow_inline_c true" -vcl+backend { import ${vmod_std}; sub vcl_recv { std.cache_req_body(1KB); C{ const struct gethdr_s HDR_REQ_X_BodyBytes = { HDR_REQ, "\014X-BodyBytes:"}; VRT_SetHdr(ctx, &HDR_REQ_X_BodyBytes, VRT_INT_string(ctx, VRT_CacheReqBody(ctx, 1024)), vrt_magic_string_end); }C return (pass); } sub vcl_deliver { if (resp.http.foo == "BAR") { return (restart); } set resp.http.X-BodyBytes = req.http.X-BodyBytes; } } -start # check log for the aborted POST logexpect l1 -v v1 { expect * 1006 Begin expect * = FetchError "^straight insufficient bytes" expect * = ReqHeader "^X-BodyBytes: -1" } -start varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq -req "POST" -body "FOO" rxresp expect resp.http.Foo == "Foo" expect resp.bodylen == 2 expect resp.http.X-BodyBytes == 3 } -run delay .1 client c1 { txreq -req POST -nolen -hdr "Content-Length: 52" delay .3 } -run delay .1 server s1 { rxreq txresp } -start client c1 { txreq -url "/is_varnish_still_running" rxresp expect resp.status == 200 expect resp.http.X-BodyBytes == 0 } -run client c2 { txreq -req POST -nolen -hdr "Content-Length: 1025" expect_close } -run varnish v1 -stop logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/m00016.vtc0000644000201500234410000000231012652366721015737 00000000000000varnishtest "Test real2integer, real2time, time2integer and time2real in std" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.x-foo = std.integer(req.http.foo, 0); set resp.http.x-bar = std.time2integer(std.real2time( std.real(resp.http.x-foo, 0.0), now), 1); set resp.http.x-baz = std.time2real(std.real2time( std.real(resp.http.x-foo, 0.0), now), 1.0); set resp.http.x-qux = std.real2integer( std.real(req.http.foo, 2.0), 2); # Representation of 9e99, which is larger than what fits in the # 128bit integers on $exotic_platform. set resp.http.x-int-fallback = std.real2integer(9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000, 2); } } -start client c1 { txreq -hdr "foo: 1140618699" rxresp expect resp.http.x-foo == resp.http.x-bar expect resp.http.x-baz == 1140618699.000 expect resp.http.x-qux == 1140618699 expect resp.http.x-int-fallback == 2 } -run # check we get the fallback if the conversion fails client c2 { txreq -hdr "foo: -9e99+1" rxresp expect resp.http.x-bar == 0 expect resp.http.x-baz == 0.000 expect resp.http.x-qux == 2 } -run varnish-4.1.1/bin/varnishtest/tests/r01350.vtc0000644000201500234410000000100512652366721015746 00000000000000varnishtest "IMS + Vary panic" server s1 { rxreq txresp -hdr "Vary: Accept-Encoding" -hdr "Last-Modified: Wed, 10 May 2006 07:22:58 GMT" -body "IMS" rxreq txresp -status 304 -body "" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.ttl = 2s; set beresp.grace = 1m; set beresp.keep = 1m; return(deliver); } } -start client c1 { txreq rxresp expect resp.status == 200 delay 3 txreq rxresp expect resp.status == 200 delay 1 txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r00386.vtc0000644000201500234410000000111212652366721015755 00000000000000varnishtest "#386, failure to insert include" server s1 { rxreq expect req.url == "/body" txresp -hdr "Last-Modified: Tue, 25 Nov 2008 00:00:00 GMT" -body "BODY" rxreq expect req.url == "/" txresp -body {} } -start varnish v1 -arg "-p debug=+workspace" -vcl+backend { sub vcl_backend_response { if (bereq.url == "/") { set beresp.do_esi = true; } } } -start client c1 { txreq -url /body rxresp expect resp.bodylen == 4 txreq -url / -hdr "If-Modified-Since: Tue, 25 Nov 2008 00:00:00 GMT" rxresp expect resp.bodylen == 11 } -run varnish-4.1.1/bin/varnishtest/tests/r01494.vtc0000644000201500234410000000065012652366721015764 00000000000000varnishtest "Test retry in be_resp w/conn: close" server s1 { rxreq txresp -hdr "Connection: close" -bodylen 3 expect_close accept rxreq txresp -hdr "Connection: close" -bodylen 5 expect_close } -start varnish v1 -vcl+backend { sub vcl_backend_response { if(bereq.retries == 0) { return(retry); } } } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.bodylen == 5 } -run varnish-4.1.1/bin/varnishtest/tests/b00039.vtc0000644000201500234410000000151012652366721015732 00000000000000varnishtest "Test Backend IMS" server s1 { rxreq txresp -hdr "Last-Modified: Wed, 11 Sep 2013 13:36:55 GMT" -body "Geoff Rules" rxreq expect req.http.if-modified-since == "Wed, 11 Sep 2013 13:36:55 GMT" txresp -status 304 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.ttl = 2s; set beresp.grace = 20s; set beresp.keep = 1m; set beresp.http.was-304 = beresp.was_304; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.body == "Geoff Rules" expect resp.http.was-304 == "false" } -run delay 3 client c1 { txreq rxresp expect resp.status == 200 expect resp.body == "Geoff Rules" expect resp.http.was-304 == "false" } -run delay 1 client c1 { txreq rxresp expect resp.status == 200 expect resp.body == "Geoff Rules" expect resp.http.was-304 == "true" } -run varnish-4.1.1/bin/varnishtest/tests/r01168.vtc0000644000201500234410000000057112652366721015764 00000000000000varnishtest "Test ESI rollback interaction" server s1 { rxreq expect req.url == "/" txresp -body {} rxreq expect req.url == "/esi" txresp -body "1" } -start varnish v1 -vcl+backend { sub vcl_recv { rollback; } sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.bodylen == 1 } -run varnish-4.1.1/bin/varnishtest/tests/r01225.vtc0000644000201500234410000000220712652366721015754 00000000000000varnishtest "Test bans_req counter on persistent reload - #1225" shell "rm -f ${tmpdir}/_.per" server s1 { rxreq expect req.url == "/" txresp -hdr "Foo: foo" } -start varnish v1 \ -arg "-pfeature=+wait_silo" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per,10m" \ -arg "-pban_lurker_sleep=0.01" \ -vcl+backend { } -start varnish v1 -cliok ban.list client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.foo == "foo" } -run # Count of 1 here (magic ban only) varnish v1 -expect bans == 1 varnish v1 -cliok "ban req.url == /" varnish v1 -cliok ban.list # Count of 2 here (our + magic ban) varnish v1 -expect bans == 2 varnish v1 -expect bans_req == 1 varnish v1 -stop server s1 -wait server s1 { rxreq expect req.url == "/" txresp -hdr "Foo: bar" } -start varnish v1 -start varnish v1 -cliok ban.list # Count of >2 here, ours plus magic bans from 2 startups varnish v1 -expect bans >= 2 client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.foo == "bar" } -run varnish v1 -cliok ban.list # Count of 1 here varnish v1 -expect bans == 1 varnish v1 -expect bans_req == 0 varnish v1 -stop varnish-4.1.1/bin/varnishtest/tests/e00028.vtc0000644000201500234410000000535212652366721015743 00000000000000varnishtest "Test Vary with ESI and gzip/gunzip" server s1 { rxreq expect req.url == "/foo" txresp -body "foo" rxreq expect req.url == "/bar" txresp -gzipbody "bar" rxreq expect req.url == "/baz" txresp -body "baz" rxreq expect req.url == "/qux" txresp -hdr "Vary: qux" -gzipbody "qux" rxreq expect req.url == "/fubar" txresp -hdr "Vary: fubar, Accept-Encoding" -gzipbody "fubar" rxreq expect req.url == "/foobar" txresp -gzipbody "foobar" rxreq expect req.url == "/foobaz" txresp -hdr "Vary: foobaz" -gzipbody "foobaz" rxreq expect req.url == "/fooqux" txresp -hdr "Vary: fooqux, Accept-Encoding" -gzipbody "fooqux" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; if (bereq.url ~ "/baz") { set beresp.do_gzip = true; } elif (bereq.url ~ "/foo(bar|baz|qux)") { set beresp.do_gunzip = true; } } } -start client c1 { # /foo txreq -url /foo rxresp expect resp.body == "foo" expect resp.http.Vary == txreq -url /foo -hdr "Accept-Encoding: gzip" rxresp expect resp.body == "foo" expect resp.http.Vary == # /bar txreq -url /bar rxresp expect resp.body == "bar" expect resp.http.Vary == "Accept-Encoding" txreq -url /bar -hdr "Accept-Encoding: gzip" rxresp expect resp.bodylen == 34 expect resp.http.Vary == "Accept-Encoding" # /baz txreq -url /baz rxresp expect resp.body == "baz" expect resp.http.Vary == "Accept-Encoding" txreq -url /baz -hdr "Accept-Encoding: gzip" rxresp expect resp.bodylen == 34 expect resp.http.Vary == "Accept-Encoding" # /qux txreq -url /qux rxresp expect resp.body == "qux" expect resp.http.Vary == "qux, Accept-Encoding" txreq -url /qux -hdr "Accept-Encoding: gzip" rxresp expect resp.bodylen == 34 expect resp.http.Vary == "qux, Accept-Encoding" # /fubar txreq -url /fubar rxresp expect resp.body == "fubar" expect resp.http.Vary == "fubar, Accept-Encoding" txreq -url /fubar -hdr "Accept-Encoding: gzip" rxresp expect resp.bodylen == 36 expect resp.http.Vary == "fubar, Accept-Encoding" # /foobar txreq -url /foobar rxresp expect resp.body == "foobar" expect resp.http.Vary == txreq -url /foobar -hdr "Accept-Encoding: gzip" rxresp expect resp.body == "foobar" expect resp.http.Vary == # /foobaz txreq -url /foobaz rxresp expect resp.body == "foobaz" expect resp.http.Vary == "foobaz" txreq -url /foobaz -hdr "Accept-Encoding: gzip" rxresp expect resp.body == "foobaz" expect resp.http.Vary == "foobaz" # /fooqux txreq -url /fooqux rxresp expect resp.body == "fooqux" expect resp.http.Vary == "fooqux, Accept-Encoding" txreq -url /fooqux -hdr "Accept-Encoding: gzip" rxresp expect resp.body == "fooqux" expect resp.http.Vary == "fooqux, Accept-Encoding" } -run varnish-4.1.1/bin/varnishtest/tests/c00057.vtc0000644000201500234410000000050712652366721015740 00000000000000varnishtest "test sigsegv handler" server s1 { rxreq txresp } -start varnish v1 -cliok "param.set vcc_allow_inline_c true" varnish v1 -vcl+backend { C{ #include #include }C sub vcl_recv { C{ raise(SIGSEGV); sleep(2); }C } } -start client c1 { txreq } -run delay 5 varnish v1 -cliok "panic.show" varnish-4.1.1/bin/varnishtest/tests/v00045.vtc0000644000201500234410000000151712652366721015762 00000000000000varnishtest "Hold a reference to a VCL after a COLD event" server s1 -start # Load and use a VCL that will hold a reference varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_init { debug.vcl_release_delay(3s); } } -start # Load and use a new VCL, freeze the first varnish v1 -vcl+backend {} varnish v1 -cliok "vcl.state vcl1 cold" # We should now see it as cooling delay 1 shell { ${varnishadm} -n ${v1_name} vcl.list | grep "auto/cooling.*vcl1" >/dev/null } # It can't be warmed up yet delay 1 shell { ${varnishadm} -n ${v1_name} vcl.state vcl1 warm 2>/dev/null | grep "vmod-debug ref on vcl1" >/dev/null } # It will eventually cool down delay 2 shell { ${varnishadm} -n ${v1_name} vcl.list | grep "auto/cold.*vcl1" >/dev/null } # At this point it becomes possible to warm up again varnish v1 -cliok "vcl.state vcl1 warm" varnish-4.1.1/bin/varnishtest/tests/r00561.vtc0000644000201500234410000000040012652366721015747 00000000000000varnishtest "Junk request should not go to vcl_synth" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_synth { return (restart); } } -start client c1 { send "sljdslf\r\n\r\n" delay .1 } -run client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/r00915.vtc0000644000201500234410000000070512652366721015762 00000000000000varnishtest "error object allocation with persistent" server s1 { rxreq txresp } -start shell "rm -f ${tmpdir}/_.per" varnish v1 \ -arg "-pfeature=+wait_silo" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per,10m" \ -vcl+backend { sub vcl_backend_response { set beresp.uncacheable = false; set beresp.ttl = 0s; set beresp.status = 751; return (deliver); } } -start client c1 { txreq -url "/" rxresp expect resp.status == 751 } -run varnish-4.1.1/bin/varnishtest/tests/r01665.vtc0000644000201500234410000000037012652366721015763 00000000000000varnishtest "Ticket 1665 regression test: wrong behavior of timeout_req" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { } -start client c1 { delay 1 send "GET " delay 1.8 send "/bar\n\n " delay 0.1 send "GET" rxresp } -run varnish-4.1.1/bin/varnishtest/tests/b00003.vtc0000644000201500234410000000125312652366721015725 00000000000000varnishtest "Check that a cache fetch + hit transaction works" server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" } -start varnish v1 -vcl+backend { } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" } -run client c2 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1004 1002" } -run # Give varnish a chance to update stats delay .1 varnish v1 -expect sess_conn == 2 varnish v1 -expect cache_hit == 1 varnish v1 -expect cache_miss == 1 varnish v1 -expect client_req == 2 varnish v1 -expect s_sess == 2 varnish v1 -expect s_req == 2 varnish v1 -expect s_fetch == 1 varnish-4.1.1/bin/varnishtest/tests/v00014.vtc0000644000201500234410000000162412652366721015755 00000000000000varnishtest "Check req.backend.healthy" server s1 { rxreq sema r1 sync 2 expect req.url == "/" txresp -body "slash" accept rxreq sema r2 sync 2 sema r3 sync 2 expect req.url == "/" txresp -body "slash" accept sema r4 sync 2 } -start varnish v1 -vcl { import ${vmod_std}; probe foo { .url = "/"; .timeout = 1s; .interval = 1s; .window = 3; .threshold = 2; .initial = 0; } backend default { .host = "${s1_addr}"; .port = "${s1_port}"; .max_connections = 1; .probe = foo; } sub vcl_recv { if (std.healthy(default)) { return(synth(200,"Backend healthy")); } else { return(synth(500,"Backend sick")); } } } -start varnish v1 -cliok "backend.list -p" client c1 { txreq rxresp expect resp.status == 500 sema r1 sync 2 sema r2 sync 2 txreq rxresp expect resp.status == 500 sema r3 sync 2 sema r4 sync 2 txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01123.vtc0000644000201500234410000000073412652366721015754 00000000000000varnishtest "Test case for #1123 - gunzip buffer reset" server s1 { rxreq txresp -body {start end} rxreq expect req.url == "/included" txresp -body {INCLUDED} } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (bereq.url == "/") { set beresp.do_esi = true; } set beresp.do_gzip = true; } } -start client c1 { txreq rxresp expect resp.bodylen == 24 expect resp.body == "start INCLUDED end" } -run varnish-4.1.1/bin/varnishtest/tests/c00002.vtc0000644000201500234410000000062612652366721015730 00000000000000varnishtest "Check that all thread pools all get started and get minimum threads" server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" } -start varnish v1 \ -arg "-p thread_pool_min=10" \ -arg "-p thread_pool_max=10" \ -arg "-p thread_pools=2" varnish v1 -vcl+backend {} -start client c1 { txreq -url "/" rxresp expect resp.status == 200 } -run varnish v1 -expect threads == 20 varnish-4.1.1/bin/varnishtest/tests/v00008.vtc0000644000201500234410000000120712652366721015755 00000000000000varnishtest "Test host header specification" server s1 { rxreq expect req.url == "/foo" expect req.http.host == "snafu" txresp -body "foo1" rxreq expect req.url == "/bar" expect req.http.host == "127.0.0.1" txresp -body "foo1" } -start varnish v1 -vcl+backend { } -start client c1 { txreq -url "/foo" -hdr "Host: snafu" rxresp txreq -url "/bar" rxresp } -run server s2 { rxreq expect req.url == "/barf" expect req.http.host == "FOObar" txresp -body "foo1" } -start varnish v1 -vcl { backend b1 { .host = "${s2_addr}"; .port = "${s2_port}"; .host_header = "FOObar"; } } client c1 { txreq -url "/barf" rxresp } -run varnish-4.1.1/bin/varnishtest/tests/c00028.vtc0000644000201500234410000000047712652366721015744 00000000000000varnishtest "Test that we can't recurse restarts forever" varnish v1 -vcl { backend bad { .host = "${bad_ip}"; .port = "9090"; } sub vcl_backend_fetch { set bereq.backend = bad; } sub vcl_synth { return (restart); } } -start client c1 { txreq -url "/" rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/r01746.vtc0000644000201500234410000000062312652366721015764 00000000000000varnishtest "ESI include is 204" server s1 { rxreq txresp -gzipbody {
} rxreq expect req.url == /b txresp -status 204 -nolen \ -hdr "Content-encoding: gzip" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.body == "" } -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/v00025.vtc0000644000201500234410000000305312652366721015755 00000000000000varnishtest "More VCL coverage" server s1 { rxreq txresp } -start varnish v1 -arg "-i J.F.Nobody" -vcl+backend { import ${vmod_std}; sub vcl_recv { set client.identity = "Samuel B. Nobody"; } sub vcl_deliver { set resp.http.server_port = std.port(server.ip); set resp.http.server_port_foo = std.port(server.ip) + "_foo"; set resp.http.ttl1 = (req.ttl + 10s); set resp.http.ttl2 = req.ttl + 10s; set resp.http.id = server.identity; set resp.http.esi = req.esi; set resp.http.be = req.backend_hint; set resp.http.c_id = client.identity; set resp.http.l_ip = local.ip; set resp.http.r_ip = remote.ip; if (obj.uncacheable) { } } sub vcl_backend_response { set beresp.http.backend = bereq.backend; set beresp.http.keep = beresp.keep; set beresp.http.hint = beresp.storage_hint; set beresp.http.be_ip = beresp.backend.ip; set beresp.http.be_nm = beresp.backend.name; set beresp.http.unc = bereq.uncacheable; if (beresp.ttl > 3 s) { set beresp.http.ttl = "long"; } else { set beresp.http.ttl = "short"; } } sub vcl_hit { if (obj.status != 200) { return(synth(700)); } if (obj.proto) { } if (obj.reason) { } if (obj.keep > 1m) { } if (obj.grace < 3m) { return (deliver); } if (obj.ttl < 3m) { return (deliver); } } sub vcl_backend_fetch { if (bereq.between_bytes_timeout < 10s) { set bereq.http.quick = "please"; } if (bereq.connect_timeout < 10s) { set bereq.http.hello = "please"; } set bereq.connect_timeout = 10s; } } -start client c1 { txreq rxresp txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/r01608.vtc0000644000201500234410000000044312652366721015761 00000000000000varnishtest "Increment counter if http_req_size is exhausted" server s1 { } -start varnish v1 -arg "-p http_req_size=1024" -vcl+backend { } -start client c1 { non-fatal send "GET /" send_n 2048 "A" send " HTTP/1.1\r\n\r\n" expect_close } -run varnish v1 -expect sc_rx_overflow == 1 varnish-4.1.1/bin/varnishtest/tests/r01367.vtc0000644000201500234410000000050012652366721015755 00000000000000varnishtest "blank GET" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_synth { return (restart); } } -start client c1 { send "GET \nHost: example.com\n\n" rxresp expect resp.status == 400 } -run client c1 { txreq -hdr "Expect: Santa-Claus" rxresp expect resp.status == 417 } -run varnish-4.1.1/bin/varnishtest/tests/m00006.vtc0000644000201500234410000000116412652366721015744 00000000000000varnishtest "test vmod_std.collect()" server s1 { rxreq expect req.http.foo == "1, 2" expect req.http.baz == "3, 4" txresp -hdr "bar: a" -hdr "bar: b" -hdr "qux: c" -hdr "qux: d" } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_recv { std.collect(req.http.foo); } sub vcl_backend_fetch { std.collect(bereq.http.baz); } sub vcl_backend_response { std.collect(beresp.http.bar); } sub vcl_deliver { std.collect(resp.http.qux); } } -start client c1 { txreq -hdr "Foo: 1" -hdr "Foo: 2" -hdr "Baz: 3" -hdr "Baz: 4" rxresp expect resp.http.bar == "a, b" expect resp.http.qux == "c, d" } -run varnish-4.1.1/bin/varnishtest/tests/g00003.vtc0000644000201500234410000000206012652366721015727 00000000000000varnishtest "test gunzip on fetch" server s1 { rxreq expect req.url == "/foo" expect req.http.accept-encoding == "gzip" txresp -gziplen 41 rxreq expect req.url == "/bar" expect req.http.accept-encoding == "gzip" txresp -bodylen 42 rxreq expect req.url == "/foobar" expect req.http.accept-encoding == "gzip" txresp -bodylen 43 } -start varnish v1 -cliok "param.set http_gzip_support true" -vcl+backend { sub vcl_backend_response { set beresp.do_gunzip = true; if (bereq.url == "/foobar") { set beresp.do_gzip = true; } } } -start client c1 { txreq -url /foo -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == expect resp.bodylen == 41 txreq -url /bar -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == expect resp.bodylen == 42 txreq -url /foobar -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == "gzip" gunzip expect resp.bodylen == 43 txreq -url /foobar rxresp expect resp.http.content-encoding == expect resp.bodylen == 43 } -run varnish-4.1.1/bin/varnishtest/tests/r01684.vtc0000644000201500234410000000141712652366721015767 00000000000000varnishtest "Regression test for #1684" server s1 { rxreq txresp -hdr "foo: 1" accept rxreq txresp -hdr "foo: 2" accept rxreq txresp -hdr "foo: 3" } -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_response { set beresp.http.bar = bereq.retries; if (beresp.http.foo != bereq.http.stop) { return (retry); } } } -start # check log for the aborted POST logexpect l1 -v v1 -g request { expect * * Begin "^bereq .* retry" expect * = BereqHeader "^X-Varnish:" expect * = BereqUnset "^X-Varnish:" expect * = BereqHeader "^X-Varnish:" } -start varnish v1 -cliok "param.set debug +syncvsl" varnish v1 -cliok "param.set max_retries 2" client c1 { txreq -hdr "stop: 3" rxresp expect resp.http.foo == 3 } -run logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/e00008.vtc0000644000201500234410000000251412652366721015736 00000000000000varnishtest "ESI parsing errors" server s1 { rxreq txresp -body { 1 Before include 2 3 After include 4 5 6 7 foo 8 9 10 11 12 13 14 15 16 17 bar 18 19 20 21 22 23 25 26 27 28 29 30 31 32 hits == 0 txreq -url "/" -hdr "Bar: 1" rxresp expect resp.status == 200 expect resp.bodylen == 6 expect resp.http.hits == 0 # This is a hit -> hits == 1 txreq -url "/" -hdr "Bar: 1" rxresp expect resp.status == 200 expect resp.bodylen == 6 expect resp.http.hits == 1 # This is a miss on different vary -> hits == 0 txreq -url "/" -hdr "Bar: 2" rxresp expect resp.status == 200 expect resp.bodylen == 4 expect resp.http.hits == 0 # This is a hit -> hits == 1 txreq -url "/" -hdr "Bar: 2" rxresp expect resp.status == 200 expect resp.bodylen == 4 expect resp.http.hits == 1 } -run # Ban everything on this hash-key varnish v1 -cliok "ban obj.http.vary ~ ." delay 1 # And run the entire test again to see that obj.hits got reset. server s1 -start client c1 -run varnish-4.1.1/bin/varnishtest/tests/r01211.vtc0000644000201500234410000000055612652366721015754 00000000000000varnishtest "TIME +/- DURATION -> TIME" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_deliver { set resp.http.bar = now + 4 d; set resp.http.foo = now - 4 d; } } -start client c1 { txreq rxresp expect resp.http.bar ~ "..., .. ... 20[1-9][0-9] ..:..:.. GMT" expect resp.http.foo ~ "..., .. ... 20[1-9][0-9] ..:..:.. GMT" } -run varnish-4.1.1/bin/varnishtest/tests/r01504.vtc0000644000201500234410000000025012652366721015750 00000000000000varnishtest "unreferenced acls" varnish v1 -arg "-p vcc_err_unref=off" -vcl { backend s1 { .host = "${bad_ip}"; .port = "9090"; } acl foo { "127.0.0.1"; } } varnish-4.1.1/bin/varnishtest/tests/r01498.vtc0000644000201500234410000000050112652366721015763 00000000000000varnishtest "backend name VCC crash" varnish v1 -vcl { vcl 4.0; import ${vmod_directors}; backend s1 { .host = "127.0.0.1"; .port = "80"; } sub vcl_init { new static = directors.random(); static.add_backend(s1, 100.0); } sub vcl_backend_fetch { set bereq.backend = static.backend(); } } varnish-4.1.1/bin/varnishtest/tests/r00412.vtc0000644000201500234410000000110612652366721015746 00000000000000varnishtest "Regression test for ticket 412" server s1 { rxreq expect req.url == "/" txresp -status 303 -hdr "Location: /foo" accept rxreq expect req.url == "/foo" txresp -body "12345" } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (beresp.status == 303) { set beresp.ttl = 60 s; set beresp.http.X-Magic-Redirect = "1"; return (deliver); } } sub vcl_deliver { if (resp.http.X-Magic-Redirect == "1") { set req.url = resp.http.Location; return (restart); } } } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/d00010.vtc0000644000201500234410000000174212652366721015730 00000000000000varnishtest "Test dynamic backends hot swap during a pipe" server s1 { rxreq expect req.url == "/foo" sema r1 sync 2 sema r2 sync 2 txresp } -start server s2 { rxreq expect req.url == "/bar" sema r2 sync 2 txresp } -start varnish v1 -vcl { import ${vmod_debug}; backend dummy { .host = "${bad_ip}"; .port = "9080"; } sub vcl_init { new s1 = debug.dyn("${s1_addr}", "${s1_port}"); } sub vcl_recv { if (req.method == "SWAP") { s1.refresh(req.http.X-Addr, req.http.X-Port); return (synth(200)); } set req.backend_hint = s1.backend(); return (pipe); } } -start varnish v1 -expect MAIN.n_backend == 2 client c1 { txreq -url "/foo" rxresp expect resp.status == 200 } -start client c2 { sema r1 sync 2 txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" rxresp expect resp.status == 200 txreq -url "/bar" rxresp expect resp.status == 200 } -run client c1 -wait varnish v1 -cli backend.list #varnish v1 -expect MAIN.n_backend == 2 varnish-4.1.1/bin/varnishtest/tests/o00001.vtc0000644000201500234410000000753112652366721015745 00000000000000varnishtest "PROXY v2 test" server s1 { # The server address is part of the hash-key # so we need three responses rxreq expect req.http.x-forwarded-for == "127.0.0.1" txresp -hdr "Obj: 1" rxreq expect req.http.x-forwarded-for == "1.2.3.4" txresp -hdr "Obj: 2" rxreq expect req.http.x-forwarded-for == "102:304:506::d0e:f10" txresp -hdr "Obj: 3" } -start varnish v1 -proto "PROXY" -vcl+backend { import ${vmod_std}; acl fwd_client { "1.2.3.4"; "102:304:506::d0e:f10"; } acl fwd_server { "5.6.7.8"; "8182:8384:8586::8d8e:8f80"; } sub vcl_deliver { set resp.http.li = local.ip; set resp.http.lp = std.port(local.ip); set resp.http.ri = remote.ip; set resp.http.rp = std.port(remote.ip); set resp.http.ci = client.ip; set resp.http.cp = std.port(client.ip); set resp.http.si = server.ip; set resp.http.sp = std.port(server.ip); set resp.http.fc = (client.ip ~ fwd_client); set resp.http.fs = (server.ip ~ fwd_server); } } -start client c1 { # LOCAL command sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a" sendhex "20 00 00 00" txreq rxresp expect resp.status == 200 expect resp.http.si == "${v1_addr}" expect resp.http.sp == "${v1_port}" expect resp.http.ci == "127.0.0.1" } -run delay .1 client c1 { # unknown command sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a" sendhex "22 00 00 00" timeout 8 expect_close } -run delay .1 client c1 { # UNSPEC proto sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a" sendhex "21 00 00 00" txreq rxresp expect resp.status == 200 expect resp.http.si == "${v1_addr}" expect resp.http.sp == "${v1_port}" expect resp.http.ci == "127.0.0.1" } -run delay .1 client c1 { # unknown proto sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a" sendhex "21 99 00 00" txreq rxresp expect resp.status == 200 expect resp.http.si == "${v1_addr}" expect resp.http.sp == "${v1_port}" expect resp.http.ci == "127.0.0.1" } -run delay .1 client c1 { # short IPv4 sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a" sendhex "21 11 00 0b" sendhex "01 02 03 04 05 06 07 08 09 0a 0b" txreq rxresp expect resp.status == 200 expect resp.http.si == "${v1_addr}" expect resp.http.sp == "${v1_port}" expect resp.http.ci == "127.0.0.1" } -run delay .1 client c1 { # short IPv6 sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a" sendhex "21 21 00 23" sendhex "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f" sendhex "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f" sendhex "01 02 03" txreq rxresp expect resp.status == 200 expect resp.http.fs == false expect resp.http.fc == false expect resp.http.si == "${v1_addr}" expect resp.http.sp == "${v1_port}" expect resp.http.ci == "127.0.0.1" } -run delay .1 client c1 { # good IPv4 sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a" sendhex "21 11 00 0c" sendhex "01 02 03 04" sendhex "05 06 07 08" sendhex "09 0a" sendhex "0b 0c" txreq rxresp expect resp.status == 200 expect resp.http.obj == 2 expect resp.http.fs == true expect resp.http.fc == true expect resp.http.ci == "1.2.3.4" expect resp.http.cp == "2314" expect resp.http.si == "5.6.7.8" expect resp.http.sp == "2828" expect resp.http.li == "${v1_addr}" expect resp.http.lp == "${v1_port}" expect resp.http.ri != "1.2.3.4" } -run delay .1 client c1 { # good IPv6 sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a" sendhex "21 21 00 24" sendhex "01 02 03 04 05 06 00 00 00 00 00 00 0d 0e 0f 10" sendhex "81 82 83 84 85 86 00 00 00 00 00 00 8d 8e 8f 80" sendhex "09 0a" sendhex "0b 0c" txreq rxresp expect resp.status == 200 expect resp.http.obj == 3 expect resp.http.fs == true expect resp.http.fc == true expect resp.http.ci == "102:304:506::d0e:f10" expect resp.http.cp == "2314" expect resp.http.si == "8182:8384:8586::8d8e:8f80" expect resp.http.sp == "2828" expect resp.http.li == "${v1_addr}" expect resp.http.lp == "${v1_port}" expect resp.http.ri != "102:304:506::d0e:f10" } -run delay .1 varnish-4.1.1/bin/varnishtest/tests/r01490.vtc0000644000201500234410000000151212652366721015756 00000000000000varnishtest "#1490 - thread destruction" server s1 { } -start varnish v1 \ -arg "-p debug=+syncvsl" \ -arg "-p vsl_mask=+WorkThread" \ -arg "-p thread_pool_min=2" \ -arg "-p thread_pool_max=3" \ -arg "-p thread_pools=1" \ -vcl+backend {} varnish v1 -start varnish v1 -expect threads == 2 logexpect l1 -v v1 -g raw { expect * 0 WorkThread {^\S+ start$} expect * 0 WorkThread {^\S+ end$} } -start varnish v1 -cliok "param.set thread_pool_min 3" # Herder thread sleeps 5 seconds. Have to wait longer than that. delay 6 varnish v1 -expect threads == 3 varnish v1 -cliok "param.set thread_pool_min 2" varnish v1 -cliok "param.set thread_pool_max 2" # Herder thread sleeps 5 seconds. Have to wait longer than that. delay 6 varnish v1 -expect threads == 2 # Use logexpect to see that the thread actually exited logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/d00012.vtc0000644000201500234410000000264212652366721015732 00000000000000varnishtest "Test a dynamic backend discard during a request" # vcl.discard testing inspired by v00006.vtc from commit e1f7207 server s1 { rxreq expect req.url == "/foo" sema r1 sync 2 txresp } -start varnish v1 -arg "-p thread_pools=1" -vcl { import ${vmod_debug}; backend dummy { .host = "${bad_ip}"; .port = "9080"; } sub vcl_init { new s1 = debug.dyn("${s1_addr}", "${s1_port}"); } sub vcl_recv { set req.backend_hint = s1.backend(); } } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 } -start varnish v1 -expect MAIN.n_backend == 2 # expected: vcl1.dummy, vcl1.s1 server s2 { rxreq expect req.url == "/bar" txresp } -start varnish v1 -vcl { import ${vmod_debug}; backend dummy { .host = "${bad_ip}"; .port = "9080"; } sub vcl_init { new s2 = debug.dyn("${s2_addr}", "${s2_port}"); } sub vcl_recv { set req.backend_hint = s2.backend(); } } varnish v1 -cli "vcl.discard vcl1" sema r1 sync 2 client c1 -wait delay 2 varnish v1 -expect MAIN.n_backend == 4 # expected: vcl1.dummy, vcl1.s1, vcl2.dummy, vcl2.s2 varnish v1 -expect n_vcl_avail == 1 varnish v1 -expect n_vcl_discard == 1 client c1 { txreq -url "/bar" rxresp expect resp.status == 200 } -run varnish v1 -cli "vcl.list" #varnish v1 -expect MAIN.n_backend == 2 # expected: vcl2.dummy, vcl2.s2 varnish v1 -expect n_vcl_avail == 1 # XXX This test fails on FreeBSD # XXX varnish v1 -expect n_vcl_discard == 0 varnish-4.1.1/bin/varnishtest/tests/r01184.vtc0000644000201500234410000000603612652366721015764 00000000000000varnishtest "Corrupt gzip'ed ESI objects" # First, check that our data is actually good server s1 { rxreq expect req.url == "/" txresp -nolen \ -hdr "Content-Encoding: gzip" \ -hdr "Transfer-Encoding: Chunked" send "ed\r\n" sendhex " 1f 8b 08 00 c2 39 33 50 02 03 45 90 4d 6a 03 31" sendhex " 0c 85 f7 73 8a 47 2e 10 d9 f2 9f ca 34 d0 c2 64" sendhex " 5b 08 bd 80 2d cb 10 28 5d 34 f4 fe f5 30 d0 68" sendhex " 25 89 a7 f7 3e b4 be 6f d7 8f db 76 59 e8 28 d8" sendhex " 10 45 f3 a9 83 b8 18 1c 7b c2 30 55 04 17 13 c4" sendhex " 0f 07 5f 7a 38 f4 8e 50 b3 37 d4 3a 32 4a 34 07" sendhex " 8a 9c d1 92 77 48 d4 0a 72 ea 06 5f b3 1c fa dd" sendhex " 2b b9 88 20 99 e6 9a 3c 84 7c 85 8e 50 e0 59 2a" sendhex " 42 b0 8a 34 0f 96 d5 1e f7 97 fb b7 7e fd 4e 87" sendhex " c7 8f be 9e ce fb 74 3a 3f 51 89 a3 9b 7e b2 43" sendhex " a4 86 a2 55 90 b9 29 4c 4b 83 b8 99 5f b5 bb 27" sendhex " 6a d4 86 18 22 83 8a 26 f4 11 1a 5c eb 34 3b ca" sendhex " 20 31 9e 12 29 ff a8 92 78 a2 e6 ec 61 55 12 fc" sendhex " 68 84 6c 12 41 b9 cf 2f 30 3b f0 10 5e d6 b7 eb" sendhex " e7 76 bb 2c 7f 8c 90 4a 14 4c 01 00 00" send "\r\n" chunkedlen 0 rxreq expect req.url == "/incl" txresp -body "INCLUDED\n" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.bodylen == 315 } -run # Second, corrupt them, while using the g-g path server s1 { rxreq expect req.url == "/c" txresp -nolen \ -hdr "Content-Encoding: gzip" \ -hdr "Transfer-Encoding: Chunked" send "70\r\n" sendhex " 1f 8b 08 00 c2 39 33 50 02 03 45 90 4d 6a 03 31" sendhex " 0c 85 f7 73 8a 47 2e 10 d9 f2 9f ca 34 d0 c2 64" sendhex " 5b 08 bd 80 2d cb 10 28 5d 34 f4 fe f5 30 d0 68" sendhex " 25 89 a7 f7 3e b4 be 6f d7 8f db 76 59 e8 28 d8" sendhex " 10 45 f3 a9 83 b8 18 1c 7b c2 30 55 04 17 13 c4" sendhex " 0f 07 5f 7a 38 f4 8e 50 b3 37 d4 3a 32 4a 34 07" sendhex " FF FF FF FF FF FF FF FF 72 ea 06 5f b3 1c fa dd" expect_close } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } client c1 { txreq -url "/c" rxresp expect resp.status == 503 } -run # Third, corrupt them, while using the g-u path server s1 { rxreq expect req.url == "/d" txresp -nolen \ -hdr "Content-Encoding: gzip" \ -hdr "Transfer-Encoding: Chunked" send "70\r\n" sendhex " 1f 8b 08 00 c2 39 33 50 02 03 45 90 4d 6a 03 31" sendhex " 0c 85 f7 73 8a 47 2e 10 d9 f2 9f ca 34 d0 c2 64" sendhex " 5b 08 bd 80 2d cb 10 28 5d 34 f4 fe f5 30 d0 68" sendhex " 25 89 a7 f7 3e b4 be 6f d7 8f db 76 59 e8 28 d8" sendhex " 10 45 f3 a9 83 b8 18 1c 7b c2 30 55 04 17 13 c4" sendhex " 0f 07 5f 7a 38 f4 8e 50 b3 37 d4 3a 32 4a 34 07" sendhex " FF FF FF FF FF FF FF FF 72 ea 06 5f b3 1c fa dd" expect_close } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; set beresp.do_gunzip = true; } } client c1 { txreq -url "/d" rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/b00007.vtc0000644000201500234410000000120412652366721015725 00000000000000varnishtest "Check chunked encoding from backend works" server s1 { rxreq expect req.url == "/bar" send "HTTP/1.1 200 OK\r\n" send "Transfer-encoding: chunked\r\n" send "\r\n" send "00000004\r\n1234\r\n" send "00000000\r\n" send "\r\n" rxreq expect req.url == "/foo" send "HTTP/1.1 200 OK\r\n" send "Transfer-encoding: chunked\r\n" send "\r\n" send "00000004\r\n1234\r\n" chunked "1234" chunked "" } -start varnish v1 -vcl+backend {} -start client c1 { txreq -url "/bar" rxresp expect resp.status == 200 expect resp.bodylen == "4" txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == "8" } -run varnish-4.1.1/bin/varnishtest/tests/r01284.vtc0000644000201500234410000000266212652366721015766 00000000000000varnishtest "#1284 - Test resource cleanup after STV_NewObject fail in fetch" server s1 { rxreq expect req.url == "/obj1" txresp -bodylen 1048290 rxreq expect req.url == "/obj2" txresp -hdr "Long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" -hdr "Long2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } -start varnish v1 \ -arg "-p nuke_limit=0" \ -arg "-sTransient=malloc,1m" \ -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; set beresp.storage_hint = "Transient"; # Unset Date header to not change the object sizes unset beresp.http.Date; } } -start varnish v1 -cliok "param.set debug +syncvsl" delay .1 client c1 { # Fill transient txreq -url "/obj1" rxresp expect resp.status == 200 } -run delay .1 varnish v1 -expect SMA.Transient.g_bytes > 1048000 varnish v1 -expect SMA.Transient.g_space < 200 client c1 { # No space for this object (more than 256 bytes in headers). Don't wait # for reply as Varnish will not send one due to Transient full. txreq -url "/obj2" delay 1 } -run # Three failures, one for obj2, one for vcl_backend_error{}, one for synth objcore varnish v1 -expect SMA.Transient.c_fail == 3 client c1 { # Check that Varnish is still alive txreq -url "/obj1" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r00326.vtc0000644000201500234410000000056112652366721015756 00000000000000varnishtest "No zerolength verbatim before " server s1 { rxreq txresp -body {} rxreq txresp -body "FOO\n" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 8 } -run varnish-4.1.1/bin/varnishtest/tests/r00911.vtc0000644000201500234410000000047612652366721015763 00000000000000varnishtest "vcc_err_unref should also cover subs" server s1 { rxreq expect req.url == "/bar" txresp -body "foobar" } -start varnish v1 -arg "-p vcc_err_unref=false" -vcl+backend { sub foobar { set req.http.foobar = "foobar"; } } -start client c1 { txreq -url /bar rxresp expect resp.bodylen == 6 } -run varnish-4.1.1/bin/varnishtest/tests/b00038.vtc0000644000201500234410000000107412652366721015736 00000000000000varnishtest "Test abandon from vcl_backend_xxx" server s1 { rxreq expect req.url == "/bar" txresp } -start varnish v1 -arg "-pfirst_byte_timeout=0.1" -vcl+backend { sub vcl_backend_fetch { if (bereq.url == "/foo") { return (abandon); } } sub vcl_backend_response { if (bereq.url == "/bar") { return (abandon); } } sub vcl_backend_error { return (abandon); } } -start client c1 { txreq -url /foo rxresp expect resp.status == 503 txreq -url /bar rxresp expect resp.status == 503 txreq -url /baz rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/m00020.vtc0000644000201500234410000000611112652366721015735 00000000000000varnishtest "Test std.time" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.x-date = std.time( regsub(req.http.x-date, "z", " "), now); if (std.time(req.http.x-date, now) < now - 1y) { set resp.http.x-past = 1; } if (std.time(req.http.x-date, now) > now + 1y) { set resp.http.x-future = 1; } } } -start client c1 { txreq -hdr "X-Date: Mon, 20 Dec 2010 00:00:00 GMT" rxresp expect resp.http.x-past == 1 expect resp.http.x-date == "Mon, 20 Dec 2010 00:00:00 GMT" txreq -hdr "X-Date: Monday, 20-Dec-30 00:00:00 GMT" rxresp expect resp.http.x-past == expect resp.http.x-future == txreq -hdr "X-Date: Monday, 30-Feb-15 00:00:00 GMT" rxresp expect resp.http.x-past == expect resp.http.x-future == txreq -hdr "X-Date: Friday, 20-Dec-30 00:00:00 GMT" rxresp expect resp.http.x-future == 1 expect resp.http.x-date == "Fri, 20 Dec 2030 00:00:00 GMT" txreq -hdr "X-Date: Mon Dec 20 00:00:00 2010" rxresp expect resp.http.x-past == 1 expect resp.http.x-date == "Mon, 20 Dec 2010 00:00:00 GMT" txreq -hdr "X-Date: 2030-12-20T00:00:00" rxresp expect resp.http.x-future == 1 expect resp.http.x-date == "Fri, 20 Dec 2030 00:00:00 GMT" txreq -hdr "X-Date: 1292803200.00" rxresp expect resp.http.x-past == 1 expect resp.http.x-date == "Mon, 20 Dec 2010 00:00:00 GMT" txreq -hdr "X-Date: 1923955200" rxresp expect resp.http.x-future == 1 expect resp.http.x-date == "Fri, 20 Dec 2030 00:00:00 GMT" delay .2 # Coverage tests of vtim.c # leapsecond txreq -hdr "X-Date: Mon, 20 Dec 2010 00:00:60 GMT" rxresp expect resp.http.x-date == "Mon, 20 Dec 2010 00:00:59 GMT" delay .1 # Range tests txreq -hdr "X-Date: Mon, 20 Dec 2010 00:00:61 GMT" rxresp expect resp.http.x-date != "Mon, 20 Dec 2010 00:00:61 GMT" delay .1 txreq -hdr "X-Date: Mon, 20 Dec 2010 00:60:00 GMT" rxresp expect resp.http.x-date != "Mon, 20 Dec 2010 00:60:00 GMT" delay .1 txreq -hdr "X-Date: Mon, 20 Dec 2010 24:00:00 GMT" rxresp expect resp.http.x-date != "Mon, 20 Dec 2010 24:00:00 GMT" delay .1 txreq -hdr "X-Date: Tue, 20 Dec 2010 00:00:00 GMT" rxresp expect resp.http.x-date != "Tue, 20 Dec 2010 00:00:00 GMT" delay .1 txreq -hdr "X-Date: Mon, 29 Feb 2010 00:00:00 GMT" rxresp expect resp.http.x-date != "Mon, 29 Feb 2010 00:00:00 GMT" delay .1 txreq -hdr "X-Date: Wed, 29 Feb 2012 00:00:00 GMT" rxresp expect resp.http.x-date == "Wed, 29 Feb 2012 00:00:00 GMT" delay .1 txreq -hdr "X-Date: 2010-13-20T00:00:00" rxresp delay .1 txreq -hdr "X-Date: Sun 31 Dec 1899 23:59:59 GMT" rxresp expect resp.http.x-date != "Sun 31 Dec 1899 23:59:59 GMT" delay .1 # White space etc. txreq -hdr "X-Date: z Wed, 29 Feb 2012 00:00:00 GMT" rxresp expect resp.http.x-date == "Wed, 29 Feb 2012 00:00:00 GMT" delay .1 txreq -hdr "X-Date: Wedx 29 Feb 2012 00:00:00 GMT" rxresp expect resp.http.x-date != "Wed, 29 Feb 2012 00:00:00 GMT" delay .1 txreq -hdr "X-Date: Wed, 29 Feb 2012 00:00:00 GMT x" rxresp expect resp.http.x-date != "Wed, 29 Feb 2012 00:00:00 GMT" delay .1 } -run varnish-4.1.1/bin/varnishtest/tests/b00010.vtc0000644000201500234410000000052412652366721015723 00000000000000varnishtest "Check simple list hasher" server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" } -start varnish v1 -arg "-h simple_list" -vcl+backend {} -start client c1 { txreq -url "/" rxresp expect resp.status == 200 txreq -url "/" rxresp expect resp.status == 200 expect resp.http.x-varnish == "1003 1002" } -run varnish-4.1.1/bin/varnishtest/tests/r01398.vtc0000644000201500234410000000060112652366721015763 00000000000000varnishtest "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 == "" expect resp.http.X-BE-IP == "" } -run varnish-4.1.1/bin/varnishtest/tests/o00000.vtc0000644000201500234410000000760112652366721015742 00000000000000varnishtest "PROXY1 protocol tests" server s1 { rxreq expect req.http.X-Forwarded-For == 1.2.3.4 txresp rxreq expect req.http.X-Forwarded-For == 1:f::2 txresp rxreq expect req.http.X-Forwarded-For == 1:f::3 txresp } -start varnish v1 -proto "PROXY" -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.url = req.url; set resp.http.li = local.ip; set resp.http.lp = std.port(local.ip); set resp.http.ri = remote.ip; set resp.http.rp = std.port(remote.ip); set resp.http.ci = client.ip; set resp.http.cp = std.port(client.ip); set resp.http.si = server.ip; set resp.http.sp = std.port(server.ip); } } -start client c1 { send "XYZ\r\n" expect_close } -run delay .1 client c1 { send "PROXY " timeout 8 expect_close } -run delay .1 client c1 { send "PROXY A B C D\r\n" timeout 8 expect_close } -run delay .1 client c1 { send "PROXY A B C D E F\r\n" timeout 8 expect_close } -run delay .1 client c1 { send "PROXY A B C D E\r\n" timeout 8 expect_close } -run delay .1 client c1 { send "PROXY TCP4 B C D E\r\n" timeout 8 expect_close } -run delay .1 client c1 { send "PROXY TCP4 1.2.3.4 C D E\r\n" timeout 8 expect_close } -run delay .1 client c1 { send "PROXY TCP4 1.2.3.4 D 1234 E\r\n" timeout 8 expect_close } -run delay .1 client c1 { send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 E\r\n" timeout 8 expect_close } -run delay .1 client c1 { send "PROXY TCP6 B C D E\r\n" timeout 8 expect_close } -run delay .1 client c1 { send "PROXY TCP6 1:f::2 C D E\r\n" timeout 8 expect_close } -run delay .1 client c1 { send "PROXY TCP6 1:f::2 1234 D E\r\n" timeout 8 expect_close } -run delay .1 client c1 { send "PROXY TCP6 1:f::2 5:a::8 1234 E\r\n" timeout 8 expect_close } -run delay .1 client c1 { send "PROXY TCP4 1:f::2 5:a::8 1234 5678\r\n" timeout 8 expect_close } -run delay .1 client c1 { send "PROXY TCP6 1.2.3.4 5.6.7.8 1234 5678\r\n" timeout 8 expect_close } -run delay .1 logexpect l1 -v v1 { expect * * ReqStart "1.2.3.4 1234" expect * * ReqStart "1:f::2 1234" } -start # Finally try something which works... client c1 { send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678\r\n" txreq -url /1 rxresp expect resp.http.url == "/1" expect resp.http.ci == "1.2.3.4" expect resp.http.cp == "1234" expect resp.http.si == "5.6.7.8" expect resp.http.sp == "5678" expect resp.http.li == ${v1_addr} expect resp.http.lp == ${v1_port} expect resp.http.ri != "1.2.3.4" expect resp.http.rp != "1234" } -run delay .1 client c1 { send "PROXY TCP6 1:f::2 5:a::8 1234 5678\r\n" txreq -url /2 rxresp expect resp.http.url == "/2" expect resp.http.ci == "1:f::2" expect resp.http.cp == "1234" expect resp.http.si == "5:a::8" expect resp.http.sp == "5678" expect resp.http.li == ${v1_addr} expect resp.http.lp == ${v1_port} expect resp.http.ri != "1:f::2" expect resp.http.rp != "1234" } -run delay .1 logexpect l1 -wait # Try with appended request (See also: #1728) client c1 { send "PROXY TCP6 1:f::3 5:a::8 1234 5678\r\nGET /3 HTTP/1.1\r\nHdr1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n\r\n" rxresp expect resp.http.url == "/3" } -run # Malformed (missing \r) client c1 { send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678\n" expect_close } -run delay .1 # Malformed, too long (106) # NB: Should check VSL for proper disposal client c1 { send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678 \r\n" expect_close } -run delay .1 # Malformed, too long (107) # NB: Should check VSL for proper disposal client c1 { send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678 \r\n" expect_close } -run delay .1 # Malformed, too long (108) # NB: Should check VSL for proper disposal client c1 { send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678 \r\n" expect_close } -run delay .1 varnish-4.1.1/bin/varnishtest/tests/r00789.vtc0000644000201500234410000000064312652366721015774 00000000000000varnishtest "pass should not filter Content-Range header" server s1 { rxreq expect req.http.range == "bytes=1-1" txresp -status 206 -hdr "Content-Range: bytes 1-1/20" -body "F" } -start varnish v1 -vcl+backend { sub vcl_recv {return(pass);} } -start client c1 { txreq -hdr "Range: bytes=1-1" rxresp expect resp.status == 206 expect resp.bodylen == 1 expect resp.http.content-range == "bytes 1-1/20" } -run varnish-4.1.1/bin/varnishtest/tests/r01777.vtc0000644000201500234410000000045512652366721015773 00000000000000varnishtest "range asked longer than object" server s1 { rxreq txresp -nolen -hdr "Transfer-Encoding: chunked" delay .5 chunkedlen 64 chunkedlen 64 chunkedlen 0 } -start varnish v1 -vcl+backend { } -start client c1 { txreq -hdr "Range: bytes=0-129" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r00980.vtc0000644000201500234410000000116012652366721015760 00000000000000varnishtest "r00980 test gzip on fetch with content_length and do_stream" server s1 { rxreq expect req.url == "/foobar" expect req.http.accept-encoding == "gzip" txresp -bodylen 43 } -start varnish v1 -cliok "param.set http_gzip_support true" -vcl+backend { sub vcl_backend_response { set beresp.do_gzip = true; set beresp.do_stream = true; } } -start client c1 { txreq -url /foobar -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == "gzip" gunzip expect resp.bodylen == 43 txreq -url /foobar rxresp expect resp.http.content-encoding == expect resp.bodylen == 43 } -run varnish-4.1.1/bin/varnishtest/tests/b00015.vtc0000644000201500234410000000265212652366721015734 00000000000000varnishtest "Check synthetic error page caching" # First test that an internally generated error is not cached varnish v1 -vcl { backend foo { .host = "${bad_ip}"; .port = "9080"; } } -start client c1 { txreq -url "/" rxresp expect resp.status == 503 expect resp.http.X-varnish == "1001" } -run delay .1 client c1 { txreq -url "/" rxresp expect resp.status == 503 expect resp.http.X-varnish == "1004" } -run delay .1 # Then check that a cacheable error from the backend is varnish v1 -cliok "ban req.url ~ .*" server s1 { rxreq txresp -status 301 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.ttl = beresp.ttl; set beresp.http.uncacheable = beresp.uncacheable; } } client c1 { txreq -url "/" rxresp expect resp.status == 301 expect resp.http.X-varnish == "1007" } -run delay .1 client c1 { txreq -url "/" rxresp expect resp.status == 301 expect resp.http.X-varnish == "1010 1008" } -run delay .1 # Then check that a non-cacheable error from the backend can be server s1 { rxreq txresp -status 502 } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (beresp.status == 502) { set beresp.ttl = 10m; } } } client c1 { txreq -url "/2" rxresp expect resp.status == 502 expect resp.http.X-varnish == "1012" } -run delay .1 client c1 { txreq -url "/2" rxresp expect resp.status == 502 expect resp.http.X-varnish == "1015 1013" } -run delay .1 varnish-4.1.1/bin/varnishtest/tests/b00034.vtc0000644000201500234410000000060412652366721015730 00000000000000varnishtest "mempool param handling" server s1 { } -start varnish v1 -vcl+backend {} varnish v1 -cliok "param.set pool_req 1,10,1" varnish v1 -clierr 106 "param.set pool_req 10" varnish v1 -clierr 106 "param.set pool_req 10,1,1" varnish v1 -clierr 106 "param.set pool_req a,10,10" varnish v1 -clierr 106 "param.set pool_req 10,a,10" varnish v1 -clierr 106 "param.set pool_req 10,10,a" varnish-4.1.1/bin/varnishtest/tests/e00024.vtc0000644000201500234410000000423212652366721015733 00000000000000varnishtest "Test all 8 gzip stopbit residuals" server s1 { rxreq expect req.http.accept-encoding == gzip txresp -gzipbody { 1 Before includes 2 {} bit0 3 {} bit1 4 {} bit2 5 {} bit3 6 {} bit4 7 {} bit5 8 {} bit6 9 {} bit7 10 After includes 11 } rxreq expect req.url == "/bit0" expect req.http.accept-encoding == gzip txresp -gzipresidual 0 -gziplevel 9 -gzipbody {e04c8d0fd604c} rxreq expect req.url == "/bit1" expect req.http.accept-encoding == gzip txresp -gzipresidual 1 -gziplevel 9 -gzipbody {1ea86e6cf31bf4ec3d7a86} rxreq expect req.url == "/bit2" expect req.http.accept-encoding == gzip txresp -gzipresidual 2 -gziplevel 9 -gzipbody {10} rxreq expect req.url == "/bit3" expect req.http.accept-encoding == gzip txresp -gzipresidual 3 -gziplevel 9 -gzipbody {a5e2e2e1c2e2} rxreq expect req.url == "/bit4" expect req.http.accept-encoding == gzip txresp -gzipresidual 4 -gziplevel 9 -gzipbody {71c5d18ec5d5d1} rxreq expect req.url == "/bit5" expect req.http.accept-encoding == gzip txresp -gzipresidual 5 -gziplevel 9 -gzipbody {39886d28a6d2988} rxreq expect req.url == "/bit6" expect req.http.accept-encoding == gzip txresp -gzipresidual 6 -gziplevel 9 -gzipbody {80000} rxreq expect req.url == "/bit7" expect req.http.accept-encoding == gzip txresp -gzipresidual 7 -gziplevel 9 -gzipbody {386811868} } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (bereq.url == "/") { set beresp.do_esi = true; } } } -start varnish v1 -cliok "param.set http_gzip_support true" varnish v1 -cliok "param.set debug +esi_chop" varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == gzip gunzip expect resp.status == 200 expect resp.bodylen == 252 txreq rxresp expect resp.http.content-encoding == expect resp.status == 200 expect resp.bodylen == 252 } -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/r00545.vtc0000644000201500234410000000033312652366721015756 00000000000000varnishtest "High-bit chars" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_deliver { set resp.http.foo = "æøå"; } } -start client c1 { txreq rxresp expect resp.http.foo == "æøå" } -run varnish-4.1.1/bin/varnishtest/tests/c00071.vtc0000644000201500234410000000164212652366721015735 00000000000000varnishtest "Test actual client workspace overflow" server s1 { rxreq txresp rxreq txresp rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_deliver { debug.workspace_allocate(client, debug.workspace_free(client) - 150); if (req.url ~ "/bar") { set resp.http.x-foo = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; } else if (req.url ~ "/baz") { set resp.http.x-foo = regsub(req.url, "baz", "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz"); } set resp.http.x-of = debug.workspace_overflowed(client); } } -start client c1 { txreq -url /foo rxresp expect resp.status == 200 expect resp.http.x-of == "false" txreq -url /bar rxresp expect resp.status == 500 expect resp.http.x-of == } -run client c2 { txreq -url /baz rxresp expect resp.status == 500 expect resp.http.x-of == } -run varnish-4.1.1/bin/varnishtest/tests/m00018.vtc0000644000201500234410000000052712652366721015751 00000000000000varnishtest "Test std.substr" server s1 -repeat 2 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.sub = std.strstr(req.url, "b"); } } -start client c1 { txreq -url "/foobar" rxresp expect resp.http.sub == "bar" txreq -url "/quux" rxresp expect resp.http.sub == "" } -run varnish-4.1.1/bin/varnishtest/tests/c00017.vtc0000644000201500234410000000114412652366721015732 00000000000000varnishtest "Test Backend Polling" server s1 { # Probes loop 8 { rxreq expect req.url == "/" txresp -hdr "Bar: foo" -body "foobar" accept } loop 3 { rxreq expect req.url == "/" txresp -status 404 -hdr "Bar: foo" -body "foobar" accept } loop 2 { rxreq expect req.url == "/" txresp -proto "FROBOZ" -status 200 -hdr "Bar: foo" -body "foobar" accept } sema r1 sync 2 } -start varnish v1 -vcl { backend foo { .host = "${s1_addr}"; .port = "${s1_port}"; .probe = { .timeout = 1 s; .interval = 0.1 s; } } } -start sema r1 sync 2 varnish v1 -cli "backend.list -p" varnish-4.1.1/bin/varnishtest/tests/b00023.vtc0000644000201500234410000000065412652366721015733 00000000000000varnishtest "Check that the first_byte_timeout works from parameters" feature SO_RCVTIMEO_WORKS server s1 { rxreq delay 1.5 txresp -body "foo" } -start varnish v1 -vcl+backend {} -start varnish v1 -cliok "param.set first_byte_timeout 1" client c1 { txreq rxresp expect resp.status == 503 } -run server s1 { rxreq delay 0.5 txresp -body "foo" } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01441.vtc0000644000201500234410000000136312652366721015756 00000000000000varnishtest "Session grouping on ESI" server s1 { rxreq expect req.url == "/" txresp -body "" rxreq expect req.url == "/include" txresp -body "included" } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (bereq.url == "/") { set beresp.do_esi = true; } } } -start -cliok "param.set debug +syncvsl" logexpect l1 -v v1 -g session { expect 0 1000 Begin sess 0 HTTP/1 expect * = End expect 0 1001 Begin req 1000 rxreq expect * = End expect 0 1002 Begin bereq 1001 fetch expect * = End expect 0 1003 Begin req 1001 esi expect * = End expect 0 1004 Begin bereq 1003 fetch expect * = End } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 } -run logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/m00003.vtc0000644000201500234410000000057412652366721015745 00000000000000varnishtest "Test vmod_dir param" feature topbuild server s1 { rxreq txresp } -start varnish v1 -arg "-pvmod_dir=${topbuild}/lib/libvmod_std/.libs/" \ -vcl+backend { import std; } -start varnish v1 -cliok "param.set vmod_dir /nonexistent" varnish v1 -errvcl {Could not load VMOD std} { import std; } varnish v1 -errvcl {Expected 'from path ...'} { import std to; } varnish-4.1.1/bin/varnishtest/tests/r00641.vtc0000644000201500234410000000106412652366721015755 00000000000000varnishtest "Regression test for 524: HTTP/1.0 and ESI" server s1 { rxreq expect req.url == "/" txresp -proto HTTP/1.0 -body { <_esi:include src="/foo"/> } } -start varnish v1 -vcl+backend { sub vcl_recv { // return (pass); } sub vcl_backend_response { set beresp.do_esi = true; } } -cliok "param.set timeout_idle 60" -start client c1 { txreq -proto HTTP/1.1 rxresp # XXX this is the problem: expect resp.proto == HTTP/1.1 expect resp.status == 200 expect resp.bodylen == 37 } -run varnish-4.1.1/bin/varnishtest/tests/p00005.vtc0000644000201500234410000000240312652366721015743 00000000000000varnishtest "Check expiry of non-instantiated object" shell "rm -f ${tmpdir}/_.per" server s1 { rxreq txresp -hdr "Foo: foo1" } -start varnish v1 \ -arg "-sdeprecated_persistent,${tmpdir}/_.per,10m" \ -arg "-pban_lurker_sleep=0" \ -arg "-pshortlived=0" \ -vcl+backend { sub vcl_backend_response { set beresp.ttl = 3s; set beresp.keep = 0s; set beresp.grace = 0s; } } -start varnish v1 -cliok "param.set debug +syncvsl" varnish v1 -cliok "param.set feature +wait_silo" logexpect l1 -v v1 -g vxid -q "Begin ~ bereq" { expect * 1002 Storage "persistent s0" } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" expect resp.http.foo == "foo1" } -run logexpect l1 -wait varnish v1 -expect n_object == 1 varnish v1 -stop server s1 -wait { rxreq txresp -hdr "Foo: foo2" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.ttl = 3s; } } -start delay 5 logexpect l1 -v v1 -g vxid -q "Begin ~ bereq" { expect * 1002 Storage "persistent s0" } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" expect resp.http.foo == "foo2" } -run logexpect l1 -wait varnish v1 -expect n_object == 1 varnish-4.1.1/bin/varnishtest/tests/d00006.vtc0000644000201500234410000000244712652366721015740 00000000000000varnishtest "Test vmod.directors round robin director in stacked fashion" server s1 { rxreq txresp -body "1" } -start server s2 { rxreq txresp -body "22" } -start server s3 { rxreq txresp -body "333" } -start server s4 { rxreq txresp -body "4444" } -start varnish v1 -errvcl {Names of VCL objects cannot contain '-'} { import ${vmod_directors}; backend b1 { .host = "127.0.0.1"; .port = "8080";} sub vcl_init { new rr1-xx = directors.round_robin(); } } varnish v1 -vcl+backend { import ${vmod_directors}; sub vcl_init { new rr1 = directors.round_robin(); rr1.add_backend(s1); rr1.add_backend(s3); new rr2 = directors.round_robin(); rr2.add_backend(s2); rr2.add_backend(s4); new rr3 = directors.round_robin(); rr3.add_backend(rr1.backend()); rr3.add_backend(rr2.backend()); } sub vcl_backend_fetch { set bereq.backend = rr3.backend(); } } -start client c1 { timeout 3 txreq -url "/foo1" rxresp expect resp.bodylen == 1 txreq -url "/foo2" rxresp expect resp.bodylen == 2 txreq -url "/foo3" rxresp expect resp.bodylen == 3 txreq -url "/foo4" rxresp expect resp.bodylen == 4 } -run server s1 -start server s2 -start client c2 { timeout 3 txreq -url "/foo11" rxresp expect resp.bodylen == 1 txreq -url "/foo22" rxresp expect resp.bodylen == 2 } -run varnish-4.1.1/bin/varnishtest/tests/m00002.vtc0000644000201500234410000000120112652366721015730 00000000000000varnishtest "Test std.random()" # needs random generator random server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.rnd1 = std.random(0, 1); set resp.http.rnd2 = std.random(0, 10); set resp.http.rnd3 = std.random(8, 10); set resp.http.rnd4 = std.random(99, 100); } } -start # NB: Do not change the number 1 # NB: Only srandom(1) is standardized as deterministic. varnish v1 -cliok "debug.srandom 1" client c1 { txreq rxresp expect resp.http.rnd1 == 0.388 expect resp.http.rnd2 == 7.478 expect resp.http.rnd3 == 9.034 expect resp.http.rnd4 == 99.502 } -run varnish-4.1.1/bin/varnishtest/tests/b00045.vtc0000644000201500234410000000042512652366721015733 00000000000000varnishtest "Check Pid file locking" server s1 { rxreq txresp } -start varnish v1 -vcl+backend {} -start client c1 { txreq rxresp } -run delay .2 err_shell {Could not open pid/lock} \ "${varnishd} -P ${tmpdir}/v1/varnishd.pid -b 127.0.0.1:80 -a :0 -n ${tmpdir} 2>&1" varnish-4.1.1/bin/varnishtest/tests/s00004.vtc0000644000201500234410000000313412652366721015747 00000000000000varnishtest "Timestamps" server s1 { rxreq expect req.url == "/1" delay 1 txresp -nolen -hdr "Transfer-Encoding: chunked" delay 1 chunkedlen 1000 chunkedlen 0 rxreq expect req.url == "/2" txresp } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; } sub vcl_deliver { if (req.url == "/1" && req.restarts == 0) { return (restart); } } } -start logexpect l1 -v v1 -g request { expect 0 1001 Begin req expect * = Timestamp {Start: \S+ 0\.000000 0\.000000} expect * = Timestamp {Req: \S+ 0\.\d+ 0\.\d+} expect * = Timestamp {Fetch: \S+ [0-4]\.\d+ [0-4]\.\d+} expect * = Timestamp {Process: \S+ 2\.\d+ 0\.\d+} expect * = Timestamp {Restart: \S+ 2\.\d+ 0\.\d+} expect * = End expect 0 1002 Begin bereq expect * = Timestamp {Start: \S+ 0\.000000 0\.000000} expect * = Timestamp {Bereq: \S+ 0\.\d+ 0\.\d+} expect * = Timestamp {Beresp: \S+ 1\.\d+ [01]\.\d+} expect * = Timestamp {BerespBody: \S+ 2\.\d+ 1\.\d+} expect * = End expect 0 1003 Begin req 1001 restart expect * = Timestamp {Start: \S+ 2\.\d+ 0\.\d+} expect * = Timestamp {Process: \S+ 2\.\d+ 0\.\d+} expect * = Timestamp {Resp: \S+ 2\.\d+ 0\.\d+} expect * = End expect 0 1004 Begin req expect * = Timestamp {Start: \S+ 0\.000000 0\.000000} expect * = Timestamp {Req: \S+ 0\.\d+ 0\.\d+} expect * = Timestamp {ReqBody: \S+ 0\.\d+ 0\.\d+} expect * = Timestamp {Fetch: \S+ 0\.\d+ 0\.\d+} expect * = Timestamp {Resp: \S+ 0\.\d+ 0\.\d+} expect * = End } -start client c1 { txreq -url "/1" rxresp delay 1 txreq -req "POST" -url "/2" -body "asdf" rxresp } -run logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/c00010.vtc0000644000201500234410000000153012652366721015722 00000000000000varnishtest "Test pass from hit" server s1 { rxreq expect req.url == "/foo" txresp -body foobar rxreq expect req.url == "/foo" txresp -body foobar1 rxreq expect req.url == "/pass" txresp -body foobar12 } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.url == "/foo") { return(hash); } else { return(pass); } } sub vcl_hit { return(pass); } } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 6 expect resp.http.x-varnish == "1001" txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 7 expect resp.http.x-varnish == "1003 1004" # a pass following a hit on the same wrk should not be # reported as a hit txreq -url "/pass" rxresp expect resp.status == 200 expect resp.bodylen == 8 expect resp.http.x-varnish == "1005" } client c1 -run varnish-4.1.1/bin/varnishtest/tests/v00042.vtc0000644000201500234410000000212412652366721015752 00000000000000varnishtest "Make sure we also get separate PRIV_TASK contexts in ESI subrequests." server s1 { rxreq expect req.url == "/a" expect req.http.x0 == "/a0" expect req.http.x1 == "/a0" txresp -body { } rxreq expect req.url == "/foo" expect req.http.x0 == "/foo1" expect req.http.x1 == "/foo1" txresp -body { } rxreq expect req.url == "/bar" expect req.http.x0 == "/bar2" expect req.http.x1 == "/bar2" txresp rxreq expect req.url == "/b" expect req.http.x0 == "/b0" expect req.http.x1 == "/b0" txresp } -start varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_recv { set req.http.x0 = debug.test_priv_task(req.url + req.esi_level); } sub vcl_miss { set req.http.x1 = debug.test_priv_task(""); } sub vcl_backend_response { set beresp.do_esi = true; } sub vcl_deliver { set resp.http.x1 = debug.test_priv_task(""); } } -start client c1 { txreq -url /a rxresp expect resp.http.x1 == "/a0" txreq -url /b rxresp expect resp.http.x1 == "/b0" } -run varnish v1 -expect s_req == 2 varnish-4.1.1/bin/varnishtest/tests/e00014.vtc0000644000201500234410000000070712652366721015735 00000000000000varnishtest "Check } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start varnish v1 -cliok "debug.fragfetch 4" client c1 { txreq -url /foo rxresp expect resp.bodylen == 49 } -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/c00065.vtc0000644000201500234410000000043112652366721015733 00000000000000varnishtest "Connection: close in vcl_deliver{}" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_deliver { set resp.http.Connection = "close"; } } -start client c1 { txreq rxresp expect_close } -run client c1 { txreq rxresp expect_close } -run varnish-4.1.1/bin/varnishtest/tests/c00020.vtc0000644000201500234410000000266712652366721015737 00000000000000varnishtest "Test -h critbit a bit" server s1 { rxreq expect req.url == "/" txresp -hdr "ID: slash" -hdr "Connection: close" -body "012345\n" } -start varnish v1 -arg "-hcritbit" -vcl+backend { } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" expect resp.http.ID == "slash" } -run delay .1 client c2 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1004 1002" expect resp.http.ID == "slash" } -run delay .1 server s1 { rxreq expect req.url == "/foo" txresp -hdr "ID: foo" -body "012345\n" rxreq expect req.url == "/bar" txresp -hdr "ID: bar" -body "012345\n" } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1006" expect resp.http.ID == "foo" delay .1 txreq -url "/" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1008 1002" expect resp.http.ID == "slash" delay .1 txreq -url "/bar" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1009" expect resp.http.ID == "bar" delay .1 txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1011 1007" expect resp.http.ID == "foo" } -run varnish v1 -expect sess_conn == 3 varnish v1 -expect cache_hit == 3 varnish v1 -expect cache_miss == 3 varnish v1 -expect client_req == 6 varnish v1 -expect s_sess == 3 varnish v1 -expect s_req == 6 varnish v1 -expect s_fetch == 3 varnish-4.1.1/bin/varnishtest/tests/r01693.vtc0000644000201500234410000000070012652366721015761 00000000000000varnishtest "Check hash is logged when the Hash bit is set" server s1 { rxreq txresp } -start varnish v1 -arg "-p vsl_mask=+Hash" -vcl+backend { sub vcl_hash { hash_data("1" + req.http.foo + "3"); } } -start logexpect l1 -v v1 { expect * 1001 Hash "1" expect 0 1001 Hash "bar" expect 0 1001 Hash "3" expect 0 1001 Hash "/" expect 0 1001 Hash "127.0.0.1" } -start client c1 { txreq -hdr "foo: bar" rxresp } -run logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/r00502.vtc0000644000201500234410000000065512652366721015756 00000000000000varnishtest "multi element ban" server s1 { rxreq txresp -hdr "foo: bar1" -body "1" rxreq txresp -hdr "foo: bar2" -body "22" } -start varnish v1 -vcl+backend { sub vcl_recv { ban("req.url == / && obj.http.foo ~ bar1"); } } -start client c1 { txreq rxresp expect resp.http.foo == "bar1" txreq rxresp expect resp.http.foo == "bar2" txreq rxresp expect resp.http.foo == "bar2" } -run varnish v1 -cliok ban.list varnish-4.1.1/bin/varnishtest/tests/m00005.vtc0000644000201500234410000000227012652366721015742 00000000000000varnishtest "Test std.duration()" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.ttl = std.duration(req.http.ttl, 1s) + 1000000s; } } -start client c1 { txreq -hdr "ttl: 10ms" rxresp expect resp.http.ttl == 1000000.010 txreq -hdr "ttl: 10s" rxresp expect resp.http.ttl == 1000010.000 txreq -hdr "ttl: 10m" rxresp expect resp.http.ttl == 1000600.000 txreq -hdr "ttl: 10h" rxresp expect resp.http.ttl == 1036000.000 txreq -hdr "ttl: 10d" rxresp expect resp.http.ttl == 1864000.000 txreq -hdr "ttl: 10w" rxresp expect resp.http.ttl == 7048000.000 txreq -hdr "ttl: 1y" rxresp expect resp.http.ttl == 32536000.000 txreq -hdr "ttl: -100s" rxresp expect resp.http.ttl == 999900.000 txreq -hdr "ttl: s" rxresp expect resp.http.ttl == 1000001.000 txreq -hdr "ttl: 3wx" rxresp expect resp.http.ttl == 1000001.000 txreq -hdr "ttl: -inf" rxresp expect resp.http.ttl == 1000001.000 txreq -hdr "ttl: 2x" rxresp expect resp.http.ttl == 1000001.000 txreq -hdr "ttl: 2h x" rxresp expect resp.http.ttl == 1000001.000 txreq -hdr "ttl: 100" rxresp expect resp.http.ttl == 1000001.000 } -run varnish-4.1.1/bin/varnishtest/tests/r01569.vtc0000644000201500234410000000035512652366721015771 00000000000000varnishtest "symbol lookup order issue" varnish v1 -vcl { vcl 4.0; import ${vmod_debug}; backend debug { .host = "127.0.0.1"; .port = "80"; } sub debug { set req.backend_hint = debug; } sub vcl_recv { call debug; } } varnish-4.1.1/bin/varnishtest/tests/r01807.vtc0000644000201500234410000000142212652366721015760 00000000000000varnishtest "Decreasing http_max_hdr" server s1 { rxreq txresp \ -hdr "h00: 00" \ -hdr "h01: 01" \ -hdr "h02: 02" \ -hdr "h03: 03" \ -hdr "h04: 04" \ -hdr "h05: 05" \ -hdr "h06: 06" \ -hdr "h07: 07" \ -hdr "h08: 08" \ -hdr "h09: 09" \ -hdr "h10: 10" \ -hdr "h11: 11" \ -hdr "h12: 12" \ -hdr "h13: 13" \ -hdr "h14: 14" \ -hdr "h15: 15" \ -hdr "h16: 16" \ -hdr "h17: 17" \ -hdr "h18: 18" \ -hdr "h19: 19" \ -hdr "h20: 20" \ -hdr "h21: 21" \ -hdr "h22: 22" \ -hdr "h23: 23" \ -hdr "h24: 24" } -start varnish v1 -vcl+backend { } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.http.h24 == 24 } -run varnish v1 -cliok {param.set http_max_hdr 32} client c1 { txreq rxresp expect resp.status == 500 } -run varnish-4.1.1/bin/varnishtest/tests/m00022.vtc0000644000201500234410000000100712652366721015736 00000000000000varnishtest "Test vmod failure in vcl_init{}" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { } -start varnish v1 -errvcl "Planned failure in vcl_init" { import ${vmod_debug}; backend default { .host = "${s1_addr}"; } sub vcl_init { debug.init_fail(); } } varnish v1 -cliok "param.set nuke_limit 42" varnish v1 -errvcl "nuke_limit is not the answer." { import ${vmod_debug}; backend default { .host = "${s1_addr}"; } } client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01404.vtc0000644000201500234410000000046412652366721015756 00000000000000varnishtest "Test that 304 does not send Content-Length" server s1 { rxreq txresp -hdr {ETag: "foo"} -body "11111\n" } -start varnish v1 -vcl+backend { } -start client c1 { txreq -hdr {If-None-Match: "foo"} rxresp -no_obj expect resp.status == 304 expect resp.http.Content-Length == } -run varnish-4.1.1/bin/varnishtest/tests/r01212.vtc0000644000201500234410000000041012652366721015742 00000000000000varnishtest "#1212 - Vmod with HEADER argument given a STRING asserts the VCL compiler" varnish v1 -errvcl {Wrong argument type. Expected HEADER. Got STRING.} { import ${vmod_std}; backend b { .host = "127.0.0.1"; } sub vcl_recv { std.collect("foo"); } } varnish-4.1.1/bin/varnishtest/tests/r01037.vtc0000644000201500234410000000105212652366721015752 00000000000000varnishtest "Test case for #1037" server s1 { rxreq # Send a bodylen of 1,5M, which will exceed cache space of 1M non-fatal txresp -nolen -hdr "Transfer-encoding: chunked" chunked {} chunkedlen 500000 chunked {} chunkedlen 500000 chunked {} chunkedlen 500000 chunkedlen 0 } -start varnish v1 -arg "-smalloc,1M" -arg "-pgzip_level=0" -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; set beresp.do_gzip = true; } } -start client c1 { txreq rxresp expect resp.status == "503" } -run varnish-4.1.1/bin/varnishtest/tests/r00913.vtc0000644000201500234410000000057112652366721015761 00000000000000varnishtest "test regsub(NULL)" server s1 { rxreq expect req.url == "/bar" txresp -body "foobar" } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (beresp.http.bar ~ "$") { set beresp.http.foo = regsub(beresp.http.bar, "$", "XXX"); } } } -start client c1 { txreq -url /bar rxresp expect resp.bodylen == 6 expect resp.http.foo == "XXX" } -run varnish-4.1.1/bin/varnishtest/tests/r01296.vtc0000644000201500234410000000071712652366721015770 00000000000000varnishtest "hash key depends on argument form to hash_data()" server s1 { rxreq txresp -hdr "OK: yes" rxreq txresp -hdr "OK: no" } -start varnish v1 -vcl+backend { sub vcl_hash { if (req.http.foo == "1") { hash_data("123"); } else { hash_data("1" + req.http.foo + "3"); } return (lookup); } } -start client c1 { txreq -hdr "foo: 1" rxresp expect resp.http.ok == "yes" txreq -hdr "foo: 2" rxresp expect resp.http.ok == "yes" } -run varnish-4.1.1/bin/varnishtest/tests/v00031.vtc0000644000201500234410000000073612652366721015757 00000000000000varnishtest "param vcc_err_unref" varnish v1 -errvcl {Unused backend c, defined:} { backend b { .host = "127.0.0.1"; } backend c { .host = "127.0.0.1"; } } varnish v1 -cliok "param.set vcc_err_unref false" varnish v1 -vcl { backend b { .host = "127.0.0.1"; } backend c { .host = "127.0.0.1"; } } varnish v1 -cliok "param.set vcc_err_unref true" varnish v1 -errvcl {Unused backend c, defined:} { backend b { .host = "127.0.0.1"; } backend c { .host = "127.0.0.1"; } } varnish-4.1.1/bin/varnishtest/tests/r01068.vtc0000644000201500234410000000055612652366721015766 00000000000000varnishtest "Bug 1068 restart on hit in vcl_deliver causes segfault" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_deliver { if (req.http.x-restart && req.restarts == 0) { return (restart); } } } -start client c1 { txreq rxresp expect resp.status == 200 txreq -hdr "x-restart: true" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/c00016.vtc0000644000201500234410000000124712652366721015735 00000000000000varnishtest "Test Connection header handling" server s1 { rxreq expect req.url == "/foo" expect req.http.Foo == "bar" txresp -hdr "Bar: foo" -body "foobar" rxreq expect req.url == "/bar" expect req.http.Foo == txresp -hdr "Bar: fnry,glyf, FOO ,brok" -hdr "Connection: bar" -body "foobar" } -start varnish v1 -vcl+backend { } -start client c1 { txreq -url "/foo" -hdr "Foo: bar" rxresp expect resp.http.Bar == "foo" txreq -url "/bar" -hdr "Foo: bar2" -hdr "Connection: foo, close" rxresp expect req.http.Bar == } -run client c1 { txreq -url "/bar" -hdr "foo: 1" -hdr "Age: 200" -hdr "Connection: Age" rxresp expect resp.status == 400 } -run varnish-4.1.1/bin/varnishtest/tests/r01729.vtc0000644000201500234410000000146112652366721015766 00000000000000varnishtest "C-L/T-E:chunked conflict" server s1 { non-fatal rxreq expect req.bodylen == 20 send "HTTP/1.1 200 OK\r\n" send "Content-Length: 31\r\n" send "Transfer-Encoding: chunked\r\n" send "\r\n" send "14\r\n" send "0123456789" send "0123456789" send "0\r\n" send "\r\n" } -start varnish v1 -vcl+backend { } -start client c1 { non-fatal send "PUT /1 HTTP/1.1\r\n" send "Content-Length: 31\r\n" send "Transfer-Encoding: chunked\r\n" send "\r\n" send "14\r\n" send "0123456789" send "0123456789" send "0\r\n" send "\r\n" rxresp expect resp.status == 400 } -run client c1 { fatal send "PUT /2 HTTP/1.1\r\n" send "Transfer-Encoding: chunked\r\n" send "\r\n" send "14\r\n" send "0123456789" send "0123456789" send "0\r\n" send "\r\n" rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/r00896.vtc0000644000201500234410000000105712652366721015773 00000000000000varnishtest "Ticket #896, strings over 256 bytes" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.http.host ~ "^(abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij|abcdefghij)") { return (synth(500,"not ok")); } } } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/v00021.vtc0000644000201500234410000000267112652366721015756 00000000000000varnishtest "VCL compiler coverage test: vcc_xref.c" varnish v1 -errvcl {Variable 'obj.ttl' is read only.} { backend b { .host = "127.0.0.1"; } sub vcl_recv { set obj.ttl = 1 w; } } varnish v1 -errvcl {Variable 'obj.ttl' is read only.} { backend b { .host = "127.0.0.1"; } sub foo { set obj.ttl = 1 w; } sub vcl_recv { call foo ; } } varnish v1 -errvcl "Expected an action, 'if', '{' or '}'" { backend b { .host = "127.0.0.1"; } sub vcl_recv { discard; } } varnish v1 -errvcl "Expected an action, 'if', '{' or '}'" { backend b { .host = "127.0.0.1"; } sub foo { discard; } sub vcl_recv { call foo; } } varnish v1 -errvcl "Function recurses on" { backend b { .host = "127.0.0.1"; } sub foo { call foo; } sub vcl_recv { call foo; } } varnish v1 -errvcl "Function recurses on" { backend b { .host = "127.0.0.1"; } sub bar { call foo; } sub foo { call bar; } sub vcl_recv { call foo; } } varnish v1 -errvcl {Unused acl foo, defined:} { backend b { .host = "127.0.0.1"; } acl foo { "localhost"; } } varnish v1 -errvcl {Unused sub foo, defined:} { backend b { .host = "127.0.0.1"; } sub foo { } } varnish v1 -errvcl {Invalid return "deliver"} { backend b { .host = "127.0.0.1"; } sub vcl_recv { call foo; } sub foo { return (deliver); } } varnish v1 -errvcl {directors are now in directors VMOD} { backend b { .host = "127.0.0.1"; } director d1 random { .backend b; } sub vcl_recv { set req.backend = d1; } } varnish-4.1.1/bin/varnishtest/tests/c00012.vtc0000644000201500234410000000076712652366721015737 00000000000000varnishtest "Test pass from miss" server s1 { rxreq expect req.url == "/foo" txresp -body foobar rxreq expect req.url == "/foo" txresp -body foobar1 } -start varnish v1 -vcl+backend { sub vcl_miss { return(pass); } } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 6 expect resp.http.x-varnish == "1001" txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 7 expect resp.http.x-varnish == "1003" } client c1 -run varnish-4.1.1/bin/varnishtest/tests/e00022.vtc0000644000201500234410000000151012652366721015725 00000000000000varnishtest "ESI ability to stitch gzip files together" server s1 { rxreq expect req.http.accept-encoding == gzip txresp -gzipbody { This is a test: Unseen University This is a test: Hello world } } -start varnish v1 -arg "-p thread_pool_stack=262144" -vcl+backend { sub vcl_recv { set req.esi = true; } sub vcl_backend_response { set beresp.do_esi = true; } } -start varnish v1 -cliok "param.set debug +esi_chop" varnish v1 -cliok "param.set http_gzip_support true" varnish v1 -cliok "param.set gzip_memlevel 1" client c1 { txreq -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == gzip gunzip expect resp.status == 200 expect resp.bodylen == 40 } client c1 -run varnish v1 -expect esi_errors == 2 varnish-4.1.1/bin/varnishtest/tests/b00006.vtc0000644000201500234410000000036312652366721015731 00000000000000varnishtest "Check that -s malloc works" server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" } -start varnish v1 -arg "-s malloc" -vcl+backend {} -start client c1 { txreq -url "/" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01755.vtc0000644000201500234410000000063012652366721015762 00000000000000varnishtest "The (struct backend).n_conn counter is never decremented" server s1 { rxreq txresp rxreq txresp } -start varnish v1 -vcl { backend s1 { .host = "${s1_addr}"; .port = "${s1_port}"; .max_connections = 1; } } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 txreq -url "/bar" rxresp expect resp.status == 200 } -run varnish v1 -expect backend_busy == 0 varnish-4.1.1/bin/varnishtest/tests/b00008.vtc0000644000201500234410000000105412652366721015731 00000000000000varnishtest "Test CLI help and parameter functions" varnish v1 -arg "-b ${bad_ip}:9080" varnish v1 -cliok "help" varnish v1 -cliok "help -a" varnish v1 -cliok "help -d" varnish v1 -cliok "help vcl.load" varnish v1 -cliok "help ban" varnish v1 -clierr 101 "FOO?" varnish v1 -clierr 100 "\x22" varnish v1 -clierr 105 "help 1 2 3" varnish v1 -cliok "param.show" varnish v1 -start varnish v1 -cliok "help" varnish v1 -clierr 106 "param.set waiter HASH(0x8839c4c)" varnish v1 -cliok "param.set cli_limit 128" varnish v1 -clierr 201 "param.show" varnish-4.1.1/bin/varnishtest/tests/b00042.vtc0000644000201500234410000000320712652366721015731 00000000000000varnishtest "param edge cases" varnish v1 -vcl {backend foo {.host = "127.0.0.1";}} -start varnish v1 -clierr "106" "param.set default_ttl -1" varnish v1 -clierr "106" "param.set acceptor_sleep_max 20" varnish v1 -clierr "200" "param.set prefer_ipv6 off" varnish v1 -clierr "200" "param.set prefer_ipv6 no" varnish v1 -clierr "200" "param.set prefer_ipv6 disable" varnish v1 -clierr "200" "param.set prefer_ipv6 false" varnish v1 -clierr "200" "param.set prefer_ipv6 on" varnish v1 -clierr "200" "param.set prefer_ipv6 yes" varnish v1 -clierr "200" "param.set prefer_ipv6 enable" varnish v1 -clierr "200" "param.set prefer_ipv6 true" varnish v1 -clierr "106" "param.set prefer_ipv6 foobar" varnish v1 -clierr "106" "param.set http_max_hdr 0" varnish v1 -clierr "106" "param.set http_max_hdr 1000000" varnish v1 -clierr "106" "param.set workspace_thread 1b" varnish v1 -clierr "106" "param.set workspace_thread 1m" varnish v1 -clierr "106" "param.set workspace_thread 1x" varnish v1 -clierr "106" "param.set workspace_thread x" varnish v1 -clierr "106" "param.set user ///" varnish v1 -clierr "106" "param.set user ///" varnish v1 -clierr "106" {param.set pool_sess "\""} varnish v1 -clierr "200" {param.set thread_pool_max 110} varnish v1 -clierr "106" {param.set thread_pool_min 111} varnish v1 -clierr "200" {param.set thread_pool_min 51} varnish v1 -clierr "106" {param.set thread_pool_max 50} varnish v1 -clierr "200" {param.set thread_pool_max 51} varnish v1 -clierr "200" {param.set thread_pool_max unlimited} varnish v1 -clierr "106" {param.show fofofofo} varnish v1 -cliok "param.show changed" varnish v1 -cliok "param.show " varnish v1 -cliok "param.show -l" varnish-4.1.1/bin/varnishtest/tests/b00009.vtc0000644000201500234410000000044612652366721015736 00000000000000varnishtest "Check poll acceptor" server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" } -start varnish v1 -arg "-Wpoll" -vcl+backend {} -start client c1 { txreq -url "/" rxresp expect resp.status == 200 delay .1 txreq -url "/" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/m00021.vtc0000644000201500234410000000152512652366721015742 00000000000000varnishtest "Test expiry callbacks" server s1 { rxreq txresp } -start varnish v1 -vcl+backend {} -start varnish v1 -cliok "param.set debug +vclrel" logexpect l1 -v v1 -g raw { expect * 0 Debug "exp_cb: registered" expect * 0 Debug "exp_cb: event insert 0x[0-9a-f]+" expect * 0 Debug "exp_cb: event remove 0x[0-9a-f]+" expect * 0 Debug "exp_cb: deregistered" } -start varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_init { debug.register_exp_callback(); } sub vcl_recv { if (req.method == "PURGE") { return (purge); } } } client c1 { txreq rxresp expect resp.status == 200 txreq -req PURGE rxresp } -run varnish v1 -expect n_object == 0 varnish v1 -vcl+backend {} varnish v1 -cliok "vcl.discard vcl2" varnish v1 -cliok "debug.vmod" varnish v1 -cliok "vcl.list" varnish v1 -expect vmods == 0 logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/e00005.vtc0000644000201500234410000000100112652366721015721 00000000000000varnishtest "ESI relative include" server s1 { rxreq expect req.url == "/foo/bar" txresp -body { Before include After include } rxreq expect req.url == "/foo/body" txresp -body { Included file } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq -url /foo/bar rxresp expect resp.status == 200 expect resp.bodylen == 67 } client c1 -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/e00016.vtc0000644000201500234410000000140412652366721015732 00000000000000varnishtest "ESI request can't be turned off midstream" server s1 { rxreq txresp -body { Before include After include } rxreq expect req.url == "/body" txresp -body { } rxreq expect req.url == "/body2" txresp -body { included } rxreq expect req.url == "/body3" txresp -body { included body3 } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } sub vcl_deliver { set req.esi = true; if(req.url == "/body") { set req.esi = false; } } } -start client c1 { txreq rxresp expect resp.bodylen == 105 expect resp.status == 200 } client c1 -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/d00001.vtc0000644000201500234410000000224512652366721015727 00000000000000varnishtest "Test fallback director" server s1 { rxreq txresp -hdr "Foo: 1" } -start server s2 { rxreq txresp -hdr "Foo: 2" } -start server s3 { rxreq txresp -hdr "Foo: 3" } -start varnish v1 -vcl+backend { import ${vmod_directors}; sub vcl_init { new fb1 = directors.fallback(); fb1.add_backend(s1); fb1.add_backend(s2); fb1.add_backend(s3); } sub vcl_recv { if (req.method == "DELETE") { fb1.remove_backend(s2); return(synth(204)); } return (pass); } sub vcl_backend_fetch { set bereq.backend = fb1.backend(); } } -start varnish v1 -cliok "backend.set_health s1 sick" varnish v1 -cliok "backend.set_health s2 sick" client c1 { # s1 & s2 are both sick, expect response from s3 txreq rxresp expect resp.http.foo == "3" } -run varnish v1 -cliok "backend.set_health s2 healthy" client c1 { txreq rxresp expect resp.http.foo == "2" } -run varnish v1 -cliok "backend.set_health s1 healthy" client c1 { txreq rxresp expect resp.http.foo == "1" } -run varnish v1 -cliok "backend.set_health s1 sick" server s3 -start client c1 { txreq -req "DELETE" rxresp expect resp.status == 204 txreq rxresp expect resp.http.foo == "3" } -run varnish-4.1.1/bin/varnishtest/tests/c00066.vtc0000644000201500234410000000213712652366721015741 00000000000000varnishtest "Check that we always deliver Date headers" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { backend bad { .host = "${bad_ip}"; .port = "9080"; } sub vcl_recv { if (req.url == "/synth") { return (synth(200, "Synth test")); } if (req.url == "/error") { set req.backend_hint = bad; } } sub vcl_backend_response { set beresp.do_stream = false; } } -start varnish v1 -cliok "param.set connect_timeout 1" logexpect l1 -v v1 -g request { expect 0 1001 Begin "^req .* rxreq" expect * = ReqURL "/" expect * = RespHeader "^Date: " expect * = End expect * 1003 Begin "^req .* rxreq" expect * = ReqURL "/synth" expect * = RespHeader "^Date: " expect * = End expect * 1004 Begin "^req .* rxreq" expect * = ReqURL "/error" expect * = RespHeader "^Date: " expect * = End } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.msg == "OK" delay .1 txreq -url "/synth" rxresp expect resp.status == 200 expect resp.msg == "Synth test" delay .1 txreq -url "/error" rxresp expect resp.status == 503 } -run logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/c00014.vtc0000644000201500234410000000141012652366721015723 00000000000000varnishtest "Test parking second request on backend delay, then pass" server s1 { rxreq expect req.url == "/foo" sema r1 sync 2 send "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\n" send "line1\n" send "line2\n" rxreq expect req.url == "/foo" txresp -body "foobar" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; set beresp.uncacheable = true; } } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 12 expect resp.http.x-varnish == "1001" } -start sema r1 sync 2 delay .2 client c2 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 6 expect resp.http.x-varnish == "1004" } -run client c1 -wait varnish v1 -expect cache_hitpass == 1 varnish-4.1.1/bin/varnishtest/tests/e00017.vtc0000644000201500234410000001235612652366721015743 00000000000000varnishtest "Aggressive use of ESI include" server s1 { rxreq txresp -body { Before include After include } rxreq txresp -body { Included file 00 } rxreq txresp -body { Included file 01 } rxreq txresp -body { Included file 02 } rxreq txresp -body { Included file 03 } rxreq txresp -body { Included file 04 } rxreq txresp -body { Included file 05 } rxreq txresp -body { Included file 06 } rxreq txresp -body { Included file 07 } rxreq txresp -body { Included file 08 } rxreq txresp -body { Included file 09 } rxreq txresp -body { Included file 10 } rxreq txresp -body { Included file 11 } rxreq txresp -body { Included file 12 } rxreq txresp -body { Included file 13 } rxreq txresp -body { Included file 14 } rxreq txresp -body { Included file 15 } rxreq txresp -body { Included file 16 } rxreq txresp -body { Included file 17 } rxreq txresp -body { Included file 18 } rxreq txresp -body { Included file 19 } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.status == 200 } client c1 -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/r00494.vtc0000644000201500234410000000067512652366721015772 00000000000000varnishtest "HTTP continuation lines" #NB: careful about spaces and tabs in this test. server s1 { rxreq txresp -hdr {Foo: bar, barf: fail} -body "xxx" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.bar = beresp.http.foo; unset beresp.http.foo; } } -start client c1 { txreq rxresp expect resp.http.bar == "bar, barf: fail" expect resp.http.barf == expect resp.http.foo == } -run varnish-4.1.1/bin/varnishtest/tests/s00001.vtc0000644000201500234410000000126412652366721015746 00000000000000varnishtest "Simple expiry test (fully reaped object)" server s1 { rxreq expect req.url == "/" txresp -hdr "Cache-control: max-age = 1" -body "1111\n" sema r1 sync 2 rxreq expect req.url == "/" txresp -hdr "Cache-control: max-age = 1" -body "22222\n" } -start varnish v1 -vcl+backend { } -start varnish v1 -cliok "param.set default_keep 0" varnish v1 -cliok "param.set default_grace 0" client c1 { txreq -url "/" rxresp expect resp.bodylen == 5 expect resp.http.x-varnish == "1001" expect resp.status == 200 } -run sema r1 sync 2 delay 1.1 client c2 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.x-varnish == "1004" expect resp.bodylen == 6 } -run varnish-4.1.1/bin/varnishtest/tests/b00022.vtc0000644000201500234410000000122212652366721015722 00000000000000varnishtest "Check the between_bytes_timeout behaves from backend definition" feature SO_RCVTIMEO_WORKS server s1 { rxreq send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 1.5 send "Baba\n" } -start varnish v1 -vcl { backend b1 { .host = "${s1_addr}"; .port = "${s1_port}"; .between_bytes_timeout = 1s; } sub vcl_backend_response { set beresp.do_stream = false; } } -start client c1 { txreq rxresp expect resp.status == 503 } -run server s1 { rxreq send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 0.5 send "Baba\n" delay 0.5 send "Baba\n" } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01810.vtc0000644000201500234410000000054612652366721015760 00000000000000varnishtest "POST HTTP/1.0 response" server s1 { non-fatal rxreq txresp -proto HTTP/1.1 -nolen -hdr "Connection: close" send "Hello World\n" delay .4 } -start varnish v1 -vcl+backend { sub vcl_backend_fetch { set bereq.proto = "HTTP/1.0"; } } -start client c1 { txreq -req POST -hdr "Content-Length: 0" rxresp expect resp.bodylen == 12 } -run varnish-4.1.1/bin/varnishtest/tests/e00027.vtc0000644000201500234410000000060312652366721015734 00000000000000varnishtest "test HEAD against ESI processing" server s1 { rxreq expect req.url == "/1" txresp -bodylen 1 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq -url "/1" rxresp expect resp.status == 200 expect resp.bodylen == 1 txreq -req "HEAD" -url "/1" rxresp -no_obj expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r00655.vtc0000644000201500234410000000017212652366721015761 00000000000000varnishtest "Test nested /*...*/ comments " varnish v1 -errvcl {/* ... */ comment contains /*} { /* foo /* bar */ } varnish-4.1.1/bin/varnishtest/tests/r00781.vtc0000644000201500234410000000042712652366721015764 00000000000000varnishtest "NULL assignment to line1 fields." server s1 { rxreq txresp -bodylen 10 } -start varnish v1 -vcl+backend { sub vcl_recv { set req.url = req.http.foo; } sub vcl_backend_fetch { set bereq.url = bereq.http.foo; } } -start client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/s00000.vtc0000644000201500234410000000120512652366721015740 00000000000000varnishtest "Simple expiry test" server s1 { rxreq expect req.url == "/" txresp -hdr "Cache-control: max-age = 1" -body "1111\n" delay 3 rxreq expect req.url == "/" txresp -hdr "Cache-control: max-age = 1" -body "22222\n" } -start varnish v1 -vcl+backend { } -start varnish v1 -cliok "param.set default_grace 0" varnish v1 -cliok "param.set default_keep 0" client c1 { txreq -url "/" rxresp expect resp.bodylen == 5 expect resp.http.x-varnish == "1001" expect resp.status == 200 } -run delay 3 client c2 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.x-varnish == "1004" expect resp.bodylen == 6 } -run varnish-4.1.1/bin/varnishtest/tests/r00948.vtc0000644000201500234410000000071412652366721015770 00000000000000varnishtest "anon acl numbering" server s1 { rxreq expect req.http.foo1 == "Match" expect req.http.foo2 == "Match" txresp -bodylen 40 } -start varnish v1 -vcl+backend { sub vcl_recv { if (client.ip == "${s1_addr}" || client.ip == "${bad_ip}") { set req.http.foo1 = "Match"; } if (client.ip == "${bad_ip}" || client.ip == "${s1_addr}") { set req.http.foo2 = "Match"; } } } -start client c1 { txreq rxresp expect resp.bodylen == 40 } -run varnish-4.1.1/bin/varnishtest/tests/a00007.vtc0000644000201500234410000000054512652366721015733 00000000000000varnishtest "TCP reuse" server s1 { rxreq expect req.url == "/1" txresp -body "123456789\n" rxreq expect req.url == "/2" txresp -body "987654321\n" } server s1 -start client c1 -connect ${s1_sock} { txreq -url "/1" -req "POST" -body "abcdefghi\n" rxresp txreq -url "/2" -req "POST" -body "ihgfedcba\n" rxresp } client c1 -run server s1 -wait varnish-4.1.1/bin/varnishtest/tests/e00015.vtc0000644000201500234410000000130012652366721015724 00000000000000varnishtest "ESI requests turned off" server s1 { rxreq txresp -body { Before include After include } rxreq txresp -body { Before include After include } rxreq expect req.url == "/body" txresp -body { Included file } } -start varnish v1 -vcl+backend { sub vcl_recv { if(req.url == "/") { set req.esi = false; } } sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.bodylen == 73 expect resp.status == 200 txreq -url "/esi" rxresp expect resp.bodylen == 65 expect resp.status == 200 } client c1 -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/a00004.vtc0000644000201500234410000000120712652366721015724 00000000000000varnishtest "dual shared server HTTP transactions" server s1 -repeat 2 { rxreq expect req.method == PUT expect req.proto == HTTP/1.0 expect req.url == "/foo" txresp -proto HTTP/1.2 -status 201 -msg Foo } server s1 -start client c1 -connect ${s1_sock} { txreq -req PUT -proto HTTP/1.0 -url /foo rxresp expect resp.proto == HTTP/1.2 expect resp.status == 201 expect resp.msg == Foo } client c2 -connect ${s1_sock} { txreq -req PUT -proto HTTP/1.0 -url /foo rxresp expect resp.proto == HTTP/1.2 expect resp.status == 201 expect resp.msg == Foo } client c1 -start client c2 -start client c1 -wait client c2 -wait server s1 -wait varnish-4.1.1/bin/varnishtest/tests/v00044.vtc0000644000201500234410000000435612652366721015765 00000000000000varnishtest "vcl.state coverage tests" server s1 -repeat 20 { rxreq txresp delay .2 close } -start # The debug vmod logs temperature vcl events varnish v1 -arg "-p vcl_cooldown=1" -vcl { import ${vmod_debug}; backend default { .host = "${s1_addr}"; .probe = { .interval = 1s; .initial = 1;} } } -start # We only have one vcl yet varnish v1 -expect VBE.vcl1.default.happy >= 0 varnish v1 -expect !VBE.vcl2.default.happy varnish v1 -cliok "backend.list -p *.*" varnish v1 -vcl { backend default { .host = "${s1_addr}"; .probe = { .interval = 1s; .initial = 1;} } } # Now we have two vcls (and run on the latest loaded) delay .4 varnish v1 -expect VBE.vcl1.default.happy >= 0 varnish v1 -expect VBE.vcl2.default.happy >= 0 # Freeze the first VCL varnish v1 -cliok "vcl.state vcl1 cold" delay .4 varnish v1 -expect !VBE.vcl1.default.happy # Set it auto should be a no-op varnish v1 -cliok "vcl.state vcl1 auto" delay .4 varnish v1 -expect !VBE.vcl1.default.happy # Use it, and it should come alive varnish v1 -cliok "vcl.use vcl1" delay .4 varnish v1 -expect VBE.vcl1.default.happy >= 0 varnish v1 -expect VBE.vcl2.default.happy >= 0 # and the unused one should go cold delay 4 varnish v1 -expect !VBE.vcl2.default.happy # Mark the used warm and use the other varnish v1 -cliok "vcl.state vcl1 warm" varnish v1 -cliok "vcl.use vcl2" # It will stay warm even after the cooldown period delay 4 varnish v1 -expect VBE.vcl1.default.happy >= 0 varnish v1 -expect VBE.vcl2.default.happy >= 0 # You can't freeze the active VCL varnish v1 -clierr 106 "vcl.state vcl2 cold" # However a warm event is guaranteed... logexpect l1 -v v1 -g raw { expect * 0 Debug "vcl1: VCL_EVENT_COLD" expect * 0 Debug "vcl1: VCL_EVENT_WARM" } -start # ...when you use a cold VCL varnish v1 -cliok "vcl.state vcl1 cold" varnish v1 -cliok "vcl.use vcl1" logexpect l1 -wait # It will apply the cooldown period once inactive varnish v1 -cliok "vcl.use vcl2" delay .4 varnish v1 -expect VBE.vcl1.default.happy >= 0 delay 4 varnish v1 -expect !VBE.vcl1.default.happy # A VMOD's warm-up can fail varnish v1 -cliok "param.set max_esi_depth 42" varnish v1 -clierr 300 "vcl.state vcl1 warm" # A warm-up failure can also fail a child start varnish v1 -cliok stop varnish v1 -clierr 300 start varnish-4.1.1/bin/varnishtest/tests/l00003.vtc0000644000201500234410000000312712652366721015741 00000000000000varnishtest "Test request byte counters with ESI" server s1 { rxreq expect req.url == "/" txresp -body {ghi} rxreq expect req.url == "/1" txresp -body {abcdef} rxreq expect req.url == "/2" txresp -body {123} } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } sub vcl_deliver { unset resp.http.date; unset resp.http.age; unset resp.http.via; unset resp.http.x-varnish; } } -start # Request (1001): # GET / HTTP/1.1\r\n 16 bytes # \r\n 2 bytes # Total: 18 bytes # Reponse: # HTTP/1.1 200 OK\r\n 17 bytes # Transfer-Encoding: chunked\r\n 28 bytes # Connection: keep-alive\r\n 24 bytes # \r\n 2 bytes # Total: 71 bytes # Response body: # 123\r\n 5 bytes # abc\r\n 5 bytes # 123\r\n 5 bytes # def\r\n 5 bytes # ghi\r\n 5 bytes # Total: 15 bytes logexpect l1 -v v1 -g request { expect 0 1001 Begin "^req .* rxreq" expect * = ReqAcct "^18 0 18 93 15 108$" expect 0 = End expect * 1003 Begin "^req .* esi" expect * = ReqAcct "^0 0 0 0 12 12$" expect 0 = End expect * 1005 Begin "^req .* esi" expect * = ReqAcct "^0 0 0 0 3 3$" expect 0 = End expect * 1007 Begin "^req .* esi" expect * = ReqAcct "^0 0 0 0 3 3$" expect 0 = End } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.body == "123abc123defghi" } -run logexpect l1 -wait varnish v1 -expect s_req_hdrbytes == 18 varnish v1 -expect s_req_bodybytes == 0 varnish v1 -expect s_resp_hdrbytes == 93 varnish v1 -expect s_resp_bodybytes == 33 varnish-4.1.1/bin/varnishtest/tests/b00025.vtc0000644000201500234410000000101412652366721015724 00000000000000varnishtest "Check that the first_byte_timeout works from backend definition" feature SO_RCVTIMEO_WORKS server s1 { rxreq delay 1.5 txresp } -start varnish v1 -vcl { backend b1 { .host = "${s1_addr}"; .port = "${s1_port}"; .first_byte_timeout = 1s; } } -start # Fragmenting storage tests for #1397 varnish v1 -cliok "debug.fragfetch 4" client c1 { txreq rxresp expect resp.status == 503 } -run server s1 { rxreq delay 0.5 txresp } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/c00064.vtc0000644000201500234410000000103112652366721015727 00000000000000varnishtest "Connection: close in vcl_synth{}" server s1 { rxreq txresp -status 400 } -start varnish v1 -vcl+backend { sub vcl_miss { if (req.url == "/333") { return (synth(333, "FOO")); } else { return (synth(334, "BAR")); } } sub vcl_synth { if (resp.status == 333) { set resp.http.connection = "close"; } } } -start client c1 { txreq -url /334 rxresp expect resp.status == 334 txreq -url /334 rxresp expect resp.status == 334 txreq -url /333 rxresp expect resp.status == 333 expect_close } -run varnish-4.1.1/bin/varnishtest/tests/r00466.vtc0000644000201500234410000000145012652366721015761 00000000000000varnishtest "Check Range forwarding to backend" server s1 { rxreq expect req.url == "/foo" expect req.http.range == txresp \ -hdr "Foobar: _barf_" \ -body "012345\n" rxreq expect req.url == "/bar" expect req.http.range == "200-300" txresp \ -status 206 \ -hdr "Foobar: _barf_" \ -body "012345\n" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.url ~ "bar") { return(pass); } } } -start varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq -url "/foo" -hdr "Range: bytes=1-2" rxresp expect resp.status == 206 expect resp.http.Content-Length == 2 expect resp.http.X-Varnish == "1001" # NB: Deliberately bogus Range header txreq -url "/bar" -hdr "Range: 200-300" rxresp expect resp.status == 206 expect resp.http.X-Varnish == "1003" } -run varnish-4.1.1/bin/varnishtest/tests/r00940.vtc0000644000201500234410000000352112652366721015757 00000000000000varnishtest "GZIP, ESI and etags" server s1 { rxreq expect req.url == /1 expect req.http.accept-encoding == "gzip" txresp -hdr {ETag: "foo"} -gziplen 41 rxreq expect req.url == /2 txresp -hdr {ETag: "foo2"} -bodylen 42 rxreq expect req.url == /3 txresp -hdr {ETag: "foo3"} -body {

foo

} rxreq expect req.url == /4 txresp -hdr {ETag: "foo4"} -gzipbody { foo } } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (bereq.url == "/2") { set beresp.do_gzip = true; } if (bereq.url == "/3" || bereq.url == "/4") { set beresp.do_esi = true; } } sub vcl_deliver { if (req.http.foo == "noesi") { set req.esi = false; } } } -start client c1 { # Straight through gzip, strong etag survives txreq -url /1 -hdr "Accept-Encoding: gzip" rxresp expect resp.http.etag == {"foo"} gunzip expect resp.bodylen == 41 delay .2 # gzip in, gunzip out, weak etag txreq -url /1 rxresp expect resp.http.etag == {W/"foo"} expect resp.bodylen == 41 delay .2 # Gzip on input, weak etag txreq -url /2 -hdr "Accept-Encoding: gzip" rxresp expect resp.http.etag == {W/"foo2"} gunzip expect resp.bodylen == 42 delay .2 # Gzip on input, gunzip on output, weak etag txreq -url /2 rxresp expect resp.http.etag == {W/"foo2"} expect resp.bodylen == 42 delay .2 # ESI expansion, weak etag txreq -url /3 rxresp expect resp.http.etag == {W/"foo3"} expect resp.bodylen == 8 delay .2 # ESI parse, but no expansion, strong etag txreq -url /3 -hdr "foo: noesi" rxresp expect resp.http.etag == {"foo3"} expect resp.bodylen == 38 delay .2 # ESI parse, no expansion, but re-gzipping, weak etag txreq -url /4 -hdr "foo: noesi" -hdr "Accept-Encoding: gzip" rxresp expect resp.http.etag == {W/"foo4"} gunzip expect resp.bodylen == 40 } -run varnish-4.1.1/bin/varnishtest/tests/r01206.vtc0000644000201500234410000000140612652366721015753 00000000000000varnishtest "Pass shouldn't honor IMS/INM if the backend doesn't" server s1 { rxreq txresp -bodylen 6 rxreq txresp -hdr {ETag: "123456789"} \ -bodylen 7 rxreq txresp -hdr "Last-Modified: Thu, 26 Jun 2008 12:00:01 GMT" \ -bodylen 8 } -start varnish v1 -vcl+backend { sub vcl_recv { return(pass); } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 6 txreq -hdr {If-None-Match: "123456789"} rxresp expect resp.status == 200 expect resp.bodylen == 7 txreq -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:01 GMT" rxresp expect resp.status == 200 expect resp.bodylen == 8 } -run server s1 -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.uncacheable = true; } } client c1 -run varnish-4.1.1/bin/varnishtest/tests/g00007.vtc0000644000201500234410000000530512652366721015740 00000000000000varnishtest "Test Vary with gzip/gunzip" server s1 { rxreq expect req.url == "/foo" txresp -body "foo" rxreq expect req.url == "/bar" txresp -gzipbody "bar" rxreq expect req.url == "/baz" txresp -body "baz" rxreq expect req.url == "/qux" txresp -hdr "Vary: qux" -gzipbody "qux" rxreq expect req.url == "/fubar" txresp -hdr "Vary: fubar, Accept-Encoding" -gzipbody "fubar" rxreq expect req.url == "/foobar" txresp -gzipbody "foobar" rxreq expect req.url == "/foobaz" txresp -hdr "Vary: foobaz" -gzipbody "foobaz" rxreq expect req.url == "/fooqux" txresp -hdr "Vary: fooqux, Accept-Encoding" -gzipbody "fooqux" } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (bereq.url ~ "/baz") { set beresp.do_gzip = true; } elif (bereq.url ~ "/foo(bar|baz|qux)") { set beresp.do_gunzip = true; } } } -start client c1 { # /foo txreq -url /foo rxresp expect resp.body == "foo" expect resp.http.Vary == txreq -url /foo -hdr "Accept-Encoding: gzip" rxresp expect resp.body == "foo" expect resp.http.Vary == # /bar txreq -url /bar rxresp expect resp.body == "bar" expect resp.http.Vary == "Accept-Encoding" txreq -url /bar -hdr "Accept-Encoding: gzip" rxresp expect resp.bodylen == 26 expect resp.http.Vary == "Accept-Encoding" # /baz txreq -url /baz rxresp expect resp.body == "baz" expect resp.http.Vary == "Accept-Encoding" txreq -url /baz -hdr "Accept-Encoding: gzip" rxresp expect resp.bodylen == 23 expect resp.http.Vary == "Accept-Encoding" # /qux txreq -url /qux rxresp expect resp.body == "qux" expect resp.http.Vary == "qux, Accept-Encoding" txreq -url /qux -hdr "Accept-Encoding: gzip" rxresp expect resp.bodylen == 26 expect resp.http.Vary == "qux, Accept-Encoding" # /fubar txreq -url /fubar rxresp expect resp.body == "fubar" expect resp.http.Vary == "fubar, Accept-Encoding" txreq -url /fubar -hdr "Accept-Encoding: gzip" rxresp expect resp.bodylen == 28 expect resp.http.Vary == "fubar, Accept-Encoding" # /foobar txreq -url /foobar rxresp expect resp.body == "foobar" expect resp.http.Vary == txreq -url /foobar -hdr "Accept-Encoding: gzip" rxresp expect resp.body == "foobar" expect resp.http.Vary == # /foobaz txreq -url /foobaz rxresp expect resp.body == "foobaz" expect resp.http.Vary == "foobaz" txreq -url /foobaz -hdr "Accept-Encoding: gzip" rxresp expect resp.body == "foobaz" expect resp.http.Vary == "foobaz" # /fooqux txreq -url /fooqux rxresp expect resp.body == "fooqux" expect resp.http.Vary == "fooqux, Accept-Encoding" txreq -url /fooqux -hdr "Accept-Encoding: gzip" rxresp expect resp.body == "fooqux" expect resp.http.Vary == "fooqux, Accept-Encoding" } -run varnish-4.1.1/bin/varnishtest/tests/e00030.vtc0000644000201500234410000000302212652366721015724 00000000000000varnishtest "Test req_top.* in an ESI context" varnish v1 -errvcl {Variable 'req_top.url' is read only.} { sub vcl_recv { set req_top.url = "/foo"; } } server s1 { rxreq expect req.http.top-url == "/" expect req.http.top-method == "GET" expect req.http.top-proto == "HTTP/1.1" expect req.http.top-foo == "bar" txresp -body { Before include After include } rxreq expect req.url == "/a1" expect req.http.top-url == "/" expect req.http.top-method == "GET" expect req.http.top-proto == "HTTP/1.1" expect req.http.top-foo == "bar" txresp -body { Included file } rxreq expect req.http.top-url == "/" expect req.http.top-method == "GET" expect req.http.top-proto == "HTTP/1.1" expect req.http.top-foo == "bar" expect req.url == "/b1" txresp rxreq expect req.http.top-url == "/" expect req.http.top-method == "GET" expect req.http.top-proto == "HTTP/1.1" expect req.http.top-foo == "bar" expect req.url == "/c2" txresp } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.esi_level > 0) { set req.url = req.url + req.esi_level; } else { set req.http.foo = "bar"; } set req.http.top-url = req_top.url; set req.http.top-method = req_top.method; set req.http.top-proto = req_top.proto; set req.http.top-foo = req_top.http.foo; } sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/r01109.vtc0000644000201500234410000000210012652366721015745 00000000000000varnishtest "Test case for #1109 - Gzip+ESI broken for large included objects" server s1 { rxreq expect req.url == "/test1" txresp -body {startend} rxreq expect req.url == "/include1" # This tests ESI+gzip delivery when the ESI-included object # has more than one storage chunk txresp -bodylen 4082 rxreq txresp -body {startend} expect req.url == "/test2" rxreq expect req.url == "/include2" # This tests gzip trailer extraction for ESI+gzip CRC calculation # when the trailer spans two storage chunks txresp -bodylen 4074 } -start varnish v1 \ -arg "-pfetch_chunksize=4k" \ -arg "-pgzip_level=0" \ -arg "-pthread_pool_stack=131072" \ -vcl+backend { sub vcl_backend_response { if (bereq.url ~ "/test") { set beresp.do_esi = true; } set beresp.do_gzip = true; } } -start client c1 { txreq -url "/test1" -hdr "Accept-Encoding: gzip" rxresp gunzip expect resp.bodylen == 4096 txreq -url "/test2" -hdr "Accept-Encoding: gzip" rxresp gunzip expect resp.bodylen == 4088 } -run varnish-4.1.1/bin/varnishtest/tests/b00016.vtc0000644000201500234410000000120312652366721015724 00000000000000varnishtest "Check naming of backends" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.X-Backend-Name = bereq.backend; } } -start client c1 { txreq -url "/" rxresp expect resp.http.X-Backend-Name == "s1" } -run varnish v1 -vcl+backend { import ${vmod_directors}; sub vcl_init { new bar = directors.random(); bar.add_backend(s1, 1); } sub vcl_recv { set req.backend_hint = bar.backend(); } sub vcl_backend_response { set beresp.http.X-Backend-Name = bereq.backend; } } client c1 { txreq -url "/" rxresp expect resp.http.X-Backend-Name == "s1" } -run varnish-4.1.1/bin/varnishtest/tests/c00049.vtc0000644000201500234410000000764412652366721015752 00000000000000varnishtest "New ban-lurker test" server s1 { rxreq expect req.url == /1 txresp -hdr "Foo: bar1" rxreq expect req.url == /2 txresp -hdr "Foo: bar2" rxreq expect req.url == /3 txresp -hdr "Foo: bar3" rxreq expect req.url == /4 txresp -hdr "Foo: bar4" rxreq expect req.url == /5 txresp -hdr "Foo: bar5" rxreq expect req.url == /6 txresp -hdr "Foo: bar6" rxreq expect req.url == /7 txresp -hdr "Foo: bar7" rxreq expect req.url == /4 txresp -hdr "Foo: bar4.1" } -start varnish v1 -vcl+backend {} -start varnish v1 -cliok "param.set ban_lurker_age 0" varnish v1 -cliok "param.set ban_lurker_sleep 0" varnish v1 -cliok "param.set debug +lurker" varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq -url /1 rxresp expect resp.http.foo == bar1 txreq -url /2 rxresp expect resp.http.foo == bar2 } -run varnish v1 -cliok "ban obj.http.foo == bar1" client c1 { txreq -url /3 rxresp expect resp.http.foo == bar3 } -run varnish v1 -cliok "ban obj.http.foo == bar2 && obj.http.foo != foof" client c1 { txreq -url /4 rxresp expect resp.http.foo == bar4 } -run varnish v1 -cliok "ban req.http.kill == yes" client c1 { txreq -url /5 rxresp expect resp.http.foo == bar5 } -run varnish v1 -cliok "ban obj.http.foo == bar5" client c1 { txreq -url /6 rxresp expect resp.http.foo == bar6 } -run varnish v1 -cliok "ban obj.http.foo == bar6" client c1 { txreq -url /7 rxresp expect resp.http.foo == bar7 } -run # Get the VSL out of the way delay 1 varnish v1 -cliok "ban.list" varnish v1 -expect bans == 6 varnish v1 -expect bans_completed == 1 varnish v1 -expect bans_req == 1 varnish v1 -expect bans_obj == 4 varnish v1 -expect bans_added == 6 varnish v1 -expect bans_deleted == 0 varnish v1 -expect bans_tested == 0 varnish v1 -expect bans_tests_tested == 0 varnish v1 -expect bans_obj_killed == 0 varnish v1 -expect bans_lurker_tested == 0 varnish v1 -expect bans_lurker_tests_tested == 0 varnish v1 -expect bans_lurker_obj_killed == 0 varnish v1 -expect bans_dups == 0 varnish v1 -cliok "param.set ban_lurker_sleep .01" delay 1 varnish v1 -cliok "ban.list" delay 1 varnish v1 -cliok "ban.list" varnish v1 -expect bans == 4 varnish v1 -expect bans_completed == 3 varnish v1 -expect bans_req == 1 varnish v1 -expect bans_obj == 3 varnish v1 -expect bans_added == 6 varnish v1 -expect bans_deleted == 2 varnish v1 -expect bans_tested == 0 varnish v1 -expect bans_tests_tested == 0 varnish v1 -expect bans_obj_killed == 0 varnish v1 -expect bans_lurker_tested == 10 varnish v1 -expect bans_lurker_tests_tested == 11 varnish v1 -expect bans_lurker_obj_killed == 4 varnish v1 -expect bans_dups == 0 client c1 { txreq -url /3 rxresp expect resp.http.foo == bar3 } -run # Give lurker time to trim tail delay 1 varnish v1 -cliok "ban.list" varnish v1 -expect bans == 4 varnish v1 -expect bans_completed == 3 varnish v1 -expect bans_req == 1 varnish v1 -expect bans_obj == 3 varnish v1 -expect bans_added == 6 varnish v1 -expect bans_deleted == 2 varnish v1 -expect bans_tested == 1 varnish v1 -expect bans_tests_tested == 1 varnish v1 -expect bans_obj_killed == 0 varnish v1 -expect bans_lurker_tested == 10 varnish v1 -expect bans_lurker_tests_tested == 11 varnish v1 -expect bans_lurker_obj_killed == 4 varnish v1 -expect bans_dups == 0 client c1 { txreq -url /4 -hdr "kill: yes" rxresp expect resp.http.foo == bar4.1 } -run # Give lurker time to trim tail delay 1 varnish v1 -cliok "ban.list" varnish v1 -expect bans == 1 varnish v1 -expect bans_completed == 1 varnish v1 -expect bans_req == 0 varnish v1 -expect bans_obj == 1 varnish v1 -expect bans_added == 6 varnish v1 -expect bans_deleted == 5 varnish v1 -expect bans_tested == 2 varnish v1 -expect bans_tests_tested == 2 varnish v1 -expect bans_obj_killed == 1 varnish v1 -expect bans_lurker_tested == 10 varnish v1 -expect bans_lurker_tests_tested == 11 varnish v1 -expect bans_lurker_obj_killed == 4 varnish v1 -expect bans_dups == 0 varnish v1 -expect n_object == 3 varnish-4.1.1/bin/varnishtest/tests/r00722.vtc0000644000201500234410000000133312652366721015754 00000000000000varnishtest "Director cleanup fails on vcl.discard" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_directors}; backend b2 { .host = "${s1_addr}"; .port = "${s1_port}"; } backend b3 { .host = "${s1_addr}"; .port = "${s1_port}"; } sub vcl_init { new foo = directors.random(); foo.add_backend(s1, 1); foo.add_backend(b2, 1); foo.add_backend(b3, 1); } sub vcl_backend_fetch { set bereq.backend = foo.backend(); } } -start varnish v1 -cliok "vcl.list" varnish v1 -cliok "backend.list" varnish v1 -vcl+backend { } varnish v1 -cliok "vcl.list" varnish v1 -cliok "backend.list" varnish v1 -cliok "vcl.list" varnish v1 -cliok "vcl.discard vcl1" client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/e00004.vtc0000644000201500234410000000072312652366721015732 00000000000000varnishtest "ESI commented include" server s1 { rxreq txresp -body { Before include After include } rxreq expect req.url == "/body" txresp -body { Included file } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 67 } client c1 -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/c00042.vtc0000644000201500234410000000121412652366721015726 00000000000000varnishtest "using req.hash_always_miss to force fetch" server s1 { rxreq expect req.url == "/1" txresp -bodylen 1 rxreq expect req.url == "/1" txresp -bodylen 2 } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.http.short) { set req.hash_always_miss = true; } } } -start client c1 { txreq -url "/1" rxresp expect resp.status == 200 expect resp.bodylen == 1 txreq -url "/1" rxresp expect resp.status == 200 expect resp.bodylen == 1 txreq -url "/1" -hdr "short: yes" rxresp expect resp.status == 200 expect resp.bodylen == 2 txreq -url "/1" rxresp expect resp.status == 200 expect resp.bodylen == 2 } -run varnish-4.1.1/bin/varnishtest/tests/r01134.vtc0000644000201500234410000000040112652366721015745 00000000000000varnishtest "vcc const/non-const tostring conversion - bug 1134" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_recv { set req.http.x-test = "Test " + 1; } } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01624.vtc0000644000201500234410000000152412652366721015760 00000000000000varnishtest "broken gunzip delivery" server s1 { rxreq txresp -nolen \ -hdr "Content-Encoding: gzip" \ -hdr "Transfer-Encoding: Chunked" send "164\r\n" sendhex "1f 8b 08 00 f3 7e 60 54 00 03 9d 94 d1 6e 82 30" sendhex "14 86 ef fb 14 ff 23 70 0e 28 7a 69 b2 78 61 e2" sendhex "76 c1 92 5d a3 69 e6 12 27 a6 b3 4b f6 f6 93 a3" sendhex "24 a5 2d 16 e9 0d f0 51 4e db bf 1f 05 52 8d 33" sendhex "2a 54 7b b3 a9 4f b6 36 7f ce ab b5 de 99 3e da" sendhex "d6 66 7f e8 7d be 3a 9b af 63 8f a8 6d 23 d7 39" sendhex "28 bf 56 07 97 dd 9b 1c 94 81 4a 70 11 21 39 09" # Truncated delay .2 accept rxreq txresp -bodylen 7 } -start varnish v1 -vcl+backend {} -start client c1 { txreq non-fatal timeout 3 rxresp } -run delay .2 client c1 { # Test varnishd is still running txreq -url /2 rxresp expect resp.bodylen == 7 } -run varnish-4.1.1/bin/varnishtest/tests/c00067.vtc0000644000201500234410000000131512652366721015737 00000000000000varnishtest "chunked req.body" server s1 { rxreq expect req.bodylen == 106 txresp -body "ABCD" rxreq expect req.bodylen == 108 txresp -body "ABCDE" } -start varnish v1 -vcl+backend { } -start varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq -req POST -nolen -hdr "Transfer-encoding: chunked" chunked {BLA} delay .2 chunkedlen 100 delay .2 chunked {FOO} delay .2 chunkedlen 0 rxresp expect resp.status == 200 expect resp.bodylen == 4 } -run delay .2 varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_recv { std.cache_req_body(110B); } } client c1 { txreq -req POST -nolen -hdr "Transfer-encoding: chunked" chunked {BLAS} delay .2 chunkedlen 110 expect_close } -run varnish-4.1.1/bin/varnishtest/tests/c00019.vtc0000644000201500234410000000371212652366721015737 00000000000000varnishtest "Check ban counters and duplicate ban elimination" server s1 { rxreq txresp -hdr "foo: 0" -body "foo0" rxreq txresp -hdr "foo: 1" -body "foo1" rxreq txresp -hdr "foo: 2" -body "foo2" rxreq txresp -hdr "foo: 3" -body "foo3" } -start varnish v1 -vcl+backend {} -start varnish v1 -cliok "ban req.url ~ FOO" # There is one "magic" ban from boot varnish v1 -expect bans_added == 2 varnish v1 -cliok "ban.list" # Our fetch is not affected by the ban # as the FOO-ban was preexisting client c1 { txreq -url /BAR rxresp expect resp.http.foo == 0 txreq -url /FOO rxresp expect resp.http.foo == 1 } -run varnish v1 -cliok "ban.list" varnish v1 -expect bans_tested == 0 varnish v1 -expect bans_tests_tested == 0 # Add another ban varnish v1 -cliok "ban req.url ~ FOO" varnish v1 -expect bans_added == 3 varnish v1 -cliok "ban.list" # The cached object will be band, and a new # fetched from the backend client c1 { txreq -url /FOO rxresp expect resp.http.foo == 2 } -run varnish v1 -expect bans_tested == 1 varnish v1 -expect bans_tests_tested == 1 varnish v1 -cliok "ban.list" # Fetch the cached copy, just for grins client c1 { txreq -url /FOO rxresp expect resp.http.foo == 2 } -run # Now add another two bans, Kilroy should not be hit varnish v1 -cliok "ban req.url ~ KILROY" varnish v1 -cliok "ban req.url ~ FOO" varnish v1 -expect bans_added == 5 # Enable dup removal of bans varnish v1 -cliok "param.set ban_dups on" # This should incapacitate the two previous FOO bans. varnish v1 -cliok "ban req.url ~ FOO" varnish v1 -expect bans_added == 6 varnish v1 -expect bans_dups == 3 varnish v1 -cliok "ban.list" # And we should get a fresh object from backend client c1 { txreq -url /FOO rxresp expect resp.http.foo == 3 } -run # With only two objects having ever been compared varnish v1 -expect bans_tested == 2 varnish v1 -expect bans_tests_tested == 2 varnish v1 -cliok "ban.list" # Test a bogus regexp varnish v1 -clierr 106 "ban req.url ~ [[[" varnish-4.1.1/bin/varnishtest/tests/v00032.vtc0000644000201500234410000000071212652366721015752 00000000000000varnishtest "Storage related vcl variables" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.has_s0 = storage.s0; set beresp.http.has_foo = storage.foo; set beresp.http.has_Transient = storage.Transient; } } -start varnish v1 -cliok "storage.list" client c1 { txreq rxresp expect resp.http.has_s0 == true expect resp.http.has_foo == false expect resp.http.has_Transient == true } -run varnish-4.1.1/bin/varnishtest/tests/r00963.vtc0000644000201500234410000000106112652366721015761 00000000000000varnishtest "Test hsh_rush" server s1 { rxreq sema r1 sync 5 txresp -bodylen 10 } -start varnish v1 -vcl+backend { } -start varnish v1 -cliok "param.set rush_exponent 2" client c1 { txreq sema r1 sync 5 rxresp expect resp.bodylen == 10 } -start client c2 { txreq sema r1 sync 5 rxresp expect resp.bodylen == 10 } -start client c3 { txreq sema r1 sync 5 rxresp expect resp.bodylen == 10 } -start client c4 { txreq sema r1 sync 5 rxresp expect resp.bodylen == 10 } -start client c1 -wait client c2 -wait client c3 -wait client c4 -wait varnish-4.1.1/bin/varnishtest/tests/r00686.vtc0000644000201500234410000000071712652366721015772 00000000000000varnishtest "Check that cache-control headers are collapsed" server s1 { rxreq txresp -hdr "Cache-Control: foo" -hdr "Cache-control: bar" -bodylen 4 } -start varnish v1 -vcl+backend { sub vcl_deliver { set resp.http.Foo = req.http.cache-control; } } -start client c1 { txreq -hdr "Cache-Control: froo" -hdr "Cache-control: boz" rxresp expect resp.http.foo == "froo, boz" expect resp.http.cache-control == "foo, bar" expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r00801.vtc0000644000201500234410000000070512652366721015754 00000000000000varnishtest "Regression test for duplicate content-length in pass" server s1 { rxreq txresp \ -hdr "Date: Mon, 25 Oct 2010 06:34:06 GMT" \ -hdr "Content-length: 000010" \ -nolen -bodylen 10 } -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_response { set beresp.do_stream = false; unset beresp.http.content-length; } } -start client c1 { txreq rxresp expect resp.http.content-length == "10" } -run varnish-4.1.1/bin/varnishtest/tests/r01775.vtc0000644000201500234410000000031412652366721015763 00000000000000varnishtest "Test loading a VCL in cold state" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { } -start varnish v1 -cliok {vcl.inline vcl2 "vcl 4.0; backend b { .host = \":80\";}" cold} varnish-4.1.1/bin/varnishtest/tests/p00004.vtc0000644000201500234410000000234312652366721015745 00000000000000varnishtest "Check object references" shell "rm -f ${tmpdir}/_.per" server s1 { rxreq txresp -hdr "Foo: foo" rxreq txresp -hdr "Bar: bar" } -start varnish v1 \ -arg "-pfeature=+wait_silo" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per,10m" \ -arg "-pban_lurker_sleep=0" \ -vcl+backend { } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" expect resp.http.foo == "foo" } -run varnish v1 -expect n_object == 1 client c1 { txreq -url "/bar" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1004" expect resp.http.bar == "bar" } -run varnish v1 -expect n_object == 2 varnish v1 -stop varnish v1 -start varnish v1 -cliok "debug.xid 1999" varnish v1 -expect n_vampireobject == 2 varnish v1 -expect n_object == 0 client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "2001 1002" expect resp.http.foo == "foo" } -run varnish v1 -expect n_vampireobject == 1 varnish v1 -expect n_object == 1 client c1 { txreq -url "/bar" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "2003 1005" expect resp.http.bar == "bar" } -run varnish v1 -expect n_object == 2 varnish v1 -expect n_vampireobject == 0 varnish-4.1.1/bin/varnishtest/tests/e00001.vtc0000644000201500234410000000071512652366721015730 00000000000000varnishtest "ESI:remove" server s1 { rxreq txresp -body { This is a test: Unseen University This is a test: Hello world } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 40 } client c1 -run varnish v1 -expect esi_errors == 2 varnish-4.1.1/bin/varnishtest/tests/b00047.vtc0000644000201500234410000000074312652366721015740 00000000000000varnishtest "Check that all but HTTP/1.0 and HTTP/1.1 get 400" server s1 { rxreq txresp -body "FOO" } -start varnish v1 -vcl+backend { } -start client c1 { send "GET /\r\n\r\n" rxresp expect resp.status == 400 } -run client c1 { send "GET / HTTP/0.5\r\n\r\n" rxresp expect resp.status == 400 } -run client c1 { send "GET / HTTP/1.2\r\n\r\n" rxresp expect resp.status == 400 } -run client c1 { send "GET / HTTP/2.0\r\n\r\n" rxresp expect resp.status == 400 } -run varnish-4.1.1/bin/varnishtest/tests/r01646.vtc0000644000201500234410000000152212652366721015762 00000000000000varnishtest "cond/stream race ?" server s1 { rxreq txresp -nolen -hdr "Transfer-Encoding: chunked" -hdr "Etag: foo" chunkedlen 32 sema r1 sync 3 chunkedlen 32 sema r2 sync 2 chunkedlen 32 chunkedlen 0 } -start server s2 { rxreq expect req.http.if-none-match == "foo" txresp -status 304 } -start varnish v1 -vcl+backend { sub vcl_backend_fetch { if (bereq.http.foo == "s2") { set bereq.backend = s2; } } sub vcl_backend_response { set beresp.ttl = 1s; set beresp.grace = 0s; set beresp.keep = 30s; } } -start varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq rxresphdrs sema r1 sync 3 rxrespbody expect resp.bodylen == 96 } -start client c2 { sema r1 sync 3 delay 2 txreq -hdr "foo: s2" rxresphdrs sema r2 sync 2 rxrespbody expect resp.bodylen == 96 } -start client c1 -wait client c2 -wait varnish-4.1.1/bin/varnishtest/tests/v00005.vtc0000644000201500234410000000160612652366721015755 00000000000000varnishtest "VCL: test backend probe syntax" # Check status definition varnish v1 -vcl { backend b1 { .host = "127.0.0.1"; .probe = { .expected_response = 204; } } } # Check url definition varnish v1 -vcl { backend b1 { .host = "127.0.0.1"; .probe = { .url = "/"; } } } # Check request definition varnish v1 -vcl { backend b1 { .host = "127.0.0.1"; .probe = { .request = "GET / HTTP/1.1" "Host: foo.bar" ; } } } # Check redefinition varnish v1 -errvcl {Probe request redefinition at:} { backend b1 { .host = "127.0.0.1"; .probe = { .url = "/"; .request = "GET / HTTP/1.1" "Host: foo.bar" ; } } } # Check redefinition the other way varnish v1 -errvcl {Probe request redefinition at:} { backend b1 { .host = "127.0.0.1"; .probe = { .request = "GET / HTTP/1.1" "Host: foo.bar" ; .url = "/"; } } } varnish-4.1.1/bin/varnishtest/tests/d00009.vtc0000644000201500234410000000172512652366721015741 00000000000000varnishtest "Test dynamic backends hot swap while being used" server s1 { rxreq expect req.url == "/foo" sema r1 sync 2 sema r2 sync 2 txresp } -start server s2 { rxreq expect req.url == "/bar" sema r2 sync 2 txresp } -start varnish v1 -vcl { import ${vmod_debug}; backend dummy { .host = "${bad_ip}"; .port = "9080"; } sub vcl_init { new s1 = debug.dyn("${s1_addr}", "${s1_port}"); } sub vcl_recv { if (req.method == "SWAP") { s1.refresh(req.http.X-Addr, req.http.X-Port); return (synth(200)); } set req.backend_hint = s1.backend(); } } -start varnish v1 -expect MAIN.n_backend == 2 client c1 { txreq -url "/foo" rxresp expect resp.status == 200 } -start client c2 { sema r1 sync 2 txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" rxresp expect resp.status == 200 txreq -url "/bar" rxresp expect resp.status == 200 } -run client c1 -wait varnish v1 -cli backend.list # varnish v1 -expect MAIN.n_backend == 2 varnish-4.1.1/bin/varnishtest/tests/c00052.vtc0000644000201500234410000000127412652366721015735 00000000000000varnishtest "Test disabling inline C code" server s1 { rxreq txresp } -start varnish v1 varnish v1 -cliok "param.set vcc_allow_inline_c true" varnish v1 -vcl+backend { C{ /*...*/ }C } varnish v1 -cliok "param.set vcc_allow_inline_c false" varnish v1 -errvcl {Inline-C not allowed} { backend default { .host = "${s1_sock}"; } C{ /*...*/ }C } varnish v1 -errvcl {Inline-C not allowed} { backend default { .host = "${s1_sock}"; } sub vcl_recv { C{ /*...*/ }C } } varnish v1 -cliok "param.set vcc_allow_inline_c true" varnish v1 -vcl+backend { sub vcl_recv { C{ /*...*/ }C } } varnish v1 -vcl+backend { C{ /*...*/ }C } varnish v1 -start client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/b00013.vtc0000644000201500234410000000141212652366721015723 00000000000000varnishtest "Check read-head / partial pipelining" server s1 { rxreq expect req.url == "/foo" txresp -body "foo" rxreq expect req.url == "/bar" txresp -body "foobar" } -start varnish v1 -vcl+backend {} # NB: The accept_filter param may not exist. varnish v1 -cli "param.set accept_filter false" varnish v1 -start client c1 { send "GET /foo HTTP/1.1\r\n\r\nGET " rxresp expect resp.status == 200 expect resp.bodylen == 3 expect resp.http.x-varnish == "1001" send "/bar HTTP/1.1\n\nGET /bar " rxresp expect resp.status == 200 expect resp.bodylen == 6 expect resp.http.x-varnish == "1003" send "HTTP/1.1\n\n" rxresp expect resp.status == 200 expect resp.bodylen == 6 expect resp.http.x-varnish == "1005 1004" } -run varnish v1 -expect sess_readahead == 2 varnish-4.1.1/bin/varnishtest/tests/r00102.vtc0000644000201500234410000000101612652366721015742 00000000000000varnishtest "Test POST->GET conversion" server s1 { rxreq txresp \ -hdr "Connection: close" \ -body "012345\n" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.method == "POST") { set req.method = "GET"; } } } -start client c1 { txreq -req POST -url "/" \ -body "123456789\n" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" txreq -req POST -url "/" \ -body "123456789\n" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1003 1002" } client c1 -run varnish-4.1.1/bin/varnishtest/tests/r01613.vtc0000644000201500234410000000075612652366721015764 00000000000000varnishtest "Extra Connection header erroneously inserted." server s1 { rxreq txresp } -start varnish v2 -vcl+backend { sub vcl_deliver { set resp.http.Connection = "close"; } } -start varnish v1 -vcl { import ${vmod_std}; backend b { .host = "${v2_addr}"; .port = "${v2_port}"; } sub vcl_backend_response { std.collect(beresp.http.Connection); set beresp.http.foo = beresp.http.Connection; } } -start client c1 { txreq rxresp expect resp.http.foo == "close" } -run varnish-4.1.1/bin/varnishtest/tests/c00021.vtc0000644000201500234410000000456412652366721015736 00000000000000varnishtest "Test banning a url with cli:ban" server s1 { rxreq expect req.url == "/foo" txresp -hdr "foo: bar5" -body "1111\n" rxreq expect req.url == "/foo" txresp -hdr "foo: bar6" -body "11111\n" rxreq expect req.url == "/foo" txresp -hdr "foo: bar7" -body "111111\n" rxreq expect req.url == "/foo" txresp -hdr "foo: bar8" -body "1111111\n" } -start varnish v1 -vcl+backend { } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar5 expect resp.bodylen == 5 } -run # syntax checks varnish v1 -clierr 104 "ban" varnish v1 -clierr 104 "ban foo" varnish v1 -clierr 104 "ban foo bar" varnish v1 -clierr 106 "ban a b c && a" varnish v1 -clierr 106 "ban a b c && a b" varnish v1 -clierr 106 "ban a b c || a b c" varnish v1 -cliok "ban.list" # exact match, not matching varnish v1 -cliok "ban req.url == foo" varnish v1 -cliok "ban.list" client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar5 expect resp.bodylen == 5 } -run # exact match, matching varnish v1 -cliok "ban req.url == /foo" varnish v1 -cliok "ban.list" client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar6 expect resp.bodylen == 6 } -run # regexp nonmatch varnish v1 -cliok "ban req.url ~ bar" varnish v1 -cliok "ban.list" client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar6 expect resp.bodylen == 6 } -run # regexp match varnish v1 -cliok "ban req.url ~ foo" varnish v1 -cliok "ban.list" client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar7 expect resp.bodylen == 7 } -run # header check, nonmatch varnish v1 -cliok "ban obj.http.foo != bar7" varnish v1 -cliok "ban.list" client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar7 expect resp.bodylen == 7 } -run # header check, match varnish v1 -cliok "ban req.http.foo == barcheck" varnish v1 -cliok "ban.list" client c1 { txreq -url "/foo" -hdr "foo: barcheck" rxresp expect resp.status == 200 expect resp.http.foo == bar8 expect resp.bodylen == 8 } -run # header check, no header varnish v1 -cliok "ban req.url ~ foo && obj.http.bar == barcheck" varnish v1 -cliok "ban.list" client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.foo == bar8 expect resp.bodylen == 8 } -run varnish-4.1.1/bin/varnishtest/tests/r00612.vtc0000644000201500234410000000125412652366721015754 00000000000000varnishtest "Url workspace gets overwritten/reused" server s1 { rxreq expect req.url == "/" txresp -body { } rxreq expect req.url == "/1" txresp -body "11111" rxreq expect req.url == "/2" txresp -body "22222" rxreq expect req.url == "/3" txresp -body "33333" rxreq expect req.url == "/4" txresp -body "44444" rxreq expect req.url == "/5" txresp -body "55555" } -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/r00700.vtc0000644000201500234410000000031512652366721015747 00000000000000varnishtest "check TAB in 3 header field" server s1 { rxreq send "HTTP/1.1 666 foo\tbar\n\nFOO" } -start varnish v1 -vcl+backend {} -start client c1 { txreq rxresp expect resp.status == 666 } -run varnish-4.1.1/bin/varnishtest/tests/r01512.vtc0000644000201500234410000000160612652366721015755 00000000000000varnishtest "Regression test for #1512" # First test bereq changes across v_b_r and v_b_f server s1 { rxreq txresp -status 700 } -start varnish v1 -vcl+backend { sub vcl_backend_fetch { if (bereq.http.x-abandon == "1") { return (abandon); } } sub vcl_backend_response { if (beresp.status == 700) { set bereq.http.x-abandon = "1"; return (retry); } } sub vcl_synth { set resp.status = 701; } } -start client c1 { txreq rxresp expect resp.status == 701 } -run # Then across v_b_e and v_b_f varnish v1 -vcl { backend bad { .host = "${bad_ip}"; .port = "9080"; } sub vcl_backend_fetch { set bereq.backend = bad; if (bereq.http.x-abandon == "2") { return (abandon); } } sub vcl_backend_error { set bereq.http.x-abandon = "2"; return (retry); } sub vcl_synth { set resp.status = 702; } } client c1 { txreq rxresp expect resp.status == 702 } -run varnish-4.1.1/bin/varnishtest/tests/c00011.vtc0000644000201500234410000000104412652366721015723 00000000000000varnishtest "Test hit for pass (pass from fetch)" server s1 { rxreq expect req.url == "/foo" txresp -body foobar rxreq expect req.url == "/foo" txresp -body foobar1 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.uncacheable = true; } } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 6 expect resp.http.x-varnish == "1001" txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 7 expect resp.http.x-varnish == "1003" } client c1 -run varnish-4.1.1/bin/varnishtest/tests/c00008.vtc0000644000201500234410000000314712652366721015737 00000000000000varnishtest "Test Client IMS" server s1 { rxreq expect req.url == "/foo" txresp -hdr "Last-Modified: Thu, 26 Jun 2008 12:00:01 GMT" \ -hdr {ETag: "foo"} \ -body "11111\n" rxreq expect req.url == "/bar" txresp -hdr "Last-Modified: Thu, 26 Jun 2008 12:00:01 GMT" \ -hdr {ETag: "bar"} } -start varnish v1 -vcl+backend { } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.http.etag == {"foo"} expect resp.http.content-length == "6" expect resp.bodylen == 6 txreq -url "/foo" \ -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:00 GMT" rxresp expect resp.status == 200 expect resp.http.content-length == "6" expect resp.http.etag == {"foo"} expect resp.bodylen == 6 txreq -url "/foo" \ -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:01 GMT" rxresp -no_obj expect resp.status == 304 expect resp.http.etag == {"foo"} expect resp.http.content-length == "" expect resp.bodylen == "" txreq -url "/foo" \ -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:02 GMT" rxresp -no_obj expect resp.status == 304 expect resp.http.etag == {"foo"} expect resp.http.content-length == "" expect resp.bodylen == "" txreq -url "/bar" rxresp expect resp.status == 200 expect resp.http.etag == {"bar"} expect resp.http.content-length == "0" expect resp.bodylen == 0 txreq -url "/bar" \ -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:01 GMT" rxresp -no_obj expect resp.status == 304 expect resp.http.etag == {"bar"} expect resp.http.content-length == expect resp.bodylen == } client c1 -run client c1 -run varnish-4.1.1/bin/varnishtest/tests/v00037.vtc0000644000201500234410000000064412652366721015763 00000000000000varnishtest "test restart in miss" server s1 { rxreq txresp -body "FOOBAR" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.restarts > 0) { unset req.http.foobar; } } sub vcl_miss { if (req.http.foobar) { return (restart); } } sub vcl_deliver { set resp.http.restarts = req.restarts; } } -start client c1 { txreq -hdr "foobar: snafu" rxresp expect resp.http.restarts == 1 } -run varnish-4.1.1/bin/varnishtest/tests/g00000.vtc0000644000201500234410000000163012652366721015726 00000000000000varnishtest "test req.can_gzip VCL variable" server s1 { rxreq txresp -bodylen 4 } -start varnish v1 -vcl+backend { sub vcl_deliver { set resp.http.gzip = req.can_gzip; } } -start client c1 { txreq -hdr "Accept-Encoding: gzip, deflate" rxresp expect resp.http.gzip == "true" txreq -hdr "Accept-Encoding: gzip;q=0.7, *;q=0" rxresp expect resp.http.gzip == "true" txreq -hdr "Accept-Encoding: deflate;q=0.7, *;q=0" rxresp expect resp.http.gzip == "false" txreq -hdr "Accept-Encoding: x-gzip;q=0.4, gzip" rxresp expect resp.http.gzip == "true" txreq -hdr "Accept-Encoding: gzip;q=0, x-gzip" rxresp expect resp.http.gzip == "true" txreq -hdr "Accept-Encoding: gzip;q=0" rxresp expect resp.http.gzip == "false" txreq -hdr "Accept-Encoding: gzip;q=-1" rxresp expect resp.http.gzip == "false" txreq -hdr "Accept-Encoding: gzip;q=0.0000001" rxresp expect resp.http.gzip == "true" } -run varnish-4.1.1/bin/varnishtest/tests/r01144.vtc0000644000201500234410000000137612652366721015762 00000000000000varnishtest "very long backend names" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { backend fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210 { .host = "127.0.0.1"; .port = "54321"; } sub vcl_backend_fetch { if (bereq.url == "never") { set bereq.backend = fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210; } } } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish v1 -errvcl {Expected ID got '0'} { backend 0fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210 { .host = "127.0.0.1"; .port = "54321"; } sub vcl_backend_fetch { if (bereq.url == "never") { set bereq.backend = fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210; } } } varnish-4.1.1/bin/varnishtest/tests/r01333.vtc0000644000201500234410000000132212652366721015751 00000000000000varnishtest "ESI:include with https" server s1 { rxreq expect req.url == "/" txresp -body { Before include After include } rxreq expect req.url == "/foo" txresp -body { Before include After include } rxreq expect req.url == "/body" expect req.http.host == "bozz" txresp -body BAR } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.bodylen == 49 } -run varnish v1 -cliok "param.set feature +esi_ignore_https" client c1 { txreq -url /foo rxresp expect resp.bodylen == 52 } -run varnish-4.1.1/bin/varnishtest/tests/v00046.vtc0000644000201500234410000000333512652366721015763 00000000000000varnishtest "Test relative to vcl_dir, dot-include and absolute includes" # relative plain shell "true > ${tmpdir}/_start.vcl" varnish v1 -arg "-p vcl_dir=${tmpdir}" -vcl { backend b { .host = "127.0.0.1"; } include "_start.vcl" ; } # absolute include varnish v1 -vcl { backend b { .host = "127.0.0.1"; } include "${tmpdir}/_start.vcl" ; } # absolute -> relative include shell "mkdir -p ${tmpdir}/1/2/3" shell "true > ${tmpdir}/1/2/b.vcl" shell "echo 'include \"./2/b.vcl\";' > ${tmpdir}/1/a.vcl" varnish v1 -vcl { backend b { .host = "127.0.0.1"; } include "${tmpdir}/1/a.vcl" ; } # same but relative to vcl_dir shell "echo 'include \"1/2/b.vcl\";' > ${tmpdir}/1/ab.vcl" varnish v1 -vcl { backend b { .host = "127.0.0.1"; } include "1/ab.vcl" ; } # dot-relative -> relative varnish v1 -vcl { backend b { .host = "127.0.0.1"; } include "1/a.vcl" ; } # relative -> relative -> relative shell "echo 'include \"./3/c.vcl\";' > ${tmpdir}/1/2/b.vcl" shell "true > ${tmpdir}/1/2/3/c.vcl" varnish v1 -vcl { backend b { .host = "127.0.0.1"; } include "1/a.vcl" ; } # relative -> absolute shell "echo 'include \"${tmpdir}/1/2/3/c.vcl\";' > ${tmpdir}/1/aa.vcl" varnish v1 -vcl { backend b { .host = "127.0.0.1"; } include "1/aa.vcl" ; } # relative -> absolute -> relative shell "echo 'include \"${tmpdir}/1/2/b.vcl\";' > ${tmpdir}/1/aaa.vcl" varnish v1 -vcl { backend b { .host = "127.0.0.1"; } include "1/aaa.vcl" ; } # includes and parses out shell "echo 'zool' > ${tmpdir}/1/2/3/c.vcl" varnish v1 -errvcl {Found: 'zool' at} { backend b { .host = "127.0.0.1"; } include "1/a.vcl"; } shell "rm -f ${tmpdir}/a" shell "rm -f ${tmpdir}/_start.vcl" varnish v1 -errvcl {needs absolute filename of including file.} { include "./foobar"; } varnish-4.1.1/bin/varnishtest/tests/c00061.vtc0000644000201500234410000000064012652366721015731 00000000000000varnishtest "retry in vcl_backend_error" varnish v1 -vcl { backend b1 { .host = "${bad_ip}"; .port = "9080"; } sub vcl_backend_error { return (retry); } sub vcl_synth { set resp.status = 504; } } -start varnish v1 -cliok "param.set debug +syncvsl" varnish v1 -cliok "param.set connect_timeout 1" varnish v1 -cliok "param.set max_retries 2" client c1 { txreq rxresp expect resp.status == 504 } -run varnish-4.1.1/bin/varnishtest/tests/r01401.vtc0000644000201500234410000000157112652366721015753 00000000000000varnishtest "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 varnish-4.1.1/bin/varnishtest/tests/c00041.vtc0000644000201500234410000000427212652366721015734 00000000000000varnishtest "test purging from vcl" server s1 { rxreq expect req.url == "/1" expect req.http.foo == "foo1" txresp -hdr "Vary: foo" -bodylen 1 rxreq expect req.url == "/1" expect req.http.foo == "foo2" txresp -hdr "Vary: foo" -bodylen 2 rxreq expect req.url == "/1" expect req.http.foo == "foo2" txresp -hdr "Vary: foo" -bodylen 12 rxreq expect req.url == "/1" expect req.http.foo == "foo1" txresp -hdr "Vary: foo" -bodylen 11 rxreq expect req.url == "/1" expect req.http.foo == "foo3" txresp -hdr "Vary: foo" -bodylen 23 rxreq expect req.url == "/1" expect req.http.foo == "foo1" txresp -hdr "Vary: foo" -bodylen 21 rxreq expect req.url == "/1" expect req.http.foo == "foo2" txresp -hdr "Vary: foo" -bodylen 22 } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.http.purge == "yes") { return(purge); } } sub vcl_purge { if (req.http.restart == "yes") { unset req.http.purge; unset req.http.restart; return(restart); } } } -start client c1 { txreq -url "/1" -hdr "foo: foo1" rxresp expect resp.status == 200 expect resp.http.x-varnish == 1001 expect resp.bodylen == 1 delay .1 txreq -url "/1" -hdr "Foo: foo2" rxresp expect resp.status == 200 expect resp.http.x-varnish == 1003 expect resp.bodylen == 2 delay .1 txreq -url "/1" -hdr "foo: foo1" rxresp expect resp.status == 200 expect resp.http.x-varnish == "1005 1002" expect resp.bodylen == 1 delay .1 txreq -url "/1" -hdr "Foo: foo2" rxresp expect resp.status == 200 expect resp.http.x-varnish == "1006 1004" expect resp.bodylen == 2 delay .1 # Purge on hit txreq -url "/1" -hdr "Foo: foo2" -hdr "purge: yes" -hdr "restart: yes" rxresp expect resp.status == 200 expect resp.bodylen == 12 delay .1 txreq -url "/1" -hdr "foo: foo1" rxresp expect resp.status == 200 expect resp.bodylen == 11 delay .1 # Purge on miss txreq -url "/1" -hdr "Foo: foo3" -hdr "purge: yes" -hdr "restart: yes" rxresp expect resp.status == 200 expect resp.bodylen == 23 delay .1 txreq -url "/1" -hdr "foo: foo1" rxresp expect resp.status == 200 expect resp.bodylen == 21 delay .1 txreq -url "/1" -hdr "Foo: foo2" rxresp expect resp.status == 200 expect resp.bodylen == 22 delay .1 } -run varnish-4.1.1/bin/varnishtest/tests/c00054.vtc0000644000201500234410000000150612652366721015735 00000000000000varnishtest "bitmap params masking" server s1 { rxreq txresp } -start varnish v1 -vcl+backend {} -start varnish v1 -cliok "param.show vsl_mask" varnish v1 -cliok "param.set vsl_mask +VCL_trace" varnish v1 -cliok "param.show vsl_mask" varnish v1 -cliok "param.set vsl_mask -WorkThread,-TTL" varnish v1 -cliok "param.show vsl_mask" varnish v1 -cliok "param.set vsl_mask +WorkThread,+TTL,+Hash" varnish v1 -cliok "param.show vsl_mask" varnish v1 -clierr 106 "param.set vsl_mask FooBar" varnish v1 -clierr 106 "param.set vsl_mask -FooBar" varnish v1 -clierr 106 {param.set vsl_mask \"} varnish v1 -cliok "param.set debug +workspace" varnish v1 -cliok "param.show debug" varnish v1 -cliok "param.show feature" varnish v1 -cliok "param.set feature +short_panic" varnish v1 -cliok "param.show feature" client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/e00023.vtc0000644000201500234410000000240112652366721015726 00000000000000varnishtest "Include gzip'ed and ungzip'ed (ESI) objects in a gzip'ed ESI object" server s1 { rxreq expect req.http.accept-encoding == gzip txresp -gzipbody { 1 Before includes 2 3 Between includes 4 5 Between includes 6 7 Between includes 8 9 After includes 10 } rxreq expect req.url == "/foo" txresp -body {

/////

} rxreq expect req.url == "/bar" txresp -body {*****} rxreq expect req.http.accept-encoding == gzip expect req.url == "/fooz" txresp -gzipbody {

-----

} rxreq expect req.http.accept-encoding == gzip expect req.url == "/barz" txresp -gzipbody {#####} } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start varnish v1 -cliok "param.set http_gzip_support true" varnish v1 -cliok "param.set debug +esi_chop" varnish v1 -cliok "param.set feature +esi_disable_xml_check" varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == gzip gunzip expect resp.status == 200 expect resp.bodylen == 192 } client c1 -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/r01493.vtc0000644000201500234410000000050012652366721015755 00000000000000varnishtest "restart in vcl_purge" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.method == "PURGE") { return (purge); } } sub vcl_purge { set req.method = "GET"; return (restart); } } -start client c1 { txreq -req PURGE rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/b00018.vtc0000644000201500234410000000110512652366721015727 00000000000000varnishtest "Check that synth response in vcl_backend_response works" server s1 { rxreq txresp -body "012345\n" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.Foo = "bar"; set beresp.status = 523; set beresp.reason = "not ok"; set beresp.uncacheable = true; set beresp.ttl = 0s; return (deliver); } } -start varnish v1 -cliok "param.set default_grace 0" varnish v1 -cliok "param.set default_keep 0" client c1 { txreq -url "/" rxresp expect resp.status == 523 } -run delay 4 varnish v1 -expect n_object == 0 varnish-4.1.1/bin/varnishtest/tests/r00702.vtc0000644000201500234410000000052712652366721015756 00000000000000varnishtest "Range bug" server s1 { rxreq txresp -bodylen 100 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; } } -start varnish v1 -cliok "param.set http_range_support on" client c1 { txreq -hdr "Range: bytes=50-200" rxresp expect resp.status == 206 expect resp.bodylen == 50 } -run varnish-4.1.1/bin/varnishtest/tests/c00056.vtc0000644000201500234410000000141412652366721015735 00000000000000varnishtest "vcl_backend_response{} retry" server s1 { rxreq txresp -hdr "foo: 1" accept rxreq txresp -hdr "foo: 2" } -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_response { set beresp.http.bar = bereq.retries; if (beresp.http.foo != bereq.http.stop) { return (retry); } } } -start varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq -hdr "stop: 2" rxresp expect resp.http.foo == 2 } -run delay .1 server s1 { rxreq txresp -hdr "foo: 1" accept rxreq txresp -hdr "foo: 2" accept rxreq txresp -hdr "foo: 3" } -start varnish v1 -cliok "param.set max_retries 2" client c1 { txreq -hdr "stop: 3" rxresp expect resp.http.foo == 3 } -run # XXX: Add a test which exceeds max_retries and gets 503 back varnish-4.1.1/bin/varnishtest/tests/r00549.vtc0000644000201500234410000000031712652366721015764 00000000000000varnishtest "Regression test for bad backend reply with ctrl char." server s1 { rxreq send "HTTP/1.1 200 OK\013\r\n\r\nTest" } -start varnish v1 -vcl+backend {} -start client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/r01120.vtc0000644000201500234410000000352612652366721015753 00000000000000varnishtest "insanely long vary string" server s1 { rxreq txresp -hdr "Vary: Foo" -body "xxxx" rxreq txresp -hdr "Vary: Foo" -body "yyyyy" } -start varnish v1 \ -cliok "param.set workspace_client 10k" \ -cliok "param.set workspace_backend 200k" \ -vcl+backend { } -start client c1 { txreq -hdr "Foo: blabla" rxresp expect resp.bodylen == 4 #txreq -hdr "Foo: blablaA" txreq -hdr "Foo: blablaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" rxresp expect resp.bodylen == 5 } -run varnish-4.1.1/bin/varnishtest/tests/e00020.vtc0000644000201500234410000000104612652366721015727 00000000000000varnishtest "ESI:remove" server s1 { rxreq txresp -gzipbody { This is a test: Unseen University This is a test: Hello world } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; set beresp.do_gunzip = true; } } -start varnish v1 -cliok "param.set http_gzip_support true" client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 40 } client c1 -run varnish v1 -expect esi_errors == 2 varnish-4.1.1/bin/varnishtest/tests/r01468.vtc0000644000201500234410000000153012652366721015763 00000000000000varnishtest "#1468 - freeing failed obj" server s1 { rxreq expect req.url == "/1" txresp -nolen -hdr "Transfer-Encoding: chunked" chunked {} sema r1 sync 2 close accept rxreq expect req.url == "/2" txresp -nolen -hdr "Transfer-Encoding: chunked" chunked {} sema r1 sync 2 } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.url == "/2") { return (pass); } } sub vcl_backend_response { set beresp.ttl = 5m; } } -start # Test the regular cached content case client c1 { txreq -url "/1" rxresphdrs expect resp.status == 200 rxchunk sema r1 sync 2 expect_close } -run # Test the pass from vcl_recv case client c1 { txreq -url "/2" rxresphdrs expect resp.status == 200 rxchunk sema r1 sync 2 expect_close } -run # Delay to allow expiry thread to do it's job delay 1 varnish v1 -expect n_object == 0 varnish-4.1.1/bin/varnishtest/tests/r01602.vtc0000644000201500234410000000120712652366721015752 00000000000000varnishtest "Test case for #1602" server s1 { rxreq expect req.url == "/bar" txresp -gzipbody {} rxreq expect req.url == "/foo" txresp -hdr "Content-Encoding: gzip" rxreq expect req.url == "/baz" txresp -gzipbody {} rxreq expect req.url == "/quux" txresp -status 204 -hdr "Content-Encoding: gzip" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq -url /bar -hdr "Accept-Encoding: gzip" rxresp expect resp.status == 200 txreq -url /baz -hdr "Accept-Encoding: gzip" rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/m00000.vtc0000644000201500234410000000212612652366721015735 00000000000000varnishtest "Test std & debug vmod" server s1 { rxreq expect req.http.encrypted == "ROT52" txresp -hdr "foo: bAr" -hdr "bar: fOo" -bodylen 4 } -start varnish v1 -vcl+backend { import ${vmod_std}; import ${vmod_debug}; sub vcl_recv { debug.rot52(req); } sub vcl_deliver { set resp.http.foo = std.toupper(resp.http.foo); set resp.http.bar = std.tolower(resp.http.bar); set resp.http.who = debug.author(phk); debug.test_priv_call(); debug.test_priv_vcl(); std.log("VCL initiated log"); std.syslog(8 + 7, "Somebody runs varnishtest"); debug.rot52(resp); } } -start client c1 { txreq -url "/bar" rxresp expect resp.status == 200 expect resp.bodylen == "4" expect resp.http.foo == "BAR" expect resp.http.bar == "foo" expect resp.http.encrypted == "ROT52" } -run varnish v1 -errvcl {Wrong enum value. Expected one of:} { import ${vmod_debug}; sub vcl_deliver { set resp.http.who = debug.author(jfk); } } varnish v1 -errvcl {Wrong argument type. Expected REAL. Got STRING.} { import ${vmod_std}; sub vcl_deliver { set resp.http.who = std.random("foo", "bar"); } } varnish-4.1.1/bin/varnishtest/tests/v00041.vtc0000644000201500234410000000162012652366721015751 00000000000000varnishtest "Test priv_task" server s1 { rxreq txresp rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_debug}; import ${vmod_std}; sub vcl_recv { set req.http.x0 = debug.test_priv_task(req.url); } sub vcl_deliver { set resp.http.x0 = req.http.x0; set resp.http.x1 = debug.test_priv_task(""); } sub vcl_backend_fetch { std.log("foo"); set bereq.http.bx0 = debug.test_priv_task(bereq.url); std.log("bar"); } sub vcl_backend_response { set beresp.http.bx0 = bereq.http.bx0; set beresp.http.bx1 = debug.test_priv_task(""); } } -start client c1 { txreq -url /foobar rxresp expect resp.http.x0 == /foobar expect resp.http.x1 == /foobar expect resp.http.bx0 == /foobar expect resp.http.bx1 == /foobar txreq -url /snafu rxresp expect resp.http.x0 == /snafu expect resp.http.x1 == /snafu expect resp.http.bx0 == /snafu expect resp.http.bx1 == /snafu } -run varnish-4.1.1/bin/varnishtest/tests/b00043.vtc0000644000201500234410000000161712652366721015735 00000000000000varnishtest "Test stale-while-revalidate" server s1 { rxreq txresp -hdr "Cache-Control: max-age=30, stale-while-revalidate=30" rxreq txresp -hdr "Cache-Control: max-age=0, stale-while-revalidate=30" rxreq txresp -hdr "Cache-Control: max-age=30, stale-while-revalidate=30" -hdr "Age: 40" rxreq txresp -status 500 -hdr "Cache-Control: max-age=30, stale-while-revalidate=30" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.grace = beresp.grace; set beresp.http.ttl = beresp.ttl; } } -start client c1 { txreq -url /1 rxresp expect resp.http.grace == 30.000 expect resp.http.ttl == 30.000 txreq -url /2 rxresp expect resp.http.grace == 30.000 expect resp.http.ttl == 0.000 txreq -url /3 rxresp expect resp.http.grace == 30.000 expect resp.http.ttl == -10.000 txreq -url /4 rxresp expect resp.http.grace == 10.000 expect resp.http.ttl == 0.000 } -run varnish-4.1.1/bin/varnishtest/tests/a00006.vtc0000644000201500234410000000071212652366721015726 00000000000000varnishtest "bidirectional message bodies" server s1 { rxreq expect req.method == PUT expect req.proto == HTTP/1.0 expect req.url == "/foo" txresp -proto HTTP/1.2 -status 201 -msg Foo \ -body "987654321\n" } server s1 -start client c1 -connect ${s1_sock} { txreq -req PUT -proto HTTP/1.0 -url /foo \ -body "123456789\n" rxresp expect resp.proto == HTTP/1.2 expect resp.status == 201 expect resp.msg == Foo } client c1 -run server s1 -wait varnish-4.1.1/bin/varnishtest/tests/r00961.vtc0000644000201500234410000000137112652366721015763 00000000000000varnishtest "Test XML 1.0 entity references" server s1 { rxreq expect req.url == "/" txresp -body { } rxreq expect req.url == "/t&t" txresp -body "1" rxreq expect req.url == "/tt" txresp -body "333" rxreq expect req.url == {/t't} txresp -body "4444" rxreq expect req.url == {/t"t} txresp -body "55555" } -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 32 } -run varnish-4.1.1/bin/varnishtest/tests/r01275.vtc0000644000201500234410000000036112652366721015760 00000000000000varnishtest "#1275 - panic with malformed Vary header" server s1 { rxreq txresp -hdr "Vary: foo bar" } -start varnish v1 -vcl+backend { } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01562.vtc0000644000201500234410000000147612652366721015767 00000000000000varnishtest "retrying a short client body read should not panic varnish" server s1 { non-fatal rxreq txresp -status 200 -hdr "Foo: BAR" -body "1234" } -start server s2 { non-fatal rxreq txresp -status 200 -hdr "Foo: Foo" -body "56" } -start varnish v1 -cliok "param.set vcc_allow_inline_c true" -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_fetch { if (bereq.retries >= 1) { set bereq.backend = s2; } else { set bereq.backend = s1; } } sub vcl_backend_error { return (retry); } } -start varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq -req "POST" -nolen -hdr "Content-Length: 10000" -bodylen 9999 } -run delay .4 server s1 { rxreq txresp -status 200 -bodylen 11 } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 11 } -run varnish-4.1.1/bin/varnishtest/tests/b00020.vtc0000644000201500234410000000145712652366721015732 00000000000000varnishtest "Check that between_bytes_timeout behaves from parameters" feature SO_RCVTIMEO_WORKS server s1 { rxreq send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 1.5 # send "Baba\n" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; } } -start varnish v1 -cliok "param.set between_bytes_timeout 1" client c1 { txreq rxresp expect resp.status == 503 } -run delay 1 varnish v1 -expect n_object == 0 varnish v1 -expect n_objectcore == 0 server s1 -wait { non-fatal rxreq send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 0.5 send "Baba\n" delay 0.5 send "Baba\n" } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 10 } -run varnish v1 -expect n_object == 1 varnish v1 -expect n_objectcore == 1 varnish-4.1.1/bin/varnishtest/tests/r00292.vtc0000644000201500234410000000127612652366721015764 00000000000000varnishtest "Header deletion test" # This test checks that the ->hdf flag which tracks Connection: header # deletes tracks the headers properly. server s1 { rxreq expect req.url == "/foo" expect req.http.hdr1 == expect req.http.hdr2 == "2" expect req.http.hdr3 == expect req.http.hdr4 == "4" expect req.http.hdr5 == expect req.http.hdr6 == "6" txresp -body "foobar" } -start varnish v1 -vcl+backend { sub vcl_recv { unset req.http.hdr1; unset req.http.hdr5; } } -start client c1 { txreq -url "/foo" \ -hdr "Connection: hdr3" \ -hdr "hdr1: 1" \ -hdr "hdr2: 2" \ -hdr "hdr3: 3" \ -hdr "hdr4: 4" \ -hdr "hdr5: 5" \ -hdr "hdr6: 6" rxresp } -run varnish-4.1.1/bin/varnishtest/tests/e00007.vtc0000644000201500234410000000265312652366721015741 00000000000000varnishtest "ESI spanning storage bits" # NB! The layout of the body in the response is very carefully # NB! tuned to give the desired code coverage. # NB! It should look like this in the varnishlog: # NB! 7 Debug c "Fetch 32 byte segments:" # NB! 7 Debug c "%0a%09%09filler%0a%09%09This is before" # NB! 7 Debug c " the test%0a%09%09%0a%09%09filler%0a%09%09This is a test: Unseen Un" # NB! 7 Debug c "iversity%0a%09%09Department of cruel a" # NB! 7 Debug c "nd unjust geography%0a%09%09%0a%09%09This is a test: Hello worl" # NB! 7 Debug c "d%0a%09" server s1 { rxreq expect req.url == "/foo/bar" send "HTTP/1.0 200 OK\n" send "Connection: close\n" send "\n" send { filler This is before the test filler This is a test: Unseen University Department of cruel and unjust geography This is a test: Hello world } } -start varnish v1 -arg "-smalloc,2m" -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start varnish v1 -cliok "debug.fragfetch 32" client c1 { txreq -url /foo/bar -hdr "Host: froboz" rxresp expect resp.status == 200 expect resp.bodylen == 120 } client c1 -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/b00046.vtc0000644000201500234410000000067012652366721015736 00000000000000varnishtest "Check that TCP OOB urgent data doesn't cause ill effects" server s1 { rxreq send_urgent " " txresp send_urgent " " rxreq send_urgent " " txresp send_urgent " " } -start varnish v1 -vcl+backend {} -start client c1 { delay 0.5 send_urgent " " expect_close } -run client c1 { send_urgent " " txreq -url /1 send_urgent " " rxresp send_urgent " " txreq -url /2 send_urgent " " rxresp send_urgent " " } -run varnish-4.1.1/bin/varnishtest/tests/r01335.vtc0000644000201500234410000000050412652366721015754 00000000000000varnishtest "#1335 fetch without busy object" server s1 { rxreq txresp -bodylen 5 rxreq txresp -bodylen 6 } -start varnish v1 -vcl+backend { sub vcl_hit { if (req.http.two == "2") { return (fetch); // also #1603 } } } -start client c1 { txreq rxresp } -run client c1 { txreq -hdr "two: 2" rxresp } -run varnish-4.1.1/bin/varnishtest/tests/p00009.vtc0000644000201500234410000000220712652366721015751 00000000000000varnishtest "Check that reloaded bans with completed flag are really completed on restart" shell "rm -f ${tmpdir}/_.per[12]" server s1 { rxreq txresp -hdr "x-foo: foo" accept rxreq txresp -hdr "x-foo: bar" } -start varnish v1 \ -arg "-pfeature=+wait_silo" \ -arg "-pban_lurker_sleep=0" \ -arg "-sper1=deprecated_persistent,${tmpdir}/_.per1,10m" \ -arg "-sper2=deprecated_persistent,${tmpdir}/_.per2,10m" \ -vcl+backend { } varnish v1 -start client c1 { txreq rxresp expect resp.http.x-foo == "foo" } -run varnish v1 -cliok "ban req.url == /test" varnish v1 -cliok "ban req.url == /test" varnish v1 -cliok "ban.list" # Expect ban_magic plus the 2 we added varnish v1 -expect bans == 3 # Expect 1 of the 2 added to be marked dup varnish v1 -expect bans_dups == 1 # Expect ban_magic plus our 1 dup to be marked completed varnish v1 -expect bans_completed == 2 # Restart varnish v1 -stop varnish v1 -start varnish v1 -cliok "ban.list" # Check that our object is still there client c1 { txreq rxresp expect resp.http.x-foo == "foo" } -run # Expect our duplicate varnish v1 -expect bans_dups == 1 varnish v1 -expect bans_completed == 1 varnish-4.1.1/bin/varnishtest/tests/r00832.vtc0000644000201500234410000000015212652366721015754 00000000000000varnishtest "Regression #832 IPV6 parse bug" varnish v1 -vcl { backend default { .host = "[::]"; } } varnish-4.1.1/bin/varnishtest/tests/c00036.vtc0000644000201500234410000000062312652366721015734 00000000000000varnishtest "Backend close retry" server s1 -repeat 1 { rxreq txresp -bodylen 5 rxreq accept rxreq txresp -bodylen 6 } -start varnish v1 -vcl+backend { sub vcl_recv { return(pass); } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 5 txreq rxresp expect resp.status == 200 expect resp.bodylen == 6 } -run varnish v1 -expect backend_retry == 1 varnish-4.1.1/bin/varnishtest/tests/c00063.vtc0000644000201500234410000000104412652366721015732 00000000000000varnishtest "cache backend synth object" varnish v1 -vcl { backend b { .host = "${bad_ip}"; .port = "9080"; } sub vcl_backend_error { set beresp.ttl = 1s; set beresp.grace = 3s; set beresp.http.foobar = "BLA" + bereq.xid; synthetic(beresp.http.foobar); return (deliver); } } -start varnish v1 -cliok "param.set connect_timeout 1.0" client c1 { txreq rxresp expect resp.http.foobar == "BLA1002" delay 2 txreq rxresp expect resp.http.foobar == "BLA1002" delay 3 txreq rxresp expect resp.http.foobar == "BLA1004" } -run varnish-4.1.1/bin/varnishtest/tests/r01169.vtc0000644000201500234410000000023712652366721015764 00000000000000varnishtest "cli_limit truncating full parameter listing - #1169" server s1 { rxreq } -start varnish v1 -vcl+backend { } varnish v1 -cliok "param.show -l" varnish-4.1.1/bin/varnishtest/tests/r01781.vtc0000644000201500234410000000073712652366721015771 00000000000000varnishtest "#1781 gzip checksum with multilevel esi" server s1 { rxreq txresp -body {Baz} rxreq txresp -body {Bar} rxreq txresp -body {Foo} } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_gzip = true; set beresp.do_esi = true; } } -start client c1 { txreq -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == "gzip" gunzip expect resp.body == "FooBarBaz" } -run varnish-4.1.1/bin/varnishtest/tests/c00058.vtc0000644000201500234410000000125612652366721015743 00000000000000varnishtest "Test v4 grace" server s1 { rxreq txresp -hdr "Last-Modified: Mon, 09 Feb 2015 09:32:47 GMT" -bodylen 3 rxreq txresp -bodylen 6 sema r2 sync 2 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.ttl = 0.5s; set beresp.grace = 10s; } } -start client c1 { txreq rxresp expect resp.bodylen == 3 delay 1 } -run varnish v1 -expect n_object == 1 client c1 { # We still get old object txreq rxresp expect resp.bodylen == 3 # But bg fetch was kicked off sema r2 sync 2 delay .2 # And now we get the new object txreq rxresp expect resp.bodylen == 6 } -run # and the old one has got superseded varnish v1 -expect n_object == 1 varnish-4.1.1/bin/varnishtest/tests/b00037.vtc0000644000201500234410000000061212652366721015732 00000000000000varnishtest "Error on multiple Host headers" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { } -start client c1 { txreq -hdr "Host: foo" -hdr "Host: bar" rxresp expect resp.status == 400 } -run varnish v1 -expect client_req_400 == 1 client c1 { txreq -hdr "Content-Length: 12" -bodylen 12 rxresp expect resp.status == 400 } -run varnish v1 -expect client_req_400 == 2 varnish-4.1.1/bin/varnishtest/tests/l00005.vtc0000644000201500234410000000272412652366721015745 00000000000000varnishtest "Test backend fetch byte counters" server s1 { rxreq expect req.url == "/1" txresp -bodylen 1000 rxreq expect req.url == "/2" send "HTTP/1.1\r\n\r\n" } -start varnish v1 -vcl+backend { sub vcl_backend_fetch { unset bereq.http.x-forwarded-for; unset bereq.http.x-varnish; set bereq.http.Host = "foo.bar"; } sub vcl_backend_response { set beresp.do_stream = false; } } -start # Request (1002): # POST /1 HTTP/1.1\r\n 18 bytes # Content-Length: 4\r\n 19 bytes # Host: foo.bar\r\n 15 bytes # \r\n 2 bytes # Total: 54 bytes # Response: # HTTP/1.1 200 OK\r\n 17 bytes # Content-Length: 1000\r\n 22 bytes # \r\n 2 bytes # Total: 41 bytes # Request (1004): # POST /2 HTTP/1.1\r\n 18 bytes # Content-Length: 4\r\n 19 bytes # Host: foo.bar\r\n 15 bytes # \r\n 2 bytes # Total: 54 bytes # Reponse: # HTTP/1.1\r\n 10 bytes # \r\n 2 bytes # Total: 12 bytes logexpect l1 -v v1 -g session { expect * 1001 Begin "^req .* rxreq" expect * = End expect 0 1003 Begin "^req .* rxreq" expect * = End expect 0 1002 Begin "^bereq " expect * = BereqAcct "^54 4 58 41 1000 1041$" expect 0 = End expect 0 1004 Begin "^bereq" expect * = BereqAcct "^54 4 58 12 0 12$" expect * = End } -start # Request 1001 client c1 { txreq -req "POST" -url "/1" -body "asdf" rxresp expect resp.status == 200 txreq -req "POST" -url "/2" -body "asdf" rxresp expect resp.status == 503 } -run logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/b00028.vtc0000644000201500234410000000102412652366721015730 00000000000000varnishtest "regexp match and no-match" server s1 { rxreq txresp -hdr "Foo: bar" -hdr "Bar: foo" -body "1111\n" } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (beresp.http.foo ~ "bar") { set beresp.http.foo1 = "1"; } else { set beresp.status = 999; } if (beresp.http.bar !~ "bar") { set beresp.http.bar1 = "2"; } else { set beresp.status = 999; } } } -start client c1 { txreq rxresp expect resp.status == "200" expect resp.http.foo1 == "1" expect resp.http.bar1 == "2" } -run varnish-4.1.1/bin/varnishtest/tests/r01577.vtc0000644000201500234410000000140612652366721015766 00000000000000varnishtest "#1577: reqbody and synth from recv" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.url == "/1") { return (synth(200, "OK")); } } sub vcl_synth { set resp.http.x-url = req.url; } sub vcl_deliver { set resp.http.x-url = req.url; } } -start client c1 { # Send a body that happens to be a valid HTTP request # This one is answered by synth() txreq -url "/1" -body "GET /foo HTTP/1.1\r\n\r\n" rxresp expect resp.status == 200 expect resp.http.x-url == "/1" # Make sure that a second request on the same connection goes through # and that the body of the previous one isn't interpreted as the # next request txreq -url "/2" rxresp expect resp.status == 200 expect resp.http.x-url == "/2" } -run varnish-4.1.1/bin/varnishtest/tests/r01627.vtc0000644000201500234410000000057012652366721015763 00000000000000varnishtest "#1627, wrong CL for gzipped+streamed content with HTTP/1.0 client" server s1 { rxreq txresp -body "Testing" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = true; set beresp.do_gzip = true; } } -start client c1 { txreq -proto "HTTP/1.0" -hdr "Accept-Encoding: gzip" rxresp gunzip expect resp.bodylen == 7 } -run varnish-4.1.1/bin/varnishtest/tests/m00019.vtc0000644000201500234410000000247512652366721015756 00000000000000varnishtest "Test var args" server s1 { rxreq txresp -bodylen 6 } -start varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_deliver { set resp.http.foo1 = debug.argtest("1", 2.0, "3"); set resp.http.foo2 = debug.argtest("1", two=2.0, three="3"); set resp.http.foo3 = debug.argtest("1", three="3", two=2.0); set resp.http.foo4 = debug.argtest("1", 2.0, three="3"); set resp.http.foo5 = debug.argtest("1", 2.0); set resp.http.foo6 = debug.argtest("1"); } } -start client c1 { txreq rxresp expect resp.bodylen == "6" expect resp.http.foo1 == "1 2 3 ," expect resp.http.foo2 == "1 2 3 ," expect resp.http.foo3 == "1 2 3 ," expect resp.http.foo4 == "1 2 3 ," expect resp.http.foo5 == "1 2 3 ," expect resp.http.foo6 == "1 2 3 ," } -run delay .1 varnish v1 -errvcl {Argument 'one' already used} { import ${vmod_debug}; backend b1 {.host = "127.0.0.1";} sub vcl_deliver { set resp.http.foo5 = debug.argtest("1", one="1"); } } varnish v1 -errvcl {Argument 'one' missing} { import ${vmod_debug}; backend b1 {.host = "127.0.0.1";} sub vcl_deliver { set resp.http.foo5 = debug.argtest(two=2.0, three="3"); } } varnish v1 -errvcl {Unknown argument 'four'} { import ${vmod_debug}; backend b1 {.host = "127.0.0.1";} sub vcl_deliver { set resp.http.foo5 = debug.argtest("1", two=2.0, four="3"); } } varnish-4.1.1/bin/varnishtest/tests/a00005.vtc0000644000201500234410000000130312652366721015722 00000000000000varnishtest "dual shared client HTTP transactions" server s1 { rxreq expect req.method == PUT expect req.proto == HTTP/1.0 expect req.url == "/foo" txresp -proto HTTP/1.2 -status 201 -msg Foo } server s2 { rxreq expect req.method == GET expect req.proto == HTTP/1.1 expect req.url == "/" txresp } server s1 -start server s2 -start client c1 -connect ${s1_sock} { txreq -req PUT -proto HTTP/1.0 -url /foo rxresp expect resp.proto == HTTP/1.2 expect resp.status == 201 expect resp.msg == Foo } client c1 -run client c1 -connect ${s2_sock} { txreq rxresp expect resp.proto == HTTP/1.1 expect resp.status == 200 expect resp.msg == OK } client c1 -run server s1 -wait server s2 -wait varnish-4.1.1/bin/varnishtest/tests/m00017.vtc0000644000201500234410000000206312652366721015745 00000000000000varnishtest "Test std.rollback" server s1 { rxreq expect req.url == "/foo" expect req.http.foobar == "bar" txresp -status 400 accept rxreq expect req.url == "/bar" expect req.http.foobar == "foo" txresp accept rxreq expect req.url == "/baz" expect req.http.foobar == "qux" txresp -status 400 accept rxreq expect req.url == "/qux" expect req.http.foobar == "baz" txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_recv { if (req.url == "/foo") { set req.http.foobar = "bar"; } } sub vcl_deliver { if (resp.status == 400) { std.rollback(req); set req.url = "/bar"; return (restart); } } } -start client c1 { txreq -url "/foo" -hdr "foobar: foo" rxresp } -run varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_backend_fetch { if (bereq.url == "/baz") { set bereq.http.foobar = "qux"; } } sub vcl_backend_response { if (beresp.status == 400) { std.rollback(bereq); set bereq.url = "/qux"; return (retry); } } } client c1 { txreq -url "/baz" -hdr "foobar: baz" rxresp } -run varnish-4.1.1/bin/varnishtest/tests/c00059.vtc0000644000201500234410000000057312652366721015745 00000000000000varnishtest "test ban obj.status" server s1 { rxreq txresp -bodylen 5 rxreq txresp -bodylen 3 } -start varnish v1 -vcl+backend {} -start client c1 { txreq rxresp expect resp.bodylen == 5 } -run varnish v1 -cliok "ban obj.status == 201" varnish v1 -cliok "ban obj.status == 200" varnish v1 -cliok "ban.list" client c1 { txreq rxresp expect resp.bodylen == 3 } -run varnish-4.1.1/bin/varnishtest/tests/r00445.vtc0000644000201500234410000000056112652366721015760 00000000000000varnishtest "zero length ESI include segmens with chunked encoding" server s1 { rxreq expect req.url == "/" txresp -body {} rxreq expect req.url == "/bar" txresp } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.bodylen == 10 } -run varnish-4.1.1/bin/varnishtest/tests/r01783.vtc0000644000201500234410000000053012652366721015762 00000000000000varnishtest "POST with no body" server s1 { rxreq txresp -hdr "foo: 1" rxreq txresp -nolen -hdr "foo: 2" -hdr "Transfer-Encoding: chunked" chunkedlen 0 } -start varnish v1 -vcl+backend {} -start client c1 { txreq -req "POST" -nolen rxresp expect resp.http.foo == 1 txreq -req "POST" -nolen rxresp expect resp.http.foo == 2 } -run varnish-4.1.1/bin/varnishtest/tests/r00803.vtc0000644000201500234410000000045212652366721015755 00000000000000varnishtest "304 response in pass mode" server s1 { rxreq txresp -status 304 \ -nolen \ -hdr "Date: Mon, 25 Oct 2010 06:34:06 GMT" delay 600 } -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } } -start client c1 { txreq rxresp -no_obj expect resp.status == 304 } -run varnish-4.1.1/bin/varnishtest/tests/c00050.vtc0000644000201500234410000000104312652366721015725 00000000000000varnishtest "Memory pool gymnastics" server s1 { } -start varnish v1 -vcl+backend {} -start delay 2 varnish v1 -expect MEMPOOL.req0.pool == 10 varnish v1 -cliok "param.set pool_req 90,100,100" delay 2 varnish v1 -expect MEMPOOL.req0.pool == 90 varnish v1 -cliok "param.set pool_req 50,80,100" delay 2 varnish v1 -expect MEMPOOL.req0.pool == 80 varnish v1 -expect MEMPOOL.req0.surplus == 10 varnish v1 -cliok "param.set pool_req 10,80,1" delay 2 varnish v1 -expect MEMPOOL.req0.pool == 10 varnish v1 -expect MEMPOOL.req0.timeout == 70 varnish-4.1.1/bin/varnishtest/tests/u00000.vtc0000644000201500234410000000137212652366721015747 00000000000000varnishtest "Simple process tests" # new & start process p1 "cat" -start process p2 "cat" -start process p3 "cat" -start # write process p1 -writeln "foo" process p2 -writeln "bar" process p3 -writeln "baz" # give enough time for the writes delay 0.5 # stop process p1 -stop process p2 -close process p3 -kill "HUP" # wait process p1 -wait process p2 -wait process p3 -wait # check stdout shell "grep foo ${tmpdir}/p1/stdout >/dev/null 2>&1" shell "grep bar ${tmpdir}/p2/stdout >/dev/null 2>&1" shell "grep baz ${tmpdir}/p3/stdout >/dev/null 2>&1" # check stderr shell "test -f ${tmpdir}/p1/stderr -a ! -s ${tmpdir}/p1/stderr" shell "test -f ${tmpdir}/p2/stderr -a ! -s ${tmpdir}/p2/stderr" shell "test -f ${tmpdir}/p3/stderr -a ! -s ${tmpdir}/p3/stderr" varnish-4.1.1/bin/varnishtest/tests/r00941.vtc0000644000201500234410000000055412652366721015763 00000000000000varnishtest "beresp.ttl set in vcl takes effect" server s1 { rxreq txresp -hdr "Cache-control: max-age=1" -body "FOO" rxreq txresp -body "FOOBAR" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.ttl = 1000s; } } -start client c1 { txreq rxresp expect resp.bodylen == 3 delay 2 txreq rxresp expect resp.bodylen == 3 } -run varnish-4.1.1/bin/varnishtest/tests/r00425.vtc0000644000201500234410000000107512652366721015757 00000000000000varnishtest "check late pass stalling" server s1 { rxreq txresp \ -hdr "Set-Cookie: foo=bar" \ -hdr "Expires: Thu, 19 Nov 1981 08:52:00 GMT" \ -body "1111\n" rxreq txresp \ -hdr "Set-Cookie: foo=bar" \ -hdr "Expires: Thu, 19 Nov 1981 08:52:00 GMT" \ -body "22222n" rxreq txresp \ -hdr "Set-Cookie: foo=bar" \ -hdr "Expires: Thu, 19 Nov 1981 08:52:00 GMT" \ -body "33333n" } -start varnish v1 -vcl+backend { } -start client c1 { txreq rxresp txreq rxresp txreq rxresp } -run varnish v1 -expect cache_hitpass == 2 varnish-4.1.1/bin/varnishtest/tests/r01419.vtc0000644000201500234410000000136312652366721015763 00000000000000varnishtest "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 varnish-4.1.1/bin/varnishtest/tests/v00001.vtc0000644000201500234410000000242312652366721015747 00000000000000varnishtest "VCL/VRT: url/request/proto/reason/status" server s1 { rxreq txresp -hdr "Connection: close" -body "012345\n" } server s1 -start varnish v1 -vcl+backend { sub vcl_recv { set req.http.foobar = req.url + req.method + req.proto; set req.url = "/"; set req.proto = "HTTP/1.2"; set req.method = "GET"; } sub vcl_backend_fetch { set bereq.http.foobar = bereq.url + bereq.proto; set bereq.url = "/"; set bereq.proto = "HTTP/1.2"; set bereq.method = "GET"; } sub vcl_backend_response { set beresp.http.foobar = beresp.proto + beresp.reason + beresp.status; set beresp.proto = "HTTP/1.2"; set beresp.reason = "For circular files"; set beresp.status = 903; set beresp.http.y-served-by-hostname = server.hostname; set beresp.http.y-served-by-identity = server.identity; } sub vcl_deliver { set resp.proto = "HTTP/1.2"; set resp.reason = "Naah, lets fail it"; set resp.status = 904; # XXX should be moved to it's own test set resp.http.x-served-by-hostname = server.hostname; set resp.http.x-served-by-identity = server.identity; set resp.http.foobar = resp.proto + resp.status; } } -start client c1 { txreq -url "/" rxresp expect resp.status == 904 } client c1 -run server s1 -wait varnish v1 -stop varnish-4.1.1/bin/varnishtest/tests/r01660.vtc0000644000201500234410000000052712652366721015762 00000000000000varnishtest "#1660: range and synth" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_recv { return (synth(200, "OK")); } } -start client c1 { txreq -hdr "Range: 0-1" rxresp expect resp.status == 416 txreq -hdr "Range: bytes=0-1" rxresp expect resp.status == 206 expect resp.http.content-length == 2 } -run varnish-4.1.1/bin/varnishtest/tests/v00006.vtc0000644000201500234410000000340412652366721015754 00000000000000varnishtest "VCL: Test backend retirement" # # This case is quite sensitive to ordering of the worker threads because # it has so little actual traffic. In a real world setting, this should # not be an issue. # # First do one request to get a work-thread that holds a VCL reference server s1 { rxreq expect req.url == "/bar" txresp } -start # Only one pool, to avoid getting more than one work thread varnish v1 -arg "-p thread_pools=1" -vcl+backend { } -start # Give the varnishd a chance to start and create workers etc. # NB: This is important for to avoid mis-ordering of the workers. delay 1 client c1 { txreq -url /bar rxresp expect resp.status == 200 } -run server s1 -wait varnish v1 -expect n_backend == 1 varnish v1 -expect n_vcl_avail == 1 varnish v1 -expect n_vcl_discard == 0 # Set up a new VCL and backend server s2 { rxreq expect req.url == "/foo" txresp } -start varnish v1 -vcl { backend b2 { .host = "${s2_addr}"; .port = "${s2_port}"; } } varnish v1 -expect n_backend == 2 varnish v1 -expect n_vcl_avail == 2 varnish v1 -expect n_vcl_discard == 0 varnish v1 -cli "vcl.list" # Discard the first VCL varnish v1 -cli "vcl.discard vcl1" # Give expiry thread a chance to let go delay 2 # It won't go away as long as the workthread holds a VCL reference varnish v1 -expect n_backend == 2 varnish v1 -expect n_vcl_avail == 1 varnish v1 -expect n_vcl_discard == 1 # Do another request through the new VCL to the new backend client c1 { txreq -url /foo rxresp expect resp.status == 200 } -run server s2 -wait # The workthread should have released its VCL reference now # but we need to tickle the CLI to notice varnish v1 -cli "vcl.list" varnish v1 -expect n_backend == 1 varnish v1 -expect n_vcl_avail == 1 varnish v1 -expect n_vcl_discard == 0 varnish-4.1.1/bin/varnishtest/tests/p00006.vtc0000644000201500234410000000220712652366721015746 00000000000000varnishtest "Check that Vary headers are stored" shell "rm -f ${tmpdir}/_.per" server s1 { rxreq txresp -hdr "Foo: foo1" -hdr "Vary: foo, bar" rxreq txresp -hdr "Foo: foo2" -hdr "Vary: foo, bar" } -start varnish v1 \ -arg "-sdeprecated_persistent,${tmpdir}/_.per,10m" \ -arg "-pban_lurker_sleep=0" \ -vcl+backend { } -start client c1 { txreq -url "/foo" -hdr "foo: 1" -hdr "bar: 2" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1001" expect resp.http.foo == "foo1" txreq -url "/foo" -hdr "foo: 2" -hdr "bar: 1" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "1003" expect resp.http.foo == "foo2" } -run varnish v1 -expect n_object == 2 server s1 -wait varnish v1 -stop varnish v1 -start varnish v1 -cliok "debug.xid 1999" varnish v1 -expect n_vampireobject == 2 client c1 { txreq -url "/foo" -hdr "foo: 1" -hdr "bar: 2" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "2001 1002" expect resp.http.foo == "foo1" txreq -url "/foo" -hdr "foo: 2" -hdr "bar: 1" rxresp expect resp.status == 200 expect resp.http.X-Varnish == "2002 1004" expect resp.http.foo == "foo2" } -run varnish-4.1.1/bin/varnishtest/tests/c00003.vtc0000644000201500234410000000075712652366721015736 00000000000000varnishtest "Check that we fail to start if any listen address does not work" # This requires non-local binds to be disabled. If you see this fail # and are on Linux, ensure /proc/net/ipv4/ip_nonlocal_bind is set to 0. # All bad listen addresses err_shell "could not be resolved to an IP address" { ${varnishd} -F -a "${bad_ip}:0" -b '***' -n ${tmpdir} 2>&1 } # old style address list err_shell "Unknown protocol" { ${varnishd} -F -a "127.0.0.1:0,${bad_ip}:0" -b '***' -n ${tmpdir} 2>&1 } varnish-4.1.1/bin/varnishtest/tests/r01287.vtc0000644000201500234410000000052012652366721015760 00000000000000varnishtest "#1287 - check NULL as first pointer to VRT_synth_page" server s1 { } -start varnish v1 -vcl+backend { sub vcl_recv { return (synth(200, "OK")); } sub vcl_synth { synthetic(resp.http.blank); return (deliver); } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.body == "(null)" } -run varnish-4.1.1/bin/varnishtest/tests/e00003.vtc0000644000201500234410000000260312652366721015730 00000000000000varnishtest "ESI include" server s1 { rxreq txresp -body { Before include After include } rxreq expect req.url == "/body1" txresp -body { Included file } } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.esi_level > 0) { set req.url = req.url + req.esi_level; } } sub vcl_backend_response { set beresp.do_esi = true; } } -start logexpect l1 -v v1 -g request { expect 0 1001 Begin "^req .* rxreq" expect * = ReqAcct "^18 0 18 176 75 251$" expect 0 = End } -start logexpect l2 -v v1 -g request { expect * 1002 Begin "^bereq " expect * = End } -start logexpect l3 -v v1 -g request { expect * 1003 Begin "^req .* esi" expect * = ReqAcct "^0 0 0 0 18 18$" expect 0 = End } -start logexpect l4 -v v1 -g request { expect * 1004 Begin "^bereq " expect * = End } -start logexpect l5 -v v1 -g request { expect * 1005 Begin "^req .* rxreq" expect * = ReqAcct "^18 0 18 181 75 256$" expect 0 = End } -start client c1 { txreq rxresp expect resp.bodylen == 75 expect resp.status == 200 delay .1 # test that there is no difference on miss/hit txreq rxresp expect resp.bodylen == 75 expect resp.status == 200 } client c1 -run varnish v1 -expect esi_errors == 0 logexpect l1 -wait logexpect l2 -wait logexpect l3 -wait logexpect l4 -wait logexpect l5 -wait varnish-4.1.1/bin/varnishtest/tests/r01532.vtc0000644000201500234410000000051612652366721015756 00000000000000varnishtest "Incorrect representation when using reals - #1532" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.x-foo = std.real2time(1140618699.00, now); } } -start client c1 { txreq rxresp expect resp.http.x-foo == "Wed, 22 Feb 2006 14:31:39 GMT" } -run varnish-4.1.1/bin/varnishtest/tests/r00263.vtc0000644000201500234410000000110012652366721015744 00000000000000varnishtest "Test refcounting backends from director" # XXX: This test is probably not relevant with VMOD.directors varnish v1 -vcl { import ${vmod_directors}; backend node1 { .host = "10.0.0.1"; .port = "80"; } backend node2 { .host = "10.0.0.2"; .port = "80"; } backend node3 { .host = "10.0.0.3"; .port = "80"; } sub vcl_init { new cluster = directors.random(); cluster.add_backend(node1, 1); cluster.add_backend(node2, 1); cluster.add_backend(node3, 1); } sub vcl_backend_fetch { set bereq.backend = cluster.backend(); } } -start varnish v1 -wait varnish-4.1.1/bin/varnishtest/tests/c00005.vtc0000644000201500234410000000110312652366721015722 00000000000000varnishtest "Test simple ACL" server s1 { rxreq expect req.url == "/" txresp -body "1111\n" rxreq expect req.url == "foo" txresp -body "2222\n" } -start varnish v1 -arg "-p vsl_mask=+VCL_trace" -vcl+backend { acl acl1 { "localhost"; } sub vcl_recv { if (client.ip ~ acl1) { set req.url = "/"; } } } -start client c1 { txreq -url "foo" rxresp expect resp.status == 200 } -run varnish v1 -vcl+backend { acl acl1 { ! "localhost"; "0.0.0.0" / 0; "::" / 0; } sub vcl_recv { if (client.ip ~ acl1) { set req.url = "/"; } } } client c1 -run varnish-4.1.1/bin/varnishtest/tests/b00031.vtc0000644000201500234410000000051412652366721015725 00000000000000varnishtest "Test X-Forward-For headers" server s1 { rxreq expect req.http.X-Forwarded-For == "127.0.0.1" txresp rxreq expect req.http.X-Forwarded-For == "1.2.3.4, 127.0.0.1" txresp } -start varnish v1 -vcl+backend { } -start client c1 { txreq -url /1 rxresp txreq -url /2 -hdr "X-forwarded-for: 1.2.3.4" rxresp } -run varnish-4.1.1/bin/varnishtest/tests/r00917.vtc0000644000201500234410000000053212652366721015762 00000000000000varnishtest "test here documents for bans" server s1 { rxreq expect req.url == "/bar" txresp -body "foobar" } -start varnish v1 -vcl+backend { } -start client c1 { txreq -url /bar rxresp expect resp.bodylen == 6 } -run varnish v1 -cliok {ban req.url ~ << foo \.bar foo } varnish v1 -cliok ban.list varnish v1 -expect bans_added == 2 varnish-4.1.1/bin/varnishtest/tests/v00013.vtc0000644000201500234410000000140212652366721015746 00000000000000varnishtest "Check obj.hits" server s1 { rxreq expect req.url == "/" txresp -body "slash" rxreq expect req.url == "/foo" txresp -body "foo" rxreq expect req.url == "/pass" txresp -body "pass" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.url == "/pass") { return (pass); } } sub vcl_deliver { set resp.http.foo = obj.hits; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.http.foo == 0 txreq rxresp expect resp.status == 200 expect resp.http.foo == 1 txreq -url /foo rxresp expect resp.status == 200 expect resp.http.foo == 0 delay .1 txreq rxresp expect resp.status == 200 expect resp.http.foo == 2 txreq -url /pass rxresp expect resp.status == 200 expect resp.http.foo == 0 } -run varnish-4.1.1/bin/varnishtest/tests/a00003.vtc0000644000201500234410000000134512652366721015726 00000000000000varnishtest "dual independent HTTP transactions" server s1 { rxreq expect req.method == PUT expect req.proto == HTTP/1.0 expect req.url == "/foo" txresp -proto HTTP/1.2 -status 201 -msg Foo } server s2 { rxreq expect req.method == GET expect req.proto == HTTP/1.1 expect req.url == "/" txresp } server s1 -start server s2 -start client c1 -connect ${s1_sock} { txreq -req PUT -proto HTTP/1.0 -url /foo rxresp expect resp.proto == HTTP/1.2 expect resp.status == 201 expect resp.msg == Foo } client c2 -connect ${s2_sock} { txreq rxresp expect resp.proto == HTTP/1.1 expect resp.status == 200 expect resp.msg == OK } client c1 -start client c2 -start client c1 -wait client c2 -wait server s1 -wait server s2 -wait varnish-4.1.1/bin/varnishtest/tests/r00558.vtc0000644000201500234410000000040312652366721015760 00000000000000varnishtest "error from vcl_recv{} has no numeric code" # XXX: V4 makes this an obsolete test ? server s1 { } -start varnish v1 -vcl+backend { sub vcl_recv { return (synth(501)); } } -start client c1 { txreq rxresp expect resp.status == 501 } -run varnish-4.1.1/bin/varnishtest/tests/r01399.vtc0000644000201500234410000000151212652366721015766 00000000000000varnishtest "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.do_stream = false; 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 varnish-4.1.1/bin/varnishtest/tests/c00038.vtc0000644000201500234410000000150612652366721015737 00000000000000varnishtest "Test req.hash_ignore_busy in vcl_recv" server s1 { rxreq sema r1 sync 2 delay 1 txresp -hdr "Server: 1" } -start server s2 { rxreq txresp -hdr "Server: 2" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.http.x-ignorebusy == "1") { set req.hash_ignore_busy = true; } } sub vcl_backend_fetch { if (bereq.http.x-client == "1") { set bereq.backend = s1; } if (bereq.http.x-client == "2") { set bereq.backend = s2; } } } -start client c1 { txreq -url "/" -hdr "x-client: 1" rxresp expect resp.status == 200 expect resp.http.Server == "1" } -start client c2 { sema r1 sync 2 txreq -url "/" -hdr "x-client: 2" -hdr "x-ignorebusy: 1" txreq -url "/" -hdr "x-client: 2" rxresp expect resp.status == 200 expect resp.http.Server == "2" } -start client c1 -wait client c2 -wait varnish-4.1.1/bin/varnishtest/tests/l00004.vtc0000644000201500234410000000224712652366721015744 00000000000000varnishtest "Test request byte counters on pipe" server s1 { rxreq expect req.url == "/" expect req.http.test == "yes" txresp -body "fdsa" } -start varnish v1 -vcl+backend { sub vcl_recv { return (pipe); } sub vcl_pipe { set bereq.http.test = "yes"; unset bereq.http.x-forwarded-for; unset bereq.http.x-varnish; unset bereq.http.connection; } } -start # req: # POST / HTTP/1.1\r\n 17 bytes # Content-Length: 4\r\n 19 bytes # \r\n 2 bytes # Total: 38 bytes # bereq: # POST / HTTP/1.1\r\n 17 bytes # Content-Length: 4\r\n 19 bytes # test: yes\r\n 11 bytes # \r\n 2 bytes # Total: 49 bytes # reqbody # asdf 4 bytes # resp: # HTTP/1.1 200 OK\r\n 17 bytes # Content-Length: 4\r\n 19 bytes # \r\n 2 bytes # fdsa 4 bytes # Total: 42 bytes logexpect l1 -v v1 -g request { expect 0 1001 Begin "^req .* rxreq" expect * = PipeAcct "^38 49 4 42$" expect 0 = End } -start client c1 { txreq -req "POST" -url "/" -hdr "Content-Length: 4" send "asdf" rxresp expect resp.status == 200 } -run logexpect l1 -wait varnish v1 -expect s_pipe_hdrbytes == 38 varnish v1 -expect s_pipe_in == 4 varnish v1 -expect s_pipe_out == 42 varnish-4.1.1/bin/varnishtest/tests/r00416.vtc0000644000201500234410000000545612652366721015766 00000000000000varnishtest "Regression test for #416: a surplus of HTTP headers" server s1 { rxreq txresp \ -hdr hdr00=00 \ -hdr hdr01=01 \ -hdr hdr02=02 \ -hdr hdr03=03 \ -hdr hdr04=04 \ -hdr hdr05=05 \ -hdr hdr06=06 \ -hdr hdr07=07 \ -hdr hdr08=08 \ -hdr hdr09=09 \ -hdr hdr10=10 \ -hdr hdr11=11 \ -hdr hdr12=12 \ -hdr hdr13=13 \ -hdr hdr14=14 \ -hdr hdr15=15 \ -hdr hdr16=16 \ -hdr hdr17=17 \ -hdr hdr18=18 \ -hdr hdr19=19 \ -hdr hdr20=20 \ -hdr hdr21=21 \ -hdr hdr22=22 \ -hdr hdr23=23 \ -hdr hdr24=24 \ -hdr hdr25=25 \ -hdr hdr26=26 \ -hdr hdr27=27 \ -hdr hdr28=28 \ -hdr hdr29=29 \ -hdr hdr30=30 \ -hdr hdr31=31 \ -hdr hdr32=32 \ -hdr hdr33=33 \ -hdr hdr34=34 \ -hdr hdr35=35 \ -hdr hdr36=36 \ -hdr hdr37=37 \ -hdr hdr38=38 \ -hdr hdr39=39 \ -hdr hdr40=40 \ -hdr hdr41=41 \ -hdr hdr42=42 \ -hdr hdr43=43 \ -hdr hdr44=44 \ -hdr hdr45=45 \ -hdr hdr46=46 \ -hdr hdr47=47 \ -hdr hdr48=48 \ -hdr hdr49=49 \ -hdr hdr50=50 \ -hdr hdr51=51 \ -hdr hdr52=52 \ -hdr hdr53=53 \ -hdr hdr54=54 \ -hdr hdr55=55 \ -hdr hdr56=56 \ -hdr hdr57=57 \ -hdr hdr58=58 \ -hdr hdr59=59 \ -hdr hdr60=60 \ -hdr hdr61=61 \ -hdr hdr62=62 \ -hdr hdr63=63 \ -hdr hdr64=64 \ -hdr hdr65=65 \ -hdr hdr66=66 \ -hdr hdr67=67 \ -hdr hdr68=68 \ -hdr hdr69=69 \ -body "foo" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; } } -start client c1 { txreq \ -hdr hdr00=00 \ -hdr hdr01=01 \ -hdr hdr02=02 \ -hdr hdr03=03 \ -hdr hdr04=04 \ -hdr hdr05=05 \ -hdr hdr06=06 \ -hdr hdr07=07 \ -hdr hdr08=08 \ -hdr hdr09=09 \ -hdr hdr10=10 \ -hdr hdr11=11 \ -hdr hdr12=12 \ -hdr hdr13=13 \ -hdr hdr14=14 \ -hdr hdr15=15 \ -hdr hdr16=16 \ -hdr hdr17=17 \ -hdr hdr18=18 \ -hdr hdr19=19 \ -hdr hdr20=20 \ -hdr hdr21=21 \ -hdr hdr22=22 \ -hdr hdr23=23 \ -hdr hdr24=24 \ -hdr hdr25=25 \ -hdr hdr26=26 \ -hdr hdr27=27 \ -hdr hdr28=28 \ -hdr hdr29=29 \ -hdr hdr30=30 \ -hdr hdr31=31 \ -hdr hdr32=32 \ -hdr hdr33=33 \ -hdr hdr34=34 \ -hdr hdr35=35 \ -hdr hdr36=36 \ -hdr hdr37=37 \ -hdr hdr38=38 \ -hdr hdr39=39 \ -hdr hdr40=40 \ -hdr hdr41=41 \ -hdr hdr42=42 \ -hdr hdr43=43 \ -hdr hdr44=44 \ -hdr hdr45=45 \ -hdr hdr46=46 \ -hdr hdr47=47 \ -hdr hdr48=48 \ -hdr hdr49=49 \ -hdr hdr50=50 \ -hdr hdr51=51 \ -hdr hdr52=52 \ -hdr hdr53=53 \ -hdr hdr54=54 \ -hdr hdr55=55 \ -hdr hdr56=56 \ -hdr hdr57=57 \ -hdr hdr58=58 \ -hdr hdr59=59 \ -hdr hdr60=60 \ -hdr hdr61=61 \ -hdr hdr62=62 \ -hdr hdr63=63 \ -hdr hdr64=64 \ -hdr hdr65=65 \ -hdr hdr66=66 \ -hdr hdr67=67 \ -hdr hdr68=68 \ -hdr hdr69=69 rxresp expect resp.status == 400 } -run client c1 { txreq rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/r01391.vtc0000644000201500234410000000074112652366721015761 00000000000000varnishtest "client abandoning hit-for-pass" server s1 { non-fatal 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 rxresphdrs rxchunk sema r1 sync 2 } -run delay 2 server s1 { rxreq txresp } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/c00013.vtc0000644000201500234410000000153212652366721015727 00000000000000varnishtest "Test parking second request on backend delay" server s1 { rxreq expect req.url == "/foo" send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay .2 sema r1 sync 2 delay .2 send "line1\n" delay .2 sema r1 sync 2 send "line2\n" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; } } -start varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq -url "/foo" -hdr "client: c1" rxresp expect resp.status == 200 expect resp.bodylen == 12 expect resp.http.x-varnish == "1001" } -start sema r1 sync 2 client c2 { txreq -url "/foo" -hdr "client: c2" delay .2 sema r1 sync 2 rxresp expect resp.status == 200 expect resp.bodylen == 12 expect resp.http.x-varnish == "1004 1002" } -run client c1 -wait varnish v1 -expect busy_sleep == 1 varnish v1 -expect busy_wakeup == 1 varnish-4.1.1/bin/varnishtest/tests/c00051.vtc0000644000201500234410000000025012652366721015725 00000000000000varnishtest "test parameter protection" varnish v1 -arg "-r cli_timeout" varnish v1 -cliok "param.show cli_timeout" varnish v1 -clierr 107 "param.set cli_timeout 1m" varnish-4.1.1/bin/varnishtest/tests/c00048.vtc0000644000201500234410000000223512652366721015740 00000000000000varnishtest "Forcing health of backends" server s1 -repeat 3 { rxreq txresp } -start varnish v1 -vcl { backend s1 { .host = "${s1_addr}"; .port = "${s1_port}"; .probe = { .window = 8; .initial = 7; .threshold = 8; .interval = 10s; } } sub vcl_recv { return(pass); } } -start delay 1 varnish v1 -cliok "vcl.list" varnish v1 -cliok "backend.list -p" varnish v1 -cliok "backend.set_health s1 auto" varnish v1 -cliok "backend.list -p" client c1 { txreq rxresp expect resp.status == 200 } -run varnish v1 -cliok "backend.list" varnish v1 -cliok "backend.set_health s1 sick" varnish v1 -cliok "backend.list" client c1 { txreq rxresp expect resp.status == 503 } -run varnish v1 -cliok "backend.list" varnish v1 -cliok "backend.set_health s1 healthy" varnish v1 -cliok "backend.list" client c1 { txreq rxresp expect resp.status == 200 } -run varnish v1 -clierr 106 "backend.set_health s1 foo" varnish v1 -clierr 106 "backend.set_health s2 foo" varnish v1 -clierr 106 "backend.set_health s2 auto" varnish v1 -cliok "vcl.list" varnish v1 -cliok "backend.list *" varnish v1 -cliok "backend.list *.foo" varnish v1 -cliok "backend.list vcl1.*" varnish-4.1.1/bin/varnishtest/tests/m00013.vtc0000644000201500234410000000136512652366721015745 00000000000000varnishtest "Test std.timestamp()" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_init { # Make sure that this doesn't cause ill effects std.timestamp("bogus"); } sub vcl_recv { std.timestamp("vcl_recv"); } sub vcl_backend_fetch { std.timestamp("vcl_backend_fetch"); } } -start logexpect l1 -v v1 -g request { expect 0 1001 Begin req expect * = Timestamp Start: expect * = Timestamp {vcl_recv: \S+ 0\.\d+ 0\.\d+} expect * = Timestamp Resp: expect * = End expect 0 1002 Begin bereq expect * = Timestamp Start: expect * = Timestamp {vcl_backend_fetch: \S+ 0\.\d+ 0\.\d+} expect * = Timestamp BerespBody: expect * = End } -start client c1 { txreq rxresp } -run logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/e00026.vtc0000644000201500234410000000323612652366721015740 00000000000000varnishtest "Test esi-include + gzip edgecase with respect to gzip hdr" server s1 { rxreq expect req.url == "/foo" txresp -gzipbody {

/////

} rxreq expect req.url == "/1" expect req.http.accept-encoding == gzip txresp -gzipbody {BA} rxreq expect req.url == "/2" expect req.http.accept-encoding == gzip txresp -gzipbody {B} rxreq expect req.url == "/3" expect req.http.accept-encoding == gzip txresp -gzipbody {A} rxreq expect req.url == "/4" expect req.http.accept-encoding == gzip txresp -gzipbody {} } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (bereq.url != "/foo") { set beresp.do_esi = true; } } } -start varnish v1 -cliok "param.set feature +esi_disable_xml_check" varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq -url /foo -hdr "Accept-Encoding: gzip" rxresp gunzip expect resp.status == 200 expect resp.bodylen == 13 txreq -url /1 -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == gzip gunzip expect resp.status == 200 expect resp.bodylen == 15 txreq -url /2 -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == gzip gunzip expect resp.status == 200 expect resp.bodylen == 14 txreq -url /3 -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == gzip gunzip expect resp.status == 200 expect resp.bodylen == 14 txreq -url /4 -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == gzip gunzip expect resp.status == 200 expect resp.bodylen == 13 } client c1 -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/j00000.vtc0000644000201500234410000000043612652366721015734 00000000000000varnishtest "Code coverage basic UNIX jail" feature user_varnish feature group_varnish feature root server s1 { rxreq txresp } -start varnish v1 \ -jail "-junix,user=varnish,ccgroup=varnish" \ -vcl+backend { } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/c00025.vtc0000644000201500234410000000316412652366721015735 00000000000000varnishtest "Test If-None-Match" server s1 { rxreq expect req.url == / txresp -hdr {ETag: "123456789"} -bodylen 10 rxreq expect req.url == /other txresp -hdr {ETag: W/"123456789"} -bodylen 10 } -start varnish v1 -vcl+backend { } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 10 expect resp.http.etag == {"123456789"} txreq -hdr {If-None-Match: "12345678"} rxresp expect resp.status == 200 txreq -hdr {If-None-Match: "123456789"} rxresp -no_obj expect resp.status == 304 txreq -hdr "Range: bytes=1-2" -hdr {If-None-Match: "123456789"} rxresp -no_obj expect resp.status == 304 txreq -hdr {If-None-Match: W/"12345678"} rxresp expect resp.status == 200 txreq -hdr {If-None-Match: W/"123456789"} rxresp -no_obj expect resp.status == 304 txreq -hdr "Range: bytes=1-2" -hdr {If-None-Match: W/"123456789"} rxresp expect resp.status == 206 txreq -url /other rxresp expect resp.status == 200 expect resp.bodylen == 10 expect resp.http.etag == {W/"123456789"} txreq -url /other -hdr {If-None-Match: "12345678"} rxresp expect resp.status == 200 txreq -url /other -hdr {If-None-Match: "123456789"} rxresp -no_obj expect resp.status == 304 txreq -url /other -hdr "Range: bytes=1-2" \ -hdr {If-None-Match: "123456789"} rxresp expect resp.status == 206 txreq -url /other -hdr {If-None-Match: W/"12345678"} rxresp expect resp.status == 200 txreq -url /other -hdr {If-None-Match: W/"123456789"} rxresp -no_obj expect resp.status == 304 txreq -url /other -hdr "Range: bytes=1-2" \ -hdr {If-None-Match: W/"123456789"} rxresp expect resp.status == 206 } -run varnish-4.1.1/bin/varnishtest/tests/r01641.vtc0000644000201500234410000000142512652366721015757 00000000000000varnishtest "Test retry of straight insufficient bytes pass-fetch : do_esi = true" server s1 { rxreq txresp -hdr "Content-Length: 10000" -nolen -bodylen 5000 } server s2 { rxreq txresp -bodylen 5 } server s1 -start server s2 -start varnish v1 -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_fetch { set bereq.between_bytes_timeout = 10s; if (bereq.retries == 0) { set bereq.backend = s1; } else { set bereq.backend = s2; } } sub vcl_backend_response { set beresp.do_esi = true; } sub vcl_backend_error { if (bereq.retries == 0) { return (retry); } else { return (deliver); } } } -start client c1 { timeout 10 txreq -url "/" rxresp expect resp.status == 200 expect resp.bodylen == 5 } -run server s1 -wait server s2 -wait varnish-4.1.1/bin/varnishtest/tests/a00009.vtc0000644000201500234410000000141312652366721015730 00000000000000varnishtest "Code coverage of VCL compiler and RSTdump etc" shell "${varnishd} -b 127.0.0.1:80 -C -n ${tmpdir} > /dev/null 2>&1" shell "${varnishd} -x dumprstparam > /dev/null 2>&1" shell "${varnishd} -x dumprstvsl > /dev/null 2>&1" err_shell {VCL version declaration missing} "echo 'bad vcl' >${tmpdir}/t.vcl ; ${varnishd} -f ${tmpdir}/t.vcl -n ${tmpdir} 2>&1" err_shell {VCL version declaration missing} "echo 'bad vcl' >${tmpdir}/t.vcl ; ${varnishd} -C -f ${tmpdir}/t.vcl -n ${tmpdir} 2>&1" err_shell {-spersistent has been deprecated} "${varnishd} -spersistent 2>&1" err_shell {Unknown jail method "xyz"} "${varnishd} -jxyz 2>&1" err_shell {-j must be the first argument} "${varnishd} -jnone -jxyz 2>&1" err_shell {-j must be the first argument} "${varnishd} -d -jxyz 2>&1" varnish-4.1.1/bin/varnishtest/tests/r00498.vtc0000644000201500234410000002035212652366721015770 00000000000000varnishtest "very very very long return header" server s1 { rxreq expect req.url == "/" txresp -hdr "Location: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" -body {foo} } -start varnish v1 -vcl+backend { } -start varnish v1 -cliok "param.set http_resp_hdr_len 32768" client c1 { txreq rxresp expect resp.bodylen == 3 } -run varnish-4.1.1/bin/varnishtest/tests/r00956.vtc0000644000201500234410000000211312652366721015762 00000000000000varnishtest "obj.ttl relative/absolute" server s1 { rxreq txresp -hdr "Cache-Control: max-age=23" -hdr "Age: 4" -bodylen 40 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.fooA = beresp.ttl; set beresp.ttl = 10s; set beresp.http.fooB = beresp.ttl; set beresp.http.ageA = beresp.age; } sub vcl_hit { set req.http.foo = obj.ttl; set req.http.ageB = obj.age; } sub vcl_deliver { set resp.http.foo = req.http.foo; set resp.http.ageB = req.http.ageB; } } -start client c1 { txreq rxresp expect resp.bodylen == 40 expect resp.http.fooA == 19.000 expect resp.http.fooB == 10.000 expect resp.http.ageA == 4.000 delay 2 txreq rxresp expect resp.bodylen == 40 expect resp.http.fooA == 19.000 expect resp.http.fooB == 10.000 expect resp.http.foo <= 8.000 expect resp.http.ageA == 4.000 expect resp.http.ageB >= 6.000 delay 2 txreq rxresp expect resp.bodylen == 40 expect resp.http.fooA == 19.000 expect resp.http.fooB == 10.000 expect resp.http.foo <= 6.000 expect resp.http.ageA == 4.000 expect resp.http.ageB >= 8.000 } -run varnish-4.1.1/bin/varnishtest/tests/b00044.vtc0000644000201500234410000000035412652366721015733 00000000000000varnishtest "Test/coverage of varnish master signal handling" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { } -start client c1 { txreq rxresp } -run server s1 -wait shell "kill -15 ${v1_pid}" varnish v1 -cleanup varnish-4.1.1/bin/varnishtest/tests/b00017.vtc0000644000201500234410000000066612652366721015741 00000000000000varnishtest "Check that we do not close one error" varnish v1 -vcl { backend foo { .host = "${bad_ip}"; .port = "9080"; } sub vcl_recv { return (synth(888)); } sub vcl_synth { synthetic("Custom vcl_synth's synth output"); return (deliver); } } -start client c1 { txreq -url "/" rxresp expect resp.status == 888 expect resp.bodylen == 31 expect resp.http.connection != close } -run varnish v1 -expect s_synth == 1 varnish-4.1.1/bin/varnishtest/tests/c00072.vtc0000644000201500234410000000161412652366721015735 00000000000000varnishtest "purge stale on refresh with and without IMS" server s1 { rxreq txresp -hdr "foo: bar" rxreq txresp -hdr "foo: bar" -hdr {ETag: "asdf"} rxreq txresp -hdr "foo: baz" rxreq expect req.http.if-none-match == {"asdf"} txresp -status 304 -nolen -hdr "foo: baz" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.ttl = 0.1s; set beresp.grace = 0s; set beresp.keep = 60s; } } -start client c1 { txreq -url /no-ims rxresp expect resp.http.foo == "bar" txreq -url /ims rxresp expect resp.http.foo == "bar" } -run # Wait for ttl to expire on both objects delay 0.2 varnish v1 -expect n_object == 2 client c1 { txreq -url /no-ims rxresp expect resp.http.foo == "baz" txreq -url /ims rxresp expect resp.http.foo == "baz" } -run # Make sure expiry is done delay 1 # Only one of each of /no-ims and /ims should be left varnish v1 -expect n_object == 2 varnish-4.1.1/bin/varnishtest/tests/r01014.vtc0000644000201500234410000000046712652366721015756 00000000000000varnishtest "bug 1014, Invalid C-L header with gzip" server s1 { rxreq txresp -nolen -hdr "Content-Encoding: gzip" -hdr "Content-Length:" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; } } -start client c1 { txreq rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/r00387.vtc0000644000201500234410000000067112652366721015767 00000000000000varnishtest "Regression test for #387: too long chunk header" server s1 { rxreq non-fatal send "HTTP/1.1 200 OK\r\n" send "Transfer-encoding: chunked\r\n" send "\r\n" send "004\r\n1234\r\n" send "1000000000000000000001\r\n@\r\n" send "00000000\r\n" send "\r\n" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; } } -start client c1 { txreq rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/r00916.vtc0000644000201500234410000000042612652366721015763 00000000000000varnishtest "VCC reference bug" server s1 { rxreq txresp -body "FOO" } -start varnish v1 -errvcl {Backend not found: 's-1'} { backend b { .host = "127.0.0.1"; } sub s1 { } sub vcl_backend_response { if (bereq.backend == s-1){ set bereq.backend = s-1; } } } varnish-4.1.1/bin/varnishtest/tests/c00034.vtc0000644000201500234410000000674212652366721015742 00000000000000varnishtest "Range headers" server s1 { rxreq txresp -bodylen 100 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; } } -start varnish v1 -cliok "param.set http_range_support off" client c1 { txreq -hdr "Range: bytes=0-9" rxresp expect resp.status == 200 expect resp.bodylen == 100 } -run varnish v1 -expect s_resp_bodybytes == 100 varnish v1 -cliok "param.set http_range_support on" client c1 { # Invalid range requests txreq -hdr "Range: bytes =0-9" rxresp expect resp.status == 416 expect resp.bodylen == 0 expect resp.http.content-length == "0" expect resp.http.transfer-encoding == "" expect resp.http.content-range == "bytes */100" txreq -hdr "Range: bytes=0- 9" rxresp expect resp.status == 416 expect resp.bodylen == 0 txreq -hdr "Range: bytes =-9" rxresp expect resp.status == 416 expect resp.bodylen == 0 txreq -hdr "Range: bytes =0-a" rxresp expect resp.status == 416 expect resp.bodylen == 0 txreq -hdr "Range: bytes=-" rxresp expect resp.status == 416 expect resp.bodylen == 0 txreq -hdr "Range: bytes=5-2" rxresp expect resp.status == 416 expect resp.bodylen == 0 txreq -hdr "Range: bytes=-0" rxresp expect resp.status == 416 expect resp.bodylen == 0 txreq -hdr "Range: bytes=100-" rxresp expect resp.status == 416 expect resp.bodylen == 0 } -run varnish v1 -expect s_resp_bodybytes == 100 delay .1 client c1 { # Valid range requests txreq -hdr "Range: bytes=0-49" rxresp expect resp.status == 206 expect resp.bodylen == 50 expect resp.http.content-range == "bytes 0-49/100" txreq -hdr "Range: bytes=50-99" rxresp expect resp.status == 206 expect resp.bodylen == 50 expect resp.http.content-range == "bytes 50-99/100" txreq -hdr "Range: bytes=-50" rxresp expect resp.status == 206 expect resp.bodylen == 50 expect resp.http.content-range == "bytes 50-99/100" txreq -hdr "Range: bytes=50-" rxresp expect resp.status == 206 expect resp.bodylen == 50 expect resp.http.content-range == "bytes 50-99/100" txreq -hdr "Range: bytes=0-0" rxresp expect resp.status == 206 expect resp.bodylen == 1 expect resp.http.content-range == "bytes 0-0/100" txreq -hdr "Range: bytes=-2000" rxresp expect resp.status == 206 expect resp.bodylen == 100 expect resp.http.content-range == "bytes 0-99/100" } -run varnish v1 -expect s_resp_bodybytes == 401 # Test Range streaming with streaming objects with C-L server s1 { rxreq txresp -nolen -hdr "Content-Length: 100" send "0123456789" send "0123456789" send "0123456789" send "0123456789" send "0123456789" send "0123456789" send "0123456789" send "0123456789" send "0123456789" delay 2 send "0123456789" rxreq txresp -nolen -hdr "Content-Length: 100" send "0123456789" send "0123456789" send "0123456789" send "0123456789" send "0123456789" send "0123456789" send "0123456789" send "0123456789" send "0123456789" delay 2 send "0123456789" } -start varnish v1 -vcl+backend { sub vcl_backend_response { if (bereq.url == "/2") { set beresp.do_gzip = true; } } } client c1 { # Open ended range to force C-L usage txreq -url /1 \ -hdr "Range: bytes=20-" \ -hdr "Connection: close" rxresphdrs expect resp.status == 206 expect resp.http.Content-Range == "bytes 20-99/100" recv 80 expect_close } -run delay .1 client c1 { # Closed C-L because we cannot use C-L txreq -url /2 \ -hdr "Range: bytes=2-5" \ -hdr "Accept-encoding: gzip" rxresp expect resp.status == 200 gunzip expect resp.bodylen == 100 } -run varnish-4.1.1/bin/varnishtest/tests/e00021.vtc0000644000201500234410000000134712652366721015734 00000000000000varnishtest "ESI ability to stitch gzip files together" server s1 { rxreq txresp -body { This is a test: Unseen University This is a test: Hello world } } -start varnish v1 -vcl+backend { sub vcl_recv { set req.esi = true; } sub vcl_backend_response { set beresp.do_esi = true; set beresp.do_gzip = true; } } -start varnish v1 -cliok "param.set debug +esi_chop" varnish v1 -cliok "param.set http_gzip_support true" client c1 { txreq -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == gzip gunzip expect resp.status == 200 expect resp.bodylen == 40 } client c1 -run varnish v1 -expect esi_errors == 2 varnish-4.1.1/bin/varnishtest/tests/m00015.vtc0000644000201500234410000000065012652366721015743 00000000000000varnishtest "Test vmod_std.real conversion" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { set resp.http.x-real = std.real(req.http.foo, 0.0); set resp.http.x-fallback = std.real(req.http.bar, 0.0); } } -start client c1 { txreq -hdr "foo: 1.00" rxresp expect resp.status == 200 expect resp.http.x-real == 1.000 expect resp.http.x-fallback == 0.000 } -run varnish-4.1.1/bin/varnishtest/tests/r01650.vtc0000644000201500234410000000044412652366721015757 00000000000000varnishtest "xff handling discards multiple headers" server s1 { rxreq expect req.http.X-Forwarded-For == "1.2.3.4, 5.6.7.8, 127.0.0.1" txresp } -start varnish v1 -vcl+backend { } -start client c1 { txreq -hdr "X-Forwarded-For: 1.2.3.4" -hdr "X-Forwarded-For: 5.6.7.8" rxresp } -run varnish-4.1.1/bin/varnishtest/tests/p00008.vtc0000644000201500234410000000352312652366721015752 00000000000000varnishtest "Ban list sync across silos" shell "rm -f ${tmpdir}/_.per[12]" # Silo 1 & 2 # Prime each with an object with X-Foo: foo server s1 { rxreq expect req.url == "/silo1" txresp -hdr "X-Foo: foo" rxreq expect req.url == "/silo2" txresp -hdr "X-Foo: foo" } -start varnish v1 \ -arg "-pfeature=+wait_silo" \ -arg "-pban_lurker_sleep=0" \ -arg "-sper1=deprecated_persistent,${tmpdir}/_.per1,10m" \ -arg "-sper2=deprecated_persistent,${tmpdir}/_.per2,10m" \ -vcl+backend { sub vcl_backend_response { set beresp.storage_hint = "per1"; if (bereq.url ~ "silo2") { set beresp.storage_hint = "per2"; } } } -start client c1 { txreq -url "/silo1" rxresp expect resp.status == 200 expect resp.http.x-foo == "foo" txreq -url "/silo2" rxresp expect resp.status == 200 expect resp.http.x-foo == "foo" } -run varnish v1 -stop server s1 -wait # Only silo 1 # Ban on obj.http.x-foo == foo varnish v2 \ -arg "-pfeature=+wait_silo" \ -arg "-pban_lurker_sleep=0" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per1,10m" \ -vcl+backend { } -start varnish v2 -cliok "ban obj.http.x-foo == foo" varnish v2 -cliok "ban.list" varnish v2 -stop # Silo 1 & 2 # Bans should be transferred varnish v3 \ -arg "-pfeature=+wait_silo" \ -arg "-pban_lurker_sleep=0" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per1,10m" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per2,10m" \ -vcl+backend { } -start varnish v3 -cliok "ban.list" varnish v3 -stop # Only silo 2 # Check that /silo2 is banned server s1 { rxreq expect req.url == "/silo2" txresp -hdr "X-Foo: bar" } -start varnish v4 \ -arg "-pfeature=+wait_silo" \ -arg "-pban_lurker_sleep=0" \ -arg "-sdeprecated_persistent,${tmpdir}/_.per2,10m" \ -vcl+backend { } -start client c1 -connect ${v4_sock} { txreq -url "/silo2" rxresp expect resp.status == 200 expect resp.http.x-foo == "bar" } -run varnish-4.1.1/bin/varnishtest/tests/e00000.vtc0000644000201500234410000000054112652366721015724 00000000000000varnishtest "ESI test with no ESI content" server s1 { rxreq txresp -body { -This is a test: Hello world } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 33 } client c1 -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/c00037.vtc0000644000201500234410000000115512652366721015736 00000000000000varnishtest "Test req.hash_always_miss in vcl_recv" server s1 { rxreq txresp -hdr "Inc: 1" rxreq txresp -hdr "Inc: 2" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.http.x-missit == "1") { set req.hash_always_miss = true; } } } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.Inc == "1" txreq -url "/" rxresp expect resp.status == 200 expect resp.http.Inc == "1" txreq -url "/" -hdr "x-missit: 1" rxresp expect resp.status == 200 expect resp.http.Inc == "2" txreq -url "/" rxresp expect resp.status == 200 expect resp.http.Inc == "2" } -run varnish-4.1.1/bin/varnishtest/tests/d00013.vtc0000644000201500234410000000204112652366721015724 00000000000000varnishtest "Test a dynamic backend hot swap after it was hinted to a req" server s1 { } -start server s2 { rxreq txresp } -start varnish v1 -vcl { import ${vmod_std}; import ${vmod_debug}; backend dummy { .host = "${bad_ip}"; .port = "9080"; } sub vcl_init { new s1 = debug.dyn("${s1_addr}", "${s1_port}"); } sub vcl_recv { if (req.method == "SWAP") { s1.refresh(req.http.X-Addr, req.http.X-Port); return (synth(200)); } set req.backend_hint = s1.backend(); # hot swap should happen while we sleep debug.sleep(2s); if (std.healthy(req.backend_hint)) { return(synth(800)); } else { set req.backend_hint = s1.backend(); } } } -start varnish v1 -expect MAIN.n_backend == 2 client c1 { txreq sema r2 sync 2 rxresp expect resp.status == 200 } client c2 { sema r2 sync 2 delay 0.1 txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" rxresp expect resp.status == 200 } client c1 -start client c2 -run client c1 -wait varnish v1 -cli backend.list #varnish v1 -expect MAIN.n_backend == 2 varnish-4.1.1/bin/varnishtest/tests/b00027.vtc0000644000201500234410000000105712652366721015735 00000000000000varnishtest "test backend transmission corner cases" server s1 { rxreq txresp rxreq txresp -proto HTTP/1.0 -hdr "Connection: keep-alive" rxreq send "HTTP/1.1 200 OK\n" send "Transfer-encoding: foobar\n" send "\n" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; } } -start client c1 { txreq -url /foo rxresp expect resp.status == 200 expect resp.bodylen == 0 txreq -url /bar rxresp expect resp.status == 200 expect resp.bodylen == 0 txreq -url /barf rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/c00009.vtc0000644000201500234410000000134412652366721015735 00000000000000varnishtest "Test restarts" server s1 { rxreq expect req.url == "/foo" txresp -status 404 } -start server s2 { rxreq expect req.url == "/foo" txresp -body "foobar" } -start varnish v1 -vcl+backend { sub vcl_recv { set req.http.restarts = req.restarts; } sub vcl_backend_fetch { if (bereq.http.restarts == "0") { set bereq.backend = s1; } else { set bereq.backend = s2; } } sub vcl_backend_response { if (beresp.status != 200) { set beresp.uncacheable = true; set beresp.ttl = 0s; return (deliver); } } sub vcl_deliver { if (resp.status != 200) { return (restart); } } } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 6 } client c1 -run varnish-4.1.1/bin/varnishtest/tests/r01770.vtc0000644000201500234410000000032612652366721015761 00000000000000varnishtest "bad protocol specs for -a" err_shell "Too many sub-arguments" "${varnishd} -a 127.0.0.1:80000,PROXY,FOO -d 2>&1" err_shell "Too many sub-arguments" "${varnishd} -a 127.0.0.1:80000,HTTP/1,FOO -d 2>&1" varnish-4.1.1/bin/varnishtest/tests/r01113.vtc0000644000201500234410000000132112652366721015744 00000000000000varnishtest "HTTP status code when hitting max_restarts" server s1 { rxreq txresp accept rxreq txresp accept rxreq txresp accept rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_hit { if (req.url == "/hit") { return(restart); } } sub vcl_deliver { if (req.url == "/deliver") { return(restart); } } sub vcl_miss { if (req.url == "/miss") { return(restart); } } } -start -cliok "param.set max_restarts 1" client c1 { txreq -url /hit rxresp expect resp.status == 200 txreq -url /hit rxresp expect resp.status == 503 } -run client c1 { txreq -url /miss rxresp expect resp.status == 503 } -run client c1 { txreq -url /deliver rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/d00011.vtc0000644000201500234410000000206412652366721015727 00000000000000varnishtest "Test a dynamic backend hot swap after it was picked by a bereq" server s1 { } -start server s2 { rxreq txresp } -start varnish v1 -vcl { import ${vmod_std}; import ${vmod_debug}; backend dummy { .host = "${bad_ip}"; .port = "9080"; } sub vcl_init { new s1 = debug.dyn("${s1_addr}", "${s1_port}"); } sub vcl_recv { if (req.method == "SWAP") { s1.refresh(req.http.X-Addr, req.http.X-Port); return (synth(200)); } } sub vcl_backend_fetch { set bereq.backend = s1.backend(); # hot swap should happen while we sleep debug.sleep(2s); if (std.healthy(bereq.backend)) { return(abandon); } else { set bereq.backend = s1.backend(); } } } -start varnish v1 -expect MAIN.n_backend == 2 client c1 { txreq sema r2 sync 2 rxresp expect resp.status == 200 } client c2 { sema r2 sync 2 delay 0.1 txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" rxresp expect resp.status == 200 } client c1 -start client c2 -run client c1 -wait varnish v1 -cli backend.list #varnish v1 -expect MAIN.n_backend == 2 varnish-4.1.1/bin/varnishtest/tests/r01821.vtc0000644000201500234410000000064612652366721015763 00000000000000varnishtest "Slim down hit-for-pass objects" server s1 -repeat 2 { rxreq txresp -bodylen 65535 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.uncacheable = true; } } -start logexpect l1 -v v1 { expect * * Storage "Transient" } -start client c1 { txreq rxresp } -run logexpect l1 -wait varnish v1 -expect SMA.Transient.c_bytes != 0 varnish v1 -expect SMA.Transient.g_bytes < 65536 varnish-4.1.1/bin/varnishtest/tests/r01730.vtc0000644000201500234410000000042412652366721015754 00000000000000varnishtest "Test connection error on pipe" varnish v1 -vcl { backend default { .host = "${bad_ip}"; .port = "9080"; } sub vcl_recv { return (pipe); } } -start client c1 { txreq expect_close } -run varnish v1 -expect sc_rx_timeout == 1 varnish-4.1.1/bin/varnishtest/tests/j00002.vtc0000644000201500234410000000064412652366721015737 00000000000000varnishtest "-junix bad subarg handling" feature root err_shell "unknown sub-argument" "${varnishd} -junix,bla=foo 2>&1" err_shell "user not found" "${varnishd} -junix,user=/// 2>&1" err_shell "user not found" "${varnishd} -junix,workuser=/// 2>&1" err_shell "group not found" "${varnishd} -junix,ccgroup=/// 2>&1" feature user_varnish err_shell "have different login groups" "${varnishd} -junix,workuser=root 2>&1" varnish-4.1.1/bin/varnishtest/tests/r01510.vtc0000644000201500234410000000061312652366721015750 00000000000000varnishtest "Duplicate object names" varnish v1 -errvcl {Object name 'first' already used.} { import ${vmod_debug}; sub vcl_init { new first = debug.obj("FOO"); new first = debug.obj("BAH"); } } varnish v1 -errvcl {Object name 'first' already used.} { import ${vmod_debug}; backend first { .host = "${bad_ip}"; .port = "9080"; } sub vcl_init { new first = debug.obj("FOO"); } } varnish-4.1.1/bin/varnishtest/tests/r01274.vtc0000644000201500234410000000145212652366721015761 00000000000000varnishtest "#1274 - panic when Vary field-name is too large to fit in a signed char" server s1 { rxreq # Vary header more than 127 characters long txresp -hdr "Vary: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" -bodylen 9 rxreq # Vary header more than 127 characters long txresp -hdr "Vary: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" -bodylen 8 } -start varnish v1 -vcl+backend { } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.bodylen == 9 txreq rxresp expect resp.status == 200 expect resp.bodylen == 8 } -run varnish-4.1.1/bin/varnishtest/tests/r01485.vtc0000644000201500234410000000076712652366721015775 00000000000000varnishtest "#1485: Wrong response reason phrase" server s1 { rxreq txresp -hdr {Etag: "foo"} rxreq expect req.http.If-None-Match == {"foo"} txresp -status 304 -msg "Not Modified" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.ttl = 1ms; set beresp.grace = 0s; set beresp.keep = 1h; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.msg == "OK" delay 0.1 txreq rxresp expect resp.status == 200 expect resp.msg == "OK" } -run varnish-4.1.1/bin/varnishtest/tests/r00694.vtc0000644000201500234410000000067612652366721015775 00000000000000varnishtest "Wrong calculation of last storage segment length" server s1 { rxreq send "HTTP/1.1 200 OK\r\n" send "Transfer-encoding: chunked\r\n" send "\r\n" # This is chunksize (128k) + 2 to force to chunks to be allocated chunkedlen 131074 chunkedlen 0 } -start varnish v1 -vcl+backend { sub vcl_deliver { unset resp.http.content-length; } } -start client c1 { txreq -proto HTTP/1.0 rxresp expect resp.bodylen == 131074 } -run varnish-4.1.1/bin/varnishtest/tests/b00012.vtc0000644000201500234410000000116712652366721015731 00000000000000varnishtest "Check pipelining" server s1 { rxreq expect req.url == "/foo" txresp -body "foo" rxreq expect req.url == "/bar" txresp -body "foobar" } -start varnish v1 -vcl+backend {} -start client c1 { send "GET /foo HTTP/1.1\n\nGET /bar HTTP/1.1\n\nGET /bar HTTP/1.1\n\n" rxresp expect resp.status == 200 expect resp.bodylen == 3 expect resp.http.x-varnish == "1001" rxresp expect resp.status == 200 expect resp.bodylen == 6 expect resp.http.x-varnish == "1003" rxresp expect resp.status == 200 expect resp.bodylen == 6 expect resp.http.x-varnish == "1005 1004" } -run varnish v1 -expect sess_readahead == 2 varnish-4.1.1/bin/varnishtest/tests/a00010.vtc0000644000201500234410000000037312652366721015724 00000000000000varnishtest "simply test that the framework support \0" server s1 { rxreq expect req.url == "/" txresp -body {a\0bc} } server s1 -start client c1 -connect ${s1_sock} { txreq rxresp expect resp.bodylen == 4 } client c1 -run server s1 -wait varnish-4.1.1/bin/varnishtest/tests/e00011.vtc0000644000201500234410000000130112652366721015721 00000000000000varnishtest "Make sure that PASS'ed ESI requests use GET for includes" server s1 { rxreq expect req.method == POST expect req.url == /foobar txresp -body { FOO } rxreq expect req.method == GET txresp -hdr "Set-Cookie: Foo=bar" -body { BAR } } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.uncacheable = true; set beresp.do_esi = true; } } -start client c1 { txreq -req POST -url /foobar -body { A debugged program is one for which you have not yet found the conditions that make it fail. -- Jerry Ogdin } rxresp expect resp.status == 200 expect resp.bodylen == 31 } -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/d00003.vtc0000644000201500234410000000327512652366721015735 00000000000000varnishtest "Test hash director" server s1 { rxreq txresp -hdr "Foo: 1" -body "1" rxreq txresp -hdr "Foo: 3" -body "3" rxreq txresp -hdr "Foo: 9" -body "9" } -start server s2 { rxreq txresp -hdr "Foo: 2" -body "2" rxreq txresp -hdr "Foo: 4" -body "4" rxreq txresp -hdr "Foo: 6" -body "6" rxreq txresp -hdr "Foo: 8" -body "8" } -start varnish v1 -vcl+backend { import ${vmod_directors}; sub vcl_init { new h1 = directors.hash(); h1.add_backend(s1, 1); h1.add_backend(s2, 1); } sub vcl_recv { if (req.method == "DELETE") { h1.remove_backend(s1); return(synth(204)); } if (req.url == "/nohdr") { set req.backend_hint = h1.backend(req.http.Void); } else if (req.url == "/emptystring") { set req.backend_hint = h1.backend(""); } else if (req.url == "/13") { set req.backend_hint = h1.backend(req.http.Void + "" + req.url); } else if (req.url == "/ip") { set req.backend_hint = h1.backend(client.ip); } else { set req.backend_hint = h1.backend(req.url); } return (pass); } } -start client c1 { txreq -url /1 rxresp expect resp.http.foo == "1" txreq -url /3 rxresp expect resp.http.foo == "2" txreq -url /13 rxresp expect resp.http.foo == "3" txreq -url /8 rxresp expect resp.http.foo == "4" txreq -url /emptystring rxresp expect resp.http.foo == "6" txreq -url /nohdr rxresp expect resp.http.foo == "8" txreq -url /ip rxresp expect resp.http.foo == "9" } -run server s2 -start client c1 { txreq -req "DELETE" rxresp expect resp.status == 204 txreq rxresp expect resp.http.foo == "2" txreq rxresp expect resp.http.foo == "4" txreq rxresp expect resp.http.foo == "6" txreq rxresp expect resp.http.foo == "8" } -run varnish-4.1.1/bin/varnishtest/tests/l00002.vtc0000644000201500234410000000450412652366721015740 00000000000000varnishtest "Test request byte counters" server s1 { rxreq expect req.url == "/1" txresp -bodylen 1000 rxreq expect req.url == "/2" txresp -bodylen 2000 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; } sub vcl_deliver { unset resp.http.date; unset resp.http.age; unset resp.http.via; unset resp.http.x-varnish; } } -start # Request (1001): # GET /1 HTTP/1.1\r\n 17 bytes # Content-Length: 4\r\n 19 bytes # \r\n 2 bytes # Total: 38 bytes # Response: # HTTP/1.1 200 OK\r\n 17 bytes # Content-Length: 1000\r\n 22 bytes # Connection: keep-alive\r\n 24 bytes # Accept-Ranges: bytes\r\n 22 bytes # \r\n 2 bytes # Total: 87 bytes # Request (1003): # GET /2 HTTP/1.1\r\n 17 bytes # \r\n 2 bytes # Total: 19 bytes # Response: # HTTP/1.1 200 OK\r\n 17 bytes # Content-Length: 2000\r\n 22 bytes # Connection: keep-alive\r\n 24 bytes # Accept-Ranges: bytes\r\n 22 bytes # \r\n 2 bytes # Total: 87 bytes # Request (1005): # GET /2 HTTP/1.1\r\n 17 bytes # \r\n 2 bytes # Total: 19 bytes # Response: # HTTP/1.1 200 OK\r\n 17 bytes # Content-Length: 2000\r\n 22 bytes # Connection: keep-alive\r\n 24 bytes # Accept-Ranges: bytes\r\n 22 bytes # \r\n 2 bytes # Total: 87 bytes # Request (1006): # GET\r\n 5 bytes # \r\n 2 bytes # Total: 7 bytes # Response: # HTTP/1.1 400 Bad Request\r\n 26 bytes # \r\n 2 bytes # Total: 28 bytes logexpect l1 -v v1 -g session { expect * 1001 Begin "^req .* rxreq" expect * = ReqAcct "^38 4 42 87 1000 1087$" expect 0 = End expect * 1003 Begin "^req .* rxreq" expect * = ReqAcct "^19 0 19 87 2000 2087$" expect 0 = End expect * 1005 Begin "^req .* rxreq" expect * = ReqAcct "^19 0 19 87 2000 2087$" expect 0 = End expect * 1006 Begin "^req .* rxreq" expect * = ReqAcct "^7 0 7 28 0 28$" expect 0 = End } -start # Request 1001 client c1 { txreq -url "/1" -body "asdf" rxresp expect resp.status == 200 send "GET /2 HTTP/1.1\r\n\r\nGET /2 HTTP/1.1\r\n\r\n" rxresp expect resp.status == 200 rxresp expect resp.status == 200 send "GET\r\n\r\n" rxresp expect resp.status == 400 } -run logexpect l1 -wait varnish v1 -expect s_req_hdrbytes == 83 varnish v1 -expect s_req_bodybytes == 4 varnish v1 -expect s_resp_hdrbytes == 289 varnish v1 -expect s_resp_bodybytes == 5000 varnish-4.1.1/bin/varnishtest/tests/r01575.vtc0000644000201500234410000000170112652366721015762 00000000000000varnishtest "#1575 - random director exhaust backend list" # Add 5 backends to a random director, with the 5th having very low weight. # Mark the first 4 sick, and make sure that the 5th will be selected. server s1 { rxreq txresp } -start server s2 { rxreq txresp } -start server s3 { rxreq txresp } -start server s4 { rxreq txresp } -start server s5 { rxreq txresp } -start varnish v1 -vcl+backend { import ${vmod_directors}; sub vcl_init { new rd = directors.random(); rd.add_backend(s1, 10000); rd.add_backend(s2, 10000); rd.add_backend(s3, 10000); rd.add_backend(s4, 10000); rd.add_backend(s5, 1); } sub vcl_backend_fetch { set bereq.backend = rd.backend(); } } -start varnish v1 -cliok "backend.set_health s1 sick" varnish v1 -cliok "backend.set_health s2 sick" varnish v1 -cliok "backend.set_health s3 sick" varnish v1 -cliok "backend.set_health s4 sick" client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/r01524.vtc0000644000201500234410000000047612652366721015764 00000000000000varnishtest "pipe of chunked request" server s1 { rxreq expect req.bodylen == 3 txresp -body "ABCD" } -start varnish v1 -vcl+backend { } -start client c1 { txreq -req MAGIC -nolen -hdr "Transfer-encoding: chunked" chunked {BLA} chunkedlen 0 rxresp expect resp.status == 200 expect resp.bodylen == 4 } -run varnish-4.1.1/bin/varnishtest/tests/r00873.vtc0000644000201500234410000000104312652366721015761 00000000000000varnishtest "Ticket #873" server s1 { rxreq txresp -nolen -hdr "Transfer-encoding: chunked" chunked {} chunked {} chunkedlen 0 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; set beresp.do_gzip = true; } } -start client c1 { txreq -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == gzip gunzip expect resp.status == 200 expect resp.bodylen == 75 } -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/b00048.vtc0000644000201500234410000000120412652366721015732 00000000000000varnishtest "Run a lot of transactions through" server s0 { loop 10 { rxreq txresp -body "foo1" } rxreq txresp -hdr "Connection: close" -body "foo1" expect_close } -dispatch varnish v1 -arg "-Wpoll" -vcl+backend { sub vcl_recv { return (pass); } sub vcl_backend_fetch { set bereq.backend = s0; } } -start client c1 { loop 20 { txreq -url /c1 rxresp expect resp.status == 200 } } -start client c2 { loop 20 { txreq -url /c2 rxresp expect resp.status == 200 } } -start client c3 { loop 20 { txreq -url /c3 rxresp expect resp.status == 200 } } -start client c1 -wait client c2 -wait client c3 -wait varnish-4.1.1/bin/varnishtest/tests/v00034.vtc0000644000201500234410000000076512652366721015764 00000000000000varnishtest "Test sub and backend redefinition" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { } -start varnish v1 -errvcl {Function c1 redefined} { backend foo { .host = "127.0.0.1"; } sub c1 { } sub c1 { } sub vcl_recv { call c1; } } varnish v1 -errvcl {Backend s1 redefined} { backend s1 { .host = "127.0.0.1"; } backend s1 { .host = "127.0.0.1"; } } varnish v1 -errvcl {Probe p1 redefined} { backend s1 { .host = "127.0.0.1"; .probe = p1;} probe p1 { } probe p1 { } } varnish-4.1.1/bin/varnishtest/tests/r00411.vtc0000644000201500234410000000155612652366721015756 00000000000000varnishtest "Test restart in vcl_deliver" server s1 { rxreq expect req.url == "/foo" txresp -status 303 -hdr "Location: /bar" rxreq expect req.url == "/bar" txresp -status 200 -body "1" } -start varnish v1 -vcl+backend { sub vcl_hit { if (obj.http.X-Magic-Redirect == "1") { set req.url = obj.http.Location; return (restart); } } sub vcl_backend_response { if (beresp.status == 303) { set beresp.ttl = 3m; set beresp.http.X-Magic-Redirect = "1"; } } sub vcl_deliver { if (resp.http.X-Magic-Redirect == "1") { return (restart); } set resp.http.X-Restarts = req.restarts; } } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 1 expect resp.http.X-Restarts == "2" txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 1 expect resp.http.X-Restarts == "1" } -run varnish-4.1.1/bin/varnishtest/tests/r01036.vtc0000644000201500234410000000061512652366721015755 00000000000000varnishtest "Test case for #1036" server s1 { rxreq # Send a bodylen of 1,5M, which will exceed cache space of 1M non-fatal txresp -bodylen 1572864 } -start varnish v1 -arg "-smalloc,1M" -arg "-pgzip_level=0" -vcl+backend { sub vcl_backend_response { set beresp.do_stream = false; set beresp.do_gzip = true; } } -start client c1 { txreq rxresp expect resp.status == "503" } -run varnish-4.1.1/bin/varnishtest/tests/r01356.vtc0000644000201500234410000000106112652366721015756 00000000000000varnishtest "#1356, req.body failure" server s1 { rxreqhdrs expect_close } -start varnish v1 -vcl+backend { } -start client c1 { txreq -req POST -nolen -hdr "Transfer-Encoding: carrier-pigeon" rxresp expect resp.status == 400 } -run client c1 { txreq -req POST -nolen -hdr "Content-Length: carrier-pigeon" rxresp expect resp.status == 400 } -run client c1 { txreq -req POST -nolen -hdr "Content-Length: 56" } -run # Check that varnishd still runs server s1 { rxreq txresp } -start client c1 { txreq rxresp expect resp.status == 200 } -run varnish-4.1.1/bin/varnishtest/tests/c00047.vtc0000644000201500234410000000170612652366721015741 00000000000000varnishtest "Test VCL regsuball()" server s1 { rxreq txresp \ -hdr "foo: barbar" \ -hdr "bar: bbbar" } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.http.baz1 = regsuball(beresp.http.foo, "barb", "zz"); set beresp.http.baz2 = regsuball(beresp.http.foo, "ar", "zz"); set beresp.http.baz3 = regsuball(beresp.http.foo, "^", "baz"); set beresp.http.baz4 = regsuball(beresp.http.foo, "^[;]*", "baz"); set beresp.http.baz5 = regsuball(beresp.http.bar, "^b*", "b"); set beresp.http.baz6 = regsuball(beresp.http.foo, "^b*", "z"); set beresp.http.baz7 = regsuball(beresp.http.foo, "ping", "pong"); } } -start client c1 { txreq -url "/" rxresp expect resp.status == 200 expect resp.http.baz1 == "zzar" expect resp.http.baz2 == "bzzbzz" expect resp.http.baz3 == "bazbarbar" expect resp.http.baz4 == "bazbarbar" expect resp.http.baz5 == "bar" expect resp.http.baz6 == "zarbar" expect resp.http.baz7 == "barbar" } -run varnish-4.1.1/bin/varnishtest/tests/r01581.vtc0000644000201500234410000000050312652366721015756 00000000000000varnishtest "Duplcate SLT_Begin" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { } -start logexpect l1 -v v1 -g request { expect 0 1001 Begin expect * = ReqStart expect * = End } -start client c1 { delay 0.1 send "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n" rxresp } -run logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/c00006.vtc0000644000201500234410000000071712652366721015735 00000000000000varnishtest "Test banning a url" server s1 { rxreq expect req.url == "/foo" txresp -body "1111\n" rxreq expect req.url == "/foo" txresp -body "11111\n" } -start varnish v1 -vcl+backend { } -start client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 5 } client c1 -run varnish v1 -cli "ban req.url ~ foo" client c1 { txreq -url "/foo" rxresp expect resp.status == 200 expect resp.bodylen == 6 } client c1 -run varnish-4.1.1/bin/varnishtest/tests/v00019.vtc0000644000201500234410000000246512652366721015766 00000000000000varnishtest "VCL compiler coverage test: vcc_token.c" varnish v1 -errvcl {Unterminated inline C source, starting at} " C{ " varnish v1 -vcl { backend b { .host = "127.0.0.1"; } # comment sub vcl_recv { set req.url = "x"; } } varnish v1 -errvcl {Unterminated /* ... */ comment, starting at} { backend b { .host = "127.0.0.1"; } /* } varnish v1 -errvcl {Unterminated long-string, starting at} { backend b { .host = "127.0.0.1"; } {" } } varnish v1 -errvcl {Unterminated string at} { backend b { .host = "127.0.0.1"; } " } varnish v1 -cliok "param.set vcc_allow_inline_c true" -vcl { backend b { .host = "127.0.0.1"; } sub vcl_recv { C{ int i; (void)i; }C } } varnish v1 -errvcl {Syntax error at} { backend b { .host = "127.0.0.1"; } ? } varnish v1 -errvcl {Comparison of different types: STRING '==' INT} { backend b { .host = "127.0.0.1"; } sub vcl_recv { if ("foo" + "bar" == 777) { set req.http.host = 1; } } } varnish v1 -errvcl {Comparison of different types: STRING '==' INT} { backend b { .host = "127.0.0.1"; } sub vcl_recv { if ("foo" + "bar" == 777) { set req.http.host = 1; } } } varnish v1 -errvcl {Comparison of different types: STRING '==' INT} { backend b { .host = "127.0.0.1"; } sub vcl_recv { if ("foo" + "bar" == 777) { set req.http.host = 1; } } } varnish-4.1.1/bin/varnishtest/tests/l00000.vtc0000644000201500234410000000157112652366721015737 00000000000000varnishtest "test logexpect" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { } -start logexpect l1 -v v1 -g session { expect 0 1000 Begin sess expect 0 = SessOpen expect 0 = Link "req 1001" expect 0 = SessClose expect 0 = End expect 0 * Begin "req 1000" expect * = ReqStart expect 0 = ReqMethod GET expect 0 = ReqURL / expect 0 = ReqProtocol HTTP/1.1 expect * = ReqHeader "Foo: bar" expect * = Link bereq expect * = End expect 0 1002 Begin "bereq 1001" expect * = End } -start # Check with a query (this selects only the backend request) logexpect l2 -v v1 -g vxid -q "Begin ~ 'bereq 1001'" { expect 0 1002 Begin expect * = End } -start client c1 { txreq -hdr "Foo: bar" rxresp expect resp.status == 200 } -run logexpect l1 -wait logexpect l2 -wait # Check -d arg logexpect l1 -d 1 { expect 0 1000 Begin sess expect * = SessClose } -run varnish-4.1.1/bin/varnishtest/tests/d00005.vtc0000644000201500234410000000243712652366721015736 00000000000000varnishtest "Test round robin stacked within fallback" server s1 -repeat 2 { rxreq txresp -body "1" } -start server s2 -repeat 4 { rxreq txresp -body "22" } -start server s3 -repeat 2 { rxreq txresp -body "333" } -start server s4 -repeat 2 { rxreq txresp -body "4444" } -start varnish v1 -vcl+backend { import ${vmod_directors}; sub vcl_init { new rr1 = directors.round_robin(); rr1.add_backend(s1); rr1.add_backend(s2); new rr2 = directors.round_robin(); rr2.add_backend(s3); rr2.add_backend(s4); new fb = directors.fallback(); fb.add_backend(rr1.backend()); fb.add_backend(rr2.backend()); } sub vcl_recv { return (pass); } sub vcl_backend_fetch { set bereq.backend = fb.backend(); } } -start client c1 { txreq rxresp expect resp.body == "1" txreq rxresp expect resp.body == "22" txreq rxresp expect resp.body == "1" txreq rxresp expect resp.body == "22" } -run varnish v1 -cliok "backend.set_health s1 sick" client c1 { txreq rxresp expect resp.body == "22" txreq rxresp expect resp.body == "22" } -run varnish v1 -cliok "backend.set_health s2 sick" client c1 { txreq rxresp expect resp.body == "333" txreq rxresp expect resp.body == "4444" txreq rxresp expect resp.body == "333" txreq rxresp expect resp.body == "4444" } -run varnish-4.1.1/bin/varnishtest/tests/e00006.vtc0000644000201500234410000000127412652366721015736 00000000000000varnishtest "ESI include with http://" server s1 { rxreq expect req.url == "/foo/bar" txresp -body { Before include After include } } -start server s2 { rxreq expect req.url == "/body" txresp -body { Included file } } -start varnish v1 -vcl+backend { sub vcl_backend_fetch { if (bereq.http.host == "bozz") { set bereq.backend = s2; } else { set bereq.backend = s1; } } sub vcl_backend_response { set beresp.do_esi = true; } } -start client c1 { txreq -url /foo/bar -hdr "Host: froboz" rxresp expect resp.status == 200 expect resp.bodylen == 67 } client c1 -run varnish v1 -expect esi_errors == 0 varnish-4.1.1/bin/varnishtest/tests/v00010.vtc0000644000201500234410000000305012652366721015744 00000000000000varnishtest "VCL: check panic and restart" server s1 { rxreq txresp -hdr "Foo: bar" -body "abcdef\n" rxreq txresp -hdr "Panic: fetch" -body "012345\n" close sema r1 sync 2 accept rxreq txresp -hdr "Foo: bar" -body "abcdef\n" rxreq txresp -hdr "Panic: deliver" -body "012345\n" close sema r1 sync 2 accept rxreq txresp -hdr "Foo: foo" -body "abcdef\n" } -start varnish v1 -arg "-smalloc,1m" -vcl+backend { import ${vmod_debug}; sub vcl_backend_response { if (beresp.http.panic == "fetch") { debug.panic("Had Panic header: " + beresp.http.panic); } } sub vcl_deliver { if (resp.http.panic == "deliver") { debug.panic("Had Panic header: " + resp.http.panic); } } } -start varnish v1 -cliok "param.set feature +no_coredump" client c1 { txreq -url "/" rxresp txreq -url "/foo" # Don't expect answer, the server crashed. } -run varnish v1 -wait-stopped varnish v1 -cliok "panic.show" varnish v1 -cliok "panic.clear" varnish v1 -expect MGT.child_panic == 1 varnish v1 -clierr 300 "panic.clear" varnish v1 -cliok "start" varnish v1 -wait-running sema r1 sync 2 delay 0.5 client c1 { txreq -url "/" rxresp txreq -url "/foo" # Don't expect answer, the server crashed. } -run varnish v1 -wait-stopped varnish v1 -cliok "panic.show" varnish v1 -cliok "panic.clear -z" varnish v1 -expect MGT.child_panic == 0 varnish v1 -clierr 300 "panic.clear" varnish v1 -cliok "start" varnish v1 -wait-running sema r1 sync 2 delay 0.5 client c1 { txreq -url "/" rxresp expect resp.http.foo == "foo" } -run varnish v1 -cliok "panic.clear -z" varnish-4.1.1/bin/varnishtest/tests/r01768.vtc0000644000201500234410000000037212652366721015771 00000000000000varnishtest "http header collision -/_" server s1 { rxreq txresp } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.http.foo_bar == req.http.foo-bar) { set req.http.foo_bar = "xxx"; } } } -start client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/r01406.vtc0000644000201500234410000000104712652366721015756 00000000000000varnishtest "#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 varnish-4.1.1/bin/varnishtest/tests/r01672.vtc0000644000201500234410000000075112652366721015764 00000000000000varnishtest "#1672: Bogus 304 backend reply" # First serve a non-200 status object to the cache, # then revalidate it unconditionally server s1 { rxreq txresp -status 404 rxreq txresp -status 304 } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.ttl = 0.1s; set beresp.grace = 0s; set beresp.keep = 10s; } } -start client c1 { txreq rxresp expect resp.status == 404 } -run delay 0.2 client c1 { txreq rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/c00069.vtc0000644000201500234410000000112412652366721015737 00000000000000varnishtest "Test resp.is_streaming" server s1 { rxreq txresp -nolen -hdr "Content-Length: 10" delay 1 send "1234567890" } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.url == "/synth") { return(synth(200, "OK")); } } sub vcl_synth { set resp.http.streaming = resp.is_streaming; } sub vcl_deliver { set resp.http.streaming = resp.is_streaming; } } -start client c1 { txreq rxresp expect resp.http.streaming == "true" delay 0.1 txreq rxresp expect resp.http.streaming == "false" txreq -url /synth rxresp expect resp.http.streaming == "false" } -run varnish-4.1.1/bin/varnishtest/tests/c00032.vtc0000644000201500234410000000104212652366721015724 00000000000000varnishtest "Test Rollback" server s1 { rxreq expect req.url == "/foo" expect req.http.foobar == "harck-coff" txresp -status 400 accept rxreq expect req.url == "/bar" expect req.http.foobar == "snark" txresp -bodylen 5 } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.url == "/foo") { set req.http.foobar = "harck-coff"; } } sub vcl_deliver { if (resp.status == 400) { rollback; set req.url = "/bar"; return (restart); } } } -start client c1 { txreq -url "/foo" -hdr "foobar: snark" rxresp } -run varnish-4.1.1/bin/varnishtest/tests/r01765.vtc0000644000201500234410000000054012652366721015763 00000000000000varnishtest "subset headers in packed format" server s1 { rxreq txresp -hdr "Foo:bar" rxreq txresp -hdr "Foo:bax" } -start varnish v1 -vcl+backend { sub vcl_hit { if (obj.http.foo == "bar") { return (pass); } } } -start client c1 { txreq rxresp expect resp.http.foo == bar txreq rxresp expect resp.http.foo == bax } -run delay 1 varnish-4.1.1/bin/varnishtest/tests/r00878.vtc0000644000201500234410000000105512652366721015771 00000000000000varnishtest "Loading vmods in subsequent VCLs" server s1 { rxreq txresp -bodylen 4 } -start varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_deliver { set resp.http.who = debug.author(phk); } } -start client c1 { txreq rxresp } -run varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_deliver { set resp.http.who = debug.author(des); } } client c1 { txreq rxresp } -run varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_deliver { set resp.http.who = debug.author(kristian); } } client c1 { txreq rxresp } -run varnish-4.1.1/bin/varnishtest/tests/c00068.vtc0000644000201500234410000000172612652366721015746 00000000000000varnishtest "synth in deliver" server s1 { rxreq txresp -status 200 rxreq txresp -status 200 rxreq txresp -status 200 } -start varnish v1 -vcl+backend { sub vcl_deliver { if (req.url == "/332") { return (synth(332, "FOO")); } else if (req.url == "/333") { return (synth(333, "FOO")); } else { return (synth(334, "BAR")); } } sub vcl_synth { if (resp.status == 333) { set resp.http.connection = "close"; } else if (resp.status == 332) { if (req.restarts == 0) { return (restart); } else { set resp.http.restarts = req.restarts; synthetic(req.restarts); } } return (deliver); } } -start client c1 { txreq -url /334 rxresp expect resp.status == 334 # cache hit txreq -url /334 rxresp expect resp.status == 334 txreq -url /333 rxresp expect resp.status == 333 expect_close } -run client c2 { txreq -url /332 rxresp expect resp.status == 332 expect resp.http.restarts == 1 expect resp.bodylen == 1 } -run varnish-4.1.1/bin/varnishtest/tests/c00053.vtc0000644000201500234410000000100512652366721015726 00000000000000varnishtest "Test include vs. unsafe_path" server s1 { rxreq txresp -hdr "foo: bAr" -hdr "bar: fOo" -bodylen 4 } -start shell "echo > ${tmpdir}/_.c00053" varnish v1 -vcl+backend { include "${tmpdir}/_.c00053"; } varnish v1 -cliok "param.set vcc_unsafe_path off" varnish v1 -errvcl {' is unsafe} { backend default { .host = "${s1_sock}"; } include "${tmpdir}/_.c00053"; } varnish v1 -cliok "param.set vcl_dir ${tmpdir}" varnish v1 -vcl+backend { include "_.c00053"; } shell "rm -f ${tmpdir}/_.c00053" varnish-4.1.1/bin/varnishtest/tests/v00016.vtc0000644000201500234410000000546512652366721015766 00000000000000varnishtest "Various VCL compiler coverage tests" shell "true > ${tmpdir}/_varnishtest_empty_file" varnish v1 -vcl { backend b { .host = "127.0.0.1"; } include "${tmpdir}/_varnishtest_empty_file" ; } varnish v1 -errvcl {include not followed by semicolon.} { backend b { .host = "127.0.0.1"; } include "${tmpdir}/_varnishtest_empty_file" | } shell "rm -f ${tmpdir}/_varnishtest_empty_file" varnish v1 -errvcl {include not followed by string constant.} { backend b { .host = "127.0.0.1"; } include << } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_recv { if (req.url == "foo") { } elsif (req.url == "bar") { } elseif (req.url == "baz") { } } } varnish v1 -errvcl {include not followed by string constant.} { /* token test */ error lookup hash pipe pass fetch deliver discard keep restart include if else elseif elsif ++ -- && || <= == != >= >> << += -= *= /= { } ( ) * + - / % > < = ; ! & . | ~ , } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } /* Test string regexp matching and "else if" */ sub vcl_recv { if ((req.url ~ "foobar")) { return(pass); } else if (req.url ~ "snafu") { return(pipe); } else { return(pass); } } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } /* test time and backend comparison */ sub vcl_backend_response { if (beresp.ttl > 1d) { set beresp.ttl = 1d; } if (bereq.backend == b) { set beresp.ttl = 1d; } else if (bereq.backend != b) { set beresp.ttl = 1h; } } } varnish v1 -errvcl {Unknown time unit 'k'. Legal are 'ms', 's', 'm', 'h', 'd', 'w' and 'y'} { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { set beresp.ttl = 1. k; } } varnish v1 -errvcl {Expression has type DURATION, expected BOOL} { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { if (beresp.ttl *= 2) { } } } varnish v1 -errvcl {Operator > not possible on BACKEND} { backend a { .host = "127.0.0.1"; } backend b { .host = "127.0.0.1"; } sub vcl_recv { if (a > b) { } } } varnish v1 -errvcl {Symbol not found: 'req.hash' (expected type BOOL):} { backend b { .host = "127.0.0.1"; } sub vcl_hash { if (req.hash != "foo") { } } } varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_hash { if (2 == 3) { } } } varnish v1 -errvcl {Symbol not found: 'foo.bar'} { sub vcl_init { new bar = foo.bar(); } } varnish v1 -errvcl {'bereq.first_byte_timeout': cannot be set} { backend b { .host = "127.0.0.1"; } sub vcl_pipe { set bereq.first_byte_timeout = 10s; } } varnish v1 -errvcl {'bereq.between_bytes_timeout': cannot be set} { backend b { .host = "127.0.0.1"; } sub vcl_pipe { set bereq.between_bytes_timeout = 10s; } } varnish v1 -errvcl {Backend not found: 'c'} { backend b { .host = "127.0.0.1"; } sub vcl_backend_response { if (beresp.backend == c) { set beresp.ttl = 1h; } } } varnish-4.1.1/bin/varnishtest/tests/g00002.vtc0000644000201500234410000000225612652366721015735 00000000000000varnishtest "test basic gunzip for client" server s1 { rxreq expect req.http.accept-encoding == "gzip" expect req.url == "/foo" txresp -proto HTTP/1.0 -nolen -gziplen 4100 accept rxreq expect req.url == "/bar" txresp -body {

} } -start varnish v1 \ -arg "-smalloc,2m" \ -cliok "param.set http_gzip_support true" \ -cliok "param.set gzip_memlevel 1" \ -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; } } -start varnish v1 -cliok "param.set fetch_chunksize 4k" varnish v1 -cliok "param.set vsl_mask +VfpAcct" client c1 { txreq -url /foo -hdr "Accept-Encoding: gzip" rxresp gunzip expect resp.http.content-encoding == "gzip" expect resp.bodylen == 4100 } -run # If this fails, the multiple storage allocations did not happen varnish v1 -expect SMA.s0.c_req > 2 client c1 { # See varnish can gunzip it. txreq -url /foo -hdr "Accept-Encoding: null" rxresp expect resp.http.content-encoding == expect resp.bodylen == 4100 delay .1 # See varnish can gunzip it, inside ESI txreq -url /bar -hdr "Accept-Encoding: null" rxresp expect resp.http.content-encoding == expect resp.bodylen == 4109 } -run varnish-4.1.1/bin/varnishtest/tests/r01818.vtc0000644000201500234410000000227012652366721015764 00000000000000varnishtest "#1818: verify that grace works for hit_for_pass objects" server s1 { rxreq expect req.http.a == "1" txresp rxreq expect req.http.b == "1" sema r2 sync 2 sema r1 sync 2 txresp } -start server s2 { rxreq expect req.http.c == "1" sema r1 sync 2 txresp } -start varnish v1 -vcl+backend { sub vcl_recv { if (req.http.c) { set req.backend_hint = s2; } } sub vcl_miss { set req.http.miss = "1"; } sub vcl_pass { set req.http.pass = "1"; } sub vcl_deliver { if (req.http.miss) { set resp.http.miss = req.http.miss; } if (req.http.pass) { set resp.http.pass = req.http.pass; } } sub vcl_backend_response { set beresp.ttl = 0.1s; set beresp.grace = 1m; set beresp.uncacheable = true; } } -start varnish v1 -cliok "param.set debug +syncvsl" varnish v1 -cliok "param.set debug +waitinglist" varnish v1 -cliok "param.show debug" client c1 { # This is a plain miss txreq -hdr "a: 1" rxresp expect resp.http.miss == "1" delay .2 # This should also miss, because the HFP is expired txreq -hdr "b: 1" rxresp expect resp.http.miss == "1" } -start client c2 { sema r2 sync 2 txreq -hdr "c: 1" rxresp expect resp.http.pass == "1" } -run varnish-4.1.1/bin/varnishtest/tests/r01637.vtc0000644000201500234410000000162712652366721015770 00000000000000varnishtest "do_esi + do_gzip + out of storage: #1637" server s1 { # First consume (almost) all of the storage rxreq expect req.url == /url1 txresp -bodylen 260000 rxreq expect req.url == /url2 txresp -bodylen 260000 rxreq expect req.url == /url3 txresp -bodylen 260000 rxreq expect req.url == /url4 txresp -bodylen 260000 rxreq expect req.url == /url5 txresp -bodylen 9000 } -start varnish v1 -arg "-smalloc,1M" -arg "-p nuke_limit=0 -p gzip_level=0" \ -vcl+backend { sub vcl_backend_response { if (bereq.url == "/url5") { set beresp.do_esi = true; set beresp.do_gzip = true; } } } -start client c1 { txreq -url /url1 rxresp expect resp.status == 200 txreq -url /url2 rxresp expect resp.status == 200 txreq -url /url3 rxresp expect resp.status == 200 txreq -url /url4 rxresp expect resp.status == 200 txreq -url /url5 rxresp expect resp.status == 503 } -run varnish-4.1.1/bin/varnishtest/tests/r00433.vtc0000644000201500234410000000122312652366721015751 00000000000000varnishtest "noidx" server s1 { rxreq expect req.url == "/foo" txresp -hdr "Connection: close" send { FOO{ }FOO The end. } } -start server s2 { rxreq expect req.url == "/bar" txresp -body "bar" } -start varnish v1 -vcl+backend { sub vcl_backend_fetch { if (bereq.url == "/foo") { set bereq.backend = s1; } else { set bereq.backend = s2; } } sub vcl_backend_response { set beresp.do_esi = true; } } -start varnish v1 -cliok "param.set debug +syncvsl" varnish v1 -cliok "debug.fragfetch 32" client c1 { txreq -url /foo rxresp } -run varnish-4.1.1/bin/varnishtest/tests/r01691.vtc0000644000201500234410000000044312652366721015763 00000000000000varnishtest "Test bogus Content-Length header" server s1 { rxreq txresp -nolen -hdr "Content-Length: bogus" } -start varnish v1 -vcl+backend { } -start logexpect l1 -v v1 { expect * 1002 Error "Body cannot be fetched" } -start client c1 { txreq rxresp } -run logexpect l1 -wait varnish-4.1.1/bin/varnishtest/tests/c00039.vtc0000644000201500234410000000266712652366721015751 00000000000000varnishtest "request req and hdr length limits" server s1 { rxreq expect req.url == "/1" txresp -bodylen 5 rxreq expect req.url == "/2" txresp -bodylen 5 } -start varnish v1 \ -vcl+backend { } -start varnish v1 -cliok "param.set http_req_size 256" varnish v1 -cliok "param.set http_req_hdr_len 40" client c1 { txreq -url "/1" -hdr "1...5: ..0....5....0....5....0....5....0" rxresp expect resp.status == 200 txreq -url "/1" -hdr "1...5....0....5....0....5....0....5....0." rxresp expect resp.status == 400 } -run client c1 { txreq -url "/2" -hdr "1...5: ..0....5\n ..0....5....0....5....0" rxresp expect resp.status == 200 txreq -url "/2" -hdr "1...5....0....5\n ..0....5....0....5....0." rxresp expect resp.status == 400 } -run client c1 { txreq -url "/1" \ -hdr "1...5: ..0....5\n ..0....5....0....5....0" \ -hdr "1...5: ..0....5\n ..0....5....0....5....0" \ -hdr "1...5: ..0....5\n ..0....5....0....5....0" \ -hdr "1...5: ..0....5\n ..0....5....0....5....0" \ -hdr "1...5: ..0....5\n ..0....5....0....5....0" \ -hdr "1...5: ..0....5\n ..0...." rxresp expect resp.status == 200 txreq -url "/1" \ -hdr "1...5: ..0....5\n ..0....5....0....5....0" \ -hdr "1...5: ..0....5\n ..0....5....0....5....0" \ -hdr "1...5: ..0....5\n ..0....5....0....5....0" \ -hdr "1...5: ..0....5\n ..0....5....0....5....0" \ -hdr "1...5: ..0....5\n ..0....5....0....5....0" \ -hdr "1...5: ..0....5\n ..0....5" expect_close } -run varnish-4.1.1/bin/varnishtest/vtc_logexp.c0000644000201500234410000003141612652366721015563 00000000000000/*- * Copyright (c) 2008-2015 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. */ /* * Synopsis: * -v * -d <0|1> (head/tail mode) * -g * -q * * vsl arguments (vsl_arg.c) * -b Only display backend records * -c Only display client records * -C Caseless regular expressions * -i Include tags * -I <[taglist:]regex> Include by regex * -L Incomplete transaction limit * -T Transaction end timeout * * * logexpect lN -v [-g ] [-d 0|1] [-q query] [vsl arguments] { * expect * } * * skip: [uint|*] Max number of record to skip * vxid: [uint|*|=] vxid to match * tag: [tagname|*|=] Tag to match against * regex: regular expression to match against (optional) * *: Match anything * =: Match value of last successfully matched record */ #include "config.h" #include #include #include #include #include "vapi/vsm.h" #include "vapi/vsl.h" #include "vtim.h" #include "vre.h" #include "vtc.h" #define LE_ANY (-1) #define LE_LAST (-2) struct logexp_test { unsigned magic; #define LOGEXP_TEST_MAGIC 0x6F62B350 VTAILQ_ENTRY(logexp_test) list; struct vsb *str; int vxid; int tag; vre_t *vre; int skip_max; }; struct logexp { unsigned magic; #define LOGEXP_MAGIC 0xE81D9F1B VTAILQ_ENTRY(logexp) list; char *name; struct vtclog *vl; char run; VTAILQ_HEAD(,logexp_test) tests; struct logexp_test *test; int skip_cnt; int vxid_last; int tag_last; int d_arg; int g_arg; char *query; struct VSM_data *vsm; struct vsb *n_arg; struct VSL_data *vsl; struct VSLQ *vslq; pthread_t tp; }; static VTAILQ_HEAD(, logexp) logexps = VTAILQ_HEAD_INITIALIZER(logexps); static void logexp_delete_tests(struct logexp *le) { struct logexp_test *test; CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); while ((test = VTAILQ_FIRST(&le->tests))) { CHECK_OBJ_NOTNULL(test, LOGEXP_TEST_MAGIC); VTAILQ_REMOVE(&le->tests, test, list); VSB_delete(test->str); if (test->vre) VRE_free(&test->vre); FREE_OBJ(test); } } static void logexp_delete(struct logexp *le) { CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); AZ(le->run); AN(le->vsl); VSL_Delete(le->vsl); AZ(le->vslq); logexp_delete_tests(le); free(le->name); free(le->query); VSM_Delete(le->vsm); if (le->n_arg) VSB_delete(le->n_arg); FREE_OBJ(le); } static struct logexp * logexp_new(const char *name) { struct logexp *le; AN(name); ALLOC_OBJ(le, LOGEXP_MAGIC); AN(le); REPLACE(le->name, name); le->vl = vtc_logopen(name); VTAILQ_INIT(&le->tests); le->d_arg = 0; le->g_arg = VSL_g_vxid; le->vsm = VSM_New(); le->vsl = VSL_New(); AN(le->vsm); AN(le->vsl); VTAILQ_INSERT_TAIL(&logexps, le, list); return (le); } static void logexp_next(struct logexp *le) { CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); if (le->test) { CHECK_OBJ_NOTNULL(le->test, LOGEXP_TEST_MAGIC); le->test = VTAILQ_NEXT(le->test, list); } else le->test = VTAILQ_FIRST(&le->tests); CHECK_OBJ_ORNULL(le->test, LOGEXP_TEST_MAGIC); if (le->test) vtc_log(le->vl, 3, "waitfor| %s", VSB_data(le->test->str)); } static int __match_proto__(VSLQ_dispatch_f) logexp_dispatch(struct VSL_data *vsl, struct VSL_transaction * const pt[], void *priv) { struct logexp *le; struct VSL_transaction *t; int i; int ok, skip; int vxid, tag, type, len; const char *legend, *data; (void)vsl; CAST_OBJ_NOTNULL(le, priv, LOGEXP_MAGIC); for (i = 0; (t = pt[i]); i++) { while (1 == VSL_Next(t->c)) { CHECK_OBJ_NOTNULL(le->test, LOGEXP_TEST_MAGIC); AN(t->c->rec.ptr); vxid = VSL_ID(t->c->rec.ptr); tag = VSL_TAG(t->c->rec.ptr); data = VSL_CDATA(t->c->rec.ptr); len = VSL_LEN(t->c->rec.ptr) - 1; if (tag == SLT__Batch) continue; ok = 1; if (le->test->vxid == LE_LAST) { if (le->vxid_last != vxid) ok = 0; } else if (le->test->vxid >= 0) { if (le->test->vxid != vxid) ok = 0; } if (le->test->tag == LE_LAST) { if (le->tag_last != tag) ok = 0; } else if (le->test->tag >= 0) { if (le->test->tag != tag) ok = 0; } if (le->test->vre && le->test->tag >= 0 && le->test->tag == tag && VRE_ERROR_NOMATCH == VRE_exec(le->test->vre, data, len, 0, 0, NULL, 0, NULL)) ok = 0; skip = 0; if (!ok && (le->test->skip_max == LE_ANY || le->test->skip_max > le->skip_cnt)) skip = 1; if (ok) legend = "match"; else if (skip) legend = NULL; else legend = "err"; type = VSL_CLIENT(t->c->rec.ptr) ? 'c' : VSL_BACKEND(t->c->rec.ptr) ? 'b' : '-'; if (legend != NULL) vtc_log(le->vl, 4, "%3s| %10u %-15s %c %.*s", legend, vxid, VSL_tags[tag], type, len, data); if (ok) { le->vxid_last = vxid; le->tag_last = tag; le->skip_cnt = 0; logexp_next(le); if (le->test == NULL) /* End of test script */ return (1); } else if (skip) le->skip_cnt++; else { /* Signal fail */ return (2); } } } return (0); } static void * logexp_thread(void *priv) { struct logexp *le; int i; CAST_OBJ_NOTNULL(le, priv, LOGEXP_MAGIC); AN(le->run); AN(le->vsm); AN(le->vslq); AZ(le->test); vtc_log(le->vl, 4, "beg|"); if (le->query != NULL) vtc_log(le->vl, 4, "qry| %s", le->query); logexp_next(le); while (le->test) { i = VSLQ_Dispatch(le->vslq, logexp_dispatch, le); if (i == 2) vtc_log(le->vl, 0, "bad| expectation failed"); else if (i < 0) vtc_log(le->vl, 0, "bad| dispatch failed (%d)", i); else if (i == 0 && le->test) VTIM_sleep(0.01); } vtc_log(le->vl, 4, "end|"); return (NULL); } static void logexp_close(struct logexp *le) { CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); AN(le->vsm); if (le->vslq) VSLQ_Delete(&le->vslq); AZ(le->vslq); VSM_Close(le->vsm); } static void logexp_start(struct logexp *le) { struct VSL_cursor *c; CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); AN(le->vsl); AZ(le->vslq); if (le->n_arg == NULL) { vtc_log(le->vl, 0, "-v argument not given"); return; } if (VSM_n_Arg(le->vsm, VSB_data(le->n_arg)) <= 0) { vtc_log(le->vl, 0, "-v argument error: %s", VSM_Error(le->vsm)); return; } if (VSM_Open(le->vsm)) { vtc_log(le->vl, 0, "VSM_Open: %s", VSM_Error(le->vsm)); return; } AN(le->vsl); c = VSL_CursorVSM(le->vsl, le->vsm, (le->d_arg ? 0 : VSL_COPT_TAIL) | VSL_COPT_BATCH); if (c == NULL) { vtc_log(le->vl, 0, "VSL_CursorVSM: %s", VSL_Error(le->vsl)); logexp_close(le); return; } le->vslq = VSLQ_New(le->vsl, &c, le->g_arg, le->query); if (le->vslq == NULL) { VSL_DeleteCursor(c); vtc_log(le->vl, 0, "VSLQ_New: %s", VSL_Error(le->vsl)); AZ(le->vslq); logexp_close(le); return; } AZ(c); le->test = NULL; le->skip_cnt = 0; le->vxid_last = le->tag_last = -1; le->run = 1; AZ(pthread_create(&le->tp, NULL, logexp_thread, le)); } static void logexp_wait(struct logexp *le) { void *res; CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); vtc_log(le->vl, 2, "Waiting for logexp"); AZ(pthread_join(le->tp, &res)); logexp_close(le); if (res != NULL && !vtc_stop) vtc_log(le->vl, 0, "logexp returned \"%p\"", (char *)res); le->run = 0; } static void cmd_logexp_expect(CMD_ARGS) { struct logexp *le; int skip_max; int vxid; int tag; vre_t *vre; const char *err; int pos; struct logexp_test *test; char *end; (void)cmd; CAST_OBJ_NOTNULL(le, priv, LOGEXP_MAGIC); if (av[1] == NULL || av[2] == NULL || av[3] == NULL) { vtc_log(vl, 0, "Syntax error"); return; } if (!strcmp(av[1], "*")) skip_max = LE_ANY; else { skip_max = (int)strtol(av[1], &end, 10); if (*end != '\0' || skip_max < 0) { vtc_log(vl, 0, "Not a positive integer: '%s'", av[1]); return; } } if (!strcmp(av[2], "*")) vxid = LE_ANY; else if (!strcmp(av[2], "=")) vxid = LE_LAST; else { vxid = (int)strtol(av[2], &end, 10); if (*end != '\0' || vxid < 0) { vtc_log(vl, 0, "Not a positive integer: '%s'", av[2]); return; } } if (!strcmp(av[3], "*")) tag = LE_ANY; else if (!strcmp(av[3], "=")) tag = LE_LAST; else { tag = VSL_Name2Tag(av[3], strlen(av[3])); if (tag < 0) { vtc_log(vl, 0, "Unknown tag name: '%s'", av[3]); return; } } vre = NULL; if (av[4]) { vre = VRE_compile(av[4], 0, &err, &pos); if (vre == NULL) { vtc_log(vl, 0, "Regex error (%s): '%s' pos %d", err, av[4], pos); return; } } ALLOC_OBJ(test, LOGEXP_TEST_MAGIC); AN(test); test->str = VSB_new_auto(); AN(test->str); AZ(VSB_printf(test->str, "%s %s %s %s ", av[0], av[1], av[2], av[3])); if (av[4]) VSB_quote(test->str, av[4], -1, 0); AZ(VSB_finish(test->str)); test->skip_max = skip_max; test->vxid = vxid; test->tag = tag; test->vre = vre; VTAILQ_INSERT_TAIL(&le->tests, test, list); } static const struct cmds logexp_cmds[] = { { "expect", cmd_logexp_expect }, { NULL, NULL }, }; static void logexp_spec(struct logexp *le, const char *spec) { CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); logexp_delete_tests(le); parse_string(spec, logexp_cmds, le, le->vl); } void cmd_logexp(CMD_ARGS) { struct logexp *le, *le2; const char tmpdir[] = "${tmpdir}"; struct vsb *vsb; (void)priv; (void)cmd; (void)vl; if (av == NULL) { /* Reset and free */ VTAILQ_FOREACH_SAFE(le, &logexps, list, le2) { CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); VTAILQ_REMOVE(&logexps, le, list); if (le->run) { (void)pthread_cancel(le->tp); logexp_wait(le); } logexp_delete(le); } return; } AZ(strcmp(av[0], "logexpect")); av++; VTAILQ_FOREACH(le, &logexps, list) { if (!strcmp(le->name, av[0])) break; } if (le == NULL) le = logexp_new(av[0]); av++; for (; *av != NULL; av++) { if (vtc_error) break; if (!strcmp(*av, "-wait")) { if (!le->run) { vtc_log(le->vl, 0, "logexp not -started '%s'", *av); return; } logexp_wait(le); continue; } /* * We do an implict -wait if people muck about with a * running logexp. */ if (le->run) logexp_wait(le); AZ(le->run); if (!strcmp(*av, "-v")) { if (av[1] == NULL) { vtc_log(le->vl, 0, "Missing -v argument"); return; } if (le->n_arg != NULL) { VSB_delete(le->n_arg); le->n_arg = NULL; } vsb = VSB_new_auto(); AN(vsb); AZ(VSB_printf(vsb, "%s/%s", tmpdir, av[1])); AZ(VSB_finish(vsb)); le->n_arg = macro_expand(le->vl, VSB_data(vsb)); VSB_delete(vsb); if (le->n_arg == NULL) return; av++; continue; } if (!strcmp(*av, "-d")) { if (av[1] == NULL) { vtc_log(le->vl, 0, "Missing -d argument"); return; } le->d_arg = atoi(av[1]); av++; continue; } if (!strcmp(*av, "-g")) { if (av[1] == NULL) { vtc_log(le->vl, 0, "Missing -g argument"); return; } le->g_arg = VSLQ_Name2Grouping(av[1], strlen(av[1])); if (le->g_arg < 0) { vtc_log(le->vl, 0, "Unknown grouping '%s'", av[1]); return; } av++; continue; } if (!strcmp(*av, "-q")) { if (av[1] == NULL) { vtc_log(le->vl, 0, "Missing -q argument"); return; } REPLACE(le->query, av[1]); av++; continue; } if (!strcmp(*av, "-start")) { logexp_start(le); continue; } if (!strcmp(*av, "-run")) { logexp_start(le); logexp_wait(le); continue; } if (**av == '-') { if (av[1] != NULL) { if (VSL_Arg(le->vsl, av[0][1], av[1])) { av++; continue; } vtc_log(le->vl, 0, "%s", VSL_Error(le->vsl)); return; } vtc_log(le->vl, 0, "Unknown logexp argument: %s", *av); return; } logexp_spec(le, *av); } } varnish-4.1.1/bin/varnishtest/vtc_varnish.c0000644000201500234410000005464012652366721015743 00000000000000/*- * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "vtc.h" #include "vapi/vsc.h" #include "vapi/vsl.h" #include "vapi/vsm.h" #include "vcli.h" #include "vss.h" #include "vsub.h" #include "vtcp.h" #include "vtim.h" extern int leave_temp; struct varnish { unsigned magic; #define VARNISH_MAGIC 0x208cd8e3 char *name; struct vtclog *vl; VTAILQ_ENTRY(varnish) list; struct vsb *args; int fds[4]; pid_t pid; pthread_t tp; pthread_t tp_vsl; int cli_fd; int vcl_nbr; char *workdir; char *jail; char *proto; struct VSM_data *vd; /* vsc use */ unsigned vsl_tag_count[256]; volatile int vsl_idle; }; #define NONSENSE "%XJEIFLH|)Xspa8P" static VTAILQ_HEAD(, varnish) varnishes = VTAILQ_HEAD_INITIALIZER(varnishes); /********************************************************************** * Ask a question over CLI */ static enum VCLI_status_e varnish_ask_cli(const struct varnish *v, const char *cmd, char **repl) { int i; unsigned retval; char *r; if (cmd != NULL) { vtc_dump(v->vl, 4, "CLI TX", cmd, -1); i = write(v->cli_fd, cmd, strlen(cmd)); if (i != strlen(cmd)) vtc_log(v->vl, 0, "CLI write failed (%s) = %u %s", cmd, errno, strerror(errno)); i = write(v->cli_fd, "\n", 1); if (i != 1) vtc_log(v->vl, 0, "CLI write failed (%s) = %u %s", cmd, errno, strerror(errno)); } i = VCLI_ReadResult(v->cli_fd, &retval, &r, 30.0); if (i != 0) { vtc_log(v->vl, 0, "CLI failed (%s) = %d %u %s", cmd, i, retval, r); return ((enum VCLI_status_e)retval); } AZ(i); vtc_log(v->vl, 3, "CLI RX %u", retval); vtc_dump(v->vl, 4, "CLI RX", r, -1); if (repl != NULL) *repl = r; else free(r); return ((enum VCLI_status_e)retval); } /********************************************************************** * */ static void wait_stopped(const struct varnish *v) { char *r; enum VCLI_status_e st; while (1) { vtc_log(v->vl, 3, "wait-stopped"); st = varnish_ask_cli(v, "status", &r); if (st != CLIS_OK) vtc_log(v->vl, 0, "CLI status command failed: %u %s", st, r); if (!strcmp(r, "Child in state stopped")) { free(r); break; } free(r); (void)usleep(200000); } } /********************************************************************** * */ static void wait_running(const struct varnish *v) { char *r; enum VCLI_status_e st; while (1) { vtc_log(v->vl, 3, "wait-running"); st = varnish_ask_cli(v, "status", &r); if (st != CLIS_OK) vtc_log(v->vl, 0, "CLI status command failed: %u %s", st, r); if (!strcmp(r, "Child in state stopped")) { vtc_log(v->vl, 0, "Child stopped before running: %u %s", st, r); free(r); break; } if (!strcmp(r, "Child in state running")) { free(r); break; } free(r); (void)usleep(200000); } } /********************************************************************** * Varnishlog gatherer thread */ static void * varnishlog_thread(void *priv) { struct varnish *v; struct VSL_data *vsl; struct VSM_data *vsm; struct VSL_cursor *c; enum VSL_tag_e tag; uint32_t vxid; unsigned len; const char *tagname, *data; int type, i, opt; CAST_OBJ_NOTNULL(v, priv, VARNISH_MAGIC); vsl = VSL_New(); AN(vsl); vsm = VSM_New(); AN(vsm); (void)VSM_n_Arg(vsm, v->workdir); c = NULL; opt = 0; while (v->pid) { if (c == NULL) { v->vsl_idle++; VTIM_sleep(0.1); if (VSM_Open(vsm)) { VSM_ResetError(vsm); continue; } c = VSL_CursorVSM(vsl, vsm, opt); if (c == NULL) { VSL_ResetError(vsl); continue; } } AN(c); opt = VSL_COPT_TAIL; i = VSL_Next(c); if (i == 0) { v->vsl_idle++; /* Nothing to do but wait */ VTIM_sleep(0.1); continue; } else if (i == -2) { /* Abandoned - try reconnect */ VSL_DeleteCursor(c); c = NULL; VSM_Close(vsm); continue; } else if (i != 1) break; v->vsl_idle = 0; tag = VSL_TAG(c->rec.ptr); vxid = VSL_ID(c->rec.ptr); if (tag != SLT_CLI) v->vsl_idle = 0; if (tag == SLT__Batch) continue; tagname = VSL_tags[tag]; len = VSL_LEN(c->rec.ptr); type = VSL_CLIENT(c->rec.ptr) ? 'c' : VSL_BACKEND(c->rec.ptr) ? 'b' : '-'; data = VSL_CDATA(c->rec.ptr); v->vsl_tag_count[tag]++; vtc_log(v->vl, 4, "vsl| %10u %-15s %c %.*s", vxid, tagname, type, (int)len, data); } v->vsl_idle = 100; if (c) VSL_DeleteCursor(c); VSL_Delete(vsl); VSM_Delete(vsm); return (NULL); } /********************************************************************** * Allocate and initialize a varnish */ static struct varnish * varnish_new(const char *name) { struct varnish *v; struct vsb *vsb; char buf[1024]; AN(name); ALLOC_OBJ(v, VARNISH_MAGIC); AN(v); REPLACE(v->name, name); REPLACE(v->jail, ""); v->vl = vtc_logopen(name); AN(v->vl); bprintf(buf, "${tmpdir}/%s", name); vsb = macro_expand(v->vl, buf); AN(vsb); v->workdir = strdup(VSB_data(vsb)); AN(v->workdir); VSB_delete(vsb); bprintf(buf, "rm -rf %s ; mkdir -p %s", v->workdir, v->workdir); AZ(system(buf)); if (*v->name != 'v') vtc_log(v->vl, 0, "Varnish name must start with 'v'"); v->args = VSB_new_auto(); v->cli_fd = -1; VTAILQ_INSERT_TAIL(&varnishes, v, list); return (v); } /********************************************************************** * Delete a varnish instance */ static void varnish_delete(struct varnish *v) { CHECK_OBJ_NOTNULL(v, VARNISH_MAGIC); vtc_logclose(v->vl); free(v->name); free(v->workdir); if (v->vd != NULL) VSM_Delete(v->vd); /* * We do not delete the workdir, it may contain stuff people * want (coredumps, shmlog/stats etc), and trying to divine * "may want" is just too much trouble. Leave it around and * nuke it at the start of the next test-run. */ /* XXX: MEMLEAK (?) */ FREE_OBJ(v); } /********************************************************************** * Varnish listener */ static void * varnish_thread(void *priv) { struct varnish *v; char buf[65536]; struct pollfd fds[1]; int i; CAST_OBJ_NOTNULL(v, priv, VARNISH_MAGIC); (void)VTCP_nonblocking(v->fds[0]); while (1) { memset(fds, 0, sizeof fds); fds->fd = v->fds[0]; fds->events = POLLIN; i = poll(fds, 1, 1000); if (i == 0) continue; if (fds->revents & POLLIN) { i = read(v->fds[0], buf, sizeof buf - 1); if (i > 0) { buf[i] = '\0'; vtc_dump(v->vl, 3, "debug", buf, -2); } } if (fds->revents & (POLLERR|POLLHUP)) { vtc_log(v->vl, 4, "STDOUT poll 0x%x", fds->revents); break; } } return (NULL); } /********************************************************************** * Launch a Varnish */ static void varnish_launch(struct varnish *v) { struct vsb *vsb, *vsb1; int i, nfd; char abuf[128], pbuf[128]; struct pollfd fd[2]; enum VCLI_status_e u; const char *err; char *r; v->vd = VSM_New(); /* Create listener socket */ v->cli_fd = VTCP_listen_on("127.0.0.1:0", NULL, 1, &err); if (err != NULL) vtc_log(v->vl, 0, "Create CLI listen socket failed: %s", err); assert(v->cli_fd > 0); VTCP_myname(v->cli_fd, abuf, sizeof abuf, pbuf, sizeof pbuf); AZ(VSB_finish(v->args)); vtc_log(v->vl, 2, "Launch"); vsb = VSB_new_auto(); AN(vsb); VSB_printf(vsb, "cd ${pwd} &&"); VSB_printf(vsb, " exec ${varnishd} %s -d -n %s", v->jail, v->workdir); if (vtc_witness) VSB_cat(vsb, " -p debug=+witness"); if (leave_temp) VSB_cat(vsb, " -p debug=+vsm_keep"); VSB_printf(vsb, " -l 2m,1m,-"); VSB_printf(vsb, " -p auto_restart=off"); VSB_printf(vsb, " -p syslog_cli_traffic=off"); VSB_printf(vsb, " -p sigsegv_handler=on"); VSB_printf(vsb, " -p thread_pool_min=10"); VSB_printf(vsb, " -p debug=+vtc_mode"); VSB_printf(vsb, " -a '%s'", "127.0.0.1:0"); if (v->proto != NULL) VSB_printf(vsb, ",%s", v->proto); VSB_printf(vsb, " -M '%s %s'", abuf, pbuf); VSB_printf(vsb, " -P %s/varnishd.pid", v->workdir); VSB_printf(vsb, " %s", VSB_data(v->args)); AZ(VSB_finish(vsb)); vtc_log(v->vl, 3, "CMD: %s", VSB_data(vsb)); vsb1 = macro_expand(v->vl, VSB_data(vsb)); AN(vsb1); VSB_delete(vsb); vsb = vsb1; vtc_log(v->vl, 3, "CMD: %s", VSB_data(vsb)); AZ(pipe(&v->fds[0])); AZ(pipe(&v->fds[2])); v->pid = fork(); assert(v->pid >= 0); if (v->pid == 0) { AZ(dup2(v->fds[0], 0)); assert(dup2(v->fds[3], 1) == 1); assert(dup2(1, 2) == 2); AZ(close(v->fds[0])); AZ(close(v->fds[1])); AZ(close(v->fds[2])); AZ(close(v->fds[3])); VSUB_closefrom(STDERR_FILENO + 1); AZ(execl("/bin/sh", "/bin/sh", "-c", VSB_data(vsb), (char*)0)); exit(1); } else { vtc_log(v->vl, 3, "PID: %ld", (long)v->pid); macro_def(v->vl, v->name, "pid", "%ld", (long)v->pid); macro_def(v->vl, v->name, "name", "%s", v->workdir); } AZ(close(v->fds[0])); AZ(close(v->fds[3])); v->fds[0] = v->fds[2]; v->fds[2] = v->fds[3] = -1; VSB_delete(vsb); AZ(pthread_create(&v->tp, NULL, varnish_thread, v)); AZ(pthread_create(&v->tp_vsl, NULL, varnishlog_thread, v)); /* Wait for the varnish to call home */ memset(fd, 0, sizeof fd); fd[0].fd = v->cli_fd; fd[0].events = POLLIN; fd[1].fd = v->fds[1]; fd[1].events = POLLIN; i = poll(fd, 2, 10000); vtc_log(v->vl, 4, "CLIPOLL %d 0x%x 0x%x", i, fd[0].revents, fd[1].revents); if (i == 0) { vtc_log(v->vl, 0, "FAIL timeout waiting for CLI connection"); return; } if (fd[1].revents & POLLHUP) { vtc_log(v->vl, 0, "FAIL debug pipe closed"); return; } if (!(fd[0].revents & POLLIN)) { vtc_log(v->vl, 0, "FAIL CLI connection wait failure"); return; } nfd = accept(v->cli_fd, NULL, NULL); if (nfd < 0) { vtc_log(v->vl, 0, "FAIL no CLI connection accepted"); return; } AZ(close(v->cli_fd)); v->cli_fd = nfd; vtc_log(v->vl, 3, "CLI connection fd = %d", v->cli_fd); assert(v->cli_fd >= 0); /* Receive the banner or auth response */ u = varnish_ask_cli(v, NULL, &r); if (vtc_error) return; if (u != CLIS_AUTH) vtc_log(v->vl, 0, "CLI auth demand expected: %u %s", u, r); bprintf(abuf, "%s/_.secret", v->workdir); nfd = open(abuf, O_RDONLY); assert(nfd >= 0); assert(sizeof abuf >= CLI_AUTH_RESPONSE_LEN + 7); strcpy(abuf, "auth "); VCLI_AuthResponse(nfd, r, abuf + 5); AZ(close(nfd)); free(r); strcat(abuf, "\n"); u = varnish_ask_cli(v, abuf, &r); if (vtc_error) return; if (u != CLIS_OK) vtc_log(v->vl, 0, "CLI auth command failed: %u %s", u, r); free(r); (void)VSM_n_Arg(v->vd, v->workdir); AZ(VSM_Open(v->vd)); } /********************************************************************** * Start a Varnish */ static void varnish_start(struct varnish *v) { enum VCLI_status_e u; char *resp, *h, *p; if (v->cli_fd < 0) varnish_launch(v); if (vtc_error) return; vtc_log(v->vl, 2, "Start"); u = varnish_ask_cli(v, "start", &resp); if (vtc_error) return; if (u != CLIS_OK) vtc_log(v->vl, 0, "CLI start command failed: %u %s", u, resp); wait_running(v); free(resp); u = varnish_ask_cli(v, "debug.xid 999", &resp); if (vtc_error) return; if (u != CLIS_OK) vtc_log(v->vl, 0, "CLI debug.xid command failed: %u %s", u, resp); free(resp); u = varnish_ask_cli(v, "debug.listen_address", &resp); if (vtc_error) return; if (u != CLIS_OK) vtc_log(v->vl, 0, "CLI debug.listen_address command failed: %u %s", u, resp); h = resp; p = strchr(h, '\n'); if (p != NULL) *p = '\0'; p = strchr(h, ' '); AN(p); *p++ = '\0'; vtc_log(v->vl, 2, "Listen on %s %s", h, p); macro_def(v->vl, v->name, "addr", "%s", h); macro_def(v->vl, v->name, "port", "%s", p); macro_def(v->vl, v->name, "sock", "%s %s", h, p); } /********************************************************************** * Stop a Varnish */ static void varnish_stop(struct varnish *v) { char *r; if (v->cli_fd < 0) varnish_launch(v); if (vtc_error) return; vtc_log(v->vl, 2, "Stop"); (void)varnish_ask_cli(v, "stop", NULL); while (1) { r = NULL; (void)varnish_ask_cli(v, "status", &r); AN(r); if (!strcmp(r, "Child in state stopped")) break; free(r); (void)sleep (1); /* XXX: should fail eventually */ } } /********************************************************************** * Cleanup */ static void varnish_cleanup(struct varnish *v) { void *p; int status, r; struct rusage ru; /* Give the VSL log time to finish */ while (v->vsl_idle < 10) (void)usleep(200000); /* Close the CLI connection */ AZ(close(v->cli_fd)); v->cli_fd = -1; /* Close the STDIN connection. */ AZ(close(v->fds[1])); /* Wait until STDOUT+STDERR closes */ AZ(pthread_join(v->tp, &p)); AZ(close(v->fds[0])); r = wait4(v->pid, &status, 0, &ru); v->pid = 0; vtc_log(v->vl, 2, "R %d Status: %04x (u %.6f s %.6f)", r, status, ru.ru_utime.tv_sec + 1e-6 * ru.ru_utime.tv_usec, ru.ru_stime.tv_sec + 1e-6 * ru.ru_stime.tv_usec ); /* Pick up the VSL thread */ AZ(pthread_join(v->tp_vsl, &p)); if (WIFEXITED(status) && (WEXITSTATUS(status) == 0)) return; #ifdef WCOREDUMP vtc_log(v->vl, 0, "Bad exit code: %04x sig %x exit %x core %x", status, WTERMSIG(status), WEXITSTATUS(status), WCOREDUMP(status)); #else vtc_log(v->vl, 0, "Bad exit code: %04x sig %x exit %x", status, WTERMSIG(status), WEXITSTATUS(status)); #endif } /********************************************************************** * Wait for a Varnish */ static void varnish_wait(struct varnish *v) { char *resp; if (v->cli_fd < 0) return; vtc_log(v->vl, 2, "Wait"); /* Do a backend.list to log if child is still running */ varnish_ask_cli(v, "backend.list", &resp); /* Then stop it */ varnish_stop(v); varnish_cleanup(v); } /********************************************************************** * Ask a CLI question */ static void varnish_cli(struct varnish *v, const char *cli, unsigned exp) { enum VCLI_status_e u; if (v->cli_fd < 0) varnish_launch(v); if (vtc_error) return; u = varnish_ask_cli(v, cli, NULL); vtc_log(v->vl, 2, "CLI %03u <%s>", u, cli); if (exp != 0 && exp != (unsigned)u) vtc_log(v->vl, 0, "FAIL CLI response %u expected %u", u, exp); } /********************************************************************** * Load a VCL program */ static void varnish_vcl(struct varnish *v, const char *vcl, enum VCLI_status_e expect, char **resp) { struct vsb *vsb; enum VCLI_status_e u; if (v->cli_fd < 0) varnish_launch(v); if (vtc_error) return; vsb = VSB_new_auto(); AN(vsb); VSB_printf(vsb, "vcl.inline vcl%d << %s\nvcl 4.0;\n%s\n%s\n", ++v->vcl_nbr, NONSENSE, vcl, NONSENSE); AZ(VSB_finish(vsb)); u = varnish_ask_cli(v, VSB_data(vsb), resp); if (u != expect) { VSB_delete(vsb); vtc_log(v->vl, 0, "VCL compilation got %u expected %u", u, expect); return; } if (u == CLIS_OK) { VSB_clear(vsb); VSB_printf(vsb, "vcl.use vcl%d", v->vcl_nbr); AZ(VSB_finish(vsb)); u = varnish_ask_cli(v, VSB_data(vsb), NULL); assert(u == CLIS_OK); } else { vtc_log(v->vl, 2, "VCL compilation failed (as expected)"); } VSB_delete(vsb); } /********************************************************************** * Load a VCL program prefixed by backend decls for our servers */ static void varnish_vclbackend(struct varnish *v, const char *vcl) { struct vsb *vsb, *vsb2; enum VCLI_status_e u; if (v->cli_fd < 0) varnish_launch(v); if (vtc_error) return; vsb = VSB_new_auto(); AN(vsb); vsb2 = VSB_new_auto(); AN(vsb2); VSB_printf(vsb2, "vcl 4.0;\n"); cmd_server_genvcl(vsb2); AZ(VSB_finish(vsb2)); VSB_printf(vsb, "vcl.inline vcl%d << %s\n%s\n%s\n%s\n", ++v->vcl_nbr, NONSENSE, VSB_data(vsb2), vcl, NONSENSE); AZ(VSB_finish(vsb)); u = varnish_ask_cli(v, VSB_data(vsb), NULL); if (u != CLIS_OK) { VSB_delete(vsb); VSB_delete(vsb2); vtc_log(v->vl, 0, "FAIL VCL does not compile"); return; } VSB_clear(vsb); VSB_printf(vsb, "vcl.use vcl%d", v->vcl_nbr); AZ(VSB_finish(vsb)); u = varnish_ask_cli(v, VSB_data(vsb), NULL); assert(u == CLIS_OK); VSB_delete(vsb); VSB_delete(vsb2); } /********************************************************************** * Check statistics */ struct stat_priv { char target_type[256]; char target_ident[256]; char target_name[256]; uintmax_t val; const struct varnish *v; }; static int do_stat_cb(void *priv, const struct VSC_point * const pt) { struct stat_priv *sp = priv; if (pt == NULL) return(0); if (strcmp(pt->section->type, sp->target_type)) return(0); if (strcmp(pt->section->ident, sp->target_ident)) return(0); if (strcmp(pt->desc->name, sp->target_name)) return(0); AZ(strcmp(pt->desc->ctype, "uint64_t")); sp->val = *(const volatile uint64_t*)pt->ptr; return (1); } static void varnish_expect(const struct varnish *v, char * const *av) { uint64_t ref; int good; char *r; char *p; char *q; int i, not = 0; struct stat_priv sp; r = av[0]; if (r[0] == '!') { not = 1; r++; AZ(av[1]); } else { AN(av[1]); AN(av[2]); } p = strchr(r, '.'); if (p == NULL) { strcpy(sp.target_type, "MAIN"); sp.target_ident[0] = '\0'; bprintf(sp.target_name, "%s", r); } else { bprintf(sp.target_type, "%.*s", (int)(p - r), r); p++; q = strrchr(p, '.'); if (q == NULL) { sp.target_ident[0] = '\0'; bprintf(sp.target_name, "%s", p); } else { bprintf(sp.target_ident, "%.*s", (int)(q - p), p); bprintf(sp.target_name, "%s", q + 1); } } sp.val = 0; sp.v = v; ref = 0; good = 0; for (i = 0; i < 10; i++, (void)usleep(100000)) { if (VSM_Abandoned(v->vd)) { VSM_Close(v->vd); good = VSM_Open(v->vd); } if (good < 0) continue; good = VSC_Iter(v->vd, NULL, do_stat_cb, &sp); if (!good) { good = -2; continue; } if (not) { vtc_log(v->vl, 0, "Found (not expected): %s", av[0]+1); return; } good = 0; ref = strtoumax(av[2], &p, 0); if (ref == UINTMAX_MAX || *p) vtc_log(v->vl, 0, "Syntax error in number (%s)", av[2]); if (!strcmp(av[1], "==")) { if (sp.val == ref) good = 1; } else if (!strcmp(av[1], "!=")) { if (sp.val != ref) good = 1; } else if (!strcmp(av[1], ">")) { if (sp.val > ref) good = 1; } else if (!strcmp(av[1], "<")) { if (sp.val < ref) good = 1; } else if (!strcmp(av[1], ">=")) { if (sp.val >= ref) good = 1; } else if (!strcmp(av[1], "<=")) { if (sp.val <= ref) good = 1; } else { vtc_log(v->vl, 0, "comparison %s unknown", av[1]); } if (good) break; } if (good == -1) { vtc_log(v->vl, 0, "VSM error: %s", VSM_Error(v->vd)); } if (good == -2) { if (not) { vtc_log(v->vl, 2, "not found (as expected): %s", av[0] + 1); return; } vtc_log(v->vl, 0, "stats field %s unknown", av[0]); } if (good == 1) { vtc_log(v->vl, 2, "as expected: %s (%ju) %s %s", av[0], sp.val, av[1], av[2]); } else { vtc_log(v->vl, 0, "Not true: %s (%ju) %s %s (%ju)", av[0], (uintmax_t)sp.val, av[1], av[2], (uintmax_t)ref); } } /********************************************************************** * Varnish server cmd dispatch */ void cmd_varnish(CMD_ARGS) { struct varnish *v, *v2; (void)priv; (void)cmd; (void)vl; if (av == NULL) { /* Reset and free */ VTAILQ_FOREACH_SAFE(v, &varnishes, list, v2) { if (v->cli_fd >= 0) varnish_wait(v); VTAILQ_REMOVE(&varnishes, v, list); varnish_delete(v); } return; } AZ(strcmp(av[0], "varnish")); av++; VTAILQ_FOREACH(v, &varnishes, list) if (!strcmp(v->name, av[0])) break; if (v == NULL) v = varnish_new(av[0]); av++; for (; *av != NULL; av++) { if (vtc_error) break; if (!strcmp(*av, "-arg")) { AN(av[1]); AZ(v->pid); VSB_cat(v->args, " "); VSB_cat(v->args, av[1]); av++; continue; } if (!strcmp(*av, "-cli")) { AN(av[1]); varnish_cli(v, av[1], 0); av++; continue; } if (!strcmp(*av, "-clierr")) { AN(av[1]); AN(av[2]); varnish_cli(v, av[2], atoi(av[1])); av += 2; continue; } if (!strcmp(*av, "-cleanup")) { AZ(av[1]); varnish_cleanup(v); continue; } if (!strcmp(*av, "-cliok")) { AN(av[1]); varnish_cli(v, av[1], (unsigned)CLIS_OK); av++; continue; } if (!strcmp(*av, "-errvcl")) { char *r = NULL; AN(av[1]); AN(av[2]); varnish_vcl(v, av[2], CLIS_PARAM, &r); if (strstr(r, av[1]) == NULL) vtc_log(v->vl, 0, "Did not find expected string: (\"%s\")", av[1]); else vtc_log(v->vl, 3, "Found expected string: (\"%s\")", av[1]); free(r); av += 2; continue; } if (!strcmp(*av, "-expect")) { av++; varnish_expect(v, av); av += 2; continue; } if (!strcmp(*av, "-jail")) { AN(av[1]); AZ(v->pid); REPLACE(v->jail, av[1]); av++; continue; } if (!strcmp(*av, "-proto")) { AN(av[1]); AZ(v->pid); REPLACE(v->proto, av[1]); av++; continue; } if (!strcmp(*av, "-start")) { varnish_start(v); continue; } if (!strcmp(*av, "-stop")) { varnish_stop(v); continue; } if (!strcmp(*av, "-vcl")) { AN(av[1]); varnish_vcl(v, av[1], CLIS_OK, NULL); av++; continue; } if (!strcmp(*av, "-vcl+backend")) { AN(av[1]); varnish_vclbackend(v, av[1]); av++; continue; } if (!strcmp(*av, "-wait-stopped")) { wait_stopped(v); continue; } if (!strcmp(*av, "-wait-running")) { wait_running(v); continue; } if (!strcmp(*av, "-wait")) { varnish_wait(v); continue; } vtc_log(v->vl, 0, "Unknown varnish argument: %s", *av); } } varnish-4.1.1/bin/varnishtest/vtc_server.c0000644000201500234410000002335312652366721015574 00000000000000/*- * Copyright (c) 2008-2010 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. */ #include "config.h" #include #include #include #include #include #include #include "vtc.h" #include "vss.h" #include "vtcp.h" struct server { unsigned magic; #define SERVER_MAGIC 0x55286619 char *name; struct vtclog *vl; VTAILQ_ENTRY(server) list; char run; unsigned repeat; char *spec; int depth; int sock; int fd; char listen[256]; char aaddr[32]; char aport[32]; pthread_t tp; }; static pthread_mutex_t server_mtx; static VTAILQ_HEAD(, server) servers = VTAILQ_HEAD_INITIALIZER(servers); /********************************************************************** * Allocate and initialize a server */ static struct server * server_new(const char *name) { struct server *s; AN(name); ALLOC_OBJ(s, SERVER_MAGIC); AN(s); REPLACE(s->name, name); s->vl = vtc_logopen(s->name); AN(s->vl); bprintf(s->listen, "%s", "127.0.0.1 0"); s->repeat = 1; s->depth = 10; s->sock = -1; s->fd = -1; AZ(pthread_mutex_lock(&server_mtx)); VTAILQ_INSERT_TAIL(&servers, s, list); AZ(pthread_mutex_unlock(&server_mtx)); return (s); } /********************************************************************** * Clean up a server */ static void server_delete(struct server *s) { CHECK_OBJ_NOTNULL(s, SERVER_MAGIC); macro_undef(s->vl, s->name, "addr"); macro_undef(s->vl, s->name, "port"); macro_undef(s->vl, s->name, "sock"); vtc_logclose(s->vl); free(s->name); /* XXX: MEMLEAK (?) (VSS ??) */ FREE_OBJ(s); } /********************************************************************** * Server listen */ static void server_listen(struct server *s) { const char *err; CHECK_OBJ_NOTNULL(s, SERVER_MAGIC); if (s->sock >= 0) VTCP_close(&s->sock); s->sock = VTCP_listen_on(s->listen, "0", s->depth, &err); if (err != NULL) vtc_log(s->vl, 0, "Server listen address (%s) cannot be resolved: %s", s->listen, err); assert(s->sock > 0); VTCP_myname(s->sock, s->aaddr, sizeof s->aaddr, s->aport, sizeof s->aport); macro_def(s->vl, s->name, "addr", "%s", s->aaddr); macro_def(s->vl, s->name, "port", "%s", s->aport); macro_def(s->vl, s->name, "sock", "%s %s", s->aaddr, s->aport); /* Record the actual port, and reuse it on subsequent starts */ bprintf(s->listen, "%s %s", s->aaddr, s->aport); } /********************************************************************** * Server thread */ static void * server_thread(void *priv) { struct server *s; struct vtclog *vl; int i, j, fd; struct sockaddr_storage addr_s; struct sockaddr *addr; socklen_t l; CAST_OBJ_NOTNULL(s, priv, SERVER_MAGIC); assert(s->sock >= 0); vl = vtc_logopen(s->name); vtc_log(vl, 2, "Started on %s", s->listen); for (i = 0; i < s->repeat; i++) { if (s->repeat > 1) vtc_log(vl, 3, "Iteration %d", i); addr = (void*)&addr_s; l = sizeof addr_s; fd = accept(s->sock, addr, &l); if (fd < 0) vtc_log(vl, 0, "Accepted failed: %s", strerror(errno)); vtc_log(vl, 3, "accepted fd %d", fd); fd = http_process(vl, s->spec, fd, &s->sock); vtc_log(vl, 3, "shutting fd %d", fd); j = shutdown(fd, SHUT_WR); if (!VTCP_Check(j)) vtc_log(vl, 0, "Shutdown failed: %s", strerror(errno)); VTCP_close(&fd); } vtc_log(vl, 2, "Ending"); return (NULL); } /********************************************************************** * Start the server thread */ static void server_start(struct server *s) { CHECK_OBJ_NOTNULL(s, SERVER_MAGIC); vtc_log(s->vl, 2, "Starting server"); server_listen(s); vtc_log(s->vl, 1, "Listen on %s", s->listen); s->run = 1; AZ(pthread_create(&s->tp, NULL, server_thread, s)); } /********************************************************************** */ static void * server_dispatch_wrk(void *priv) { struct server *s; struct vtclog *vl; int j, fd; CAST_OBJ_NOTNULL(s, priv, SERVER_MAGIC); assert(s->sock < 0); vl = vtc_logopen(s->name); fd = s->fd; vtc_log(vl, 3, "start with fd %d", fd); fd = http_process(vl, s->spec, fd, &s->sock); vtc_log(vl, 3, "shutting fd %d", fd); j = shutdown(fd, SHUT_WR); if (!VTCP_Check(j)) vtc_log(vl, 0, "Shutdown failed: %s", strerror(errno)); VTCP_close(&s->fd); vtc_log(vl, 2, "Ending"); return (NULL); } static void * server_dispatch_thread(void *priv) { struct server *s, *s2; int sn = 1, fd; char snbuf[8]; struct vtclog *vl; struct sockaddr_storage addr_s; struct sockaddr *addr; socklen_t l; CAST_OBJ_NOTNULL(s, priv, SERVER_MAGIC); assert(s->sock >= 0); vl = vtc_logopen(s->name); vtc_log(vl, 2, "Dispatch started on %s", s->listen); while (1) { addr = (void*)&addr_s; l = sizeof addr_s; fd = accept(s->sock, addr, &l); if (fd < 0) vtc_log(vl, 0, "Accepted failed: %s", strerror(errno)); bprintf(snbuf, "s%d", sn++); vtc_log(vl, 3, "dispatch fd %d -> %s", fd, snbuf); s2 = server_new(snbuf); s2->spec = s->spec; strcpy(s2->listen, s->listen); s2->fd = fd; s2->run = 1; AZ(pthread_create(&s2->tp, NULL, server_dispatch_wrk, s2)); } return(NULL); } static void server_dispatch(struct server *s) { CHECK_OBJ_NOTNULL(s, SERVER_MAGIC); server_listen(s); vtc_log(s->vl, 2, "Starting dispatch server"); s->run = 1; AZ(pthread_create(&s->tp, NULL, server_dispatch_thread, s)); } /********************************************************************** * Force stop the server thread */ static void server_break(struct server *s) { void *res; CHECK_OBJ_NOTNULL(s, SERVER_MAGIC); vtc_log(s->vl, 2, "Breaking for server"); (void)pthread_cancel(s->tp); AZ(pthread_join(s->tp, &res)); s->tp = 0; s->run = 0; } /********************************************************************** * Wait for server thread to stop */ static void server_wait(struct server *s) { void *res; CHECK_OBJ_NOTNULL(s, SERVER_MAGIC); vtc_log(s->vl, 2, "Waiting for server (%d/%d)", s->sock, s->fd); AZ(pthread_join(s->tp, &res)); if (res != NULL && !vtc_stop) vtc_log(s->vl, 0, "Server returned \"%p\"", (char *)res); s->tp = 0; s->run = 0; } /********************************************************************** * Generate VCL backend decls for our servers */ void cmd_server_genvcl(struct vsb *vsb) { struct server *s; AZ(pthread_mutex_lock(&server_mtx)); VTAILQ_FOREACH(s, &servers, list) { VSB_printf(vsb, "backend %s { .host = \"%s\"; .port = \"%s\"; }\n", s->name, s->aaddr, s->aport); } AZ(pthread_mutex_unlock(&server_mtx)); } /********************************************************************** * Server command dispatch */ void cmd_server(CMD_ARGS) { struct server *s; (void)priv; (void)cmd; (void)vl; if (av == NULL) { /* Reset and free */ while (1) { AZ(pthread_mutex_lock(&server_mtx)); s = VTAILQ_FIRST(&servers); CHECK_OBJ_ORNULL(s, SERVER_MAGIC); if (s != NULL) VTAILQ_REMOVE(&servers, s, list); AZ(pthread_mutex_unlock(&server_mtx)); if (s == NULL) break; if (s->run) { (void)pthread_cancel(s->tp); server_wait(s); } if (s->sock >= 0) VTCP_close(&s->sock); server_delete(s); } return; } AZ(strcmp(av[0], "server")); av++; if (*av[0] != 's') { fprintf(stderr, "Server name must start with 's' (is: %s)\n", av[0]); exit(1); } AZ(pthread_mutex_lock(&server_mtx)); VTAILQ_FOREACH(s, &servers, list) if (!strcmp(s->name, av[0])) break; AZ(pthread_mutex_unlock(&server_mtx)); if (s == NULL) s = server_new(av[0]); CHECK_OBJ_NOTNULL(s, SERVER_MAGIC); av++; for (; *av != NULL; av++) { if (vtc_error) break; if (!strcmp(*av, "-wait")) { if (!s->run) vtc_log(s->vl, 0, "Server not -started"); server_wait(s); continue; } if (!strcmp(*av, "-break")) { server_break(s); continue; } /* * We do an implict -wait if people muck about with a * running server. */ if (s->run) server_wait(s); AZ(s->run); if (!strcmp(*av, "-repeat")) { s->repeat = atoi(av[1]); av++; continue; } if (!strcmp(*av, "-listen")) { if (s->sock >= 0) VTCP_close(&s->sock); bprintf(s->listen, "%s", av[1]); av++; continue; } if (!strcmp(*av, "-start")) { server_start(s); continue; } if (!strcmp(*av, "-dispatch")) { if (strcmp(s->name, "s0")) { fprintf(stderr, "server -dispatch only works on s0\n"); exit(1); } server_dispatch(s); continue; } if (**av == '-') vtc_log(s->vl, 0, "Unknown server argument: %s", *av); s->spec = *av; } } void init_server(void) { AZ(pthread_mutex_init(&server_mtx, NULL)); } varnish-4.1.1/bin/varnishtest/vtc_process.c0000644000201500234410000002042312652366721015737 00000000000000/*- * Copyright (c) 2015 Varnish Software AS * All rights reserved. * * Author: Dridi Boukelmoune * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include "vtc.h" #include "vsub.h" struct process { unsigned magic; #define PROCESS_MAGIC 0x1617b43e char *name; struct vtclog *vl; VTAILQ_ENTRY(process) list; char *spec; char *workdir; char *outdir; char *out; char *err; int fds[2]; pid_t pid; pthread_t tp; unsigned running; int status; }; static VTAILQ_HEAD(, process) processes = VTAILQ_HEAD_INITIALIZER(processes); /********************************************************************** * Allocate and initialize a process */ #define PROCESS_EXPAND(field, format, ...) \ do { \ bprintf(buf, format, __VA_ARGS__); \ vsb = macro_expand(p->vl, buf); \ AN(vsb); \ p->field = strdup(VSB_data(vsb)); \ AN(p->field); \ VSB_delete(vsb); \ } while (0) static struct process * process_new(const char *name) { struct process *p; struct vsb *vsb; char buf[1024]; AN(name); ALLOC_OBJ(p, PROCESS_MAGIC); AN(p); REPLACE(p->name, name); p->vl = vtc_logopen(name); AN(p->vl); PROCESS_EXPAND(workdir, "%s", "${pwd}"); PROCESS_EXPAND(outdir, "${tmpdir}/%s", name); PROCESS_EXPAND(out, "${tmpdir}/%s/stdout", name); PROCESS_EXPAND(err, "${tmpdir}/%s/stderr", name); bprintf(buf, "rm -rf %s ; mkdir -p %s ; touch %s %s", p->outdir, p->outdir, p->out, p->err); AZ(system(buf)); p->fds[0] = -1; p->fds[1] = -1; if (*p->name != 'p') vtc_log(p->vl, 0, "Process name must start with 'p'"); VTAILQ_INSERT_TAIL(&processes, p, list); return (p); } #undef PROCESS_EXPAND /********************************************************************** * Clean up process */ static void process_delete(struct process *p) { CHECK_OBJ_NOTNULL(p, PROCESS_MAGIC); vtc_logclose(p->vl); free(p->name); free(p->workdir); free(p->outdir); free(p->out); free(p->err); /* * We do not delete the outdir, it may contain useful stdout * and stderr files. */ /* XXX: MEMLEAK (?) */ FREE_OBJ(p); } /********************************************************************** * Start the process thread */ static void * process_thread(void *priv) { struct process *p; struct rusage ru; int r; CAST_OBJ_NOTNULL(p, priv, PROCESS_MAGIC); r = wait4(p->pid, &p->status, 0, &ru); macro_undef(p->vl, p->name, "pid"); p->pid = 0; p->running = 0; vtc_log(p->vl, 2, "R %d Status: %04x (u %.6f s %.6f)", r, p->status, ru.ru_utime.tv_sec + 1e-6 * ru.ru_utime.tv_usec, ru.ru_stime.tv_sec + 1e-6 * ru.ru_stime.tv_usec ); if (WIFEXITED(p->status) && WEXITSTATUS(p->status) == 0) return (NULL); #ifdef WCOREDUMP vtc_log(p->vl, 2, "Bad exit code: %04x sig %d exit %d core %d", p->status, WTERMSIG(p->status), WEXITSTATUS(p->status), WCOREDUMP(p->status)); #else vtc_log(p->vl, 2, "Bad exit code: %04x sig %d exit %d", p->status, WTERMSIG(p->status), WEXITSTATUS(p->status)); #endif (void)close(p->fds[1]); p->fds[1] = -1; return (NULL); } static void process_start(struct process *p) { struct vsb *cl; int out_fd, err_fd; CHECK_OBJ_NOTNULL(p, PROCESS_MAGIC); vtc_log(p->vl, 4, "CMD: %s", p->spec); cl = macro_expand(p->vl, p->spec); AN(cl); AZ(pipe(p->fds)); out_fd = open(p->out, O_WRONLY|O_APPEND); assert(out_fd >= 0); err_fd = open(p->err, O_WRONLY|O_APPEND); assert(err_fd >= 0); p->pid = fork(); assert(p->pid >= 0); p->running = 1; if (p->pid == 0) { assert(dup2(p->fds[0], 0) == 0); assert(dup2(out_fd, 1) == 1); assert(dup2(err_fd, 2) == 2); VSUB_closefrom(STDERR_FILENO + 1); AZ(execl("/bin/sh", "/bin/sh", "-c", VSB_data(cl), (char*)0)); exit(1); } vtc_log(p->vl, 3, "PID: %ld", (long)p->pid); macro_def(p->vl, p->name, "pid", "%ld", (long)p->pid); AZ(close(p->fds[0])); AZ(close(out_fd)); AZ(close(err_fd)); p->fds[0] = -1; VSB_delete(cl); AZ(pthread_create(&p->tp, NULL, process_thread, p)); } /********************************************************************** * Wait for process thread to stop */ static void process_wait(const struct process *p) { void *v; if (p->running && p->pid) AZ(pthread_join(p->tp, &v)); } /********************************************************************** * Send a signal to a process */ static void process_kill(const struct process *p, const char *sig) { int s; char buf[64]; CHECK_OBJ_NOTNULL(p, PROCESS_MAGIC); AN(sig); if (!p->running || !p->pid) vtc_log(p->vl, 0, "Cannot signal a non-running process"); bprintf(buf, "kill -%s %d", sig, p->pid); vtc_log(p->vl, 4, "CMD: %s", buf); s = system(buf); if (s != 0) vtc_log(p->vl, 0, "Failed to send signal (exit status: %d)", s); } static inline void process_stop(const struct process *p) { process_kill(p, "TERM"); } static inline void process_terminate(const struct process *p) { process_kill(p, "TERM"); sleep(1); if (p->running && p->pid) process_kill(p, "KILL"); } /********************************************************************** * Write to a process' stdin */ static void process_write(const struct process *p, const char *text) { int r, len; if (!p->running || !p->pid) vtc_log(p->vl, 0, "Cannot write to a non-running process"); len = strlen(text); vtc_log(p->vl, 4, "Writing %d bytes", len); r = write(p->fds[1], text, len); if (r < 0) vtc_log(p->vl, 0, "Failed to write: %s (%d)", strerror(errno), errno); } static void process_close(struct process *p) { if (!p->running || !p->pid) vtc_log(p->vl, 0, "Cannot close on a non-running process"); (void)close(p->fds[1]); p->fds[1] = -1; } /********************************************************************** * Process command dispatch */ void cmd_process(CMD_ARGS) { struct process *p, *p2; (void)priv; (void)cmd; (void)vl; if (av == NULL) { /* Reset and free */ VTAILQ_FOREACH_SAFE(p, &processes, list, p2) { if (p->running && p->pid) process_terminate(p); VTAILQ_REMOVE(&processes, p, list); process_delete(p); } return; } AZ(strcmp(av[0], "process")); av++; VTAILQ_FOREACH(p, &processes, list) if (!strcmp(p->name, av[0])) break; if (p == NULL) p = process_new(av[0]); av++; for (; *av != NULL; av++) { if (vtc_error) break; if (!strcmp(*av, "-start")) { process_start(p); continue; } if (!strcmp(*av, "-wait")) { process_wait(p); continue; } if (!strcmp(*av, "-kill")) { process_kill(p, av[1]); av++; continue; } if (!strcmp(*av, "-stop")) { process_stop(p); continue; } if (!strcmp(*av, "-write")) { process_write(p, av[1]); av++; continue; } if (!strcmp(*av, "-writeln")) { process_write(p, av[1]); process_write(p, "\n"); av++; continue; } if (!strcmp(*av, "-close")) { process_close(p); continue; } if (**av == '-') vtc_log(p->vl, 0, "Unknown process argument: %s", *av); REPLACE(p->spec, *av); } } varnish-4.1.1/bin/varnishtest/vtc_sema.c0000644000201500234410000001001312652366721015200 00000000000000/*- * Copyright (c) 2008-2010 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. */ #include "config.h" #include #include #include #include #include "vtc.h" struct sema { unsigned magic; #define SEMA_MAGIC 0x29b64317 char *name; VTAILQ_ENTRY(sema) list; pthread_mutex_t mtx; pthread_cond_t cond; unsigned waiters; unsigned expected; }; static pthread_mutex_t sema_mtx; static VTAILQ_HEAD(, sema) semas = VTAILQ_HEAD_INITIALIZER(semas); /********************************************************************** * Allocate and initialize a sema */ static struct sema * sema_new(char *name, struct vtclog *vl) { struct sema *r; ALLOC_OBJ(r, SEMA_MAGIC); AN(r); AN(name); if (*name != 'r') vtc_log(vl, 0, "Sema name must start with 'r' (%s)", name); r->name = name; AZ(pthread_mutex_init(&r->mtx, NULL)); AZ(pthread_cond_init(&r->cond, NULL)); r->waiters = 0; r->expected = 0; VTAILQ_INSERT_TAIL(&semas, r, list); return (r); } /********************************************************************** * Sync a sema */ static void sema_sync(struct sema *r, const char *av, struct vtclog *vl) { unsigned u; CHECK_OBJ_NOTNULL(r, SEMA_MAGIC); u = strtoul(av, NULL, 0); if (r->expected == 0) r->expected = u; if (r->expected != u) vtc_log(vl, 0, "Sema(%s) use error: different expectations (%u vs %u)", r->name, r->expected, u); if (++r->waiters == r->expected) { vtc_log(vl, 4, "Sema(%s) wake %u", r->name, r->expected); AZ(pthread_cond_broadcast(&r->cond)); r->waiters = 0; r->expected = 0; } else { vtc_log(vl, 4, "Sema(%s) wait %u of %u", r->name, r->waiters, r->expected); AZ(pthread_cond_wait(&r->cond, &r->mtx)); } } /********************************************************************** * Semaphore command dispatch */ void cmd_sema(CMD_ARGS) { struct sema *r, *r2; (void)priv; (void)cmd; if (av == NULL) { AZ(pthread_mutex_lock(&sema_mtx)); /* Reset and free */ VTAILQ_FOREACH_SAFE(r, &semas, list, r2) { AZ(pthread_mutex_lock(&r->mtx)); AZ(r->waiters); AZ(r->expected); AZ(pthread_mutex_unlock(&r->mtx)); } AZ(pthread_mutex_unlock(&sema_mtx)); return; } AZ(strcmp(av[0], "sema")); av++; AZ(pthread_mutex_lock(&sema_mtx)); VTAILQ_FOREACH(r, &semas, list) if (!strcmp(r->name, av[0])) break; if (r == NULL) r = sema_new(av[0], vl); av++; AZ(pthread_mutex_lock(&r->mtx)); AZ(pthread_mutex_unlock(&sema_mtx)); for (; *av != NULL; av++) { if (!strcmp(*av, "sync")) { av++; AN(*av); sema_sync(r, *av, vl); continue; } vtc_log(vl, 0, "Unknown sema argument: %s", *av); } AZ(pthread_mutex_unlock(&r->mtx)); } void init_sema(void) { AZ(pthread_mutex_init(&sema_mtx, NULL)); } varnish-4.1.1/bin/varnishtest/vtc_client.c0000644000201500234410000001336112652366721015542 00000000000000/*- * Copyright (c) 2008-2011 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. */ #include "config.h" #include #include #include #include #include #include "vtc.h" #include "vss.h" #include "vtcp.h" struct client { unsigned magic; #define CLIENT_MAGIC 0x6242397c char *name; struct vtclog *vl; VTAILQ_ENTRY(client) list; char *spec; char connect[256]; unsigned repeat; unsigned running; pthread_t tp; }; static VTAILQ_HEAD(, client) clients = VTAILQ_HEAD_INITIALIZER(clients); /********************************************************************** * Client thread */ static void * client_thread(void *priv) { struct client *c; struct vtclog *vl; int fd; unsigned u; struct vsb *vsb; char *p; char mabuf[32], mpbuf[32]; const char *err; CAST_OBJ_NOTNULL(c, priv, CLIENT_MAGIC); AN(*c->connect); vl = vtc_logopen(c->name); p = strdup(c->connect); AN(p); vsb = macro_expand(vl, p); AN(vsb); if (c->repeat == 0) c->repeat = 1; if (c->repeat != 1) vtc_log(vl, 2, "Started (%u iterations)", c->repeat); for (u = 0; u < c->repeat; u++) { vtc_log(vl, 3, "Connect to %s", VSB_data(vsb)); fd = VTCP_open(VSB_data(vsb), NULL, 10., &err); if (fd < 0) vtc_log(c->vl, 0, "Failed to open %s: %s", VSB_data(vsb), err); assert(fd >= 0); VTCP_blocking(fd); VTCP_myname(fd, mabuf, sizeof mabuf, mpbuf, sizeof mpbuf); vtc_log(vl, 3, "connected fd %d from %s %s to %s", fd, mabuf, mpbuf, VSB_data(vsb)); fd = http_process(vl, c->spec, fd, NULL); vtc_log(vl, 3, "closing fd %d", fd); VTCP_close(&fd); } vtc_log(vl, 2, "Ending"); VSB_delete(vsb); free(p); return (NULL); } /********************************************************************** * Allocate and initialize a client */ static struct client * client_new(const char *name) { struct client *c; AN(name); ALLOC_OBJ(c, CLIENT_MAGIC); AN(c); REPLACE(c->name, name); c->vl = vtc_logopen(name); AN(c->vl); if (*c->name != 'c') vtc_log(c->vl, 0, "Client name must start with 'c'"); bprintf(c->connect, "%s", "${v1_sock}"); VTAILQ_INSERT_TAIL(&clients, c, list); return (c); } /********************************************************************** * Clean up client */ static void client_delete(struct client *c) { CHECK_OBJ_NOTNULL(c, CLIENT_MAGIC); vtc_logclose(c->vl); free(c->spec); free(c->name); /* XXX: MEMLEAK (?)*/ FREE_OBJ(c); } /********************************************************************** * Start the client thread */ static void client_start(struct client *c) { CHECK_OBJ_NOTNULL(c, CLIENT_MAGIC); vtc_log(c->vl, 2, "Starting client"); AZ(pthread_create(&c->tp, NULL, client_thread, c)); c->running = 1; } /********************************************************************** * Wait for client thread to stop */ static void client_wait(struct client *c) { void *res; CHECK_OBJ_NOTNULL(c, CLIENT_MAGIC); vtc_log(c->vl, 2, "Waiting for client"); AZ(pthread_join(c->tp, &res)); if (res != NULL) vtc_log(c->vl, 0, "Client returned \"%s\"", (char *)res); c->tp = 0; c->running = 0; } /********************************************************************** * Run the client thread */ static void client_run(struct client *c) { client_start(c); client_wait(c); } /********************************************************************** * Client command dispatch */ void cmd_client(CMD_ARGS) { struct client *c, *c2; (void)priv; (void)cmd; (void)vl; if (av == NULL) { /* Reset and free */ VTAILQ_FOREACH_SAFE(c, &clients, list, c2) { VTAILQ_REMOVE(&clients, c, list); if (c->tp != 0) client_wait(c); client_delete(c); } return; } AZ(strcmp(av[0], "client")); av++; VTAILQ_FOREACH(c, &clients, list) if (!strcmp(c->name, av[0])) break; if (c == NULL) c = client_new(av[0]); av++; for (; *av != NULL; av++) { if (vtc_error) break; if (!strcmp(*av, "-wait")) { client_wait(c); continue; } /* Don't muck about with a running client */ if (c->running) client_wait(c); if (!strcmp(*av, "-connect")) { bprintf(c->connect, "%s", av[1]); av++; continue; } if (!strcmp(*av, "-repeat")) { c->repeat = atoi(av[1]); av++; continue; } if (!strcmp(*av, "-start")) { client_start(c); continue; } if (!strcmp(*av, "-run")) { client_run(c); continue; } if (**av == '-') vtc_log(c->vl, 0, "Unknown client argument: %s", *av); REPLACE(c->spec, *av); } } varnish-4.1.1/bin/varnishtest/vtc.h0000644000201500234410000000643612652366721014216 00000000000000/*- * Copyright (c) 2008-2011 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. * */ #include #include #include #include #ifdef HAVE_PTHREAD_NP_H #include #endif #include "miniobj.h" #include "vas.h" #include "vdef.h" #include "vqueue.h" #include "vsb.h" struct vtclog; struct cmds; #define CMD_ARGS \ char * const *av, void *priv, const struct cmds *cmd, struct vtclog *vl typedef void cmd_f(CMD_ARGS); struct cmds { const char *name; cmd_f *cmd; }; void parse_string(const char *spec, const struct cmds *cmd, void *priv, struct vtclog *vl); cmd_f cmd_delay; cmd_f cmd_server; cmd_f cmd_client; cmd_f cmd_varnish; cmd_f cmd_sema; cmd_f cmd_logexp; cmd_f cmd_process; extern volatile sig_atomic_t vtc_error; /* Error, bail out */ extern int vtc_stop; /* Abandon current test, no error */ extern pthread_t vtc_thread; extern int iflg; extern unsigned vtc_maxdur; extern int vtc_witness; extern int feature_dns; void init_sema(void); void init_server(void); int http_process(struct vtclog *vl, const char *spec, int sock, int *sfd); void cmd_server_genvcl(struct vsb *vsb); void vtc_loginit(char *buf, unsigned buflen); struct vtclog *vtc_logopen(const char *id); void vtc_logclose(struct vtclog *vl); void vtc_log(struct vtclog *vl, int lvl, const char *fmt, ...) __v_printflike(3, 4); void vtc_dump(struct vtclog *vl, int lvl, const char *pfx, const char *str, int len); void vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx, const unsigned char *str, int len); int exec_file(const char *fn, const char *script, const char *tmpdir, char *logbuf, unsigned loglen); void macro_undef(struct vtclog *vl, const char *instance, const char *name); void macro_def(struct vtclog *vl, const char *instance, const char *name, const char *fmt, ...) __v_printflike(4, 5); struct vsb *macro_expand(struct vtclog *vl, const char *text); void extmacro_def(const char *name, const char *fmt, ...) __v_printflike(2, 3); varnish-4.1.1/bin/varnishtest/programs.h0000644000201500234410000000300512652366721015241 00000000000000/*- * Copyright (c) 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. * */ VTC_PROG(varnishd) VTC_PROG(varnishadm) VTC_PROG(varnishstat) VTC_PROG(varnishhist) VTC_PROG(varnishlog) VTC_PROG(varnishncsa) varnish-4.1.1/config.h.in0000644000201500234410000002162312652366724012150 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have accept filters */ #undef HAVE_ACCEPT_FILTERS /* Define to 1 if the backtrace function exists */ #undef HAVE_BACKTRACE /* Define to 1 if you have the `clock_gettime' function. */ #undef HAVE_CLOCK_GETTIME /* Define to 1 if you have the `closefrom' function. */ #undef HAVE_CLOSEFROM /* Define to 1 if a SysV or X/Open compatible Curses library is present */ #undef HAVE_CURSES /* Define to 1 if library supports color (enhanced functions) */ #undef HAVE_CURSES_COLOR /* Define to 1 if library supports X/Open Enhanced functions */ #undef HAVE_CURSES_ENHANCED /* Define to 1 if is present */ #undef HAVE_CURSES_H /* Define to 1 if library supports certain obsolete features */ #undef HAVE_CURSES_OBSOLETE /* Define to 1 if you have the `daemon' function. */ #undef HAVE_DAEMON /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #undef HAVE_DECL_STRERROR_R /* Define to 1 if you have the `dladdr' function. */ #undef HAVE_DLADDR /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the header file. */ #undef HAVE_EDITLINE_READLINE_H /* Define to 1 if you have the header file. */ #undef HAVE_EDIT_READLINE_READLINE_H /* Define to 1 if you have the header file. */ #undef HAVE_ENDIAN_H /* Define to 1 if you have the `epoll_ctl' function. */ #undef HAVE_EPOLL_CTL /* Define to 1 if you have the header file. */ #undef HAVE_EXECINFO_H /* Define to 1 if you have the `fallocate' function. */ #undef HAVE_FALLOCATE /* Define to 1 if you have the `fmtcheck' function. */ #undef HAVE_FMTCHECK /* Define to 1 if you have the `getdtablesize' function. */ #undef HAVE_GETDTABLESIZE /* Define to 1 if you have the `gethrtime' function. */ #undef HAVE_GETHRTIME /* Define to 1 if you have the header file. */ #undef HAVE_HISTORY_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `kqueue' function. */ #undef HAVE_KQUEUE /* Define to 1 if you have the `dl' library (-ldl). */ #undef HAVE_LIBDL /* Define if we have libedit */ #undef HAVE_LIBEDIT /* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL /* Define if you have a readline compatible library */ #undef HAVE_LIBREADLINE /* Define to 1 if you have the `rt' library (-lrt). */ #undef HAVE_LIBRT /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define to 1 if you have the `umem' library (-lumem). */ #undef HAVE_LIBUMEM /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `nanosleep' function. */ #undef HAVE_NANOSLEEP /* Define to 1 if the Ncurses library is present */ #undef HAVE_NCURSES /* Define to 1 if the NcursesW library is present */ #undef HAVE_NCURSESW /* Define to 1 if is present */ #undef HAVE_NCURSESW_CURSES_H /* Define to 1 if is present */ #undef HAVE_NCURSESW_H /* Define to 1 if is present */ #undef HAVE_NCURSES_CURSES_H /* Define to 1 if is present */ #undef HAVE_NCURSES_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the `port_create' function. */ #undef HAVE_PORT_CREATE /* Define to 1 if you have the header file. */ #undef HAVE_PRIV_H /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD /* Define to 1 if you have the `pthread_mutex_isowned_np' function. */ #undef HAVE_PTHREAD_MUTEX_ISOWNED_NP /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_NP_H /* Define to 1 if you have the `pthread_set_name_np' function. */ #undef HAVE_PTHREAD_SET_NAME_NP /* Define to 1 if you have the `pthread_timedjoin_np' function. */ #undef HAVE_PTHREAD_TIMEDJOIN_NP /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_H /* Define if your readline library has \`add_history' */ #undef HAVE_READLINE_HISTORY /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_HISTORY_H /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_READLINE_H /* Define to 1 if you have the `setppriv' function. */ #undef HAVE_SETPPRIV /* Define to 1 if you have the `setproctitle' function. */ #undef HAVE_SETPROCTITLE /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the `strerror_r' function. */ #undef HAVE_STRERROR_R /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strptime' function. */ #undef HAVE_STRPTIME /* Define to 1 if `sa_len' is a member of `struct sockaddr'. */ #undef HAVE_STRUCT_SOCKADDR_SA_LEN /* Define to 1 if you have the header file. */ #undef HAVE_SYS_ENDIAN_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_FILIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MOUNT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STATVFS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_VFS_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define if OS supports TCP_KEEP* socket options */ #undef HAVE_TCP_KEEP /* Define to 1 if you have the header file. */ #undef HAVE_UMEM_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define if SO_RCVTIMEO works */ #undef SO_RCVTIMEO_WORKS /* Define if SO_SNDTIMEO works */ #undef SO_SNDTIMEO_WORKS /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if strerror_r returns char *. */ #undef STRERROR_R_CHAR_P /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Use the PCRE JIT compiler */ #undef USE_PCRE_JIT /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* C compiler command line for VCL code */ #undef VCC_CC /* Version number of package */ #undef VERSION /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `unsigned int' if does not define. */ #undef size_t varnish-4.1.1/m4/0000755000201500234410000000000012652366756010526 500000000000000varnish-4.1.1/m4/lt~obsolete.m40000644000201500234410000001375612652366722013267 00000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) varnish-4.1.1/m4/ltoptions.m40000644000201500234410000003007312652366722012737 00000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) varnish-4.1.1/m4/ld-version-script.m40000644000201500234410000000336412652366721014272 00000000000000# ld-version-script.m4 serial 3 dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Simon Josefsson # FIXME: The test below returns a false positive for mingw # cross-compiles, 'local:' statements does not reduce number of # exported symbols in a DLL. Use --disable-ld-version-script to work # around the problem. # gl_LD_VERSION_SCRIPT # -------------------- # Check if LD supports linker scripts, and define automake conditional # HAVE_LD_VERSION_SCRIPT if so. AC_DEFUN([gl_LD_VERSION_SCRIPT], [ AC_ARG_ENABLE([ld-version-script], AS_HELP_STRING([--enable-ld-version-script], [enable linker version script (default is enabled when possible)]), [have_ld_version_script=$enableval], []) if test -z "$have_ld_version_script"; then AC_MSG_CHECKING([if LD -Wl,--version-script works]) save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" cat > conftest.map < conftest.map < # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 7 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE AC_LANG_C ax_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes) AC_MSG_RESULT($ax_pthread_ok) if test x"$ax_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # ... -mt is also the pthreads flag for HP/aCC # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthreads/-mt/ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" ;; *-darwin*) acx_pthread_flags="-pthread $acx_pthread_flags" ;; esac if test x"$ax_pthread_ok" = xno; then for flag in $ax_pthread_flags; do case $flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $flag]) PTHREAD_CFLAGS="$flag" ;; pthread-config) AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no) if test x"$ax_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$flag]) PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. AC_TRY_LINK([#include static void routine(void* a) {a=0;} static void* start_routine(void* a) {return a;}], [pthread_t th; pthread_attr_t attr; pthread_join(th, 0); pthread_attr_init(&attr); pthread_cleanup_push(routine, 0); pthread_create(&th,0,start_routine,0); pthread_cleanup_pop(0); ], [ax_pthread_ok=yes]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT($ax_pthread_ok) if test "x$ax_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$ax_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. AC_MSG_CHECKING([for joinable pthread attribute]) attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do AC_TRY_LINK([#include ], [int attr=$attr; return attr;], [attr_name=$attr; break]) done AC_MSG_RESULT($attr_name) if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, [Define to necessary symbol if this constant uses a non-standard name on your system.]) fi AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r if test x"$GCC" != xyes; then AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$ax_pthread_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else ax_pthread_ok=no $2 fi AC_LANG_RESTORE ])dnl AX_PTHREAD varnish-4.1.1/m4/ax_lib_readline.m40000644000201500234410000000744612652366721014014 00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_lib_readline.html # =========================================================================== # # SYNOPSIS # # AX_LIB_READLINE # # DESCRIPTION # # Searches for a readline compatible library. If found, defines # `HAVE_LIBREADLINE'. If the found library has the `add_history' function, # sets also `HAVE_READLINE_HISTORY'. Also checks for the locations of the # necessary include files and sets `HAVE_READLINE_H' or # `HAVE_READLINE_READLINE_H' and `HAVE_READLINE_HISTORY_H' or # 'HAVE_HISTORY_H' if the corresponding include files exists. # # The libraries that may be readline compatible are `libedit', # `libeditline' and `libreadline'. Sometimes we need to link a termcap # library for readline to work, this macro tests these cases too by trying # to link with `libtermcap', `libcurses' or `libncurses' before giving up. # # Here is an example of how to use the information provided by this macro # to perform the necessary includes or declarations in a C file: # # #ifdef HAVE_LIBREADLINE # # if defined(HAVE_READLINE_READLINE_H) # # include # # elif defined(HAVE_READLINE_H) # # include # # else /* !defined(HAVE_READLINE_H) */ # extern char *readline (); # # endif /* !defined(HAVE_READLINE_H) */ # char *cmdline = NULL; # #else /* !defined(HAVE_READLINE_READLINE_H) */ # /* no readline */ # #endif /* HAVE_LIBREADLINE */ # # #ifdef HAVE_READLINE_HISTORY # # if defined(HAVE_READLINE_HISTORY_H) # # include # # elif defined(HAVE_HISTORY_H) # # include # # else /* !defined(HAVE_HISTORY_H) */ # extern void add_history (); # extern int write_history (); # extern int read_history (); # # endif /* defined(HAVE_READLINE_HISTORY_H) */ # /* no history */ # #endif /* HAVE_READLINE_HISTORY */ # # LICENSE # # Copyright (c) 2008 Ville Laurikari # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 6 AU_ALIAS([VL_LIB_READLINE], [AX_LIB_READLINE]) AC_DEFUN([AX_LIB_READLINE], [ AC_CACHE_CHECK([for a readline compatible library], ax_cv_lib_readline, [ ORIG_LIBS="$LIBS" for readline_lib in readline edit editline; do for termcap_lib in "" termcap curses ncurses; do if test -z "$termcap_lib"; then TRY_LIB="-l$readline_lib" else TRY_LIB="-l$readline_lib -l$termcap_lib" fi LIBS="$ORIG_LIBS $TRY_LIB" AC_TRY_LINK_FUNC(readline, ax_cv_lib_readline="$TRY_LIB") if test -n "$ax_cv_lib_readline"; then break fi done if test -n "$ax_cv_lib_readline"; then break fi done if test -z "$ax_cv_lib_readline"; then ax_cv_lib_readline="no" fi LIBS="$ORIG_LIBS" ]) if test "$ax_cv_lib_readline" != "no"; then LIBS="$LIBS $ax_cv_lib_readline" AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have a readline compatible library]) AC_CHECK_HEADERS(readline.h readline/readline.h) AC_CACHE_CHECK([whether readline supports history], ax_cv_lib_readline_history, [ ax_cv_lib_readline_history="no" AC_TRY_LINK_FUNC(add_history, ax_cv_lib_readline_history="yes") ]) if test "$ax_cv_lib_readline_history" = "yes"; then AC_DEFINE(HAVE_READLINE_HISTORY, 1, [Define if your readline library has \`add_history']) AC_CHECK_HEADERS(history.h readline/history.h) fi fi ])dnl varnish-4.1.1/m4/ax_check_compile_flag.m40000644000201500234410000000625112652366721015152 00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's compiler # or gives an error. (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 2 AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS varnish-4.1.1/m4/ltsugar.m40000644000201500234410000001042412652366722012363 00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) varnish-4.1.1/m4/ax_with_curses.m40000644000201500234410000006073312652366721013740 00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_with_curses.html # =========================================================================== # # SYNOPSIS # # AX_WITH_CURSES # # DESCRIPTION # # This macro checks whether a SysV or X/Open-compatible Curses library is # present, along with the associated header file. The NcursesW # (wide-character) library is searched for first, followed by Ncurses, # then the system-default plain Curses. The first library found is the # one returned. # # The following options are understood: --with-ncursesw, --with-ncurses, # --without-ncursesw, --without-ncurses. The "--with" options force the # macro to use that particular library, terminating with an error if not # found. The "--without" options simply skip the check for that library. # The effect on the search pattern is: # # (no options) - NcursesW, Ncurses, Curses # --with-ncurses --with-ncursesw - NcursesW only [*] # --without-ncurses --with-ncursesw - NcursesW only [*] # --with-ncursesw - NcursesW only [*] # --with-ncurses --without-ncursesw - Ncurses only [*] # --with-ncurses - NcursesW, Ncurses [**] # --without-ncurses --without-ncursesw - Curses only # --without-ncursesw - Ncurses, Curses # --without-ncurses - NcursesW, Curses # # [*] If the library is not found, abort the configure script. # # [**] If the second library (Ncurses) is not found, abort configure. # # The following preprocessor symbols may be defined by this macro if the # appropriate conditions are met: # # HAVE_CURSES - if any SysV or X/Open Curses library found # HAVE_CURSES_ENHANCED - if library supports X/Open Enhanced functions # HAVE_CURSES_COLOR - if library supports color (enhanced functions) # HAVE_CURSES_OBSOLETE - if library supports certain obsolete features # HAVE_NCURSESW - if NcursesW (wide char) library is to be used # HAVE_NCURSES - if the Ncurses library is to be used # # HAVE_CURSES_H - if is present and should be used # HAVE_NCURSESW_H - if should be used # HAVE_NCURSES_H - if should be used # HAVE_NCURSESW_CURSES_H - if should be used # HAVE_NCURSES_CURSES_H - if should be used # # (These preprocessor symbols are discussed later in this document.) # # The following output variable is defined by this macro; it is precious # and may be overridden on the ./configure command line: # # CURSES_LIB - library to add to xxx_LDADD # # The library listed in CURSES_LIB is NOT added to LIBS by default. You # need to add CURSES_LIB to the appropriate xxx_LDADD line in your # Makefile.am. For example: # # prog_LDADD = @CURSES_LIB@ # # If CURSES_LIB is set on the configure command line (such as by running # "./configure CURSES_LIB=-lmycurses"), then the only header searched for # is . The user may use the CPPFLAGS precious variable to # override the standard #include search path. If the user needs to # specify an alternative path for a library (such as for a non-standard # NcurseW), the user should use the LDFLAGS variable. # # The following shell variables may be defined by this macro: # # ax_cv_curses - set to "yes" if any Curses library found # ax_cv_curses_enhanced - set to "yes" if Enhanced functions present # ax_cv_curses_color - set to "yes" if color functions present # ax_cv_curses_obsolete - set to "yes" if obsolete features present # # ax_cv_ncursesw - set to "yes" if NcursesW library found # ax_cv_ncurses - set to "yes" if Ncurses library found # ax_cv_plaincurses - set to "yes" if plain Curses library found # ax_cv_curses_which - set to "ncursesw", "ncurses", "plaincurses" or "no" # # These variables can be used in your configure.ac to determine the level # of support you need from the Curses library. For example, if you must # have either Ncurses or NcursesW, you could include: # # AX_WITH_CURSES # if test "x$ax_cv_ncursesw" != xyes && test "x$ax_cv_ncurses" != xyes; then # AX_MSG_ERROR([requires either NcursesW or Ncurses library]) # fi # # If any Curses library will do (but one must be present and must support # color), you could use: # # AX_WITH_CURSES # if test "x$ax_cv_curses" != xyes || test "x$ax_cv_curses_color" != xyes; then # AC_MSG_ERROR([requires an X/Open-compatible Curses library with color]) # fi # # Certain preprocessor symbols and shell variables defined by this macro # can be used to determine various features of the Curses library. In # particular, HAVE_CURSES and ax_cv_curses are defined if the Curses # library found conforms to the traditional SysV and/or X/Open Base Curses # definition. Any working Curses library conforms to this level. # # HAVE_CURSES_ENHANCED and ax_cv_curses_enhanced are defined if the # library supports the X/Open Enhanced Curses definition. In particular, # the wide-character types attr_t, cchar_t and wint_t, the functions # wattr_set() and wget_wch() and the macros WA_NORMAL and _XOPEN_CURSES # are checked. The Ncurses library does NOT conform to this definition, # although NcursesW does. # # HAVE_CURSES_COLOR and ax_cv_curses_color are defined if the library # supports color functions and macros such as COLOR_PAIR, A_COLOR, # COLOR_WHITE, COLOR_RED and init_pair(). These are NOT part of the # X/Open Base Curses definition, but are part of the Enhanced set of # functions. The Ncurses library DOES support these functions, as does # NcursesW. # # HAVE_CURSES_OBSOLETE and ax_cv_curses_obsolete are defined if the # library supports certain features present in SysV and BSD Curses but not # defined in the X/Open definition. In particular, the functions # getattrs(), getcurx() and getmaxx() are checked. # # To use the HAVE_xxx_H preprocessor symbols, insert the following into # your system.h (or equivalent) header file: # # #if defined HAVE_NCURSESW_CURSES_H # # include # #elif defined HAVE_NCURSESW_H # # include # #elif defined HAVE_NCURSES_CURSES_H # # include # #elif defined HAVE_NCURSES_H # # include # #elif defined HAVE_CURSES_H # # include # #else # # error "SysV or X/Open-compatible Curses header file required" # #endif # # For previous users of this macro: you should not need to change anything # in your configure.ac or Makefile.am, as the previous (serial 10) # semantics are still valid. However, you should update your system.h (or # equivalent) header file to the fragment shown above. You are encouraged # also to make use of the extended functionality provided by this version # of AX_WITH_CURSES, as well as in the additional macros # AX_WITH_CURSES_PANEL, AX_WITH_CURSES_MENU and AX_WITH_CURSES_FORM. # # LICENSE # # Copyright (c) 2009 Mark Pulford # Copyright (c) 2009 Damian Pietras # Copyright (c) 2012 Reuben Thomas # Copyright (c) 2011 John Zaitseff # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 13 AU_ALIAS([MP_WITH_CURSES], [AX_WITH_CURSES]) AC_DEFUN([AX_WITH_CURSES], [ AC_ARG_VAR([CURSES_LIB], [linker library for Curses, e.g. -lcurses]) AC_ARG_WITH([ncurses], [AS_HELP_STRING([--with-ncurses], [force the use of Ncurses or NcursesW])], [], [with_ncurses=check]) AC_ARG_WITH([ncursesw], [AS_HELP_STRING([--without-ncursesw], [do not use NcursesW (wide character support)])], [], [with_ncursesw=check]) ax_saved_LIBS=$LIBS AS_IF([test "x$with_ncurses" = xyes || test "x$with_ncursesw" = xyes], [ax_with_plaincurses=no], [ax_with_plaincurses=check]) ax_cv_curses_which=no # Test for NcursesW AS_IF([test "x$CURSES_LIB" = x && test "x$with_ncursesw" != xno], [ LIBS="$ax_saved_LIBS -lncursesw" AC_CACHE_CHECK([for NcursesW wide-character library], [ax_cv_ncursesw], [ AC_LINK_IFELSE([AC_LANG_CALL([], [initscr])], [ax_cv_ncursesw=yes], [ax_cv_ncursesw=no]) ]) AS_IF([test "x$ax_cv_ncursesw" = xno && test "x$with_ncursesw" = xyes], [ AC_MSG_ERROR([--with-ncursesw specified but could not find NcursesW library]) ]) AS_IF([test "x$ax_cv_ncursesw" = xyes], [ ax_cv_curses=yes ax_cv_curses_which=ncursesw CURSES_LIB="-lncursesw" AC_DEFINE([HAVE_NCURSESW], [1], [Define to 1 if the NcursesW library is present]) AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present]) AC_CACHE_CHECK([for working ncursesw/curses.h], [ax_cv_header_ncursesw_curses_h], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@define _XOPEN_SOURCE_EXTENDED 1 @%:@include ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ]])], [ax_cv_header_ncursesw_curses_h=yes], [ax_cv_header_ncursesw_curses_h=no]) ]) AS_IF([test "x$ax_cv_header_ncursesw_curses_h" = xyes], [ ax_cv_curses_enhanced=yes ax_cv_curses_color=yes ax_cv_curses_obsolete=yes AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions]) AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features]) AC_DEFINE([HAVE_NCURSESW_CURSES_H], [1], [Define to 1 if is present]) ]) AC_CACHE_CHECK([for working ncursesw.h], [ax_cv_header_ncursesw_h], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@define _XOPEN_SOURCE_EXTENDED 1 @%:@include ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ]])], [ax_cv_header_ncursesw_h=yes], [ax_cv_header_ncursesw_h=no]) ]) AS_IF([test "x$ax_cv_header_ncursesw_h" = xyes], [ ax_cv_curses_enhanced=yes ax_cv_curses_color=yes ax_cv_curses_obsolete=yes AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions]) AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features]) AC_DEFINE([HAVE_NCURSESW_H], [1], [Define to 1 if is present]) ]) AC_CACHE_CHECK([for working ncurses.h], [ax_cv_header_ncurses_h_with_ncursesw], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@define _XOPEN_SOURCE_EXTENDED 1 @%:@include ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ]])], [ax_cv_header_ncurses_h_with_ncursesw=yes], [ax_cv_header_ncurses_h_with_ncursesw=no]) ]) AS_IF([test "x$ax_cv_header_ncurses_h_with_ncursesw" = xyes], [ ax_cv_curses_enhanced=yes ax_cv_curses_color=yes ax_cv_curses_obsolete=yes AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions]) AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features]) AC_DEFINE([HAVE_NCURSES_H], [1], [Define to 1 if is present]) ]) AS_IF([test "x$ax_cv_header_ncursesw_curses_h" = xno && test "x$ax_cv_header_ncursesw_h" = xno && test "x$ax_cv_header_ncurses_h_with_ncursesw" = xno], [ AC_MSG_WARN([could not find a working ncursesw/curses.h, ncursesw.h or ncurses.h]) ]) ]) ]) # Test for Ncurses AS_IF([test "x$CURSES_LIB" = x && test "x$with_ncurses" != xno && test "x$ax_cv_curses_which" = xno], [ LIBS="$ax_saved_LIBS -lncurses" AC_CACHE_CHECK([for Ncurses library], [ax_cv_ncurses], [ AC_LINK_IFELSE([AC_LANG_CALL([], [initscr])], [ax_cv_ncurses=yes], [ax_cv_ncurses=no]) ]) AS_IF([test "x$ax_cv_ncurses" = xno && test "x$with_ncurses" = xyes], [ AC_MSG_ERROR([--with-ncurses specified but could not find Ncurses library]) ]) AS_IF([test "x$ax_cv_ncurses" = xyes], [ ax_cv_curses=yes ax_cv_curses_which=ncurses CURSES_LIB="-lncurses" AC_DEFINE([HAVE_NCURSES], [1], [Define to 1 if the Ncurses library is present]) AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present]) AC_CACHE_CHECK([for working ncurses/curses.h], [ax_cv_header_ncurses_curses_h], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@include ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); ]])], [ax_cv_header_ncurses_curses_h=yes], [ax_cv_header_ncurses_curses_h=no]) ]) AS_IF([test "x$ax_cv_header_ncurses_curses_h" = xyes], [ ax_cv_curses_color=yes ax_cv_curses_obsolete=yes AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features]) AC_DEFINE([HAVE_NCURSES_CURSES_H], [1], [Define to 1 if is present]) ]) AC_CACHE_CHECK([for working ncurses.h], [ax_cv_header_ncurses_h], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@include ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); ]])], [ax_cv_header_ncurses_h=yes], [ax_cv_header_ncurses_h=no]) ]) AS_IF([test "x$ax_cv_header_ncurses_h" = xyes], [ ax_cv_curses_color=yes ax_cv_curses_obsolete=yes AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features]) AC_DEFINE([HAVE_NCURSES_H], [1], [Define to 1 if is present]) ]) AS_IF([test "x$ax_cv_header_ncurses_curses_h" = xno && test "x$ax_cv_header_ncurses_h" = xno], [ AC_MSG_WARN([could not find a working ncurses/curses.h or ncurses.h]) ]) ]) ]) # Test for plain Curses (or if CURSES_LIB was set by user) AS_IF([test "x$with_plaincurses" != xno && test "x$ax_cv_curses_which" = xno], [ AS_IF([test "x$CURSES_LIB" != x], [ LIBS="$ax_saved_LIBS $CURSES_LIB" ], [ LIBS="$ax_saved_LIBS -lcurses" ]) AC_CACHE_CHECK([for Curses library], [ax_cv_plaincurses], [ AC_LINK_IFELSE([AC_LANG_CALL([], [initscr])], [ax_cv_plaincurses=yes], [ax_cv_plaincurses=no]) ]) AS_IF([test "x$ax_cv_plaincurses" = xyes], [ ax_cv_curses=yes ax_cv_curses_which=plaincurses AS_IF([test "x$CURSES_LIB" = x], [ CURSES_LIB="-lcurses" ]) AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present]) # Check for base conformance (and header file) AC_CACHE_CHECK([for working curses.h], [ax_cv_header_curses_h], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@include ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; initscr(); ]])], [ax_cv_header_curses_h=yes], [ax_cv_header_curses_h=no]) ]) AS_IF([test "x$ax_cv_header_curses_h" = xyes], [ AC_DEFINE([HAVE_CURSES_H], [1], [Define to 1 if is present]) # Check for X/Open Enhanced conformance AC_CACHE_CHECK([for X/Open Enhanced Curses conformance], [ax_cv_plaincurses_enhanced], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@define _XOPEN_SOURCE_EXTENDED 1 @%:@include @%:@ifndef _XOPEN_CURSES @%:@error "this Curses library is not enhanced" "this Curses library is not enhanced" @%:@endif ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ]])], [ax_cv_plaincurses_enhanced=yes], [ax_cv_plaincurses_enhanced=no]) ]) AS_IF([test "x$ax_cv_plaincurses_enhanced" = xyes], [ ax_cv_curses_enhanced=yes ax_cv_curses_color=yes AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions]) AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) ]) # Check for color functions AC_CACHE_CHECK([for Curses color functions], [ax_cv_plaincurses_color], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@define _XOPEN_SOURCE_EXTENDED 1 @%:@include ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); ]])], [ax_cv_plaincurses_color=yes], [ax_cv_plaincurses_color=no]) ]) AS_IF([test "x$ax_cv_plaincurses_color" = xyes], [ ax_cv_curses_color=yes AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) ]) # Check for obsolete functions AC_CACHE_CHECK([for obsolete Curses functions], [ax_cv_plaincurses_obsolete], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@include ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); ]])], [ax_cv_plaincurses_obsolete=yes], [ax_cv_plaincurses_obsolete=no]) ]) AS_IF([test "x$ax_cv_plaincurses_obsolete" = xyes], [ ax_cv_curses_obsolete=yes AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features]) ]) ]) AS_IF([test "x$ax_cv_header_curses_h" = xno], [ AC_MSG_WARN([could not find a working curses.h]) ]) ]) ]) AS_IF([test "x$ax_cv_curses" != xyes], [ax_cv_curses=no]) AS_IF([test "x$ax_cv_curses_enhanced" != xyes], [ax_cv_curses_enhanced=no]) AS_IF([test "x$ax_cv_curses_color" != xyes], [ax_cv_curses_color=no]) AS_IF([test "x$ax_cv_curses_obsolete" != xyes], [ax_cv_curses_obsolete=no]) LIBS=$ax_saved_LIBS ])dnl varnish-4.1.1/m4/ax_check_link_flag.m40000644000201500234410000000611512652366721014456 00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # # Check whether the given FLAG works with the linker or gives an error. # (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the linker's default flags # when the check is done. The check is thus made with the flags: "LDFLAGS # EXTRA-FLAGS FLAG". This can for example be used to force the linker to # issue an error when a bad flag is given. # # INPUT gives an alternative input source to AC_LINK_IFELSE. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 3 AC_DEFUN([AX_CHECK_LINK_FLAG], [AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS $4 $1" AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) LDFLAGS=$ax_check_save_flags]) AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_LINK_FLAGS varnish-4.1.1/m4/ltversion.m40000644000201500234410000000126212652366722012727 00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) varnish-4.1.1/m4/libtool.m40000644000201500234410000106043412652366722012355 00000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS varnish-4.1.1/varnish.m40000644000201500234410000000673712652366721012047 00000000000000# varnish.m4 - Macros to locate Varnish header files. -*- Autoconf -*- # serial 3 (varnish-4.0) # Copyright (c) 2013-2015 Varnish Software AS # All rights reserved. # # Author: Tollef Fog Heen # # 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. # # For compatibility with autoconf < 2.63b m4_ifndef([AS_VAR_COPY], [m4_define([AS_VAR_COPY], [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])]) # VARNISH_VMOD_INCLUDE_DIR([]) # ---------------------------- AC_DEFUN([VARNISH_VMOD_INCLUDES], [ m4_pattern_forbid([^_?VARNISH[A-Z_]+$]) m4_pattern_allow([^VARNISH_VMOD(_INCLUDE_DIR|TOOL)$]) # Check for pkg-config PKG_CHECK_EXISTS([varnishapi],[],[ if test -z "$PKG_CONFIG"; then AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. To get pkg-config, see .]) else AC_MSG_FAILURE( [pkg-config was unable to locate the varnishapi configuration data. Please check config.log or adjust the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.]) fi ]) VARNISH_PKG_GET_VAR([VAPI_INCLUDE_DIR], [pkgincludedir]) _CPPFLAGS="$CPPFLAGS" VMOD_INCLUDES="-I$VAPI_INCLUDE_DIR" CPPFLAGS="$VMOD_INCLUDES $CPPFLAGS" AC_CHECK_HEADERS([vsha256.h cache/cache.h]) CPPFLAGS="$_CPPFLAGS" AC_SUBST([VMOD_INCLUDES]) ])# VARNISH_VMOD_INCLUDE_DIR # VARNISH_VMOD_DIR([]) # -------------------- AC_DEFUN([VARNISH_VMOD_DIR], [ VARNISH_PKG_GET_VAR([VMOD_DIR], [vmoddir]) AC_SUBST([VMOD_DIR]) ]) # VARNISH_VMODTOOL([]) # -------------------- AC_DEFUN([VARNISH_VMODTOOL], [ AC_CHECK_PROGS(PYTHON, [python3 python3.1 python3.2 python2.7 python2.6 python2.5 python2 python], "no") if test "x$PYTHON" = "xno"; then AC_MSG_ERROR([Python is needed to build, please install python.]) fi VARNISH_PKG_GET_VAR([VMODTOOL], [vmodtool]) AC_SUBST([VMODTOOL]) ]) # VARNISH_PKG_GET_VAR([VARIABLE, PC_VAR_NAME]) # ------------------------------- AC_DEFUN([VARNISH_PKG_GET_VAR], [ # Uses internal function for now.. pkg_failed=no _PKG_CONFIG([$1], [variable=][$2], [varnishapi]) if test "$pkg_failed" = "yes"; then AC_MSG_FAILURE([$2][ not defined, too old Varnish?]) fi AS_VAR_COPY([$1], [pkg_cv_][$1]) ]) varnish-4.1.1/configure0000755000201500234410000213464312652366730012042 00000000000000#! /bin/sh # From configure.ac Id. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for Varnish 4.1.1. # # Report bugs to . # # Copyright (c) 2006 Verdens Gang AS # Copyright (c) 2006-2016 Varnish Software AS # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: varnish-dev@varnish-cache.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Varnish' PACKAGE_TARNAME='varnish' PACKAGE_VERSION='4.1.1' PACKAGE_STRING='Varnish 4.1.1' PACKAGE_BUGREPORT='varnish-dev@varnish-cache.org' PACKAGE_URL='' ac_unique_file="include/miniobj.h" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS VTC_TESTS VCC_CC ENABLE_TESTS_FALSE ENABLE_TESTS_TRUE AM_LT_LDFLAGS HAVE_LD_VERSION_SCRIPT_FALSE HAVE_LD_VERSION_SCRIPT_TRUE varnishconfdir VARNISH_STATE_DIR PYTHON LIBUMEM JEMALLOC_LDADD libvgz_extra_cflags LIBEDIT_LIBS LIBEDIT_CFLAGS PCRE_CONFIG PCRE_LIBS PCRE_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG LIBM NET_LIBS CURSES_LIB DL_LIBS RT_LIBS HAVE_DOT_FALSE HAVE_DOT_TRUE DOT HAVE_RST2HTML_FALSE HAVE_RST2HTML_TRUE RST2HTML RST2MAN PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC ax_pthread_config OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP SED LIBTOOL AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build EGREP GREP CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_maintainer_mode enable_dependency_tracking enable_silent_rules enable_static enable_shared with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock with_rst2man with_rst2html with_dot with_ncurses with_ncursesw with_pcre_config enable_pcre_jit with_jemalloc enable_largefile enable_kqueue enable_epoll enable_ports enable_ld_version_script enable_stack_protector enable_developer_warnings enable_debugging_symbols enable_tests ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CURSES_LIB PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PCRE_CFLAGS PCRE_LIBS LIBEDIT_CFLAGS LIBEDIT_LIBS VCC_CC' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Varnish 4.1.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/varnish] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Varnish 4.1.1:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0') --enable-static[=PKGS] build static libraries [default=no] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-pcre-jit use the PCRE JIT compiler (default is YES) --disable-largefile omit support for large files --enable-kqueue use kqueue if available (default is YES) --enable-epoll use epoll if available (default is YES) --enable-ports use ports if available (default is YES) --enable-ld-version-script enable linker version script (default is enabled when possible) --enable-stack-protector enable stack protector (default is YES) --enable-developer-warnings enable strict warnings (default is NO) --enable-debugging-symbols enable debugging symbols (default is NO) --enable-tests build test programs (default is NO) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-rst2man=PATH Location of rst2man (auto) --with-rst2html=PATH Location of rst2html (auto) --with-dot=PATH Location of the dot tool from graphviz (auto) --with-ncurses force the use of Ncurses or NcursesW --without-ncursesw do not use NcursesW (wide character support) --with-pcre-config=PATH Location of PCRE pcre-config (auto) --with-jemalloc use jemalloc memory allocator. Default is yes on Linux, no elsewhere Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CURSES_LIB linker library for Curses, e.g. -lcurses PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path PCRE_CFLAGS C compiler flags for PCRE, overriding pkg-config PCRE_LIBS linker flags for PCRE, overriding pkg-config LIBEDIT_CFLAGS C compiler flags for LIBEDIT, overriding pkg-config LIBEDIT_LIBS linker flags for LIBEDIT, overriding pkg-config VCC_CC C compiler command line for VCL code Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Varnish configure 4.1.1 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2016 Varnish Software AS _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## -------------------------------------------- ## ## Report this to varnish-dev@varnish-cache.org ## ## -------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Varnish $as_me 4.1.1, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" ac_aux_dir= for ac_dir in build-aux "$srcdir"/build-aux; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h # save command line CFLAGS for use in VCC_CC (to pass through things like -m64) OCFLAGS="$CFLAGS" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='varnish' VERSION='4.1.1' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=no fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu case $ac_cv_prog_cc_stdc in #( no) : ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( *) : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static void test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str; int number; float fnumber; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c99" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then : ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 else ac_cv_prog_cc_stdc=no fi fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 $as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } if ${ac_cv_prog_cc_stdc+:} false; then : $as_echo_n "(cached) " >&6 fi case $ac_cv_prog_cc_stdc in #( no) : { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; #( '') : { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; #( *) : { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 $as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" = "xno" || test "x$ac_cv_prog_cc_c99" = "x"; then # We might be on RHEL5 with a git checkout and so broken # autoconf. Check if CC is gcc and if it bails when given -std=gnu99. # If not, use that. Yuck. if test "x$ac_cv_c_compiler_gnu" = "xyes"; then CC="$CC -std=gnu99" if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else as_fn_error $? "Could not find a C99 compatible compiler" "$LINENO" 5 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else as_fn_error $? "Could not find a C99 compatible compiler" "$LINENO" 5 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ax_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 $as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_join (); int main () { return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 $as_echo "$ax_pthread_ok" >&6; } if test x"$ax_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # ... -mt is also the pthreads flag for HP/aCC # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthreads/-mt/ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" ;; *-darwin*) acx_pthread_flags="-pthread $acx_pthread_flags" ;; esac if test x"$ax_pthread_ok" = xno; then for flag in $ax_pthread_flags; do case $flag in none) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 $as_echo_n "checking whether pthreads work without any flags... " >&6; } ;; -*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5 $as_echo_n "checking whether pthreads work with $flag... " >&6; } PTHREAD_CFLAGS="$flag" ;; pthread-config) # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ax_pthread_config+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ax_pthread_config"; then ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ax_pthread_config="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" fi fi ax_pthread_config=$ac_cv_prog_ax_pthread_config if test -n "$ax_pthread_config"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 $as_echo "$ax_pthread_config" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$ax_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 $as_echo_n "checking for the pthreads library -l$flag... " >&6; } PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include static void routine(void* a) {a=0;} static void* start_routine(void* a) {return a;} int main () { pthread_t th; pthread_attr_t attr; pthread_join(th, 0); pthread_attr_init(&attr); pthread_cleanup_push(routine, 0); pthread_create(&th,0,start_routine,0); pthread_cleanup_pop(0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 $as_echo "$ax_pthread_ok" >&6; } if test "x$ax_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$ax_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 $as_echo_n "checking for joinable pthread attribute... " >&6; } attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int attr=$attr; return attr; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : attr_name=$attr; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 $as_echo "$attr_name" >&6; } if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then cat >>confdefs.h <<_ACEOF #define PTHREAD_CREATE_JOINABLE $attr_name _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 $as_echo_n "checking if more special flags are required for pthreads... " >&6; } flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5 $as_echo "${flag}" >&6; } if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r if test x"$GCC" != xyes; then for ac_prog in xlc_r cc_r do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PTHREAD_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PTHREAD_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 $as_echo "$PTHREAD_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PTHREAD_CC" && break done test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$ax_pthread_ok" = xyes; then $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h : else ax_pthread_ok=no as_fn_error $? "Could not configure pthreads support" "$LINENO" 5 fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi # Check whether --with-rst2man was given. if test "${with_rst2man+set}" = set; then : withval=$with_rst2man; RST2MAN="$withval" else for ac_prog in rst2man rst2man.py do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RST2MAN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RST2MAN"; then ac_cv_prog_RST2MAN="$RST2MAN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RST2MAN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RST2MAN=$ac_cv_prog_RST2MAN if test -n "$RST2MAN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RST2MAN" >&5 $as_echo "$RST2MAN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$RST2MAN" && break done test -n "$RST2MAN" || RST2MAN="no" fi if test "x$RST2MAN" = "xno"; then as_fn_error $? "rst2man is needed to build Varnish, please install python-docutils." "$LINENO" 5 fi # Check whether --with-rst2html was given. if test "${with_rst2html+set}" = set; then : withval=$with_rst2html; RST2HTML="$withval" else for ac_prog in rst2html rst2html.py do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RST2HTML+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RST2HTML"; then ac_cv_prog_RST2HTML="$RST2HTML" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RST2HTML="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RST2HTML=$ac_cv_prog_RST2HTML if test -n "$RST2HTML"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RST2HTML" >&5 $as_echo "$RST2HTML" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$RST2HTML" && break done test -n "$RST2HTML" || RST2HTML=""no"" if test "x$RST2HTML" = "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: rst2html not found - not building changelog" >&5 $as_echo "$as_me: WARNING: rst2html not found - not building changelog" >&2;} fi fi if test "x$RST2HTML" != "xno"; then HAVE_RST2HTML_TRUE= HAVE_RST2HTML_FALSE='#' else HAVE_RST2HTML_TRUE='#' HAVE_RST2HTML_FALSE= fi # Check whether --with-dot was given. if test "${with_dot+set}" = set; then : withval=$with_dot; DOT="$withval" else for ac_prog in dot do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DOT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DOT"; then ac_cv_prog_DOT="$DOT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DOT="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DOT=$ac_cv_prog_DOT if test -n "$DOT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5 $as_echo "$DOT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DOT" && break done test -n "$DOT" || DOT="no" if test "x$DOT" = "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dot not found - can't generate graphviz output for documentation." >&5 $as_echo "$as_me: WARNING: dot not found - can't generate graphviz output for documentation." >&2;} fi fi if test "x$DOT" != "xno"; then HAVE_DOT_TRUE= HAVE_DOT_FALSE='#' else HAVE_DOT_TRUE='#' HAVE_DOT_FALSE= fi # Checks for libraries. save_LIBS="${LIBS}" LIBS="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 $as_echo_n "checking for clock_gettime in -lrt... " >&6; } if ${ac_cv_lib_rt_clock_gettime+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char clock_gettime (); int main () { return clock_gettime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_rt_clock_gettime=yes else ac_cv_lib_rt_clock_gettime=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 $as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBRT 1 _ACEOF LIBS="-lrt $LIBS" fi RT_LIBS="${LIBS}" LIBS="${save_LIBS}" save_LIBS="${LIBS}" LIBS="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF LIBS="-ldl $LIBS" fi DL_LIBS="${LIBS}" LIBS="${save_LIBS}" # Check whether --with-ncurses was given. if test "${with_ncurses+set}" = set; then : withval=$with_ncurses; else with_ncurses=check fi # Check whether --with-ncursesw was given. if test "${with_ncursesw+set}" = set; then : withval=$with_ncursesw; else with_ncursesw=check fi ax_saved_LIBS=$LIBS if test "x$with_ncurses" = xyes || test "x$with_ncursesw" = xyes; then : ax_with_plaincurses=no else ax_with_plaincurses=check fi ax_cv_curses_which=no # Test for NcursesW if test "x$CURSES_LIB" = x && test "x$with_ncursesw" != xno; then : LIBS="$ax_saved_LIBS -lncursesw" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NcursesW wide-character library" >&5 $as_echo_n "checking for NcursesW wide-character library... " >&6; } if ${ax_cv_ncursesw+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char initscr (); int main () { return initscr (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_ncursesw=yes else ax_cv_ncursesw=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_ncursesw" >&5 $as_echo "$ax_cv_ncursesw" >&6; } if test "x$ax_cv_ncursesw" = xno && test "x$with_ncursesw" = xyes; then : as_fn_error $? "--with-ncursesw specified but could not find NcursesW library" "$LINENO" 5 fi if test "x$ax_cv_ncursesw" = xyes; then : ax_cv_curses=yes ax_cv_curses_which=ncursesw CURSES_LIB="-lncursesw" $as_echo "#define HAVE_NCURSESW 1" >>confdefs.h $as_echo "#define HAVE_CURSES 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working ncursesw/curses.h" >&5 $as_echo_n "checking for working ncursesw/curses.h... " >&6; } if ${ax_cv_header_ncursesw_curses_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include int main () { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_header_ncursesw_curses_h=yes else ax_cv_header_ncursesw_curses_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_header_ncursesw_curses_h" >&5 $as_echo "$ax_cv_header_ncursesw_curses_h" >&6; } if test "x$ax_cv_header_ncursesw_curses_h" = xyes; then : ax_cv_curses_enhanced=yes ax_cv_curses_color=yes ax_cv_curses_obsolete=yes $as_echo "#define HAVE_CURSES_ENHANCED 1" >>confdefs.h $as_echo "#define HAVE_CURSES_COLOR 1" >>confdefs.h $as_echo "#define HAVE_CURSES_OBSOLETE 1" >>confdefs.h $as_echo "#define HAVE_NCURSESW_CURSES_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working ncursesw.h" >&5 $as_echo_n "checking for working ncursesw.h... " >&6; } if ${ax_cv_header_ncursesw_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include int main () { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_header_ncursesw_h=yes else ax_cv_header_ncursesw_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_header_ncursesw_h" >&5 $as_echo "$ax_cv_header_ncursesw_h" >&6; } if test "x$ax_cv_header_ncursesw_h" = xyes; then : ax_cv_curses_enhanced=yes ax_cv_curses_color=yes ax_cv_curses_obsolete=yes $as_echo "#define HAVE_CURSES_ENHANCED 1" >>confdefs.h $as_echo "#define HAVE_CURSES_COLOR 1" >>confdefs.h $as_echo "#define HAVE_CURSES_OBSOLETE 1" >>confdefs.h $as_echo "#define HAVE_NCURSESW_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working ncurses.h" >&5 $as_echo_n "checking for working ncurses.h... " >&6; } if ${ax_cv_header_ncurses_h_with_ncursesw+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include int main () { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_header_ncurses_h_with_ncursesw=yes else ax_cv_header_ncurses_h_with_ncursesw=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_header_ncurses_h_with_ncursesw" >&5 $as_echo "$ax_cv_header_ncurses_h_with_ncursesw" >&6; } if test "x$ax_cv_header_ncurses_h_with_ncursesw" = xyes; then : ax_cv_curses_enhanced=yes ax_cv_curses_color=yes ax_cv_curses_obsolete=yes $as_echo "#define HAVE_CURSES_ENHANCED 1" >>confdefs.h $as_echo "#define HAVE_CURSES_COLOR 1" >>confdefs.h $as_echo "#define HAVE_CURSES_OBSOLETE 1" >>confdefs.h $as_echo "#define HAVE_NCURSES_H 1" >>confdefs.h fi if test "x$ax_cv_header_ncursesw_curses_h" = xno && test "x$ax_cv_header_ncursesw_h" = xno && test "x$ax_cv_header_ncurses_h_with_ncursesw" = xno; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find a working ncursesw/curses.h, ncursesw.h or ncurses.h" >&5 $as_echo "$as_me: WARNING: could not find a working ncursesw/curses.h, ncursesw.h or ncurses.h" >&2;} fi fi fi # Test for Ncurses if test "x$CURSES_LIB" = x && test "x$with_ncurses" != xno && test "x$ax_cv_curses_which" = xno; then : LIBS="$ax_saved_LIBS -lncurses" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ncurses library" >&5 $as_echo_n "checking for Ncurses library... " >&6; } if ${ax_cv_ncurses+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char initscr (); int main () { return initscr (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_ncurses=yes else ax_cv_ncurses=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_ncurses" >&5 $as_echo "$ax_cv_ncurses" >&6; } if test "x$ax_cv_ncurses" = xno && test "x$with_ncurses" = xyes; then : as_fn_error $? "--with-ncurses specified but could not find Ncurses library" "$LINENO" 5 fi if test "x$ax_cv_ncurses" = xyes; then : ax_cv_curses=yes ax_cv_curses_which=ncurses CURSES_LIB="-lncurses" $as_echo "#define HAVE_NCURSES 1" >>confdefs.h $as_echo "#define HAVE_CURSES 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working ncurses/curses.h" >&5 $as_echo_n "checking for working ncurses/curses.h... " >&6; } if ${ax_cv_header_ncurses_curses_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_header_ncurses_curses_h=yes else ax_cv_header_ncurses_curses_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_header_ncurses_curses_h" >&5 $as_echo "$ax_cv_header_ncurses_curses_h" >&6; } if test "x$ax_cv_header_ncurses_curses_h" = xyes; then : ax_cv_curses_color=yes ax_cv_curses_obsolete=yes $as_echo "#define HAVE_CURSES_COLOR 1" >>confdefs.h $as_echo "#define HAVE_CURSES_OBSOLETE 1" >>confdefs.h $as_echo "#define HAVE_NCURSES_CURSES_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working ncurses.h" >&5 $as_echo_n "checking for working ncurses.h... " >&6; } if ${ax_cv_header_ncurses_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_header_ncurses_h=yes else ax_cv_header_ncurses_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_header_ncurses_h" >&5 $as_echo "$ax_cv_header_ncurses_h" >&6; } if test "x$ax_cv_header_ncurses_h" = xyes; then : ax_cv_curses_color=yes ax_cv_curses_obsolete=yes $as_echo "#define HAVE_CURSES_COLOR 1" >>confdefs.h $as_echo "#define HAVE_CURSES_OBSOLETE 1" >>confdefs.h $as_echo "#define HAVE_NCURSES_H 1" >>confdefs.h fi if test "x$ax_cv_header_ncurses_curses_h" = xno && test "x$ax_cv_header_ncurses_h" = xno; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find a working ncurses/curses.h or ncurses.h" >&5 $as_echo "$as_me: WARNING: could not find a working ncurses/curses.h or ncurses.h" >&2;} fi fi fi # Test for plain Curses (or if CURSES_LIB was set by user) if test "x$with_plaincurses" != xno && test "x$ax_cv_curses_which" = xno; then : if test "x$CURSES_LIB" != x; then : LIBS="$ax_saved_LIBS $CURSES_LIB" else LIBS="$ax_saved_LIBS -lcurses" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Curses library" >&5 $as_echo_n "checking for Curses library... " >&6; } if ${ax_cv_plaincurses+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char initscr (); int main () { return initscr (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_plaincurses=yes else ax_cv_plaincurses=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_plaincurses" >&5 $as_echo "$ax_cv_plaincurses" >&6; } if test "x$ax_cv_plaincurses" = xyes; then : ax_cv_curses=yes ax_cv_curses_which=plaincurses if test "x$CURSES_LIB" = x; then : CURSES_LIB="-lcurses" fi $as_echo "#define HAVE_CURSES 1" >>confdefs.h # Check for base conformance (and header file) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working curses.h" >&5 $as_echo_n "checking for working curses.h... " >&6; } if ${ax_cv_header_curses_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { chtype a = A_BOLD; int b = KEY_LEFT; initscr(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_header_curses_h=yes else ax_cv_header_curses_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_header_curses_h" >&5 $as_echo "$ax_cv_header_curses_h" >&6; } if test "x$ax_cv_header_curses_h" = xyes; then : $as_echo "#define HAVE_CURSES_H 1" >>confdefs.h # Check for X/Open Enhanced conformance { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X/Open Enhanced Curses conformance" >&5 $as_echo_n "checking for X/Open Enhanced Curses conformance... " >&6; } if ${ax_cv_plaincurses_enhanced+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include #ifndef _XOPEN_CURSES #error "this Curses library is not enhanced" "this Curses library is not enhanced" #endif int main () { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_plaincurses_enhanced=yes else ax_cv_plaincurses_enhanced=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_plaincurses_enhanced" >&5 $as_echo "$ax_cv_plaincurses_enhanced" >&6; } if test "x$ax_cv_plaincurses_enhanced" = xyes; then : ax_cv_curses_enhanced=yes ax_cv_curses_color=yes $as_echo "#define HAVE_CURSES_ENHANCED 1" >>confdefs.h $as_echo "#define HAVE_CURSES_COLOR 1" >>confdefs.h fi # Check for color functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Curses color functions" >&5 $as_echo_n "checking for Curses color functions... " >&6; } if ${ax_cv_plaincurses_color+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include int main () { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_plaincurses_color=yes else ax_cv_plaincurses_color=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_plaincurses_color" >&5 $as_echo "$ax_cv_plaincurses_color" >&6; } if test "x$ax_cv_plaincurses_color" = xyes; then : ax_cv_curses_color=yes $as_echo "#define HAVE_CURSES_COLOR 1" >>confdefs.h fi # Check for obsolete functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for obsolete Curses functions" >&5 $as_echo_n "checking for obsolete Curses functions... " >&6; } if ${ax_cv_plaincurses_obsolete+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { chtype a = A_BOLD; int b = KEY_LEFT; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_plaincurses_obsolete=yes else ax_cv_plaincurses_obsolete=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_plaincurses_obsolete" >&5 $as_echo "$ax_cv_plaincurses_obsolete" >&6; } if test "x$ax_cv_plaincurses_obsolete" = xyes; then : ax_cv_curses_obsolete=yes $as_echo "#define HAVE_CURSES_OBSOLETE 1" >>confdefs.h fi fi if test "x$ax_cv_header_curses_h" = xno; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find a working curses.h" >&5 $as_echo "$as_me: WARNING: could not find a working curses.h" >&2;} fi fi fi if test "x$ax_cv_curses" != xyes; then : ax_cv_curses=no fi if test "x$ax_cv_curses_enhanced" != xyes; then : ax_cv_curses_enhanced=no fi if test "x$ax_cv_curses_color" != xyes; then : ax_cv_curses_color=no fi if test "x$ax_cv_curses_obsolete" != xyes; then : ax_cv_curses_obsolete=no fi LIBS=$ax_saved_LIBS if test "x$ax_cv_curses" != xyes; then as_fn_error $? "requires an X/Open-compatible Curses library" "$LINENO" 5 fi save_LIBS="${LIBS}" LIBS="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create" >&5 $as_echo_n "checking for library containing pthread_create... " >&6; } if ${ac_cv_search_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF for ac_lib in '' thr pthread c_r; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_pthread_create=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_pthread_create+:} false; then : break fi done if ${ac_cv_search_pthread_create+:} false; then : else ac_cv_search_pthread_create=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_create" >&5 $as_echo "$ac_cv_search_pthread_create" >&6; } ac_res=$ac_cv_search_pthread_create if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi PTHREAD_LIBS="${LIBS}" LIBS="${save_LIBS}" save_LIBS="${LIBS}" LIBS="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_socket=yes else ac_cv_lib_socket_socket=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } if test "x$ac_cv_lib_socket_socket" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -lnsl" >&5 $as_echo_n "checking for getaddrinfo in -lnsl... " >&6; } if ${ac_cv_lib_nsl_getaddrinfo+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getaddrinfo (); int main () { return getaddrinfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_getaddrinfo=yes else ac_cv_lib_nsl_getaddrinfo=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_getaddrinfo" >&5 $as_echo "$ac_cv_lib_nsl_getaddrinfo" >&6; } if test "x$ac_cv_lib_nsl_getaddrinfo" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF LIBS="-lnsl $LIBS" fi NET_LIBS="${LIBS}" LIBS="${save_LIBS}" LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5 $as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; } if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmw $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char _mwvalidcheckl (); int main () { return _mwvalidcheckl (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_mw__mwvalidcheckl=yes else ac_cv_lib_mw__mwvalidcheckl=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5 $as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; } if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then : LIBM="-lmw" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 $as_echo_n "checking for cos in -lm... " >&6; } if ${ac_cv_lib_m_cos+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cos (); int main () { return cos (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_cos=yes else ac_cv_lib_m_cos=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5 $as_echo "$ac_cv_lib_m_cos" >&6; } if test "x$ac_cv_lib_m_cos" = xyes; then : LIBM="$LIBM -lm" fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 $as_echo_n "checking for cos in -lm... " >&6; } if ${ac_cv_lib_m_cos+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cos (); int main () { return cos (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_cos=yes else ac_cv_lib_m_cos=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5 $as_echo "$ac_cv_lib_m_cos" >&6; } if test "x$ac_cv_lib_m_cos" = xyes; then : LIBM="-lm" fi ;; esac if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi if test -n $PKG_CONFIG; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PCRE" >&5 $as_echo_n "checking for PCRE... " >&6; } if test -n "$PCRE_CFLAGS"; then pkg_cv_PCRE_CFLAGS="$PCRE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre\""; } >&5 ($PKG_CONFIG --exists --print-errors "libpcre") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PCRE_CFLAGS=`$PKG_CONFIG --cflags "libpcre" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$PCRE_LIBS"; then pkg_cv_PCRE_LIBS="$PCRE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre\""; } >&5 ($PKG_CONFIG --exists --print-errors "libpcre") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PCRE_LIBS=`$PKG_CONFIG --libs "libpcre" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then PCRE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpcre" 2>&1` else PCRE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpcre" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PCRE_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (libpcre) were not met: $PCRE_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables PCRE_CFLAGS and PCRE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables PCRE_CFLAGS and PCRE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else PCRE_CFLAGS=$pkg_cv_PCRE_CFLAGS PCRE_LIBS=$pkg_cv_PCRE_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi else # Extract the first word of "pcre-config", so it can be a program name with args. set dummy pcre-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PCRE_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PCRE_CONFIG"; then ac_cv_prog_PCRE_CONFIG="$PCRE_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PCRE_CONFIG="pcre-config" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PCRE_CONFIG=$ac_cv_prog_PCRE_CONFIG if test -n "$PCRE_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PCRE_CONFIG" >&5 $as_echo "$PCRE_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Check whether --with-pcre-config was given. if test "${with_pcre_config+set}" = set; then : withval=$with_pcre_config; pcre_config="$withval" else pcre_config="" fi if test "x$pcre_config" != "x" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $pcre_config" >&5 $as_echo_n "checking for $pcre_config... " >&6; } if test -f $pcre_config ; then PCRE_CONFIG=$pcre_config { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - searching PATH" >&5 $as_echo "no - searching PATH" >&6; } fi fi if test "x$PCRE_CONFIG" = "x"; then for ac_prog in pcre-config do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PCRE_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PCRE_CONFIG"; then ac_cv_prog_PCRE_CONFIG="$PCRE_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PCRE_CONFIG="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PCRE_CONFIG=$ac_cv_prog_PCRE_CONFIG if test -n "$PCRE_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PCRE_CONFIG" >&5 $as_echo "$PCRE_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PCRE_CONFIG" && break done fi PCRE_CFLAGS=`$PCRE_CONFIG --cflags` PCRE_LIBS=`$PCRE_CONFIG --libs` fi # --enable-pcre-jit # Check whether --enable-pcre-jit was given. if test "${enable_pcre_jit+set}" = set; then : enableval=$enable_pcre_jit; else enable_pcre_jit=yes fi if test "$enable_pcre_jit" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PCRE JIT usability" >&5 $as_echo_n "checking for PCRE JIT usability... " >&6; } save_CFLAGS="${CFLAGS}" CFLAGS="${PCRE_CFLAGS}" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "pcre.h" #if PCRE_MAJOR != 8 || PCRE_MINOR < 32 #error no jit #endif int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define USE_PCRE_JIT 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="${save_CFLAGS}" fi for ac_header in edit/readline/readline.h do : ac_fn_c_check_header_mongrel "$LINENO" "edit/readline/readline.h" "ac_cv_header_edit_readline_readline_h" "$ac_includes_default" if test "x$ac_cv_header_edit_readline_readline_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_EDIT_READLINE_READLINE_H 1 _ACEOF $as_echo "#define HAVE_LIBEDIT 1" >>confdefs.h LIBEDIT_LIBS="-ledit" else pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBEDIT" >&5 $as_echo_n "checking for LIBEDIT... " >&6; } if test -n "$LIBEDIT_CFLAGS"; then pkg_cv_LIBEDIT_CFLAGS="$LIBEDIT_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libedit\""; } >&5 ($PKG_CONFIG --exists --print-errors "libedit") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBEDIT_CFLAGS=`$PKG_CONFIG --cflags "libedit" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBEDIT_LIBS"; then pkg_cv_LIBEDIT_LIBS="$LIBEDIT_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libedit\""; } >&5 ($PKG_CONFIG --exists --print-errors "libedit") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBEDIT_LIBS=`$PKG_CONFIG --libs "libedit" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then LIBEDIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libedit" 2>&1` else LIBEDIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libedit" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBEDIT_PKG_ERRORS" >&5 # AX_LIB_READLINE overwrites LIBS which leads to every binary getting # linked against libreadline uselessly. So we re-use LIBEDIT_LIBS which # we have for libedit to add the lib specifically where needed save_LIBS="${LIBS}" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a readline compatible library" >&5 $as_echo_n "checking for a readline compatible library... " >&6; } if ${ax_cv_lib_readline+:} false; then : $as_echo_n "(cached) " >&6 else ORIG_LIBS="$LIBS" for readline_lib in readline edit editline; do for termcap_lib in "" termcap curses ncurses; do if test -z "$termcap_lib"; then TRY_LIB="-l$readline_lib" else TRY_LIB="-l$readline_lib -l$termcap_lib" fi LIBS="$ORIG_LIBS $TRY_LIB" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char readline (); int main () { return readline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_lib_readline="$TRY_LIB" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -n "$ax_cv_lib_readline"; then break fi done if test -n "$ax_cv_lib_readline"; then break fi done if test -z "$ax_cv_lib_readline"; then ax_cv_lib_readline="no" fi LIBS="$ORIG_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lib_readline" >&5 $as_echo "$ax_cv_lib_readline" >&6; } if test "$ax_cv_lib_readline" != "no"; then LIBS="$LIBS $ax_cv_lib_readline" $as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h for ac_header in readline.h readline/readline.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether readline supports history" >&5 $as_echo_n "checking whether readline supports history... " >&6; } if ${ax_cv_lib_readline_history+:} false; then : $as_echo_n "(cached) " >&6 else ax_cv_lib_readline_history="no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char add_history (); int main () { return add_history (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_lib_readline_history="yes" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lib_readline_history" >&5 $as_echo "$ax_cv_lib_readline_history" >&6; } if test "$ax_cv_lib_readline_history" = "yes"; then $as_echo "#define HAVE_READLINE_HISTORY 1" >>confdefs.h for ac_header in history.h readline/history.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi fi LIBS="${save_LIBS}" if test "$ax_cv_lib_readline" = "no"; then as_fn_error $? "neither libedit nor another readline compatible library found" "$LINENO" 5 fi if test "x$ax_cv_lib_readline_history" != "xyes"; then as_fn_error $? "need readline history support" "$LINENO" 5 fi LIBEDIT_LIBS="$ax_cv_lib_readline" elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } # AX_LIB_READLINE overwrites LIBS which leads to every binary getting # linked against libreadline uselessly. So we re-use LIBEDIT_LIBS which # we have for libedit to add the lib specifically where needed save_LIBS="${LIBS}" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a readline compatible library" >&5 $as_echo_n "checking for a readline compatible library... " >&6; } if ${ax_cv_lib_readline+:} false; then : $as_echo_n "(cached) " >&6 else ORIG_LIBS="$LIBS" for readline_lib in readline edit editline; do for termcap_lib in "" termcap curses ncurses; do if test -z "$termcap_lib"; then TRY_LIB="-l$readline_lib" else TRY_LIB="-l$readline_lib -l$termcap_lib" fi LIBS="$ORIG_LIBS $TRY_LIB" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char readline (); int main () { return readline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_lib_readline="$TRY_LIB" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -n "$ax_cv_lib_readline"; then break fi done if test -n "$ax_cv_lib_readline"; then break fi done if test -z "$ax_cv_lib_readline"; then ax_cv_lib_readline="no" fi LIBS="$ORIG_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lib_readline" >&5 $as_echo "$ax_cv_lib_readline" >&6; } if test "$ax_cv_lib_readline" != "no"; then LIBS="$LIBS $ax_cv_lib_readline" $as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h for ac_header in readline.h readline/readline.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether readline supports history" >&5 $as_echo_n "checking whether readline supports history... " >&6; } if ${ax_cv_lib_readline_history+:} false; then : $as_echo_n "(cached) " >&6 else ax_cv_lib_readline_history="no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char add_history (); int main () { return add_history (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_lib_readline_history="yes" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lib_readline_history" >&5 $as_echo "$ax_cv_lib_readline_history" >&6; } if test "$ax_cv_lib_readline_history" = "yes"; then $as_echo "#define HAVE_READLINE_HISTORY 1" >>confdefs.h for ac_header in history.h readline/history.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi fi LIBS="${save_LIBS}" if test "$ax_cv_lib_readline" = "no"; then as_fn_error $? "neither libedit nor another readline compatible library found" "$LINENO" 5 fi if test "x$ax_cv_lib_readline_history" != "xyes"; then as_fn_error $? "need readline history support" "$LINENO" 5 fi LIBEDIT_LIBS="$ax_cv_lib_readline" else LIBEDIT_CFLAGS=$pkg_cv_LIBEDIT_CFLAGS LIBEDIT_LIBS=$pkg_cv_LIBEDIT_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # having the module does not imply having the header for ac_header in editline/readline.h do : ac_fn_c_check_header_mongrel "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default" if test "x$ac_cv_header_editline_readline_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_EDITLINE_READLINE_H 1 _ACEOF $as_echo "#define HAVE_LIBEDIT 1" >>confdefs.h else as_fn_error $? "Found libedit, but header file is missing. Hint: Install dev package?" "$LINENO" 5 fi done fi fi done # Checks for header files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi for ac_header in sys/param.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" if test "x$ac_cv_header_sys_param_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_PARAM_H 1 _ACEOF fi done for ac_header in sys/types.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" if test "x$ac_cv_header_sys_types_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_TYPES_H 1 _ACEOF fi done for ac_header in sys/endian.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/endian.h" "ac_cv_header_sys_endian_h" "$ac_includes_default" if test "x$ac_cv_header_sys_endian_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_ENDIAN_H 1 _ACEOF fi done for ac_header in sys/filio.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/filio.h" "ac_cv_header_sys_filio_h" "$ac_includes_default" if test "x$ac_cv_header_sys_filio_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_FILIO_H 1 _ACEOF fi done for ac_header in sys/mount.h do : ac_fn_c_check_header_compile "$LINENO" "sys/mount.h" "ac_cv_header_sys_mount_h" "#include " if test "x$ac_cv_header_sys_mount_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_MOUNT_H 1 _ACEOF fi done for ac_header in sys/socket.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" if test "x$ac_cv_header_sys_socket_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_SOCKET_H 1 _ACEOF fi done for ac_header in sys/statvfs.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/statvfs.h" "ac_cv_header_sys_statvfs_h" "$ac_includes_default" if test "x$ac_cv_header_sys_statvfs_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_STATVFS_H 1 _ACEOF fi done for ac_header in sys/vfs.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/vfs.h" "ac_cv_header_sys_vfs_h" "$ac_includes_default" if test "x$ac_cv_header_sys_vfs_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_VFS_H 1 _ACEOF fi done for ac_header in endian.h do : ac_fn_c_check_header_mongrel "$LINENO" "endian.h" "ac_cv_header_endian_h" "$ac_includes_default" if test "x$ac_cv_header_endian_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ENDIAN_H 1 _ACEOF fi done for ac_header in execinfo.h do : ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default" if test "x$ac_cv_header_execinfo_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_EXECINFO_H 1 _ACEOF fi done for ac_header in netinet/in.h do : ac_fn_c_check_header_mongrel "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" if test "x$ac_cv_header_netinet_in_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NETINET_IN_H 1 _ACEOF fi done for ac_header in pthread_np.h do : ac_fn_c_check_header_compile "$LINENO" "pthread_np.h" "ac_cv_header_pthread_np_h" "#include " if test "x$ac_cv_header_pthread_np_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_NP_H 1 _ACEOF fi done for ac_header in stddef.h do : ac_fn_c_check_header_mongrel "$LINENO" "stddef.h" "ac_cv_header_stddef_h" "$ac_includes_default" if test "x$ac_cv_header_stddef_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDDEF_H 1 _ACEOF fi done for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done for ac_header in unistd.h do : ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UNISTD_H 1 _ACEOF fi done for ac_header in priv.h do : ac_fn_c_check_header_mongrel "$LINENO" "priv.h" "ac_cv_header_priv_h" "$ac_includes_default" if test "x$ac_cv_header_priv_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PRIV_H 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct sockaddr" "sa_len" "ac_cv_member_struct_sockaddr_sa_len" " #include #ifdef HAVE_SYS_SOCKET_H #include #endif " if test "x$ac_cv_member_struct_sockaddr_sa_len" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_SOCKADDR_SA_LEN 1 _ACEOF fi # Checks for library functions. { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VPRINTF 1 _ACEOF ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" if test "x$ac_cv_func__doprnt" = xyes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done for ac_func in strerror do : ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" if test "x$ac_cv_func_strerror" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRERROR 1 _ACEOF fi done ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" if test "x$ac_cv_have_decl_strerror_r" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRERROR_R $ac_have_decl _ACEOF for ac_func in strerror_r do : ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" if test "x$ac_cv_func_strerror_r" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRERROR_R 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 $as_echo_n "checking whether strerror_r returns char *... " >&6; } if ${ac_cv_func_strerror_r_char_p+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_func_strerror_r_char_p=no if test $ac_cv_have_decl_strerror_r = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); char *p = strerror_r (0, buf, sizeof buf); return !p || x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else # strerror_r is not declared. Choose between # systems that have relatively inaccessible declarations for the # function. BeOS and DEC UNIX 4.0 fall in this category, but the # former has a strerror_r that returns char*, while the latter # has a strerror_r that returns `int'. # This test should segfault on the DEC system. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default extern char *strerror_r (); int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); return ! isalpha (x); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 $as_echo "$ac_cv_func_strerror_r_char_p" >&6; } if test $ac_cv_func_strerror_r_char_p = yes; then $as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h fi for ac_func in dladdr do : ac_fn_c_check_func "$LINENO" "dladdr" "ac_cv_func_dladdr" if test "x$ac_cv_func_dladdr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLADDR 1 _ACEOF fi done for ac_func in socket do : ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" if test "x$ac_cv_func_socket" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SOCKET 1 _ACEOF fi done for ac_func in strptime do : ac_fn_c_check_func "$LINENO" "strptime" "ac_cv_func_strptime" if test "x$ac_cv_func_strptime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRPTIME 1 _ACEOF fi done for ac_func in fmtcheck do : ac_fn_c_check_func "$LINENO" "fmtcheck" "ac_cv_func_fmtcheck" if test "x$ac_cv_func_fmtcheck" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FMTCHECK 1 _ACEOF fi done for ac_func in getdtablesize do : ac_fn_c_check_func "$LINENO" "getdtablesize" "ac_cv_func_getdtablesize" if test "x$ac_cv_func_getdtablesize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETDTABLESIZE 1 _ACEOF fi done for ac_func in nanosleep do : ac_fn_c_check_func "$LINENO" "nanosleep" "ac_cv_func_nanosleep" if test "x$ac_cv_func_nanosleep" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NANOSLEEP 1 _ACEOF fi done for ac_func in setppriv do : ac_fn_c_check_func "$LINENO" "setppriv" "ac_cv_func_setppriv" if test "x$ac_cv_func_setppriv" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETPPRIV 1 _ACEOF fi done for ac_func in fallocate do : ac_fn_c_check_func "$LINENO" "fallocate" "ac_cv_func_fallocate" if test "x$ac_cv_func_fallocate" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FALLOCATE 1 _ACEOF fi done for ac_func in closefrom do : ac_fn_c_check_func "$LINENO" "closefrom" "ac_cv_func_closefrom" if test "x$ac_cv_func_closefrom" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_CLOSEFROM 1 _ACEOF fi done save_LIBS="${LIBS}" LIBS="${PTHREAD_LIBS}" for ac_func in pthread_set_name_np do : ac_fn_c_check_func "$LINENO" "pthread_set_name_np" "ac_cv_func_pthread_set_name_np" if test "x$ac_cv_func_pthread_set_name_np" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_SET_NAME_NP 1 _ACEOF fi done for ac_func in pthread_mutex_isowned_np do : ac_fn_c_check_func "$LINENO" "pthread_mutex_isowned_np" "ac_cv_func_pthread_mutex_isowned_np" if test "x$ac_cv_func_pthread_mutex_isowned_np" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_MUTEX_ISOWNED_NP 1 _ACEOF fi done for ac_func in pthread_timedjoin_np do : ac_fn_c_check_func "$LINENO" "pthread_timedjoin_np" "ac_cv_func_pthread_timedjoin_np" if test "x$ac_cv_func_pthread_timedjoin_np" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_TIMEDJOIN_NP 1 _ACEOF fi done LIBS="${save_LIBS}" # Support for visibility attribute save_CFLAGS="${CFLAGS}" CFLAGS="${CFLAGS} -Werror" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have support for visibility attributes" >&5 $as_echo_n "checking whether we have support for visibility attributes... " >&6; } if ${ac_cv_have_viz+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL #endif int ZLIB_INTERNAL foo; int main () { ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_have_viz=yes else ac_cv_have_viz=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_viz" >&5 $as_echo "$ac_cv_have_viz" >&6; } if test "$ac_cv_have_viz" = no; then libvgz_extra_cflags="-DNO_VIZ" fi CFLAGS="${save_CFLAGS}" # Use jemalloc on Linux JEMALLOC_LDADD= # Check whether --with-jemalloc was given. if test "${with_jemalloc+set}" = set; then : withval=$with_jemalloc; else with_jemalloc=check fi case $target in *-*-linux*) if test "x$with_jemalloc" != xno; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc_conf in -ljemalloc" >&5 $as_echo_n "checking for malloc_conf in -ljemalloc... " >&6; } if ${ac_cv_lib_jemalloc_malloc_conf+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ljemalloc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char malloc_conf (); int main () { return malloc_conf (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_jemalloc_malloc_conf=yes else ac_cv_lib_jemalloc_malloc_conf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jemalloc_malloc_conf" >&5 $as_echo "$ac_cv_lib_jemalloc_malloc_conf" >&6; } if test "x$ac_cv_lib_jemalloc_malloc_conf" = xyes; then : JEMALLOC_LDADD="-ljemalloc" else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No system jemalloc found, using system malloc" >&5 $as_echo "$as_me: WARNING: No system jemalloc found, using system malloc" >&2;} fi fi ;; esac # Userland slab allocator, available only on Solaris case $target in *-*-solaris*) for ac_header in umem.h do : ac_fn_c_check_header_mongrel "$LINENO" "umem.h" "ac_cv_header_umem_h" "$ac_includes_default" if test "x$ac_cv_header_umem_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UMEM_H 1 _ACEOF fi done if test "$ac_cv_have_umem_h" = yes; then save_LIBS="${LIBS}" LIBS="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for umem_alloc in -lumem" >&5 $as_echo_n "checking for umem_alloc in -lumem... " >&6; } if ${ac_cv_lib_umem_umem_alloc+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lumem $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char umem_alloc (); int main () { return umem_alloc (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_umem_umem_alloc=yes else ac_cv_lib_umem_umem_alloc=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_umem_umem_alloc" >&5 $as_echo "$ac_cv_lib_umem_umem_alloc" >&6; } if test "x$ac_cv_lib_umem_umem_alloc" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBUMEM 1 _ACEOF LIBS="-lumem $LIBS" fi LIBUMEM="${LIBS}" LIBS="${save_LIBS}" fi ;; esac # These functions are provided by libcompat on platforms where they # are not available for ac_func in setproctitle do : ac_fn_c_check_func "$LINENO" "setproctitle" "ac_cv_func_setproctitle" if test "x$ac_cv_func_setproctitle" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETPROCTITLE 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing backtrace" >&5 $as_echo_n "checking for library containing backtrace... " >&6; } if ${ac_cv_search_backtrace+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char backtrace (); int main () { return backtrace (); ; return 0; } _ACEOF for ac_lib in '' execinfo; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_backtrace=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_backtrace+:} false; then : break fi done if ${ac_cv_search_backtrace+:} false; then : else ac_cv_search_backtrace=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_backtrace" >&5 $as_echo "$ac_cv_search_backtrace" >&6; } ac_res=$ac_cv_search_backtrace if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_BACKTRACE 1" >>confdefs.h fi # white lie - we don't actually test it { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether daemon() works" >&5 $as_echo_n "checking whether daemon() works... " >&6; } case $target in *-*-darwin*) # present but not functional { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ac_cv_func_daemon=no ;; *) for ac_func in daemon do : ac_fn_c_check_func "$LINENO" "daemon" "ac_cv_func_daemon" if test "x$ac_cv_func_daemon" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DAEMON 1 _ACEOF fi done ;; esac # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi save_LIBS="${LIBS}" LIBS="${LIBS} ${RT_LIBS}" for ac_func in clock_gettime do : ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" if test "x$ac_cv_func_clock_gettime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_CLOCK_GETTIME 1 _ACEOF fi done for ac_func in gethrtime do : ac_fn_c_check_func "$LINENO" "gethrtime" "ac_cv_func_gethrtime" if test "x$ac_cv_func_gethrtime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETHRTIME 1 _ACEOF fi done LIBS="${save_LIBS}" # --enable-kqueue # Check whether --enable-kqueue was given. if test "${enable_kqueue+set}" = set; then : enableval=$enable_kqueue; else enable_kqueue=yes fi if test "$enable_kqueue" = yes; then for ac_func in kqueue do : ac_fn_c_check_func "$LINENO" "kqueue" "ac_cv_func_kqueue" if test "x$ac_cv_func_kqueue" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_KQUEUE 1 _ACEOF fi done else ac_cv_func_kqueue=no fi # --enable-epoll # Check whether --enable-epoll was given. if test "${enable_epoll+set}" = set; then : enableval=$enable_epoll; else enable_epoll=yes fi if test "$enable_epoll" = yes; then for ac_func in epoll_ctl do : ac_fn_c_check_func "$LINENO" "epoll_ctl" "ac_cv_func_epoll_ctl" if test "x$ac_cv_func_epoll_ctl" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_EPOLL_CTL 1 _ACEOF fi done else ac_cv_func_epoll_ctl=no fi # --enable-ports # Check whether --enable-ports was given. if test "${enable_ports+set}" = set; then : enableval=$enable_ports; else enable_ports=yes fi if test "$enable_ports" = yes; then for ac_func in port_create do : ac_fn_c_check_func "$LINENO" "port_create" "ac_cv_func_port_create" if test "x$ac_cv_func_port_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PORT_CREATE 1 _ACEOF fi done else ac_cv_func_port_create=no fi if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi for ac_prog in python3 python3.1 python3.2 python2.7 python2.6 python2.5 python2 python do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PYTHON"; then ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PYTHON="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PYTHON=$ac_cv_prog_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PYTHON" && break done test -n "$PYTHON" || PYTHON=""no"" if test "x$PYTHON" = "xno"; then as_fn_error $? "Python is needed to build Varnish, please install python." "$LINENO" 5 fi ac_fn_c_check_decl "$LINENO" "SO_ACCEPTFILTER" "ac_cv_have_decl_SO_ACCEPTFILTER" " #include #include " if test "x$ac_cv_have_decl_SO_ACCEPTFILTER" = xyes; then : $as_echo "#define HAVE_ACCEPT_FILTERS 1" >>confdefs.h fi # Older Solaris versions define SO_{RCV,SND}TIMEO, but do not # implement them. # # Varnish will build and run without these, but connections will not # time out, which may leave Varnish vulnerable to denail-of-service # attacks which would not be possible on other platforms. # # Newer Solaris releases with the Volo framework (Solaris 11, # Opensolaris starting with onnv_106) do support SO_{RCV,SND}TIMEO # (see PSARC 2007/587, initially committed into onnv-gate / # OpenSolaris 8348:4137e18bfaf0 Thu Dec 11 20:04:13 2008) save_LIBS="${LIBS}" LIBS="${LIBS} ${NET_LIBS}" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether SO_RCVTIMEO works" >&5 $as_echo_n "checking whether SO_RCVTIMEO works... " >&6; } if ${ac_cv_so_rcvtimeo_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { int sd = socket(AF_INET, SOCK_STREAM, 0); struct timeval tv = { 1, 0 }; if (setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv) == 0) { socklen_t l = sizeof tv; if (getsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, &l) == 0) { return (l != sizeof tv); } } return 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_so_rcvtimeo_works=yes else ac_cv_so_rcvtimeo_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_so_rcvtimeo_works" >&5 $as_echo "$ac_cv_so_rcvtimeo_works" >&6; } if test "$ac_cv_so_rcvtimeo_works" = yes; then $as_echo "#define SO_RCVTIMEO_WORKS 1" >>confdefs.h fi LIBS="${save_LIBS}" save_LIBS="${LIBS}" LIBS="${LIBS} ${NET_LIBS}" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether SO_SNDTIMEO works" >&5 $as_echo_n "checking whether SO_SNDTIMEO works... " >&6; } if ${ac_cv_so_sndtimeo_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { int sd = socket(AF_INET, SOCK_STREAM, 0); struct timeval tv = { 1, 0 }; if (setsockopt(sd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv) == 0) { socklen_t l = sizeof tv; if (getsockopt(sd, SOL_SOCKET, SO_SNDTIMEO, &tv, &l) == 0) { return (l != sizeof tv); } } return 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_so_sndtimeo_works=yes else ac_cv_so_sndtimeo_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_so_sndtimeo_works" >&5 $as_echo "$ac_cv_so_sndtimeo_works" >&6; } if test "$ac_cv_so_sndtimeo_works" = yes; then $as_echo "#define SO_SNDTIMEO_WORKS 1" >>confdefs.h fi if test "$ac_cv_so_rcvtimeo_works" = no || test "$ac_cv_so_sndtimeo_works" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: connection timeouts will not work" >&5 $as_echo "$as_me: WARNING: connection timeouts will not work" >&2;} fi LIBS="${save_LIBS}" # Check if the OS supports TCP_KEEP(CNT|IDLE|INTVL) socket options save_LIBS="${LIBS}" LIBS="${LIBS} ${NET_LIBS}" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TCP_KEEP(CNT|IDLE|INTVL) socket options" >&5 $as_echo_n "checking for TCP_KEEP(CNT|IDLE|INTVL) socket options... " >&6; } if ${ac_cv_have_tcp_keep+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include int main () { int s = socket(AF_INET, SOCK_STREAM, 0); int i; i = 5; if (setsockopt(s, IPPROTO_TCP, TCP_KEEPCNT, &i, sizeof i)) return (1); if (setsockopt(s, IPPROTO_TCP, TCP_KEEPIDLE, &i, sizeof i)) return (1); if (setsockopt(s, IPPROTO_TCP, TCP_KEEPINTVL, &i, sizeof i)) return (1); return (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_have_tcp_keep=yes else ac_cv_have_tcp_keep=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_tcp_keep" >&5 $as_echo "$ac_cv_have_tcp_keep" >&6; } if test "$ac_cv_have_tcp_keep" = yes; then $as_echo "#define HAVE_TCP_KEEP 1" >>confdefs.h fi LIBS="${save_LIBS}" # Run-time directory VARNISH_STATE_DIR='${localstatedir}/varnish' # Default configuration directory. varnishconfdir='${sysconfdir}/varnish' # Check for linker script support # Check whether --enable-ld-version-script was given. if test "${enable_ld_version_script+set}" = set; then : enableval=$enable_ld_version_script; have_ld_version_script=$enableval fi if test -z "$have_ld_version_script"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if LD -Wl,--version-script works" >&5 $as_echo_n "checking if LD -Wl,--version-script works... " >&6; } save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" cat > conftest.map <conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : accepts_syntax_errors=yes else accepts_syntax_errors=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$accepts_syntax_errors" = no; then cat > conftest.map <conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_ld_version_script=yes else have_ld_version_script=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else have_ld_version_script=no fi rm -f conftest.map LDFLAGS="$save_LDFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_ld_version_script" >&5 $as_echo "$have_ld_version_script" >&6; } fi if test "$have_ld_version_script" = "yes"; then HAVE_LD_VERSION_SCRIPT_TRUE= HAVE_LD_VERSION_SCRIPT_FALSE='#' else HAVE_LD_VERSION_SCRIPT_TRUE='#' HAVE_LD_VERSION_SCRIPT_FALSE= fi ####################################################################### # Now that we're done using the compiler to look for functions and # libraries, set CFLAGS to what we want them to be for our own code # This is a test to see how much havoc Jenkins exposes. # # The reason for -Wno-error=unused-result is a glibc/gcc interaction # idiocy where write is marked as warn_unused_result, causing build # failures. CFLAGS="${CFLAGS} -Wall -Werror" OCFLAGS="${OCFLAGS} -Wall -Werror" as_CACHEVAR=`$as_echo "ax_cv_check_cflags__-Werror=unused-result" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Werror=unused-result" >&5 $as_echo_n "checking whether C compiler accepts -Werror=unused-result... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror=unused-result" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : CFLAGS="${CFLAGS} -Wno-error=unused-result" OCFLAGS="${OCFLAGS} -Wno-error=unused-result" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunused-result" >&5 $as_echo_n "checking whether C compiler accepts -Wunused-result... " >&6; } if ${ax_cv_check_cflags___Wunused_result+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Wunused-result" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_cv_check_cflags___Wunused_result=yes else ax_cv_check_cflags___Wunused_result=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wunused_result" >&5 $as_echo "$ax_cv_check_cflags___Wunused_result" >&6; } if test x"$ax_cv_check_cflags___Wunused_result" = xyes; then : CFLAGS="${CFLAGS} -Wno-unused-result" OCFLAGS="${OCFLAGS} -Wno-unused-result" else : fi fi # This corresponds to FreeBSD's WARNS level 6 DEVELOPER_CFLAGS=" \ -Werror \ -Wall \ -Wno-format-y2k \ -W \ -Wstrict-prototypes \ -Wmissing-prototypes \ -Wpointer-arith \ -Wreturn-type \ -Wcast-qual \ -Wwrite-strings \ -Wswitch \ -Wshadow \ -Wunused-parameter \ -Wcast-align \ -Wchar-subscripts \ -Wnested-externs \ -Wextra \ -Wno-sign-compare \ " # These are not compliable yet DEVELOPER_GCC_CFLAGS="-Wold-style-definition -Wredundant-decls " #DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} ${DEVELOPER_GCC_CFLAGS}" # These are compilable DEVELOPER_CLANG_CFLAGS="-Wmissing-variable-declarations -Wno-string-plus-int" # -Wno-empty-body #DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} ${DEVELOPER_CLANG_CFLAGS}" # --enable-stack-protector # Check whether --enable-stack-protector was given. if test "${enable_stack_protector+set}" = set; then : enableval=$enable_stack_protector; else enable_stack_protector=yes fi if test "x$enable_stack_protector" != "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstack-protector" >&5 $as_echo_n "checking whether C compiler accepts -fstack-protector... " >&6; } if ${ax_cv_check_cflags___fstack_protector+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -fstack-protector" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_cv_check_cflags___fstack_protector=yes else ax_cv_check_cflags___fstack_protector=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fstack_protector" >&5 $as_echo "$ax_cv_check_cflags___fstack_protector" >&6; } if test x"$ax_cv_check_cflags___fstack_protector" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fstack-protector" >&5 $as_echo_n "checking whether the linker accepts -fstack-protector... " >&6; } if ${ax_cv_check_ldflags___fstack_protector+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -fstack-protector" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_check_ldflags___fstack_protector=yes else ax_cv_check_ldflags___fstack_protector=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags___fstack_protector" >&5 $as_echo "$ax_cv_check_ldflags___fstack_protector" >&6; } if test x"$ax_cv_check_ldflags___fstack_protector" = xyes; then : DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -fstack-protector" else : fi else : fi fi # --enable-developer-warnings # Check whether --enable-developer-warnings was given. if test "${enable_developer_warnings+set}" = set; then : enableval=$enable_developer_warnings; else enable_developer_warnings=no fi if test "x$enable_developer_warnings" != "xno"; then # compiler flags not available on gcc3 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wno-pointer-sign" >&5 $as_echo_n "checking whether C compiler accepts -Wno-pointer-sign... " >&6; } if ${ax_cv_check_cflags___Wno_pointer_sign+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Wno-pointer-sign" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_cv_check_cflags___Wno_pointer_sign=yes else ax_cv_check_cflags___Wno_pointer_sign=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wno_pointer_sign" >&5 $as_echo "$ax_cv_check_cflags___Wno_pointer_sign" >&6; } if test x"$ax_cv_check_cflags___Wno_pointer_sign" = xyes; then : DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-pointer-sign" else : fi # Not available in gcc 4.1.2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wno-address" >&5 $as_echo_n "checking whether C compiler accepts -Wno-address... " >&6; } if ${ax_cv_check_cflags___Wno_address+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Wno-address" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_cv_check_cflags___Wno_address=yes else ax_cv_check_cflags___Wno_address=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wno_address" >&5 $as_echo "$ax_cv_check_cflags___Wno_address" >&6; } if test x"$ax_cv_check_cflags___Wno_address" = xyes; then : DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-address" else : fi # no known way to specifically disabling missing-field-initializers warnings # keeping the rest of Wextra { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wno-missing-field-initializers" >&5 $as_echo_n "checking whether C compiler accepts -Wno-missing-field-initializers... " >&6; } if ${ax_cv_check_cflags___Wno_missing_field_initializers+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Wno-missing-field-initializers" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_cv_check_cflags___Wno_missing_field_initializers=yes else ax_cv_check_cflags___Wno_missing_field_initializers=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wno_missing_field_initializers" >&5 $as_echo "$ax_cv_check_cflags___Wno_missing_field_initializers" >&6; } if test x"$ax_cv_check_cflags___Wno_missing_field_initializers" = xyes; then : DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-missing-field-initializers" else DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-extra" fi CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}" OCFLAGS="${OCFLAGS} ${DEVELOPER_CFLAGS}" fi # --enable-debugging-symbols # Check whether --enable-debugging-symbols was given. if test "${enable_debugging_symbols+set}" = set; then : enableval=$enable_debugging_symbols; CFLAGS="${CFLAGS} -O0 -g -fno-inline" fi # --enable-tests # Check whether --enable-tests was given. if test "${enable_tests+set}" = set; then : enableval=$enable_tests; fi if test x$enable_tests = xyes; then ENABLE_TESTS_TRUE= ENABLE_TESTS_FALSE='#' else ENABLE_TESTS_TRUE='#' ENABLE_TESTS_FALSE= fi # Command line for compiling VCL code. I wish there were a simple way # to figure this out dynamically without introducing a run-time # dependency on libtool. if test "$ac_cv_env_VCC_CC_set" = "set"; then VCC_CC="$ac_cv_env_VCC_CC_value" else case $target in *-*-solaris*) case $PTHREAD_CC in *gcc*) VCC_CC="$PTHREAD_CC $OCFLAGS $PTHREAD_CFLAGS -fpic -shared -o %o %s" break ;; *cc) VCC_CC="$PTHREAD_CC $OCFLAGS $PTHREAD_CFLAGS -Kpic -G -o %o %s" ;; esac ;; *-*-darwin*) VCC_CC="exec cc $OCFLAGS -dynamiclib -Wl,-undefined,dynamic_lookup -o %o %s" ;; *) VCC_CC="exec $PTHREAD_CC $OCFLAGS $PTHREAD_CFLAGS -fpic -shared -Wl,-x -o %o %s" ;; esac fi cat >>confdefs.h <<_ACEOF #define VCC_CC "$VCC_CC" _ACEOF # Stupid automake needs this VTC_TESTS="$(cd $srcdir/bin/varnishtest && echo tests/*.vtc)" # Make sure this include dir exists ac_config_commands="$ac_config_commands mkdir" # Generate output ac_config_files="$ac_config_files Makefile bin/Makefile bin/varnishadm/Makefile bin/varnishd/Makefile bin/varnishlog/Makefile bin/varnishstat/Makefile bin/varnishtop/Makefile bin/varnishhist/Makefile bin/varnishtest/Makefile bin/varnishncsa/Makefile doc/Makefile doc/graphviz/Makefile doc/sphinx/Makefile doc/sphinx/conf.py etc/Makefile include/Makefile lib/Makefile lib/libvarnish/Makefile lib/libvarnishapi/Makefile lib/libvarnishtools/Makefile lib/libvarnishcompat/Makefile lib/libvcc/Makefile lib/libvgz/Makefile lib/libvmod_debug/Makefile lib/libvmod_std/Makefile lib/libvmod_directors/Makefile man/Makefile varnishapi.pc varnishapi-uninstalled.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${HAVE_RST2HTML_TRUE}" && test -z "${HAVE_RST2HTML_FALSE}"; then as_fn_error $? "conditional \"HAVE_RST2HTML\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_DOT_TRUE}" && test -z "${HAVE_DOT_FALSE}"; then as_fn_error $? "conditional \"HAVE_DOT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_LD_VERSION_SCRIPT_TRUE}" && test -z "${HAVE_LD_VERSION_SCRIPT_FALSE}"; then as_fn_error $? "conditional \"HAVE_LD_VERSION_SCRIPT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_TESTS_TRUE}" && test -z "${ENABLE_TESTS_FALSE}"; then as_fn_error $? "conditional \"ENABLE_TESTS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by Varnish $as_me 4.1.1, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ Varnish config.status 4.1.1 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "mkdir") CONFIG_COMMANDS="$CONFIG_COMMANDS mkdir" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "bin/Makefile") CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;; "bin/varnishadm/Makefile") CONFIG_FILES="$CONFIG_FILES bin/varnishadm/Makefile" ;; "bin/varnishd/Makefile") CONFIG_FILES="$CONFIG_FILES bin/varnishd/Makefile" ;; "bin/varnishlog/Makefile") CONFIG_FILES="$CONFIG_FILES bin/varnishlog/Makefile" ;; "bin/varnishstat/Makefile") CONFIG_FILES="$CONFIG_FILES bin/varnishstat/Makefile" ;; "bin/varnishtop/Makefile") CONFIG_FILES="$CONFIG_FILES bin/varnishtop/Makefile" ;; "bin/varnishhist/Makefile") CONFIG_FILES="$CONFIG_FILES bin/varnishhist/Makefile" ;; "bin/varnishtest/Makefile") CONFIG_FILES="$CONFIG_FILES bin/varnishtest/Makefile" ;; "bin/varnishncsa/Makefile") CONFIG_FILES="$CONFIG_FILES bin/varnishncsa/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "doc/graphviz/Makefile") CONFIG_FILES="$CONFIG_FILES doc/graphviz/Makefile" ;; "doc/sphinx/Makefile") CONFIG_FILES="$CONFIG_FILES doc/sphinx/Makefile" ;; "doc/sphinx/conf.py") CONFIG_FILES="$CONFIG_FILES doc/sphinx/conf.py" ;; "etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "lib/libvarnish/Makefile") CONFIG_FILES="$CONFIG_FILES lib/libvarnish/Makefile" ;; "lib/libvarnishapi/Makefile") CONFIG_FILES="$CONFIG_FILES lib/libvarnishapi/Makefile" ;; "lib/libvarnishtools/Makefile") CONFIG_FILES="$CONFIG_FILES lib/libvarnishtools/Makefile" ;; "lib/libvarnishcompat/Makefile") CONFIG_FILES="$CONFIG_FILES lib/libvarnishcompat/Makefile" ;; "lib/libvcc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/libvcc/Makefile" ;; "lib/libvgz/Makefile") CONFIG_FILES="$CONFIG_FILES lib/libvgz/Makefile" ;; "lib/libvmod_debug/Makefile") CONFIG_FILES="$CONFIG_FILES lib/libvmod_debug/Makefile" ;; "lib/libvmod_std/Makefile") CONFIG_FILES="$CONFIG_FILES lib/libvmod_std/Makefile" ;; "lib/libvmod_directors/Makefile") CONFIG_FILES="$CONFIG_FILES lib/libvmod_directors/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "varnishapi.pc") CONFIG_FILES="$CONFIG_FILES varnishapi.pc" ;; "varnishapi-uninstalled.pc") CONFIG_FILES="$CONFIG_FILES varnishapi-uninstalled.pc" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Whether or not to build static libraries. build_old_libs=$enable_static # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; "mkdir":C) $MKDIR_P doc/sphinx/include ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi varnish-4.1.1/LICENSE0000644000201500234410000000245212652366721011126 00000000000000Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2014 Varnish Software AS All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 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. varnish-4.1.1/aclocal.m40000644000201500234410000012673212652366724011774 00000000000000# generated automatically by aclocal 1.11.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, [m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, # 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless `enable' is passed literally. # For symmetry, `disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful (and sometimes confusing) to the casual installer], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2009, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # (`yes' being less verbose, `no' or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [ --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0')]) case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few `make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using `$V' instead of `$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/ax_check_compile_flag.m4]) m4_include([m4/ax_check_link_flag.m4]) m4_include([m4/ax_lib_readline.m4]) m4_include([m4/ax_pthread.m4]) m4_include([m4/ax_with_curses.m4]) m4_include([m4/ld-version-script.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) varnish-4.1.1/README0000644000201500234410000000077312652366721011005 00000000000000This is Varnish Cache, the high-performance HTTP accelerator. Documentation and additional information about Varnish is available on https://www.varnish-cache.org/ Technical questions about Varnish and this release should be addressed to . Please see https://www.varnish-cache.org/trac/wiki/Contributing for how to contribute patches and report bugs. Questions about commercial support and services related to Varnish should be addressed to . varnish-4.1.1/Makefile.am0000644000201500234410000000167412652366721012162 00000000000000ACLOCAL_AMFLAGS = -I m4 SUBDIRS = include lib bin etc doc man pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = varnishapi.pc m4dir = $(datadir)/aclocal m4_DATA = varnish.m4 CLEANFILES = cscope.in.out cscope.out cscope.po.out EXTRA_DIST = README.Packaging LICENSE autogen.sh varnishapi.pc.in varnish.m4 DISTCHECK_CONFIGURE_FLAGS = \ --enable-developer-warnings \ --enable-debugging-symbols \ --enable-dependency-tracking \ --enable-tests install-data-local: $(install_sh) -d -m 0755 $(DESTDIR)$(localstatedir)/varnish distcleancheck_listfiles = \ find . -type f -exec sh -c 'test -f $(srcdir)/$$1 || echo $$1' \ sh '{}' ';' # XXX: This is a hack to ensure we have a built source tree when # running make dist If we had used non-recursive make we could have # solved it better, but we don't, so use this at least for now. LICENSE: all cscope: -rm -f cscope* find . -name '*.[hcS]' > cscope.files cscope -b .PHONY: cscope varnish-4.1.1/include/0000755000201500234410000000000012652366756011631 500000000000000varnish-4.1.1/include/vrt_obj.h0000644000201500234410000001060612652366743013366 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ VCL_HTTP VRT_r_bereq(VRT_CTX); VCL_BACKEND VRT_r_bereq_backend(VRT_CTX); void VRT_l_bereq_backend(VRT_CTX, VCL_BACKEND); VCL_DURATION VRT_r_bereq_between_bytes_timeout(VRT_CTX); void VRT_l_bereq_between_bytes_timeout(VRT_CTX, VCL_DURATION); VCL_DURATION VRT_r_bereq_connect_timeout(VRT_CTX); void VRT_l_bereq_connect_timeout(VRT_CTX, VCL_DURATION); VCL_DURATION VRT_r_bereq_first_byte_timeout(VRT_CTX); void VRT_l_bereq_first_byte_timeout(VRT_CTX, VCL_DURATION); VCL_STRING VRT_r_bereq_method(VRT_CTX); void VRT_l_bereq_method(VRT_CTX, const char *, ...); VCL_STRING VRT_r_bereq_proto(VRT_CTX); void VRT_l_bereq_proto(VRT_CTX, const char *, ...); VCL_INT VRT_r_bereq_retries(VRT_CTX); VCL_BOOL VRT_r_bereq_uncacheable(VRT_CTX); VCL_STRING VRT_r_bereq_url(VRT_CTX); void VRT_l_bereq_url(VRT_CTX, const char *, ...); VCL_STRING VRT_r_bereq_xid(VRT_CTX); VCL_HTTP VRT_r_beresp(VRT_CTX); VCL_DURATION VRT_r_beresp_age(VRT_CTX); VCL_BACKEND VRT_r_beresp_backend(VRT_CTX); VCL_IP VRT_r_beresp_backend_ip(VRT_CTX); VCL_STRING VRT_r_beresp_backend_name(VRT_CTX); VCL_BOOL VRT_r_beresp_do_esi(VRT_CTX); void VRT_l_beresp_do_esi(VRT_CTX, VCL_BOOL); VCL_BOOL VRT_r_beresp_do_gunzip(VRT_CTX); void VRT_l_beresp_do_gunzip(VRT_CTX, VCL_BOOL); VCL_BOOL VRT_r_beresp_do_gzip(VRT_CTX); void VRT_l_beresp_do_gzip(VRT_CTX, VCL_BOOL); VCL_BOOL VRT_r_beresp_do_stream(VRT_CTX); void VRT_l_beresp_do_stream(VRT_CTX, VCL_BOOL); VCL_DURATION VRT_r_beresp_grace(VRT_CTX); void VRT_l_beresp_grace(VRT_CTX, VCL_DURATION); VCL_DURATION VRT_r_beresp_keep(VRT_CTX); void VRT_l_beresp_keep(VRT_CTX, VCL_DURATION); VCL_STRING VRT_r_beresp_proto(VRT_CTX); void VRT_l_beresp_proto(VRT_CTX, const char *, ...); VCL_STRING VRT_r_beresp_reason(VRT_CTX); void VRT_l_beresp_reason(VRT_CTX, const char *, ...); VCL_INT VRT_r_beresp_status(VRT_CTX); void VRT_l_beresp_status(VRT_CTX, VCL_INT); VCL_STRING VRT_r_beresp_storage_hint(VRT_CTX); void VRT_l_beresp_storage_hint(VRT_CTX, const char *, ...); VCL_DURATION VRT_r_beresp_ttl(VRT_CTX); void VRT_l_beresp_ttl(VRT_CTX, VCL_DURATION); VCL_BOOL VRT_r_beresp_uncacheable(VRT_CTX); void VRT_l_beresp_uncacheable(VRT_CTX, VCL_BOOL); VCL_BOOL VRT_r_beresp_was_304(VRT_CTX); VCL_STRING VRT_r_client_identity(VRT_CTX); void VRT_l_client_identity(VRT_CTX, const char *, ...); VCL_IP VRT_r_client_ip(VRT_CTX); VCL_IP VRT_r_local_ip(VRT_CTX); VCL_TIME VRT_r_now(VRT_CTX); VCL_DURATION VRT_r_obj_age(VRT_CTX); VCL_DURATION VRT_r_obj_grace(VRT_CTX); VCL_INT VRT_r_obj_hits(VRT_CTX); VCL_DURATION VRT_r_obj_keep(VRT_CTX); VCL_STRING VRT_r_obj_proto(VRT_CTX); VCL_STRING VRT_r_obj_reason(VRT_CTX); VCL_INT VRT_r_obj_status(VRT_CTX); VCL_DURATION VRT_r_obj_ttl(VRT_CTX); VCL_BOOL VRT_r_obj_uncacheable(VRT_CTX); VCL_IP VRT_r_remote_ip(VRT_CTX); VCL_HTTP VRT_r_req(VRT_CTX); VCL_BACKEND VRT_r_req_backend_hint(VRT_CTX); void VRT_l_req_backend_hint(VRT_CTX, VCL_BACKEND); VCL_BOOL VRT_r_req_can_gzip(VRT_CTX); VCL_BOOL VRT_r_req_esi(VRT_CTX); void VRT_l_req_esi(VRT_CTX, VCL_BOOL); VCL_INT VRT_r_req_esi_level(VRT_CTX); VCL_BOOL VRT_r_req_hash_always_miss(VRT_CTX); void VRT_l_req_hash_always_miss(VRT_CTX, VCL_BOOL); VCL_BOOL VRT_r_req_hash_ignore_busy(VRT_CTX); void VRT_l_req_hash_ignore_busy(VRT_CTX, VCL_BOOL); VCL_STRING VRT_r_req_method(VRT_CTX); void VRT_l_req_method(VRT_CTX, const char *, ...); VCL_STRING VRT_r_req_proto(VRT_CTX); void VRT_l_req_proto(VRT_CTX, const char *, ...); VCL_INT VRT_r_req_restarts(VRT_CTX); VCL_DURATION VRT_r_req_ttl(VRT_CTX); void VRT_l_req_ttl(VRT_CTX, VCL_DURATION); VCL_STRING VRT_r_req_url(VRT_CTX); void VRT_l_req_url(VRT_CTX, const char *, ...); VCL_STRING VRT_r_req_xid(VRT_CTX); VCL_STRING VRT_r_req_top_method(VRT_CTX); VCL_STRING VRT_r_req_top_proto(VRT_CTX); VCL_STRING VRT_r_req_top_url(VRT_CTX); VCL_HTTP VRT_r_resp(VRT_CTX); VCL_BOOL VRT_r_resp_is_streaming(VRT_CTX); VCL_STRING VRT_r_resp_proto(VRT_CTX); void VRT_l_resp_proto(VRT_CTX, const char *, ...); VCL_STRING VRT_r_resp_reason(VRT_CTX); void VRT_l_resp_reason(VRT_CTX, const char *, ...); VCL_INT VRT_r_resp_status(VRT_CTX); void VRT_l_resp_status(VRT_CTX, VCL_INT); VCL_STRING VRT_r_server_hostname(VRT_CTX); VCL_STRING VRT_r_server_identity(VRT_CTX); VCL_IP VRT_r_server_ip(VRT_CTX); double VRT_Stv_free_space(const char *); double VRT_Stv_used_space(const char *); unsigned VRT_Stv_happy(const char *); varnish-4.1.1/include/vtcp.h0000644000201500234410000000531312652366721012670 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ struct suckaddr; /* from libvarnish/tcp.c */ /* NI_MAXHOST and NI_MAXSERV are ridiculously long for numeric format */ #define VTCP_ADDRBUFSIZE 64 #define VTCP_PORTBUFSIZE 16 int VTCP_Check(int a); #define VTCP_Assert(a) assert(VTCP_Check(a)) struct suckaddr *VTCP_my_suckaddr(int sock); void VTCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen); void VTCP_hisname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen); int VTCP_filter_http(int sock); int VTCP_blocking(int sock); int VTCP_nonblocking(int sock); int VTCP_linger(int sock, int linger); int VTCP_check_hup(int sock); // #ifdef SOL_SOCKET void VTCP_name(const struct suckaddr *addr, char *abuf, unsigned alen, char *pbuf, unsigned plen); int VTCP_connected(int s); int VTCP_connect(const struct suckaddr *name, int msec); int VTCP_open(const char *addr, const char *def_port, double timeout, const char **err); void VTCP_close(int *s); int VTCP_bind(const struct suckaddr *addr, const char **errp); int VTCP_listen(const struct suckaddr *addr, int depth, const char **errp); int VTCP_listen_on(const char *addr, const char *def_port, int depth, const char **errp); void VTCP_set_read_timeout(int s, double seconds); int VTCP_read(int fd, void *ptr, size_t len, double tmo); // #endif varnish-4.1.1/include/vmb.h0000644000201500234410000000550712652366721012505 00000000000000/*- * Copyright (c) 2010 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. * * Memory barriers * * XXX: It is utterly braindamaged, that no standard facility for this * XXX: is available. The "just use pthreads locking" excuse does not * XXX: make sense, and does not apply to two unthreaded programs sharing * XXX: a memory segment. */ #ifndef VMB_H_INCLUDED #define VMB_H_INCLUDED #if defined(__FreeBSD__) #include #endif #if defined(__FreeBSD__) && __FreeBSD_version >= 800058 #include #include #define VMB() mb() #define VWMB() wmb() #define VRMB() rmb() #elif defined(__amd64__) && defined(__GNUC__) #define VMB() __asm __volatile("mfence;" : : : "memory") #define VWMB() __asm __volatile("sfence;" : : : "memory") #define VRMB() __asm __volatile("lfence;" : : : "memory") #elif defined(__arm__) #define VMB() #define VWMB() #define VRMB() #elif defined(__i386__) && defined(__GNUC__) #define VMB() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory") #define VWMB() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory") #define VRMB() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory") #elif defined(__sparc64__) && defined(__GNUC__) #define VMB() __asm__ __volatile__ ("membar #MemIssue": : :"memory") #define VWMB() VMB() #define VRMB() VMB() #else #define VMB_NEEDS_PTHREAD_WORKAROUND_THIS_IS_BAD_FOR_PERFORMANCE 1 void vmb_pthread(void); #define VMB() vmb_pthread() #define VWMB() vmb_pthread() #define VRMB() vmb_pthread() #endif #endif /* VMB_H_INCLUDED */ varnish-4.1.1/include/vsl_priv.h0000644000201500234410000000500112652366721013552 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * 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. * * Define the layout of the shared memory log segment. * * NB: THIS IS NOT A PUBLIC API TO VARNISH! */ #ifndef VSL_PRIV_H_INCLUDED #define VSL_PRIV_H_INCLUDED #include "vapi/vsl_int.h" #include "vapi/vsm_int.h" #define VSL_CLASS "Log" #define VSL_SEGMENTS 8U // power of two /* * Shared memory log format * * The segments array has index values providing safe entry points into * the log, where each element N gives the index of the first log record * in the Nth segment of the log. An index value of -1 indicates that no * log records in this segment exists. * * The segment_n member is incremented only, natively wrapping at * UINT_MAX. When taken modulo VSL_SEGMENTS, it gives the current index * into the offset array. * * The format of the actual log is in vapi/vsl_int.h * */ struct VSL_head { #define VSL_HEAD_MARKER "VSLHEAD1" /* Incr. as version# */ char marker[VSM_MARKER_LEN]; ssize_t segsize; unsigned segment_n; ssize_t offset[VSL_SEGMENTS]; uint32_t log[]; }; #endif /* VSL_PRIV_H_INCLUDED */ varnish-4.1.1/include/vre.h0000644000201500234410000000431412652366721012510 00000000000000/*- * Copyright (c) 2009 Varnish Software AS * All rights reserved. * * Author: Tollef Fog Heen * * 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. * * Regular expression support * * We wrap PCRE in VRE to make to make it feasible to use something else * without hunting down stuff through out the Varnish source code. * */ #ifndef VRE_H_INCLUDED #define VRE_H_INCLUDED struct vre; struct vre_limits { unsigned match; unsigned match_recursion; }; typedef struct vre vre_t; /* This maps to PCRE error codes */ #define VRE_ERROR_NOMATCH (-1) /* And those to PCRE options */ extern const unsigned VRE_has_jit; extern const unsigned VRE_CASELESS; extern const unsigned VRE_NOTEMPTY; vre_t *VRE_compile(const char *, int, const char **, int *); int VRE_exec(const vre_t *code, const char *subject, int length, int startoffset, int options, int *ovector, int ovecsize, const volatile struct vre_limits *lim); void VRE_free(vre_t **); #endif /* VRE_H_INCLUDED */ varnish-4.1.1/include/vsm_priv.h0000644000201500234410000001034312652366721013560 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Define the layout of the shared memory log segment. * * NB: THIS IS NOT A PUBLIC API TO VARNISH! * * There is a lot of diplomacy and protocol involved with the VSM segment * since there is no way to (and no desire to!) lock between the readers * and the writer. * * In particular we want the readers to seamlessly jump from one VSM instance * to another when the child restarts. * * The VSM segment life-cycle is: * * Manager creates VSM file under temp name * * Temp VSM file is initialized such that VSM_head is consistent * with a non-zero alloc_seq * * Manager renames Temp VSM file to correct filename as atomic * operation. * * When manager abandons VSM file, alloc_seq is set to zero, which * never happens in any other circumstances. * * If a manager is started and finds and old abandoned VSM segment * it will zero the alloc_seq in it, before replacing the file. * * Subscribers will have to monitor three things to make sure they look at * the right thing: The alloc_seq field, the age counter and the dev+inode * of the path-name. The former check is by far the cheaper, the second * can be used to check that varnishd is still alive and the last check * should only be employed when lack of activity in the VSM segment raises * suspicion that something has happened. * * The allocations ("chunks") in the VSM forms a linked list, starting with * VSM_head->first, with the first/next fields being byte offsets relative * to the start of the VSM segment. * * The last chunk on the list, has next == 0. * * New chunks are appended to the list, no matter where in the VSM * they happen to be allocated. * * Chunk allocation sequence is: * Find free space * Zero payload * Init Chunk header * Write memory barrier * update hdr->first or $last->next pointer * hdr->alloc_seq changes * Write memory barrier * * Chunk contents should be designed so that zero bytes are not mistaken * for valid contents. * * Chunk deallocation sequence is: * update hdr->first or $prev->next pointer * Write memory barrier * this->len = 0 * hdr->alloc_seq changes * Write memory barrier * * The space occupied by the chunk is put on a cooling list and is not * recycled for at least a minute. * */ #ifndef VSM_PRIV_H_INCLUDED #define VSM_PRIV_H_INCLUDED #include struct VSM_chunk { #define VSM_CHUNK_MARKER "VSMCHUNK" char marker[VSM_MARKER_LEN]; ssize_t len; /* Incl VSM_chunk */ ssize_t next; /* Offset in shmem */ char class[VSM_MARKER_LEN]; char type[VSM_MARKER_LEN]; char ident[VSM_IDENT_LEN]; }; struct VSM_head { #define VSM_HEAD_MARKER "VSMHEAD0" /* Incr. as version# */ char marker[VSM_MARKER_LEN]; ssize_t hdrsize; ssize_t shm_size; ssize_t first; /* Offset, first chunk */ unsigned alloc_seq; uint64_t age; }; #endif /* VSM_PRIV_H_INCLUDED */ varnish-4.1.1/include/vev.h0000644000201500234410000000442712652366721012521 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 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. * */ struct vev; struct vev_base; typedef int vev_cb_f(const struct vev *, int what); struct vev { unsigned magic; #define VEV_MAGIC 0x46bbd419 /* pub */ const char *name; int fd; unsigned fd_flags; #define EV_RD POLLIN #define EV_WR POLLOUT #define EV_ERR POLLERR #define EV_HUP POLLHUP #define EV_SIG -1 int sig; unsigned sig_flags; double timeout; vev_cb_f *callback; void *priv; /* priv */ double __when; VTAILQ_ENTRY(vev) __list; unsigned __binheap_idx; unsigned __privflags; struct vev_base *__vevb; int __poll_idx; }; struct vev_base *vev_new_base(void); void vev_destroy_base(struct vev_base *evb); struct vev *vev_new(void); int vev_add(struct vev_base *evb, struct vev *e); void vev_del(struct vev_base *evb, struct vev *e); int vev_schedule_one(struct vev_base *evb); int vev_schedule(struct vev_base *evb); varnish-4.1.1/include/vss.h0000644000201500234410000000311412652366721012524 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 Varnish Software AS * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 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. * */ /* vss.c */ struct suckaddr; typedef int vss_resolved_f(void *priv, const struct suckaddr *); int VSS_resolver(const char *addr, const char *def_port, vss_resolved_f *func, void *priv, const char **err); varnish-4.1.1/include/libvcc.h0000644000201500234410000000355712652366721013166 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 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. * */ struct vcc; struct vcp *VCP_New(void); void VCP_Builtin_VCL(struct vcp *, const char *str); void VCP_VCL_dir(struct vcp *, const char *str); void VCP_VMOD_dir(struct vcp *, const char *str); void VCP_Err_Unref(struct vcp *tl, unsigned u); void VCP_Allow_InlineC(struct vcp *tl, unsigned u); void VCP_Unsafe_Path(struct vcp *tl, unsigned u); char *VCC_Compile(const struct vcp *, struct vsb *sb, const char *vclsrc, const char *vclsrcfile); varnish-4.1.1/include/Makefile.am0000644000201500234410000000633012652366721013577 00000000000000# # API headers nobase_pkginclude_HEADERS = \ tbl/acct_fields_req.h \ tbl/acct_fields_bereq.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 \ tbl/http_headers.h \ tbl/http_response.h \ tbl/locks.h \ tbl/obj_attr.h \ tbl/params.h \ tbl/req_body.h \ tbl/req_flags.h \ tbl/sess_attr.h \ tbl/sess_close.h \ tbl/steps.h \ tbl/symbol_kind.h \ tbl/vcc_types.h \ tbl/vcl_returns.h \ tbl/vrt_stv_var.h \ tbl/vsc_types.h \ tbl/vsc_all.h \ tbl/vsc_fields.h \ tbl/vsc_levels.h \ tbl/vsc_f_main.h \ tbl/vsl_tags.h \ tbl/vsl_tags_http.h \ vapi/vsm.h \ vapi/vsm_int.h \ vapi/vsc.h \ vapi/vsc_int.h \ vapi/vsl.h \ vapi/vsl_int.h \ vapi/voptget.h \ vapi/vapi_options.h \ vcli.h # Headers for use with vmods nobase_pkginclude_HEADERS += \ miniobj.h \ vas.h \ vav.h \ vbm.h \ vcl.h \ vcs.h \ vmod_abi.h \ vqueue.h \ vre.h \ vdef.h \ vrt.h \ vrt_obj.h \ vsa.h \ vsb.h \ vsha256.h \ vtcp.h \ vtim.h # Private headers nobase_noinst_HEADERS = \ binary_heap.h \ compat/daemon.h \ compat/execinfo.h \ flopen.h \ libvcc.h \ vcli_common.h \ vcli_priv.h \ vcli_serve.h \ vcs_version.h \ vct.h \ vcurses.h \ vend.h \ vev.h \ vfil.h \ vin.h \ vlu.h \ vmb.h \ vnum.h \ vpf.h \ vrnd.h \ vsl_priv.h \ vsm_priv.h \ vsub.h \ vss.h \ vtcp.h \ vtree.h \ vut.h \ vut_options.h tbl/vrt_stv_var.h tbl/vcl_returns.h tbl/vcc_types.h vrt_obj.h: vcl.h vcl.h: $(top_srcdir)/lib/libvcc/generate.py $(top_srcdir)/include/vrt.h mkdir -p tbl @PYTHON@ $(top_srcdir)/lib/libvcc/generate.py $(top_srcdir) $(top_builddir) BUILT_SOURCES = vcs_version.h vmod_abi.h MAINTAINERCLEANFILES = vcs_version.h vcs_version.h: FORCE @if [ -d "$(top_srcdir)/.git" ]; then \ V="$$(git show -s --pretty=format:%h)" \ B="$$(git rev-parse --abbrev-ref HEAD)" \ H="$$(head -n 1 vcs_version.h 2>/dev/null || true)"; \ if [ "/* $$V */" != "$$H" ]; then \ ( \ echo "/* $$V */" ;\ echo '/*' ;\ echo ' * NB: This file is machine generated, DO NOT EDIT!' ;\ echo ' *' ;\ echo ' * Run make to regenerate' ;\ echo ' *' ;\ echo ' */' ;\ echo "/* $$V */" ;\ echo '' ;\ echo "#define VCS_Version \"$$V\"" ; \ echo "#define VCS_Branch \"$$B\"" \ ) > vcs_version.h ; \ fi \ else \ if [ ! -f vcs_version.h ]; then \ ( \ echo "/* NOGIT */" ; \ echo '/* No git commit ID available, see include/Makefile.am for explanation */' ; \ echo '#define VCS_Version "NOGIT"' ; \ echo '#define VCS_Branch "NOGIT"' \ ) > vcs_version.h ; \ fi \ fi FORCE: # If vcs_version contains NOGIT, Varnish has not been built from a # tarball made with make dist, nor from a git checkout, so there's no # way for us to give strong guarantees about what version you're # actually running. # # The way to fix this is to either build Varnish from a tarball made # with `make dist` or a git checkout. vmod_abi.h: vcs_version.h @GITID=$$(sed 's/[^0-9a-f]//g;q' vcs_version.h) ; \ if [ -z "$$GITID" ]; then \ echo "warning: weak VMOD ABI checking, see include/Makefile.am" ; \ fi ; \ echo "#define VMOD_ABI_Version \"@PACKAGE_STRING@ $$GITID\"" > vmod_abi.h CLEANFILES = \ tbl/vcl_returns.h \ tbl/vrt_stv_var.h \ vcl.h \ vrt_obj.h \ vmod_abi.h varnish-4.1.1/include/tbl/0000755000201500234410000000000012652366756012412 500000000000000varnish-4.1.1/include/tbl/locks.h0000644000201500234410000000324312652366721013610 00000000000000/*- * Copyright (c) 2010 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 */ LOCK(backend) LOCK(backend_tcp) LOCK(ban) LOCK(busyobj) LOCK(cli) LOCK(exp) LOCK(hcb) LOCK(lru) LOCK(mempool) LOCK(objhdr) LOCK(pipestat) LOCK(sess) LOCK(smp) LOCK(vbe) LOCK(vcapace) LOCK(vcl) LOCK(vxid) LOCK(waiter) LOCK(wq) LOCK(wstat) /*lint -restore */ varnish-4.1.1/include/tbl/ban_vars.h0000644000201500234410000000336212652366721014272 00000000000000/*- * Copyright (c) 2008-2011 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. * * Define which variables we can ban on, and which function does it. * */ /*lint -save -e525 -e539 */ PVAR("req.url", BANS_FLAG_REQ, BANS_ARG_URL) PVAR("req.http.", BANS_FLAG_REQ | BANS_FLAG_HTTP, BANS_ARG_REQHTTP) PVAR("obj.status", BANS_FLAG_OBJ, BANS_ARG_OBJSTATUS) PVAR("obj.http.", BANS_FLAG_OBJ | BANS_FLAG_HTTP, BANS_ARG_OBJHTTP) /*lint -restore */ varnish-4.1.1/include/tbl/http_response.h0000644000201500234410000000545612652366721015402 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 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 */ HTTP_RESP(101, "Switching Protocols") HTTP_RESP(200, "OK") HTTP_RESP(201, "Created") HTTP_RESP(202, "Accepted") HTTP_RESP(203, "Non-Authoritative Information") HTTP_RESP(204, "No Content") HTTP_RESP(205, "Reset Content") HTTP_RESP(206, "Partial Content") HTTP_RESP(300, "Multiple Choices") HTTP_RESP(301, "Moved Permanently") HTTP_RESP(302, "Found") HTTP_RESP(303, "See Other") HTTP_RESP(304, "Not Modified") HTTP_RESP(305, "Use Proxy") HTTP_RESP(306, "(Unused)") HTTP_RESP(307, "Temporary Redirect") HTTP_RESP(400, "Bad Request") HTTP_RESP(401, "Unauthorized") HTTP_RESP(402, "Payment Required") HTTP_RESP(403, "Forbidden") HTTP_RESP(404, "Not Found") HTTP_RESP(405, "Method Not Allowed") HTTP_RESP(406, "Not Acceptable") HTTP_RESP(407, "Proxy Authentication Required") HTTP_RESP(408, "Request Timeout") HTTP_RESP(409, "Conflict") HTTP_RESP(410, "Gone") HTTP_RESP(411, "Length Required") HTTP_RESP(412, "Precondition Failed") HTTP_RESP(413, "Request Entity Too Large") HTTP_RESP(414, "Request-URI Too Long") HTTP_RESP(415, "Unsupported Media Type") HTTP_RESP(416, "Requested Range Not Satisfiable") HTTP_RESP(417, "Expectation Failed") HTTP_RESP(500, "Internal Server Error") HTTP_RESP(501, "Not Implemented") HTTP_RESP(502, "Bad Gateway") HTTP_RESP(503, "Service Unavailable") HTTP_RESP(504, "Gateway Timeout") HTTP_RESP(505, "HTTP Version Not Supported") /*lint -restore */ varnish-4.1.1/include/tbl/req_body.h0000644000201500234410000000306312652366721014301 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ /*lint -save -e525 -e539 */ REQ_BODY(INIT) REQ_BODY(WITHOUT_LEN) REQ_BODY(WITH_LEN) REQ_BODY(TAKEN) REQ_BODY(CACHED) REQ_BODY(FAIL) REQ_BODY(NONE) /*lint -restore */ varnish-4.1.1/include/tbl/backend_poll.h0000644000201500234410000000331212652366721015107 00000000000000/*- * Copyright (c) 2008-2011 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 */ BITMAP(good_ipv4, '4', "Good IPv4", 0) BITMAP(good_ipv6, '6', "Good IPv6", 0) BITMAP( err_xmit, 'x', "Error Xmit", 0) BITMAP(good_xmit, 'X', "Good Xmit", 0) BITMAP( err_recv, 'r', "Error Recv", 0) BITMAP(good_recv, 'R', "Good Recv", 0) BITMAP(happy, 'H', "Happy", 1) /* lint -restore */ varnish-4.1.1/include/tbl/vsc_types.h0000644000201500234410000000472712652366721014524 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-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. */ /* * Fields (n, l, e, d): * n - Name: Field name, in C-source * t - Type: Type name, in shm chunk * l - Label: Display name, in stats programs * e - Explanation: Short description of this counter type * d - Description: Long description of this counter type * * The order in which the types are defined in this file determines the * order in which counters are reported in the API, and then also the * display order in varnishstat. */ /*lint -save -e525 -e539 */ VSC_TYPE_F(main, "MAIN", "", "Child", "Child process main counters" ) VSC_TYPE_F(mgt, "MGT", "MGT", "Master", "Management process counters" ) VSC_TYPE_F(mempool, "MEMPOOL", "MEMPOOL", "Memory pool", "Memory pool counters" ) VSC_TYPE_F(sma, "SMA", "SMA", "Storage malloc", "Malloc storage counters" ) VSC_TYPE_F(smf, "SMF", "SMF", "Storage file", "File storage counters" ) VSC_TYPE_F(vbe, "VBE", "VBE", "Backend", "Backend counters" ) VSC_TYPE_F(lck, "LCK", "LCK", "Lock", "Mutex lock counters" ) /*lint -restore */ varnish-4.1.1/include/tbl/steps.h0000644000201500234410000000470212652366721013634 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ /*lint -save -e525 -e539 */ #ifdef SESS_STEP SESS_STEP(h1newsess, H1NEWSESS) SESS_STEP(h1newreq, H1NEWREQ) SESS_STEP(h1proc, H1PROC) SESS_STEP(h1busy, H1BUSY) SESS_STEP(h1cleanup, H1CLEANUP) SESS_STEP(h1_last, H1_LAST) SESS_STEP(proxynewsess, PROXYNEWSESS) SESS_STEP(proxy_last, PROXY_LAST) #endif #ifdef REQ_STEP REQ_STEP(restart, RESTART, (wrk, req)) REQ_STEP(recv, RECV, (wrk, req)) REQ_STEP(pipe, PIPE, (wrk, req)) REQ_STEP(pass, PASS, (wrk, req)) REQ_STEP(lookup, LOOKUP, (wrk, req)) REQ_STEP(purge, PURGE, (wrk, req)) REQ_STEP(miss, MISS, (wrk, req)) REQ_STEP(fetch, FETCH, (wrk, req)) REQ_STEP(deliver, DELIVER, (wrk, req)) REQ_STEP(synth, SYNTH, (wrk, req)) #endif #ifdef FETCH_STEP FETCH_STEP(mkbereq, MKBEREQ, (wrk, bo)) FETCH_STEP(retry, RETRY, (wrk, bo)) FETCH_STEP(startfetch, STARTFETCH, (wrk, bo)) FETCH_STEP(condfetch, CONDFETCH, (wrk, bo)) FETCH_STEP(fetch, FETCH, (wrk, bo)) FETCH_STEP(error, ERROR, (wrk, bo)) FETCH_STEP(fail, FAIL, (wrk, bo)) FETCH_STEP(done, DONE, ()) #endif /*lint -restore */ varnish-4.1.1/include/tbl/sess_close.h0000644000201500234410000000460312652366721014640 00000000000000/*- * Copyright (c) 2012 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 */ // enum sess_close sc_* stat is_err Description SESS_CLOSE(REM_CLOSE, rem_close, 0, "Client Closed") SESS_CLOSE(REQ_CLOSE, req_close, 0, "Client requested close") SESS_CLOSE(REQ_HTTP10, req_http10, 1, "Proto < HTTP/1.1") SESS_CLOSE(RX_BAD, rx_bad, 1, "Received bad req/resp") SESS_CLOSE(RX_BODY, rx_body, 1, "Failure receiving req.body") SESS_CLOSE(RX_JUNK, rx_junk, 1, "Received junk data") SESS_CLOSE(RX_OVERFLOW, rx_overflow, 1, "Received buffer overflow") SESS_CLOSE(RX_TIMEOUT, rx_timeout, 1, "Receive timeout") SESS_CLOSE(TX_PIPE, tx_pipe, 0, "Piped transaction") SESS_CLOSE(TX_ERROR, tx_error, 1, "Error transaction") SESS_CLOSE(TX_EOF, tx_eof, 0, "EOF transmission") SESS_CLOSE(RESP_CLOSE, resp_close, 0, "Backend/VCL requested close") SESS_CLOSE(OVERLOAD, overload, 1, "Out of some resource") SESS_CLOSE(PIPE_OVERFLOW, pipe_overflow,1, "Session pipe overflow") SESS_CLOSE(RANGE_SHORT, range_short, 1, "Insufficient data for range") /*lint -restore */ varnish-4.1.1/include/tbl/vsc_all.h0000644000201500234410000000451112652366721014117 00000000000000/*- * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ /*lint -save -e525 -e539 */ VSC_DO(MAIN, main, VSC_type_main) #include "tbl/vsc_f_main.h" VSC_DONE(MAIN, main, VSC_type_main) VSC_DO(MGT, mgt, VSC_type_mgt) #define VSC_DO_MGT #include "tbl/vsc_fields.h" #undef VSC_DO_MGT VSC_DONE(MGT, mgt, VSC_type_mgt) VSC_DO(MEMPOOL, mempool, VSC_type_mempool) #define VSC_DO_MEMPOOL #include "tbl/vsc_fields.h" #undef VSC_DO_MEMPOOL VSC_DONE(MEMPOOL, mempool, VSC_type_mempool) VSC_DO(SMA, sma, VSC_type_sma) #define VSC_DO_SMA #include "tbl/vsc_fields.h" #undef VSC_DO_SMA VSC_DONE(SMA, sma, VSC_type_sma) VSC_DO(SMF, smf, VSC_type_smf) #define VSC_DO_SMF #include "tbl/vsc_fields.h" #undef VSC_DO_SMF VSC_DONE(SMF, smf, VSC_type_smf) VSC_DO(VBE, vbe, VSC_type_vbe) #define VSC_DO_VBE #include "tbl/vsc_fields.h" #undef VSC_DO_VBE VSC_DONE(VBE, vbe, VSC_type_vbe) VSC_DO(LCK, lck, VSC_type_lck) #define VSC_DO_LCK #include "tbl/vsc_fields.h" #undef VSC_DO_LCK VSC_DONE(LCK, lck, VSC_type_lck) /*lint -restore */ varnish-4.1.1/include/tbl/obj_attr.h0000644000201500234410000000355412652366721014306 00000000000000/*- * 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 */ /* upper, lower */ #ifdef OBJ_ATTR OBJ_ATTR(VXID, vxid) OBJ_ATTR(EXP, exp) OBJ_ATTR(VARY, vary) OBJ_ATTR(HEADERS, headers) OBJ_ATTR(FLAGS, flags) OBJ_ATTR(GZIPBITS, gzipbits) OBJ_ATTR(ESIDATA, esidata) OBJ_ATTR(LASTMODIFIED, lastmodified) #endif #ifdef OBJ_FLAG /* upper, lower, val */ OBJ_FLAG(GZIPED, gziped, (1<<1)) OBJ_FLAG(CHGGZIP, chggzip, (1<<2)) OBJ_FLAG(IMSCAND, imscand, (1<<3)) OBJ_FLAG(ESIPROC, esiproc, (1<<4)) #endif /*lint -restore */ varnish-4.1.1/include/tbl/acct_fields_bereq.h0000644000201500234410000000315512652366721016115 00000000000000/*- * Copyright (c) 2008 Verdens Gang AS * Copyright (c) 2008-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. * * These are the stats we keep track of per busyobj. */ /*lint -save -e525 -e539 */ ACCT(bereq_hdrbytes) ACCT(bereq_bodybytes) ACCT(beresp_hdrbytes) ACCT(beresp_bodybytes) /*lint -restore */ varnish-4.1.1/include/tbl/vcc_types.h0000644000201500234410000000062312652366743014477 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ /*lint -save -e525 -e539 */ VCC_TYPE(BACKEND) VCC_TYPE(BLOB) VCC_TYPE(BOOL) VCC_TYPE(BYTES) VCC_TYPE(DURATION) VCC_TYPE(ENUM) VCC_TYPE(HEADER) VCC_TYPE(HTTP) VCC_TYPE(INT) VCC_TYPE(IP) VCC_TYPE(PROBE) VCC_TYPE(REAL) VCC_TYPE(STRING) VCC_TYPE(STRING_LIST) VCC_TYPE(TIME) VCC_TYPE(VOID) /*lint -restore */ varnish-4.1.1/include/tbl/vrt_stv_var.h0000644000201500234410000000103112652366743015051 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ #ifndef VRTSTVTYPE #define VRTSTVTYPE(ct) #define VRTSTVTYPEX #endif #ifndef VRTSTVVAR #define VRTSTVVAR(nm, vtype, ctype, dval) #define VRTSTVVARX #endif VRTSTVTYPE(double) VRTSTVVAR(free_space, BYTES, double, 0.) VRTSTVVAR(used_space, BYTES, double, 0.) VRTSTVTYPE(unsigned) VRTSTVVAR(happy, BOOL, unsigned, 0) #ifdef VRTSTVTYPEX #undef VRTSTVTYPEX #undef VRTSTVTYPE #endif #ifdef VRTSTVVARX #undef VRTSTVVARX #undef VRTSTVVAR #endif varnish-4.1.1/include/tbl/params.h0000644000201500234410000010514212652366721013761 00000000000000/*- * Copyright (c) 2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * PARAM(nm, ty, mi, ma, de, un, fl, st, lt, fn) */ /*lint -save -e525 -e539 */ PARAM( /* name */ accept_filter, /* typ */ bool, /* min */ NULL, /* max */ NULL, /* default */ "on", /* units */ "bool", /* flags */ MUST_RESTART, /* s-text */ "Enable kernel accept-filters (if available in the kernel).", /* l-text */ NULL, /* func */ NULL ) PARAM( /* name */ acceptor_sleep_decay, /* typ */ double, /* min */ "0", /* max */ "1", /* default */ "0.9", /* units */ NULL, /* flags */ EXPERIMENTAL, /* s-text */ "If we run out of resources, such as file descriptors or worker " "threads, the acceptor will sleep between accepts.\n" "This parameter (multiplicatively) reduce the sleep duration for " "each successful accept. (ie: 0.9 = reduce by 10%)", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ acceptor_sleep_incr, /* typ */ timeout, /* min */ "0", /* max */ "1", /* default */ "0", /* units */ "seconds", /* flags */ EXPERIMENTAL, /* s-text */ "If we run out of resources, such as file descriptors or worker " "threads, the acceptor will sleep between accepts.\n" "This parameter control how much longer we sleep, each time we " "fail to accept a new connection.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ acceptor_sleep_max, /* typ */ timeout, /* min */ "0", /* max */ "10", /* default */ "0.05", /* units */ "seconds", /* flags */ EXPERIMENTAL, /* s-text */ "If we run out of resources, such as file descriptors or worker " "threads, the acceptor will sleep between accepts.\n" "This parameter limits how long it can sleep between attempts to " "accept new connections.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ auto_restart, /* typ */ bool, /* min */ NULL, /* max */ NULL, /* default */ "on", /* units */ "bool", /* flags */ 0, /* s-text */ "Automatically restart the child/worker process if it dies.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ ban_dups, /* typ */ bool, /* min */ NULL, /* max */ NULL, /* default */ "on", /* units */ "bool", /* flags */ 0, /* s-text */ "Eliminate older identical bans when a new ban is added. This saves " "CPU cycles by not comparing objects to identical bans.\n" "This is a waste of time if you have many bans which are never " "identical.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ ban_lurker_age, /* typ */ timeout, /* min */ "0", /* max */ NULL, /* default */ "60", /* units */ "seconds", /* flags */ 0, /* s-text */ "The ban lurker will ignore bans until they are this old. " "When a ban is added, the active traffic will be tested against it " "as part of object lookup. This parameter " "holds the ban-lurker off, until the rush is over.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ ban_lurker_batch, /* typ */ uint, /* min */ "1", /* max */ NULL, /* default */ "1000", /* units */ NULL, /* flags */ 0, /* s-text */ "The ban lurker sleeps ${ban_lurker_sleep} after examining this " "many objects." " Use this to pace the ban-lurker if it eats too many resources.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ ban_lurker_sleep, /* typ */ timeout, /* min */ "0", /* max */ NULL, /* default */ "0.010", /* units */ "seconds", /* flags */ 0, /* s-text */ "How long the ban lurker sleeps after examining ${ban_lurker_batch} " "objects." " Use this to pace the ban-lurker if it eats too many resources.\n" "A value of zero will disable the ban lurker entirely.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ first_byte_timeout, /* typ */ timeout, /* min */ "0", /* max */ NULL, /* default */ "60", /* units */ "seconds", /* flags */ 0, /* s-text */ "Default timeout for receiving first byte from backend. We only " "wait for this many seconds for the first byte before giving up. A " "value of 0 means it will never time out. VCL can override this " "default value for each backend and backend request. This " "parameter does not apply to pipe.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ between_bytes_timeout, /* typ */ timeout, /* min */ "0", /* max */ NULL, /* default */ "60", /* units */ "seconds", /* flags */ 0, /* s-text */ "We only wait for this many seconds between bytes received from " "the backend before giving up the fetch.\n" "A value of zero means never give up.\n" "VCL values, per backend or per backend request take precedence.\n" "This parameter does not apply to pipe'ed requests.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ backend_idle_timeout, /* typ */ timeout, /* min */ "1", /* max */ NULL, /* default */ "60", /* units */ "seconds", /* flags */ 0, /* s-text */ "Timeout before we close unused backend connections.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ cli_buffer, /* typ */ bytes_u, /* min */ "4k", /* max */ NULL, /* default */ "8k", /* units */ "bytes", /* flags */ 0, /* s-text */ "Size of buffer for CLI command input.\n" "You may need to increase this if you have big VCL files and use " "the vcl.inline CLI command.\n" "NB: Must be specified with -p to have effect.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ cli_limit, /* typ */ bytes_u, /* min */ "128b", /* max */ "99999999b", /* default */ "48k", /* units */ "bytes", /* flags */ 0, /* s-text */ "Maximum size of CLI response. If the response exceeds this " "limit, the response code will be 201 instead of 200 and the last " "line will indicate the truncation.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ cli_timeout, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "60.000", /* units */ "seconds", /* flags */ 0, /* s-text */ "Timeout for the childs replies to CLI requests from the " "mgt_param.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ clock_skew, /* typ */ uint, /* min */ "0", /* max */ NULL, /* default */ "10", /* units */ "seconds", /* flags */ 0, /* s-text */ "How much clockskew we are willing to accept between the backend " "and our own clock.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ connect_timeout, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "3.500", /* units */ "seconds", /* flags */ 0, /* s-text */ "Default connection timeout for backend connections. We only try " "to connect to the backend for this many seconds before giving up. " "VCL can override this default value for each backend and backend " "request.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ critbit_cooloff, /* typ */ timeout, /* min */ "60.000", /* max */ "254.000", /* default */ "180.000", /* units */ "seconds", /* flags */ WIZARD, /* s-text */ "How long the critbit hasher keeps deleted objheads on the cooloff " "list.", /* l-text */ "", /* func */ NULL ) #if 0 PARAM( /* name */ debug, /* typ */ debug, /* min */ NULL, /* max */ NULL, /* default */ NULL, /* units */ NULL, /* flags */ 0, /* s-text */ "Enable/Disable various kinds of debugging.\n" " none Disable all debugging\n" "\n" "Use +/- prefix to set/reset individual bits:\n" " req_state VSL Request state engine\n" " workspace VSL Workspace operations\n" " waiter VSL Waiter internals\n" " waitinglist VSL Waitinglist events\n" " syncvsl Make VSL synchronous\n" " hashedge Edge cases in Hash\n" " vclrel Rapid VCL release\n" " lurker VSL Ban lurker\n" " esi_chop Chop ESI fetch to bits\n" " flush_head Flush after http1 head\n" " vtc_mode Varnishtest Mode", /* l-text */ "", /* func */ NULL ) #endif PARAM( /* name */ default_grace, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "10.000", /* units */ "seconds", /* flags */ OBJ_STICKY, /* s-text */ "Default grace period. We will deliver an object this long after " "it has expired, provided another thread is attempting to get a " "new copy.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ default_keep, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "0.000", /* units */ "seconds", /* flags */ OBJ_STICKY, /* s-text */ "Default keep period. We will keep a useless object around this " "long, making it available for conditional backend fetches. That " "means that the object will be removed from the cache at the end " "of ttl+grace+keep.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ default_ttl, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "120.000", /* units */ "seconds", /* flags */ OBJ_STICKY, /* s-text */ "The TTL assigned to objects if neither the backend nor the VCL " "code assigns one.", /* l-text */ "", /* func */ NULL ) #if 0 PARAM( /* name */ feature, /* typ */ feature, /* min */ NULL, /* max */ NULL, /* default */ NULL, /* units */ NULL, /* flags */ 0, /* s-text */ "Enable/Disable various minor features.\n" " none Disable all features.\n" "\n" "Use +/- prefix to enable/disable individual feature:\n" " short_panic Short panic message.\n" " wait_silo Wait for persistent silo.\n" " no_coredump No coredumps.\n" " esi_ignore_https Treat HTTPS as HTTP in ESI:includes\n" " esi_disable_xml_check Don't check of body looks like XML\n" " esi_ignore_other_elements Ignore non-esi XML-elements\n" " esi_remove_bom Remove UTF-8 BOM", /* l-text */ "", /* func */ NULL ) #endif PARAM( /* name */ fetch_chunksize, /* typ */ bytes, /* min */ "4k", /* max */ NULL, /* default */ "16k", /* units */ "bytes", /* flags */ EXPERIMENTAL, /* s-text */ "The default chunksize used by fetcher. This should be bigger than " "the majority of objects with short TTLs.\n" "Internal limits in the storage_file module makes increases above " "128kb a dubious idea.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ fetch_maxchunksize, /* typ */ bytes, /* min */ "64k", /* max */ NULL, /* default */ "0.25G", /* units */ "bytes", /* flags */ EXPERIMENTAL, /* s-text */ "The maximum chunksize we attempt to allocate from storage. Making " "this too large may cause delays and storage fragmentation.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ gzip_buffer, /* typ */ bytes_u, /* min */ "2k", /* max */ NULL, /* default */ "32k", /* units */ "bytes", /* flags */ EXPERIMENTAL, /* s-text */ "Size of malloc buffer used for gzip processing.\n" "These buffers are used for in-transit data, for instance " "gunzip'ed data being sent to a client.Making this space to small " "results in more overhead, writes to sockets etc, making it too " "big is probably just a waste of memory.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ gzip_level, /* typ */ uint, /* min */ "0", /* max */ "9", /* default */ "6", /* units */ NULL, /* flags */ 0, /* s-text */ "Gzip compression level: 0=debug, 1=fast, 9=best", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ gzip_memlevel, /* typ */ uint, /* min */ "1", /* max */ "9", /* default */ "8", /* units */ NULL, /* flags */ 0, /* s-text */ "Gzip memory level 1=slow/least, 9=fast/most compression.\n" "Memory impact is 1=1k, 2=2k, ... 9=256k.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ http_gzip_support, /* typ */ bool, /* min */ NULL, /* max */ NULL, /* default */ "on", /* units */ "bool", /* flags */ 0, /* s-text */ "Enable gzip support. When enabled Varnish request compressed " "objects from the backend and store them compressed. If a client " "does not support gzip encoding Varnish will uncompress compressed " "objects on demand. Varnish will also rewrite the Accept-Encoding " "header of clients indicating support for gzip to:\n" " Accept-Encoding: gzip\n" "\n" "Clients that do not support gzip will have their Accept-Encoding " "header removed. For more information on how gzip is implemented " "please see the chapter on gzip in the Varnish reference.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ http_max_hdr, /* typ */ uint, /* min */ "32", /* max */ "65535", /* default */ "64", /* units */ "header lines", /* flags */ 0, /* s-text */ "Maximum number of HTTP header lines we allow in " "{req|resp|bereq|beresp}.http (obj.http is autosized to the exact " "number of headers).\n" "Cheap, ~20 bytes, in terms of workspace memory.\n" "Note that the first line occupies five header lines.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ http_range_support, /* typ */ bool, /* min */ NULL, /* max */ NULL, /* default */ "on", /* units */ "bool", /* flags */ 0, /* s-text */ "Enable support for HTTP Range headers.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ http_req_hdr_len, /* typ */ bytes_u, /* min */ "40b", /* max */ NULL, /* default */ "8k", /* units */ "bytes", /* flags */ 0, /* s-text */ "Maximum length of any HTTP client request header we will allow. " "The limit is inclusive its continuation lines.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ http_req_size, /* typ */ bytes_u, /* min */ "0.25k", /* max */ NULL, /* default */ "32k", /* units */ "bytes", /* flags */ 0, /* s-text */ "Maximum number of bytes of HTTP client request we will deal with. " " This is a limit on all bytes up to the double blank line which " "ends the HTTP request.\n" "The memory for the request is allocated from the client workspace " "(param: workspace_client) and this parameter limits how much of " "that the request is allowed to take up.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ http_resp_hdr_len, /* typ */ bytes_u, /* min */ "40b", /* max */ NULL, /* default */ "8k", /* units */ "bytes", /* flags */ 0, /* s-text */ "Maximum length of any HTTP backend response header we will allow. " " The limit is inclusive its continuation lines.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ http_resp_size, /* typ */ bytes_u, /* min */ "0.25k", /* max */ NULL, /* default */ "32k", /* units */ "bytes", /* flags */ 0, /* s-text */ "Maximum number of bytes of HTTP backend response we will deal " "with. This is a limit on all bytes up to the double blank line " "which ends the HTTP request.\n" "The memory for the request is allocated from the backend workspace " "(param: workspace_backend) and this parameter limits how much " "of that the request is allowed to take up.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ idle_send_timeout, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "60.000", /* units */ "seconds", /* flags */ DELAYED_EFFECT, /* s-text */ "Time to wait with no data sent. If no data has been transmitted " "in this many\n" "seconds the session is closed.\n" "See setsockopt(2) under SO_SNDTIMEO for more information.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ listen_depth, /* typ */ uint, /* min */ "0", /* max */ NULL, /* default */ "1024", /* units */ "connections", /* flags */ MUST_RESTART, /* s-text */ "Listen queue depth.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ lru_interval, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "2.000", /* units */ "seconds", /* flags */ EXPERIMENTAL, /* s-text */ "Grace period before object moves on LRU list.\n" "Objects are only moved to the front of the LRU list if they have " "not been moved there already inside this timeout period. This " "reduces the amount of lock operations necessary for LRU list " "access.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ max_esi_depth, /* typ */ uint, /* min */ "0", /* max */ NULL, /* default */ "5", /* units */ "levels", /* flags */ 0, /* s-text */ "Maximum depth of esi:include processing.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ max_restarts, /* typ */ uint, /* min */ "0", /* max */ NULL, /* default */ "4", /* units */ "restarts", /* flags */ 0, /* s-text */ "Upper limit on how many times a request can restart.\n" "Be aware that restarts are likely to cause a hit against the " "backend, so don't increase thoughtlessly.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ max_retries, /* typ */ uint, /* min */ "0", /* max */ NULL, /* default */ "4", /* units */ "retries", /* flags */ 0, /* s-text */ "Upper limit on how many times a backend fetch can retry.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ nuke_limit, /* typ */ uint, /* min */ "0", /* max */ NULL, /* default */ "50", /* units */ "allocations", /* flags */ EXPERIMENTAL, /* s-text */ "Maximum number of objects we attempt to nuke in order to make " "space for a object body.", /* l-text */ "", /* func */ NULL ) #if 0 PARAM( /* name */ pcre_match_limit, /* typ */ uint, /* min */ "1", /* max */ NULL, /* default */ "1.000", /* units */ NULL, /* flags */ 0, /* s-text */ "The limit for the number of internal matching function calls in " "a pcre_exec() execution.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ pcre_match_limit_recursion, /* typ */ uint, /* min */ "1", /* max */ NULL, /* default */ "1.000", /* units */ NULL, /* flags */ 0, /* s-text */ "The limit for the number of internal matching function " "recursions in a pcre_exec() execution.", /* l-text */ "", /* func */ NULL ) #endif PARAM( /* name */ ping_interval, /* typ */ uint, /* min */ "0", /* max */ NULL, /* default */ "3", /* units */ "seconds", /* flags */ MUST_RESTART, /* s-text */ "Interval between pings from parent to child.\n" "Zero will disable pinging entirely, which makes it possible to " "attach a debugger to the child.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ pipe_timeout, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "60.000", /* units */ "seconds", /* flags */ 0, /* s-text */ "Idle timeout for PIPE sessions. If nothing have been received in " "either direction for this many seconds, the session is closed.", /* l-text */ "", /* func */ NULL ) #if 0 PARAM( /* name */ pool_req, /* typ */ poolparam, /* min */ NULL, /* max */ NULL, /* default */ "10,100,10", /* units */ NULL, /* flags */ 0, /* s-text */ "Parameters for per worker pool request memory pool.\n" MEMPOOL_TEXT, /* l-text */ "", /* func */ NULL ) PARAM( /* name */ pool_sess, /* typ */ poolparam, /* min */ NULL, /* max */ NULL, /* default */ "10,100,10", /* units */ NULL, /* flags */ 0, /* s-text */ "Parameters for per worker pool session memory pool.\n" MEMPOOL_TEXT, /* l-text */ "", /* func */ NULL ) PARAM( /* name */ pool_vbo, /* typ */ poolparam, /* min */ NULL, /* max */ NULL, /* default */ "10,100,10", /* units */ NULL, /* flags */ 0, /* s-text */ "Parameters for backend object fetch memory pool.\n" MEMPOOL_TEXT, /* l-text */ "", /* func */ NULL ) #endif PARAM( /* name */ prefer_ipv6, /* typ */ bool, /* min */ NULL, /* max */ NULL, /* default */ "off", /* units */ "bool", /* flags */ 0, /* s-text */ "Prefer IPv6 address when connecting to backends which have both " "IPv4 and IPv6 addresses.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ rush_exponent, /* typ */ uint, /* min */ "2", /* max */ NULL, /* default */ "3", /* units */ "requests per request", /* flags */ EXPERIMENTAL, /* s-text */ "How many parked request we start for each completed request on " "the object.\n" "NB: Even with the implict delay of delivery, this parameter " "controls an exponential increase in number of worker threads.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ send_timeout, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "600.000", /* units */ "seconds", /* flags */ DELAYED_EFFECT, /* s-text */ "Send timeout for client connections. If the HTTP response hasn't " "been transmitted in this many\n" "seconds the session is closed.\n" "See setsockopt(2) under SO_SNDTIMEO for more information.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ session_max, /* typ */ uint, /* min */ "1000", /* max */ NULL, /* default */ "100000", /* units */ "sessions", /* flags */ 0, /* s-text */ "Maximum number of sessions we will allocate from one pool before " "just dropping connections.\n" "This is mostly an anti-DoS measure, and setting it plenty high " "should not hurt, as long as you have the memory for it.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ shm_reclen, /* typ */ vsl_reclen, /* min */ "16b", /* max */ "4084", /* default */ "255b", /* units */ "bytes", /* flags */ 0, /* s-text */ "Old name for vsl_reclen, use that instead.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ shortlived, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "10.000", /* units */ "seconds", /* flags */ 0, /* s-text */ "Objects created with (ttl+grace+keep) shorter than this are " "always put in transient storage.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ sigsegv_handler, /* typ */ bool, /* min */ NULL, /* max */ NULL, /* default */ "on", /* units */ "bool", /* flags */ MUST_RESTART, /* s-text */ "Install a signal handler which tries to dump debug information on " "segmentation faults, bus errors and abort signals.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ syslog_cli_traffic, /* typ */ bool, /* min */ NULL, /* max */ NULL, /* default */ "on", /* units */ "bool", /* flags */ 0, /* s-text */ "Log all CLI traffic to syslog(LOG_INFO).", /* l-text */ "", /* func */ NULL ) #if 0 PARAM( /* name */ tcp_keepalive_intvl, /* typ */ timeout, /* min */ "1.000", /* max */ "100.000", /* default */ "5.000", /* units */ "seconds", /* flags */ EXPERIMENTAL, /* s-text */ "The number of seconds between TCP keep-alive probes.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ tcp_keepalive_probes, /* typ */ uint, /* min */ "1", /* max */ "100", /* default */ "5", /* units */ "probes", /* flags */ EXPERIMENTAL, /* s-text */ "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.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ tcp_keepalive_time, /* typ */ timeout, /* min */ "1.000", /* max */ "7200.000", /* default */ "600.000", /* units */ "seconds", /* flags */ EXPERIMENTAL, /* s-text */ "The number of seconds a connection needs to be idle before TCP " "begins sending out keep-alive probes.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ thread_pool_add_delay, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "0.000", /* units */ "seconds", /* flags */ EXPERIMENTAL, /* s-text */ "Wait at least this long after creating a thread.\n" "\n" "Some (buggy) systems may need a short (sub-second) delay between " "creating threads.\n" "Set this to a few milliseconds if you see the 'threads_failed' " "counter grow too much.\n" "Setting this too high results in insuffient worker threads.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ thread_pool_destroy_delay, /* typ */ timeout, /* min */ "0.010", /* max */ NULL, /* default */ "1.000", /* units */ "seconds", /* flags */ DELAYED_EFFECT| EXPERIMENTAL, /* s-text */ "Wait this long after destroying a thread.\n" "This controls the decay of thread pools when idle(-ish).", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ thread_pool_fail_delay, /* typ */ timeout, /* min */ "0.010", /* max */ NULL, /* default */ "0.200", /* units */ "seconds", /* flags */ EXPERIMENTAL, /* s-text */ "Wait at least this long after a failed thread creation before " "trying to create another thread.\n" "\n" "Failure to create a worker thread is often a sign that the end " "is near, because the process is running out of some resource. " "This delay tries to not rush the end on needlessly.\n" "\n" "If thread creation failures are a problem, check that " "thread_pool_max is not too high.\n" "\n" "It may also help to increase thread_pool_timeout and " "thread_pool_min, to reduce the rate at which treads are destroyed " "and later recreated.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ thread_pool_max, /* typ */ thread_pool_max, /* min */ "100", /* max */ NULL, /* default */ "5000", /* units */ "threads", /* flags */ DELAYED_EFFECT, /* s-text */ "The maximum number of worker threads in each pool.\n" "\n" "Do not set this higher than you have to, since excess worker " "threads soak up RAM and CPU and generally just get in the way of " "getting work done.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ thread_pool_min, /* typ */ thread_pool_min, /* min */ NULL, /* max */ "5000", /* default */ "100", /* units */ "threads", /* flags */ DELAYED_EFFECT, /* s-text */ "The minimum number of worker threads in each pool.\n" "\n" "Increasing this may help ramp up faster from low load situations " "or when threads have expired." "Minimum is 10 threads.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ thread_pool_stack, /* typ */ bytes, /* min */ "2k", /* max */ NULL, /* default */ "48k", /* units */ "bytes", /* flags */ EXPERIMENTAL, /* s-text */ "Worker thread stack size.\n" "This will likely be rounded up to a multiple of 4k (or whatever " "the page_size might be) by the kernel.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ thread_pool_timeout, /* typ */ timeout, /* min */ "10.000", /* max */ NULL, /* default */ "300.000", /* units */ "seconds", /* flags */ DELAYED_EFFECT| EXPERIMENTAL, /* s-text */ "Thread idle threshold.\n" "\n" "Threads in excess of thread_pool_min, which have been idle for at " "least this long, will be destroyed.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ thread_pools, /* typ */ uint, /* min */ "1", /* max */ NULL, /* default */ "2", /* units */ "pools", /* flags */ DELAYED_EFFECT| EXPERIMENTAL, /* s-text */ "Number of worker thread pools.\n" "\n" "Increasing number of worker pools decreases lock contention.\n" "\n" "Too many pools waste CPU and RAM resources, and more than one " "pool for each CPU is probably detrimal to performance.\n" "\n" "Can be increased on the fly, but decreases require a restart to " "take effect.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ thread_queue_limit, /* typ */ uint, /* min */ "0", /* max */ NULL, /* default */ "20", /* units */ NULL, /* flags */ EXPERIMENTAL, /* s-text */ "Permitted queue length per thread-pool.\n" "\n" "This sets the number of requests we will queue, waiting for an " "available thread. Above this limit sessions will be dropped " "instead of queued.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ thread_stats_rate, /* typ */ uint, /* min */ "0", /* max */ NULL, /* default */ "10", /* units */ "requests", /* flags */ EXPERIMENTAL, /* s-text */ "Worker threads accumulate statistics, and dump these into the " "global stats counters if the lock is free when they finish a job " "(request/fetch etc).\n" "This parameters defines the maximum number of jobs a worker " "thread may handle, before it is forced to dump its accumulated " "stats into the global counters.", /* l-text */ "", /* func */ NULL ) #endif PARAM( /* name */ timeout_idle, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "5.000", /* units */ "seconds", /* flags */ 0, /* s-text */ "Idle timeout for client connections.\n" "A connection is considered idle, until we have received the full " "request headers.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ timeout_linger, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "0.050", /* units */ "seconds", /* flags */ EXPERIMENTAL, /* s-text */ "How long the worker thread lingers on an idle session before " "handing it over to the waiter.\n" "When sessions are reused, as much as half of all reuses happen " "within the first 100 msec of the previous request completing.\n" "Setting this too high results in worker threads not doing " "anything for their keep, setting it too low just means that more " "sessions take a detour around the waiter.", /* l-text */ "", /* func */ NULL ) #if 0 PARAM( /* name */ vcc_allow_inline_c, /* typ */ bool, /* min */ NULL, /* max */ NULL, /* default */ "off", /* units */ "bool", /* flags */ 0, /* s-text */ "Allow inline C code in VCL.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ vcc_err_unref, /* typ */ bool, /* min */ NULL, /* max */ NULL, /* default */ "on", /* units */ "bool", /* flags */ 0, /* s-text */ "Unreferenced VCL objects result in error.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ vcc_unsafe_path, /* typ */ bool, /* min */ NULL, /* max */ NULL, /* default */ "on", /* units */ "bool", /* flags */ 0, /* s-text */ "Allow '/' in vmod & include paths.\n" "Allow 'import ... from ...'.", /* l-text */ "", /* func */ NULL ) #endif PARAM( /* name */ vcl_cooldown, /* typ */ timeout, /* min */ "0.000", /* max */ NULL, /* default */ "600.000", /* units */ "seconds", /* flags */ 0, /* s-text */ "How long a VCL is kept warm after being replaced as the " "active VCL (granularity approximately 30 seconds).", /* l-text */ "", /* func */ NULL ) #if 0 PARAM( /* name */ vcl_dir, /* typ */ string, /* min */ NULL, /* max */ NULL, /* default */ /opt/varnish/etc/varnish, /* units */ NULL, /* flags */ 0, /* s-text */ "Directory from which relative VCL filenames (vcl.load and " "include) are opened.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ vmod_dir, /* typ */ string, /* min */ NULL, /* max */ NULL, /* default */ /opt/varnish/lib/varnish/vmods, /* units */ NULL, /* flags */ 0, /* s-text */ "Directory where VCL modules are to be found.", /* l-text */ "", /* func */ NULL ) #endif PARAM( /* name */ vsl_buffer, /* typ */ vsl_buffer, /* min */ "267", /* max */ NULL, /* default */ "4k", /* units */ "bytes", /* flags */ 0, /* s-text */ "Bytes of (req-/backend-)workspace dedicated to buffering VSL " "records.\n" "Setting this too high costs memory, setting it too low will cause " "more VSL flushes and likely increase lock-contention on the VSL " "mutex.\n\n" "The minimum tracks the vsl_reclen parameter + 12 bytes.", /* l-text */ "", /* func */ NULL ) #if 0 PARAM( /* name */ vsl_mask, /* typ */ vsl_mask, /* min */ NULL, /* max */ NULL, /* default */ "default", /* units */ NULL, /* flags */ 0, /* s-text */ "Mask individual VSL messages from being logged.\n" " default Set default value\n" "\n" "Use +/- prefix in front of VSL tag name, to mask/unmask " "individual VSL messages.", /* l-text */ "", /* func */ NULL ) #endif PARAM( /* name */ vsl_reclen, /* typ */ vsl_reclen, /* min */ "16b", /* max */ "4084b", /* default */ "255b", /* units */ "bytes", /* flags */ 0, /* s-text */ "Maximum number of bytes in SHM log record.\n\n" "The maximum tracks the vsl_buffer parameter - 12 bytes.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ vsl_space, /* typ */ bytes, /* min */ "1M", /* max */ NULL, /* default */ "80M", /* units */ "bytes", /* flags */ MUST_RESTART, /* s-text */ "The amount of space to allocate for the VSL fifo buffer in the " "VSM memory segment. If you make this too small, " "varnish{ncsa|log} etc will not be able to keep up. Making it too " "large just costs memory resources.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ vsm_space, /* typ */ bytes, /* min */ "1M", /* max */ NULL, /* default */ "1M", /* units */ "bytes", /* flags */ MUST_RESTART, /* s-text */ "The amount of space to allocate for stats counters in the VSM " "memory segment. If you make this too small, some counters will " "be invisible. Making it too large just costs memory resources.", /* l-text */ "", /* func */ NULL ) #if 0 PARAM( /* name */ waiter, /* typ */ waiter, /* min */ NULL, /* max */ NULL, /* default */ kqueue (possible values: kqueue, poll), /* units */ NULL, /* flags */ MUST_RESTART| WIZARD, /* s-text */ "Select the waiter kernel interface.", /* l-text */ "", /* func */ NULL ) #endif PARAM( /* name */ workspace_backend, /* typ */ bytes_u, /* min */ "1k", /* max */ NULL, /* default */ "64k", /* units */ "bytes", /* flags */ DELAYED_EFFECT, /* s-text */ "Bytes of HTTP protocol workspace for backend HTTP req/resp. If " "larger than 4k, use a multiple of 4k for VM efficiency.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ workspace_client, /* typ */ bytes_u, /* min */ "9k", /* max */ NULL, /* default */ "64k", /* units */ "bytes", /* flags */ DELAYED_EFFECT, /* s-text */ "Bytes of HTTP protocol workspace for clients HTTP req/resp. If " "larger than 4k, use a multiple of 4k for VM efficiency.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ workspace_session, /* typ */ bytes_u, /* min */ "0.25k", /* max */ NULL, /* default */ "0.50k", /* units */ "bytes", /* flags */ DELAYED_EFFECT, /* s-text */ "Allocation size for session structure and workspace. The " "workspace is primarily used for TCP connection addresses. If " "larger than 4k, use a multiple of 4k for VM efficiency.", /* l-text */ "", /* func */ NULL ) PARAM( /* name */ workspace_thread, /* typ */ bytes_u, /* min */ "0.25k", /* max */ "8k", /* default */ "2k", /* units */ "bytes", /* flags */ DELAYED_EFFECT, /* s-text */ "Bytes of auxiliary workspace per thread.\n" "This workspace is used for certain temporary data structures " "during the operation of a worker thread.\n" "One use is for the io-vectors for writing requests and responses " "to sockets, having too little space will result in more writev(2) " "system calls, having too much just wastes the space.", /* l-text */ "", /* func */ NULL ) /*lint -restore */ varnish-4.1.1/include/tbl/vsc_fields.h0000644000201500234410000001730412652366721014621 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Definition of all shared memory statistics below (except main - see * include/tbl/vsc_f_main.h). * * Fields (n, t, l, s, f, v, d, e): * n - Name: Field name, in C-source and stats programs * t - C-type: uint64_t, unless marked in 's' * l - Local: Local counter in worker thread. * s - Semantics: Semantics of the value in this field * 'b' - Bitmap * 'c' - Counter, never decreases. * 'g' - Gauge, goes up and down * f - Format: Display format for the field * 'b' - Bitmap * 'i' - Integer * 'd' - Duration * v - Verbosity: Counter verbosity level (see vsc_levels.h) * d - Description: Short description of field (for screen use) * e - Explanation: Long explanation of field (for doc use) * * Please describe Gauge variables as "Number of..." to indicate that * this is a snapshot, and Counter variables as "Count of" to indicate * accumulative count. * * ----------------------- * NB: Cleanup in progress * ----------------------- * * Insufficient attention has caused this to become a swamp of conflicting * conventions, shorthands and general mumbo-jumbo. I'm trying to clean * it up as I go over the code in other business. * * Please see the sessmem section for how it should look. * */ /**********************************************************************/ #ifdef VSC_DO_MGT VSC_F(uptime, uint64_t, 0, 'c', 'd', info, "Management process uptime", "Uptime in seconds of the management process" ) VSC_F(child_start, uint64_t, 0, 'c', 'i', diag, "Child process started", "Number of times the child process has been started" ) VSC_F(child_exit, uint64_t, 0, 'c', 'i', diag, "Child process normal exit", "Number of times the child process has been cleanly stopped" ) VSC_F(child_stop, uint64_t, 0, 'c', 'i', diag, "Child process unexpected exit", "Number of times the child process has exited with an unexpected" " return code" ) VSC_F(child_died, uint64_t, 0, 'c', 'i', diag, "Child process died (signal)", "Number of times the child process has died due to signals" ) VSC_F(child_dump, uint64_t, 0, 'c', 'i', diag, "Child process core dumped", "Number of times the child process has produced core dumps" ) VSC_F(child_panic, uint64_t, 0, 'c', 'i', diag, "Child process panic", "Number of times the management process has caught a child panic" ) #endif /**********************************************************************/ #ifdef VSC_DO_LCK VSC_F(creat, uint64_t, 0, 'c', 'i', debug, "Created locks", "" ) VSC_F(destroy, uint64_t, 0, 'c', 'i', debug, "Destroyed locks", "" ) VSC_F(locks, uint64_t, 0, 'c', 'i', debug, "Lock Operations", "" ) #endif /********************************************************************** * All Stevedores support these counters */ #if defined(VSC_DO_SMA) || defined (VSC_DO_SMF) VSC_F(c_req, uint64_t, 0, 'c', 'i', info, "Allocator requests", "Number of times the storage has been asked to provide a storage segment." ) VSC_F(c_fail, uint64_t, 0, 'c', 'i', info, "Allocator failures", "Number of times the storage has failed to provide a storage segment." ) VSC_F(c_bytes, uint64_t, 0, 'c', 'B', info, "Bytes allocated", "Number of total bytes allocated by this storage." ) VSC_F(c_freed, uint64_t, 0, 'c', 'B', info, "Bytes freed", "Number of total bytes returned to this storage." ) VSC_F(g_alloc, uint64_t, 0, 'g', 'i', info, "Allocations outstanding", "Number of storage allocations outstanding." ) VSC_F(g_bytes, uint64_t, 0, 'g', 'B', info, "Bytes outstanding", "Number of bytes allocated from the storage." ) VSC_F(g_space, uint64_t, 0, 'g', 'B', info, "Bytes available", "Number of bytes left in the storage." ) #endif /**********************************************************************/ #ifdef VSC_DO_SMA /* No SMA specific counters */ #endif /**********************************************************************/ #ifdef VSC_DO_SMF VSC_F(g_smf, uint64_t, 0, 'g', 'i', info, "N struct smf", "" ) VSC_F(g_smf_frag, uint64_t, 0, 'g', 'i', info, "N small free smf", "" ) VSC_F(g_smf_large, uint64_t, 0, 'g', 'i', info, "N large free smf", "" ) #endif /**********************************************************************/ #ifdef VSC_DO_VBE VSC_F(happy, uint64_t, 0, 'b', 'b', info, "Happy health probes", "" ) VSC_F(bereq_hdrbytes, uint64_t, 0, 'c', 'B', info, "Request header bytes", "Total backend request header bytes sent" ) VSC_F(bereq_bodybytes, uint64_t, 0, 'c', 'B', info, "Request body bytes", "Total backend request body bytes sent" ) VSC_F(beresp_hdrbytes, uint64_t, 0, 'c', 'B', info, "Response header bytes", "Total backend response header bytes received" ) VSC_F(beresp_bodybytes, uint64_t, 0, 'c', 'B', info, "Response body bytes", "Total backend response body bytes received" ) VSC_F(pipe_hdrbytes, uint64_t, 0, 'c', 'B', info, "Pipe request header bytes", "Total request bytes sent for piped sessions" ) VSC_F(pipe_out, uint64_t, 0, 'c', 'B', info, "Piped bytes to backend", "Total number of bytes forwarded to backend in" " pipe sessions" ) VSC_F(pipe_in, uint64_t, 0, 'c', 'B', info, "Piped bytes from backend", "Total number of bytes forwarded from backend in" " pipe sessions" ) VSC_F(conn, uint64_t, 0, 'g', 'i', info, "Concurrent connections to backend", "" ) VSC_F(req, uint64_t, 0, 'c', 'i', info, "Backend requests sent", "" ) #endif /**********************************************************************/ #ifdef VSC_DO_MEMPOOL VSC_F(live, uint64_t, 0, 'g', 'i', debug, "In use", "" ) VSC_F(pool, uint64_t, 0, 'g', 'i', debug, "In Pool", "" ) VSC_F(sz_wanted, uint64_t, 0, 'g', 'B', debug, "Size requested", "" ) VSC_F(sz_actual, uint64_t, 0, 'g', 'B', debug, "Size allocated", "" ) VSC_F(allocs, uint64_t, 0, 'c', 'i', debug, "Allocations", "" ) VSC_F(frees, uint64_t, 0, 'c', 'i', debug, "Frees", "" ) VSC_F(recycle, uint64_t, 0, 'c', 'i', debug, "Recycled from pool", "" ) VSC_F(timeout, uint64_t, 0, 'c', 'i', debug, "Timed out from pool", "" ) VSC_F(toosmall, uint64_t, 0, 'c', 'i', debug, "Too small to recycle", "" ) VSC_F(surplus, uint64_t, 0, 'c', 'i', debug, "Too many for pool", "" ) VSC_F(randry, uint64_t, 0, 'c', 'i', debug, "Pool ran dry", "" ) #endif varnish-4.1.1/include/tbl/vsc_levels.h0000644000201500234410000000402312652366721014637 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-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. */ /* * Fields (v, l, e, d): * v - Verbosity lvl: Field name, in C-source * l - Label: Display name, in stats programs * e - Explanation: Short description of this counter type * d - Description: Long description of this counter type */ /*lint -save -e525 -e539 */ VSC_LEVEL_F(info, "INFO", "Informational counters", "Counters giving runtime information") VSC_LEVEL_F(diag, "DIAG", "Diagnostic counters", "Counters giving diagnostic information") VSC_LEVEL_F(debug, "DEBUG", "Debug counters", "Counters giving Varnish internals debug information") /*lint -restore */ varnish-4.1.1/include/tbl/sess_attr.h0000644000201500234410000000407212652366721014505 00000000000000/*- * Copyright (c) 2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Session attributes should be stored as cheaply as possible in terms of * memory. This stuff implements "small pointers", 16 bit offsets into * the session workspace, for these bits. */ /*lint -save -e525 -e539 */ // upper lower type len SESS_ATTR(REMOTE_ADDR, remote_addr, struct suckaddr *, vsa_suckaddr_len) SESS_ATTR(LOCAL_ADDR, local_addr, struct suckaddr *, vsa_suckaddr_len) SESS_ATTR(CLIENT_ADDR, client_addr, struct suckaddr *, vsa_suckaddr_len) SESS_ATTR(SERVER_ADDR, server_addr, struct suckaddr *, vsa_suckaddr_len) SESS_ATTR(CLIENT_IP, client_ip, char *, -1) SESS_ATTR(CLIENT_PORT, client_port, char *, -1) /*lint -restore */ varnish-4.1.1/include/tbl/vsc_f_main.h0000644000201500234410000004525712652366721014614 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Definition of the main shared memory statistics below. * * See include/tbl/vsc_fields.h for the table definition. */ /*-------------------------------------------------------------------- * Globals, not related to traffic */ VSC_F(uptime, uint64_t, 0, 'c', 'd', info, "Child process uptime", "How long the child process has been running." ) /*--------------------------------------------------------------------- * Sessions */ VSC_F(sess_conn, uint64_t, 1, 'c', 'i', info, "Sessions accepted", "Count of sessions successfully accepted" ) VSC_F(sess_drop, uint64_t, 1, 'c', 'i', info, "Sessions dropped", "Count of sessions silently dropped due to lack of worker thread." ) VSC_F(sess_fail, uint64_t, 1, 'c', 'i', info, "Session accept failures", "Count of failures to accept TCP connection." " Either the client changed its mind, or the kernel ran out of" " some resource like file descriptors." ) /*---------------------------------------------------------------------*/ VSC_F(client_req_400, uint64_t, 1, 'c', 'i', info, "Client requests received, subject to 400 errors", "400 means we couldn't make sense of the request, it was" " malformed in some drastic way." ) VSC_F(client_req_417, uint64_t, 1, 'c', 'i', info, "Client requests received, subject to 417 errors", "417 means that something went wrong with an Expect: header." ) VSC_F(client_req, uint64_t, 1, 'c', 'i', info, "Good client requests received", "The count of parseable client requests seen." ) /*---------------------------------------------------------------------*/ VSC_F(cache_hit, uint64_t, 1, 'c', 'i', info, "Cache hits", "Count of cache hits. " " A cache hit indicates that an object has been delivered to a" " client without fetching it from a backend server." ) VSC_F(cache_hitpass, uint64_t, 1, 'c', 'i', info, "Cache hits for pass", "Count of hits for pass" " A cache hit for pass indicates that Varnish is going to" " pass the request to the backend and this decision has been " " cached in it self. This counts how many times the cached " " decision is being used." ) VSC_F(cache_miss, uint64_t, 1, 'c', 'i', info, "Cache misses", "Count of misses" " A cache miss indicates the object was fetched from the" " backend before delivering it to the backend." ) /*---------------------------------------------------------------------*/ VSC_F(backend_conn, uint64_t, 0, 'c', 'i', info, "Backend conn. success", "How many backend connections have successfully been" " established." ) VSC_F(backend_unhealthy, uint64_t, 0, 'c', 'i', info, "Backend conn. not attempted", "" ) VSC_F(backend_busy, uint64_t, 0, 'c', 'i', info, "Backend conn. too many", "" ) VSC_F(backend_fail, uint64_t, 0, 'c', 'i', info, "Backend conn. failures", "" ) VSC_F(backend_reuse, uint64_t, 0, 'c', 'i', info, "Backend conn. reuses", "Count of backend connection reuses" " This counter is increased whenever we reuse a recycled connection." ) VSC_F(backend_recycle, uint64_t, 0, 'c', 'i', info, "Backend conn. recycles", "Count of backend connection recycles" " This counter is increased whenever we have a keep-alive" " connection that is put back into the pool of connections." " It has not yet been used, but it might be, unless the backend" " closes it." ) VSC_F(backend_retry, uint64_t, 0, 'c', 'i', info, "Backend conn. retry", "" ) /*--------------------------------------------------------------------- * Backend fetch statistics */ VSC_F(fetch_head, uint64_t, 1, 'c', 'i', info, "Fetch no body (HEAD)", "beresp with no body because the request is HEAD." ) VSC_F(fetch_length, uint64_t, 1, 'c', 'i', info, "Fetch with Length", "beresp.body with Content-Length." ) VSC_F(fetch_chunked, uint64_t, 1, 'c', 'i', info, "Fetch chunked", "beresp.body with Chunked." ) VSC_F(fetch_eof, uint64_t, 1, 'c', 'i', info, "Fetch EOF", "beresp.body with EOF." ) VSC_F(fetch_bad, uint64_t, 1, 'c', 'i', info, "Fetch bad T-E", "beresp.body length/fetch could not be determined." ) VSC_F(fetch_none, uint64_t, 1, 'c', 'i', info, "Fetch no body", "beresp.body empty" ) VSC_F(fetch_1xx, uint64_t, 1, 'c', 'i', info, "Fetch no body (1xx)", "beresp with no body because of 1XX response." ) VSC_F(fetch_204, uint64_t, 1, 'c', 'i', info, "Fetch no body (204)", "beresp with no body because of 204 response." ) VSC_F(fetch_304, uint64_t, 1, 'c', 'i', info, "Fetch no body (304)", "beresp with no body because of 304 response." ) VSC_F(fetch_failed, uint64_t, 1, 'c', 'i', info, "Fetch failed (all causes)", "beresp fetch failed." ) VSC_F(fetch_no_thread, uint64_t, 1, 'c', 'i', info, "Fetch failed (no thread)", "beresp fetch failed, no thread available." ) /*--------------------------------------------------------------------- * Pools, threads, and sessions * see: cache_pool.c * */ VSC_F(pools, uint64_t, 0, 'g', 'i', info, "Number of thread pools", "Number of thread pools. See also parameter thread_pools." " NB: Presently pools cannot be removed once created." ) VSC_F(threads, uint64_t, 0, 'g', 'i', info, "Total number of threads", "Number of threads in all pools." " See also parameters thread_pools, thread_pool_min and" " thread_pool_max." ) VSC_F(threads_limited, uint64_t, 0, 'c', 'i', info, "Threads hit max", "Number of times more threads were needed, but limit was reached" " in a thread pool." " See also parameter thread_pool_max." ) VSC_F(threads_created, uint64_t, 0, 'c', 'i', info, "Threads created", "Total number of threads created in all pools." ) VSC_F(threads_destroyed, uint64_t, 0, 'c', 'i', info, "Threads destroyed", "Total number of threads destroyed in all pools." ) VSC_F(threads_failed, uint64_t, 0, 'c', 'i', info, "Thread creation failed", "Number of times creating a thread failed." " See VSL::Debug for diagnostics." " See also parameter thread_fail_delay." ) VSC_F(thread_queue_len, uint64_t, 0, 'g', 'i', info, "Length of session queue", "Length of session queue waiting for threads." " NB: Only updates once per second." " See also parameter queue_max." ) VSC_F(busy_sleep, uint64_t, 1, 'c', 'i', info, "Number of requests sent to sleep on busy objhdr", "Number of requests sent to sleep without a worker thread because" " they found a busy object." ) VSC_F(busy_wakeup, uint64_t, 1, 'c', 'i', info, "Number of requests woken after sleep on busy objhdr", "Number of requests taken of the busy object sleep list and" " and rescheduled." ) VSC_F(busy_killed, uint64_t, 1, 'c', 'i', info, "Number of requests killed after sleep on busy objhdr", "Number of requests killed from the busy object sleep list" " due to lack of resources." ) VSC_F(sess_queued, uint64_t, 0, 'c', 'i', info, "Sessions queued for thread", "Number of times session was queued waiting for a thread." " See also parameter queue_max." ) VSC_F(sess_dropped, uint64_t, 0, 'c', 'i', info, "Sessions dropped for thread", "Number of times session was dropped because the queue were too" " long already. See also parameter queue_max." ) /*---------------------------------------------------------------------*/ VSC_F(n_object, uint64_t, 1, 'g', 'i', info, "object structs made", "Number of object structs made" ) VSC_F(n_vampireobject, uint64_t, 1, 'g', 'i', diag, "unresurrected objects", "Number of unresurrected objects" ) VSC_F(n_objectcore, uint64_t, 1, 'g', 'i', info, "objectcore structs made", "Number of objectcore structs made" ) VSC_F(n_objecthead, uint64_t, 1, 'g', 'i', info, "objecthead structs made", "Number of objecthead structs made" ) VSC_F(n_waitinglist, uint64_t, 1, 'g', 'i', debug, "waitinglist structs made", "Number of waitinglist structs made" ) VSC_F(n_backend, uint64_t, 0, 'g', 'i', info, "Number of backends", "Number of backends known to us." ) VSC_F(n_expired, uint64_t, 0, 'g', 'i', info, "Number of expired objects", "Number of objects that expired from cache" " because of old age." ) VSC_F(n_lru_nuked, uint64_t, 0, 'g', 'i', info, "Number of LRU nuked objects", "How many objects have been forcefully evicted" " from storage to make room for a new object." ) VSC_F(n_lru_moved, uint64_t, 0, 'g', 'i', diag, "Number of LRU moved objects", "Number of move operations done on the LRU list." ) VSC_F(losthdr, uint64_t, 0, 'c', 'i', info, "HTTP header overflows", "" ) VSC_F(s_sess, uint64_t, 1, 'c', 'i', info, "Total sessions seen", "" ) VSC_F(s_req, uint64_t, 1, 'c', 'i', info, "Total requests seen", "" ) VSC_F(s_pipe, uint64_t, 1, 'c', 'i', info, "Total pipe sessions seen", "" ) VSC_F(s_pass, uint64_t, 1, 'c', 'i', info, "Total pass-ed requests seen", "" ) VSC_F(s_fetch, uint64_t, 1, 'c', 'i', info, "Total backend fetches initiated", "" ) VSC_F(s_synth, uint64_t, 1, 'c', 'i', info, "Total synthethic responses made", "" ) VSC_F(s_req_hdrbytes, uint64_t, 1, 'c', 'B', info, "Request header bytes", "Total request header bytes received" ) VSC_F(s_req_bodybytes, uint64_t, 1, 'c', 'B', info, "Request body bytes", "Total request body bytes received" ) VSC_F(s_resp_hdrbytes, uint64_t, 1, 'c', 'B', info, "Response header bytes", "Total response header bytes transmitted" ) VSC_F(s_resp_bodybytes, uint64_t, 1, 'c', 'B', info, "Response body bytes", "Total response body bytes transmitted" ) VSC_F(s_pipe_hdrbytes, uint64_t, 0, 'c', 'B', info, "Pipe request header bytes", "Total request bytes received for piped sessions" ) VSC_F(s_pipe_in, uint64_t, 0, 'c', 'B', info, "Piped bytes from client", "Total number of bytes forwarded from clients in" " pipe sessions" ) VSC_F(s_pipe_out, uint64_t, 0, 'c', 'B', info, "Piped bytes to client", "Total number of bytes forwarded to clients in" " pipe sessions" ) VSC_F(sess_closed, uint64_t, 1, 'c', 'i', info, "Session Closed", "" ) VSC_F(sess_closed_err, uint64_t, 0, 'c', 'i', info, "Session Closed with error", "Total number of sessions closed with errors." " See sc_* diag counters for detailed breakdown" ) VSC_F(sess_readahead, uint64_t, 1, 'c', 'i', info, "Session Read Ahead", "" ) VSC_F(sess_herd, uint64_t, 1, 'c', 'i', diag, "Session herd", "" ) #define SESS_CLOSE_ERR0 "OK " #define SESS_CLOSE_ERR1 "Err " #define SESS_CLOSE_ERROR0 "" #define SESS_CLOSE_ERROR1 "Error " #define SESS_CLOSE(r, f, e, s) \ VSC_F(sc_ ## f, uint64_t, 0, 'c', 'i', diag, \ "Session " SESS_CLOSE_ERR ## e #r, \ "Number of session closes with " \ SESS_CLOSE_ERROR ## e #r " (" s ")" \ ) #include "tbl/sess_close.h" #undef SESS_CLOSE #undef SESS_CLOSE_ERROR1 #undef SESS_CLOSE_ERROR0 #undef SESS_CLOSE_ERR1 #undef SESS_CLOSE_ERR0 /*--------------------------------------------------------------------*/ VSC_F(shm_records, uint64_t, 0, 'c', 'i', diag, "SHM records", "" ) VSC_F(shm_writes, uint64_t, 0, 'c', 'i', diag, "SHM writes", "" ) VSC_F(shm_flushes, uint64_t, 0, 'c', 'i', diag, "SHM flushes due to overflow", "" ) VSC_F(shm_cont, uint64_t, 0, 'c', 'i', diag, "SHM MTX contention", "" ) VSC_F(shm_cycles, uint64_t, 0, 'c', 'i', diag, "SHM cycles through buffer", "" ) /*--------------------------------------------------------------------*/ VSC_F(backend_req, uint64_t, 0, 'c', 'i', info, "Backend requests made", "" ) /*--------------------------------------------------------------------*/ VSC_F(n_vcl, uint64_t, 0, 'c', 'i', info, "Number of loaded VCLs in total", "" ) VSC_F(n_vcl_avail, uint64_t, 0, 'c', 'i', diag, "Number of VCLs available", "" ) VSC_F(n_vcl_discard, uint64_t, 0, 'c', 'i', diag, "Number of discarded VCLs", "" ) /*--------------------------------------------------------------------*/ VSC_F(bans, uint64_t, 0, 'g', 'i', info, "Count of bans", "Number of all bans in system, including bans superseded" " by newer bans and bans already checked by the ban-lurker." ) VSC_F(bans_completed, uint64_t, 0, 'g', 'i', diag, "Number of bans marked 'completed'", "Number of bans which are no longer active, either because they" " got checked by the ban-lurker or superseded by newer identical bans." ) VSC_F(bans_obj, uint64_t, 0, 'g', 'i', diag, "Number of bans using obj.*", "Number of bans which use obj.* variables. These bans can possibly" " be washed by the ban-lurker." ) VSC_F(bans_req, uint64_t, 0, 'g', 'i', diag, "Number of bans using req.*", "Number of bans which use req.* variables. These bans can not" " be washed by the ban-lurker." ) VSC_F(bans_added, uint64_t, 0, 'c', 'i', diag, "Bans added", "Counter of bans added to ban list." ) VSC_F(bans_deleted, uint64_t, 0, 'c', 'i', diag, "Bans deleted", "Counter of bans deleted from ban list." ) VSC_F(bans_tested, uint64_t, 0, 'c', 'i', diag, "Bans tested against objects (lookup)", "Count of how many bans and objects have been tested against" " each other during hash lookup." ) VSC_F(bans_obj_killed, uint64_t, 0, 'c', 'i', diag, "Objects killed by bans (lookup)", "Number of objects killed by bans during object lookup." ) VSC_F(bans_lurker_tested, uint64_t, 0, 'c', 'i', diag, "Bans tested against objects (lurker)", "Count of how many bans and objects have been tested against" " each other by the ban-lurker." ) VSC_F(bans_tests_tested, uint64_t, 0, 'c', 'i', diag, "Ban tests tested against objects (lookup)", "Count of how many tests and objects have been tested against" " each other during lookup." " 'ban req.url == foo && req.http.host == bar'" " counts as one in 'bans_tested' and as two in 'bans_tests_tested'" ) VSC_F(bans_lurker_tests_tested, uint64_t, 0, 'c', 'i', diag, "Ban tests tested against objects (lurker)", "Count of how many tests and objects have been tested against" " each other by the ban-lurker." " 'ban req.url == foo && req.http.host == bar'" " counts as one in 'bans_tested' and as two in 'bans_tests_tested'" ) VSC_F(bans_lurker_obj_killed, uint64_t, 0, 'c', 'i', diag, "Objects killed by bans (lurker)", "Number of objects killed by ban-lurker." ) VSC_F(bans_dups, uint64_t, 0, 'c', 'i', diag, "Bans superseded by other bans", "Count of bans replaced by later identical bans." ) VSC_F(bans_lurker_contention, uint64_t, 0, 'c', 'i', diag, "Lurker gave way for lookup", "Number of times the ban-lurker had to wait for lookups." ) VSC_F(bans_persisted_bytes, uint64_t, 0, 'g', 'B', diag, "Bytes used by the persisted ban lists", "Number of bytes used by the persisted ban lists." ) VSC_F(bans_persisted_fragmentation, uint64_t, 0, 'g', 'B', diag, "Extra bytes in persisted ban lists due to fragmentation", "Number of extra bytes accumulated through dropped and" " completed bans in the persistent ban lists." ) /*--------------------------------------------------------------------*/ VSC_F(n_purges, uint64_t, 0, 'g', 'i', info, "Number of purge operations executed", "" ) VSC_F(n_obj_purged, uint64_t, 0, 'g', 'i', info, "Number of purged objects", "" ) /*--------------------------------------------------------------------*/ VSC_F(exp_mailed, uint64_t, 0, 'c', 'i', 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', 'i', diag, "Number of objects received by expiry thread", "Number of objects received by expiry thread for handling." ) /*--------------------------------------------------------------------*/ VSC_F(hcb_nolock, uint64_t, 1, 'c', 'i', debug, "HCB Lookups without lock", "" ) VSC_F(hcb_lock, uint64_t, 0, 'c', 'i', debug, "HCB Lookups with lock", "" ) VSC_F(hcb_insert, uint64_t, 0, 'c', 'i', debug, "HCB Inserts", "" ) /*--------------------------------------------------------------------*/ VSC_F(esi_errors, uint64_t, 0, 'c', 'i', diag, "ESI parse errors (unlock)", "" ) VSC_F(esi_warnings, uint64_t, 0, 'c', 'i', diag, "ESI parse warnings (unlock)", "" ) /*--------------------------------------------------------------------*/ VSC_F(vmods, uint64_t, 0, 'g', 'i', info, "Loaded VMODs", "" ) /*--------------------------------------------------------------------*/ VSC_F(n_gzip, uint64_t, 0, 'c', 'i', info, "Gzip operations", "" ) VSC_F(n_gunzip, uint64_t, 0, 'c', 'i', info, "Gunzip operations", "" ) /*--------------------------------------------------------------------*/ VSC_F(vsm_free, uint64_t, 0, 'g', 'B', diag, "Free VSM space", "Number of bytes free in the shared memory used to communicate" " with tools like varnishstat, varnishlog etc." ) VSC_F(vsm_used, uint64_t, 0, 'g', 'B', diag, "Used VSM space", "Number of bytes used in the shared memory used to communicate" " with tools like varnishstat, varnishlog etc." ) VSC_F(vsm_cooling, uint64_t, 0, 'g', 'B', debug, "Cooling VSM space", "Number of bytes which will soon (max 1 minute) be freed" " in the shared memory used to communicate" " with tools like varnishstat, varnishlog etc." ) VSC_F(vsm_overflow, uint64_t, 0, 'g', 'B', diag, "Overflow VSM space", "Number of bytes which does not fit" " in the shared memory used to communicate" " with tools like varnishstat, varnishlog etc." ) VSC_F(vsm_overflowed, uint64_t, 0, 'c', 'B', diag, "Overflowed VSM space", "Total number of bytes which did not fit" " in the shared memory used to communicate" " with tools like varnishstat, varnishlog etc." ) varnish-4.1.1/include/tbl/feature_bits.h0000644000201500234410000000473012652366721015153 00000000000000/*- * Copyright (c) 2012 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. * * Fields in the feature parameter * */ /*lint -save -e525 -e539 */ FEATURE_BIT(SHORT_PANIC, short_panic, "Short panic message.", "Reduce level of detail for panic messages." ) FEATURE_BIT(WAIT_SILO, wait_silo, "Wait for persistent silo.", "Wait for persistent silos to load completely before serving requests." ) FEATURE_BIT(NO_COREDUMP, no_coredump, "No coredumps.", "Don't attempt to coredump child process on panics." ) FEATURE_BIT(ESI_IGNORE_HTTPS, esi_ignore_https, "Treat HTTPS as HTTP in ESI:includes", "Convert * * 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 */ REQ_FLAG(disable_esi, 0, 0, "") REQ_FLAG(hash_ignore_busy, 1, 1, "") REQ_FLAG(hash_always_miss, 1, 1, "") REQ_FLAG(is_hit, 0, 0, "") /*lint -restore */ varnish-4.1.1/include/tbl/vcl_returns.h0000644000201500234410000000530212652366743015045 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ /*lint -save -e525 -e539 */ #ifdef VCL_RET_MAC VCL_RET_MAC(abandon, ABANDON, VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_FETCH | VCL_MET_BACKEND_RESPONSE ) VCL_RET_MAC(deliver, DELIVER, VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE | VCL_MET_DELIVER | VCL_MET_HIT | VCL_MET_SYNTH ) VCL_RET_MAC(fail, FAIL, VCL_MET_INIT ) VCL_RET_MAC(fetch, FETCH, VCL_MET_BACKEND_FETCH | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS ) VCL_RET_MAC(hash, HASH, VCL_MET_RECV ) VCL_RET_MAC(lookup, LOOKUP, VCL_MET_HASH ) VCL_RET_MAC(miss, MISS, VCL_MET_HIT ) VCL_RET_MAC(ok, OK, VCL_MET_FINI | VCL_MET_INIT ) VCL_RET_MAC(pass, PASS, VCL_MET_HIT | VCL_MET_MISS | VCL_MET_RECV ) VCL_RET_MAC(pipe, PIPE, VCL_MET_PIPE | VCL_MET_RECV ) VCL_RET_MAC(purge, PURGE, VCL_MET_RECV ) VCL_RET_MAC(restart, RESTART, VCL_MET_DELIVER | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PURGE | VCL_MET_SYNTH ) VCL_RET_MAC(retry, RETRY, VCL_MET_BACKEND_ERROR | VCL_MET_BACKEND_RESPONSE ) VCL_RET_MAC(synth, SYNTH, VCL_MET_DELIVER | VCL_MET_HIT | VCL_MET_MISS | VCL_MET_PASS | VCL_MET_PIPE | VCL_MET_PURGE | VCL_MET_RECV ) #endif #ifdef VCL_MET_MAC VCL_MET_MAC(backend_error, BACKEND_ERROR, B, ( (1U << VCL_RET_ABANDON) | (1U << VCL_RET_DELIVER) | (1U << VCL_RET_RETRY) )) VCL_MET_MAC(backend_fetch, BACKEND_FETCH, B, ( (1U << VCL_RET_ABANDON) | (1U << VCL_RET_FETCH) )) VCL_MET_MAC(backend_response, BACKEND_RESPONSE, B, ( (1U << VCL_RET_ABANDON) | (1U << VCL_RET_DELIVER) | (1U << VCL_RET_RETRY) )) VCL_MET_MAC(deliver, DELIVER, C, ( (1U << VCL_RET_DELIVER) | (1U << VCL_RET_RESTART) | (1U << VCL_RET_SYNTH) )) VCL_MET_MAC(fini, FINI, H, ( (1U << VCL_RET_OK) )) VCL_MET_MAC(hash, HASH, C, ( (1U << VCL_RET_LOOKUP) )) VCL_MET_MAC(hit, HIT, C, ( (1U << VCL_RET_DELIVER) | (1U << VCL_RET_FETCH) | (1U << VCL_RET_MISS) | (1U << VCL_RET_PASS) | (1U << VCL_RET_RESTART) | (1U << VCL_RET_SYNTH) )) VCL_MET_MAC(init, INIT, H, ( (1U << VCL_RET_FAIL) | (1U << VCL_RET_OK) )) VCL_MET_MAC(miss, MISS, C, ( (1U << VCL_RET_FETCH) | (1U << VCL_RET_PASS) | (1U << VCL_RET_RESTART) | (1U << VCL_RET_SYNTH) )) VCL_MET_MAC(pass, PASS, C, ( (1U << VCL_RET_FETCH) | (1U << VCL_RET_RESTART) | (1U << VCL_RET_SYNTH) )) VCL_MET_MAC(pipe, PIPE, C, ( (1U << VCL_RET_PIPE) | (1U << VCL_RET_SYNTH) )) VCL_MET_MAC(purge, PURGE, C, ( (1U << VCL_RET_RESTART) | (1U << VCL_RET_SYNTH) )) VCL_MET_MAC(recv, RECV, C, ( (1U << VCL_RET_HASH) | (1U << VCL_RET_PASS) | (1U << VCL_RET_PIPE) | (1U << VCL_RET_PURGE) | (1U << VCL_RET_SYNTH) )) VCL_MET_MAC(synth, SYNTH, C, ( (1U << VCL_RET_DELIVER) | (1U << VCL_RET_RESTART) )) #endif /*lint -restore */ varnish-4.1.1/include/tbl/vsl_tags.h0000644000201500234410000004032012652366721014314 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Define the tags in the shared memory in a reusable format. * Whoever includes this get to define what the SLTM macro does. * * REMEMBER to update the documentation (especially the varnishlog(1) man * page) whenever this list changes. * * XXX: Please add new entries a the end to not break saved log-segments. * XXX: we can resort them when we have a major release. * * Arguments: * Tag-Name * Flags * Short Description (1 line, max ? chars) * Long Description (in RST "definition list" format) */ /*lint -save -e525 -e539 */ #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" " helpful during trouble-shooting. Most debug messages must" " be explicitly enabled with parameters.\n\n" ) SLTM(Error, 0, "Error messages", "Error messages are stuff you probably want to know.\n\n" ) SLTM(CLI, 0, "CLI communication", "CLI communication between varnishd master and child process.\n\n" ) /*---------------------------------------------------------------------*/ SLTM(SessOpen, 0, "Client connection opened", "The first record for a client connection, with the socket-endpoints" " of the connection.\n\n" "The format is::\n\n" "\t%s %d %s %s %s %d\n" "\t| | | | | |\n" "\t| | | | | +- File descriptor number\n" "\t| | | | +---- Local TCP port ('-' if !$log_local_addr)\n" "\t| | | +------- Local IPv4/6 address ('-' if !$log_local_addr)\n" "\t| | +---------- Listen socket (-a argument)\n" "\t| +------------- Remote TCP port\n" "\t+---------------- Remote IPv4/6 address\n" "\n" ) /* * XXX: compilers are _so_ picky, and won't let us do an #include * XXX: in the middle of a macro invocation :-( * XXX: If we could, these three lines would have described the * XXX: 'reason' field below. #define SESS_CLOSE(nm, s, err, desc) " " #nm "\n\t" desc "\n\n" #include "tbl/sess_close.h" #undef SESS_CLOSE */ SLTM(SessClose, 0, "Client connection closed", "SessionClose is the last record for any client connection.\n\n" "The format is::\n\n" "\t%s %f\n" "\t| |\n" "\t| +- How long the session was open\n" "\t+---- Why the connection closed\n" "\n" ) /*---------------------------------------------------------------------*/ SLTM(BackendOpen, 0, "Backend connection opened", "Logged when a new backend connection is opened.\n\n" "The format is::\n\n" "\t%d %s %s %s %s %s\n" "\t| | | | | |\n" "\t| | | | | +- Local port\n" "\t| | | | +---- Local address\n" "\t| | | +------- Remote port\n" "\t| | +---------- Remote address\n" "\t| +------------- Backend display name\n" "\t+---------------- Connection file descriptor\n" "\n" ) SLTM(BackendReuse, 0, "Backend connection put up for reuse", "Logged when a backend connection is put up for reuse by a later" " connection.\n\n" "The format is::\n\n" "\t%d %s\n" "\t| |\n" "\t| +- Backend display name\n" "\t+---- Connection file descriptor\n" "\n" ) SLTM(BackendClose, 0, "Backend connection closed", "Logged when a backend connection is closed.\n\n" "The format is::\n\n" "\t%d %s [ %s ]\n" "\t| | |\n" "\t| | +- Optional reason\n" "\t| +------ Backend display name\n" "\t+--------- Connection file descriptor\n" "\n" ) SLTM(HttpGarbage, SLT_F_BINARY, "Unparseable HTTP request", "Logs the content of unparseable HTTP requests.\n\n" ) SLTM(Proxy, 0, "PROXY protocol information", "PROXY protocol information.\n\n" "The format is::\n\n" "\t%d %s %d %s %d [key value]...\n" "\t| | | | | |\n" "\t| | | | | +- optional information\n" "\t| | | | +- server port\n" "\t| | | +- server ip\n" "\t| | +- client port\n" "\t| +- client ip\n" "\t+---- PROXY protocol version\n" ) SLTM(ProxyGarbage, 0, "Unparseable PROXY request", "A PROXY protocol header was unparseable.\n\n" ) SLTM(Backend, 0, "Backend selected", "Logged when a connection is selected for handling a backend" " request.\n\n" "The format is::\n\n" "\t%d %s %s\n" "\t| | |\n" "\t| | +- Backend display name\n" "\t| +---- VCL name\n" "\t+------- Connection file descriptor\n" "\n" ) SLTM(Length, 0, "Size of object body", "Logs the size of a fetch object body.\n\n" ) SLTM(FetchError, 0, "Error while fetching object", "Logs the error message of a failed fetch operation.\n\n" ) #define SLTH(tag, ind, req, resp, sdesc, ldesc) \ SLTM(Req##tag, (req ? 0 : SLT_F_UNUSED), "Client request " sdesc, ldesc) #include "tbl/vsl_tags_http.h" #undef SLTH #define SLTH(tag, ind, req, resp, sdesc, ldesc) \ SLTM(Resp##tag, (resp ? 0 : SLT_F_UNUSED), "Client response " sdesc, \ ldesc) #include "tbl/vsl_tags_http.h" #undef SLTH #define SLTH(tag, ind, req, resp, sdesc, ldesc) \ SLTM(Bereq##tag, (req ? 0 : SLT_F_UNUSED), "Backend request " sdesc, \ ldesc) #include "tbl/vsl_tags_http.h" #undef SLTH #define SLTH(tag, ind, req, resp, sdesc, ldesc) \ SLTM(Beresp##tag, (resp ? 0 : SLT_F_UNUSED), "Backend response " \ sdesc, ldesc) #include "tbl/vsl_tags_http.h" #undef SLTH #define SLTH(tag, ind, req, resp, sdesc, ldesc) \ SLTM(Obj##tag, (resp ? 0 : SLT_F_UNUSED), "Object " sdesc, ldesc) #include "tbl/vsl_tags_http.h" #undef SLTH SLTM(BogoHeader, 0, "Bogus HTTP received", "Contains the first 20 characters of received HTTP headers we could" " not make sense of. Applies to both req.http and beresp.http.\n\n" ) SLTM(LostHeader, 0, "Failed attempt to set HTTP header", "Logs the header name of a failed HTTP header operation due to" " resource exhaustion or configured limits.\n\n" ) SLTM(TTL, 0, "TTL set on object", "A TTL record is emitted whenever the ttl, grace or keep" " values for an object is set.\n\n" "The format is::\n\n" "\t%s %d %d %d %d [ %d %d %u %u ]\n" "\t| | | | | | | | |\n" "\t| | | | | | | | +- Max-Age from Cache-Control header\n" "\t| | | | | | | +---- Expires header\n" "\t| | | | | | +------- Date header\n" "\t| | | | | +---------- Age (incl Age: header value)\n" "\t| | | | +--------------- Reference time for TTL\n" "\t| | | +------------------ Keep\n" "\t| | +--------------------- Grace\n" "\t| +------------------------ TTL\n" "\t+--------------------------- \"RFC\" or \"VCL\"\n" "\n" "The last four fields are only present in \"RFC\" headers.\n\n" "Examples::\n\n" "\tRFC 60 10 -1 1312966109 1312966109 1312966109 0 60\n" "\tVCL 120 10 0 1312966111\n" "\n" ) SLTM(Fetch_Body, 0, "Body fetched from backend", "Ready to fetch body from backend.\n\n" "The format is::\n\n" "\t%d (%s) %s\n" "\t| | |\n" "\t| | +---- 'stream' or '-'\n" "\t| +--------- Text description of body fetch mode\n" "\t+------------- Body fetch mode\n" "\n" ) SLTM(VCL_acl, 0, "VCL ACL check results", "Logs VCL ACL evaluation results.\n\n" ) SLTM(VCL_call, 0, "VCL method called", "Logs the VCL method name when a VCL method is called.\n\n" ) SLTM(VCL_trace, 0, "VCL trace data", "Logs VCL execution trace data.\n\n" "The format is::\n\n" "\t%u %u.%u\n" "\t| | |\n" "\t| | +- VCL program line position\n" "\t| +---- VCL program line number\n" "\t+------- VCL trace point index\n" "\n" NODEF_NOTICE ) SLTM(VCL_return, 0, "VCL method return value", "Logs the VCL method terminating statement.\n\n" ) SLTM(ReqStart, 0, "Client request start", "Start of request processing. Logs the client IP address and port" " number.\n\n" "The format is::\n\n" "\t%s %s\n" "\t| |\n" "\t| +- Client Port number\n" "\t+---- Client IP4/6 address\n" "\n" ) SLTM(Hit, 0, "Hit object in cache", "Object looked up in cache. Shows the VXID of the object.\n\n" ) SLTM(HitPass, 0, "Hit for pass object in cache.", "Hit-for-pass object looked up in cache. Shows the VXID of the" " hit-for-pass object.\n\n" ) SLTM(ExpBan, 0, "Object evicted due to ban", "Logs the VXID when an object is banned.\n\n" ) SLTM(ExpKill, 0, "Object expiry event", "Logs events related to object expiry. The events are:\n\n" "EXP_Rearm\n" "\tLogged when the expiry time of an object changes.\n\n" "EXP_Inbox\n" "\tLogged when the expiry thread picks an object from the inbox for" " processing.\n\n" "EXP_Kill\n" "\tLogged when the expiry thread kills an object from the inbox.\n\n" "EXP_When\n" "\tLogged when the expiry thread moves an object on the binheap.\n\n" "EXP_Expired\n" "\tLogged when the expiry thread expires an object.\n\n" "LRU_Cand\n" "\tLogged when an object is evaluated for LRU force expiry.\n\n" "LRU\n" "\tLogged when an object is force expired due to LRU.\n\n" "LRU_Fail\n" "\tLogged when no suitable candidate object is found for LRU force" " expiry.\n\n" "The format is::\n\n" "\tEXP_Rearm p=%p E=%f e=%f f=0x%x\n" "\tEXP_Inbox p=%p e=%f f=0x%x\n" "\tEXP_Kill p=%p e=%f f=0x%x\n" "\tEXP_When p=%p e=%f f=0x%x\n" "\tEXP_Expired x=%u t=%f\n" "\tLRU_Cand p=%p f=0x%x r=%d\n" "\tLRU x=%u\n" "\tLRU_Fail\n" "\t\n" "\tLegend:\n" "\tp=%p Objcore pointer\n" "\tt=%f Remaining TTL (s)\n" "\te=%f Expiry time (unix epoch)\n" "\tE=%f Old expiry time (unix epoch)\n" "\tf=0x%x Objcore flags\n" "\tr=%d Objcore refcount\n" "\tx=%u Object VXID\n" "\n" ) SLTM(WorkThread, 0, "Logs thread start/stop events", "Logs worker thread creation and termination events.\n\n" "The format is::\n\n" "\t%p %s\n" "\t| |\n" "\t| +- [start|end]\n" "\t+---- Worker struct pointer\n" "\n" NODEF_NOTICE ) SLTM(ESI_xmlerror, 0, "ESI parser error or warning message", "An error or warning was generated during parsing of an ESI object." " The log record describes the problem encountered." ) SLTM(Hash, SLT_F_BINARY, "Value added to hash", "This value was added to the object lookup hash.\n\n" NODEF_NOTICE ) SLTM(Backend_health, 0, "Backend health check", "The result of a backend health probe.\n\n" "The format is::\n\n" "\t%s %s %s %u %u %u %f %f %s\n" "\t| | | | | | | | |\n" "\t| | | | | | | | +- Probe HTTP response\n" "\t| | | | | | | +---- Average response time\n" "\t| | | | | | +------- Response time\n" "\t| | | | | +---------- Probe window size\n" "\t| | | | +------------- Probe threshold level\n" "\t| | | +---------------- Number of good probes in window\n" "\t| | +------------------- Probe window bits\n" "\t| +---------------------- Status message\n" "\t+------------------------- Backend name\n" "\n" ) SLTM(VCL_Log, 0, "Log statement from VCL", "User generated log messages insert from VCL through std.log()" ) SLTM(VCL_Error, 0, "VCL execution error message", "Logs error messages generated during VCL execution.\n\n" ) SLTM(Gzip, 0, "G(un)zip performed on object", "A Gzip record is emitted for each instance of gzip or gunzip" " work performed. Worst case, an ESI transaction stored in" " gzip'ed objects but delivered gunziped, will run into many of" " these.\n\n" "The format is::\n\n" "\t%c %c %c %d %d %d %d %d\n" "\t| | | | | | | |\n" "\t| | | | | | | +- Bit length of compressed data\n" "\t| | | | | | +---- Bit location of 'last' bit\n" "\t| | | | | +------- Bit location of first deflate block\n" "\t| | | | +---------- Bytes output\n" "\t| | | +------------- Bytes input\n" "\t| | +---------------- 'E': ESI, '-': Plain object\n" "\t| +------------------- 'F': Fetch, 'D': Deliver\n" "\t+---------------------- 'G': Gzip, 'U': Gunzip, 'u': Gunzip-test\n" "\n" "Examples::\n\n" "\tU F E 182 159 80 80 1392\n" "\tG F E 159 173 80 1304 1314\n" "\n" ) 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 %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 %s\n" "\t| | |\n" "\t| | +- Reason\n" "\t| +---- Parent vxid\n" "\t+------- Type (\"sess\", \"req\" or \"bereq\")\n" "\n" ) SLTM(End, 0, "Marks the end of a VXID", "The last record of a VXID transaction.\n\n" ) SLTM(VSL, 0, "VSL API warnings and error message", "Warnings and error messages genererated by the VSL API while" " reading the shared memory log.\n\n" ) SLTM(Storage, 0, "Where object is stored", "Type and name of the storage backend the object is stored in.\n\n" "The format is::\n\n" "\t%s %s\n" "\t| |\n" "\t| +- Name of storage backend\n" "\t+---- Type (\"malloc\", \"file\", \"persistent\" etc.)\n" "\n" ) SLTM(Timestamp, 0, "Timing information", "Contains timing information for the Varnish worker threads.\n\n" "Time stamps are issued by Varnish on certain events," " and show the absolute time of the event, the time spent since the" " start of the work unit, and the time spent since the last timestamp" " was logged. See vsl(7) for information about the individual" " timestamps.\n\n" "The format is::\n\n" "\t%s: %f %f %f\n" "\t| | | |\n" "\t| | | +- Time since last timestamp\n" "\t| | +---- Time since start of work unit\n" "\t| +------- Absolute time of event\n" "\t+----------- Event label\n" "\n" ) SLTM(ReqAcct, 0, "Request handling byte counts", "Contains byte counts for the request handling.\n" "ESI sub-request counts are also added to their parent request.\n" "The body bytes count does not include transmission " "(ie: chunked encoding) overhead.\n" "The format is::\n\n" "\t%d %d %d %d %d %d\n" "\t| | | | | |\n" "\t| | | | | +- Total bytes transmitted\n" "\t| | | | +---- Body bytes transmitted\n" "\t| | | +------- Header bytes transmitted\n" "\t| | +---------- Total bytes received\n" "\t| +------------- Body bytes received\n" "\t+---------------- Header bytes received\n" "\n" ) SLTM(PipeAcct, 0, "Pipe byte counts", "Contains byte counters for pipe sessions.\n\n" "The format is::\n\n" "\t%d %d %d %d\n" "\t| | | |\n" "\t| | | +------- Piped bytes to client\n" "\t| | +---------- Piped bytes from client\n" "\t| +------------- Backend request headers\n" "\t+---------------- Client request headers\n" "\n" ) SLTM(BereqAcct, 0, "Backend request accounting", "Contains byte counters from backend request processing.\n\n" "The format is::\n\n" "\t%d %d %d %d %d %d\n" "\t| | | | | |\n" "\t| | | | | +- Total bytes received\n" "\t| | | | +---- Body bytes received\n" "\t| | | +------- Header bytes received\n" "\t| | +---------- Total bytes transmitted\n" "\t| +------------- Body bytes transmitted\n" "\t+---------------- Header bytes transmitted\n" "\n" ) SLTM(VfpAcct, 0, "Fetch filter accounting", "Contains name of VFP and statistics.\n\n" "The format is::\n\n" "\t%s %d %d\n" "\t| | |\n" "\t| | +- Total bytes produced\n" "\t| +---- Number of calls made\n" "\t+------- Name of filter\n" "\n" NODEF_NOTICE ) SLTM(Witness, 0, "Lock order witness records", "Diagnostic recording of locking order.\n" ) #undef NODEF_NOTICE /*lint -restore */ varnish-4.1.1/include/tbl/vsl_tags_http.h0000644000201500234410000000537512652366721015366 00000000000000/*- * Copyright (c) 2012 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. * * Define the VSL tags for HTTP protocol messages * * 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 * struct http header index * 1 if this header is used in requests * 1 if this header is used in responses * short description postfix * long description (in RST "definition list" format) * */ /*lint -save -e525 -e539 */ SLTH(Method, HTTP_HDR_METHOD, 1, 0, "method", "The HTTP request method used.\n\n" ) SLTH(URL, HTTP_HDR_URL, 1, 0, "URL", "The HTTP request URL.\n\n" ) SLTH(Protocol, HTTP_HDR_PROTO, 1, 1, "protocol", "The HTTP protocol version information.\n\n" ) SLTH(Status, HTTP_HDR_STATUS, 0, 1, "status", "The HTTP status code received.\n\n" ) SLTH(Reason, HTTP_HDR_REASON, 0, 1, "response", "The HTTP response string received.\n\n" ) SLTH(Header, HTTP_HDR_FIRST, 1, 1, "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(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", "" ) /*lint -restore */ varnish-4.1.1/include/tbl/debug_bits.h0000644000201500234410000000426112652366721014605 00000000000000/*- * Copyright (c) 2012 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. * * Fields in the debug parameter * */ /*lint -save -e525 -e539 */ DEBUG_BIT(REQ_STATE, req_state, "VSL Request state engine") DEBUG_BIT(WORKSPACE, workspace, "VSL Workspace operations") DEBUG_BIT(WAITER, waiter, "VSL Waiter internals") DEBUG_BIT(WAITINGLIST, waitinglist, "VSL Waitinglist events") DEBUG_BIT(SYNCVSL, syncvsl, "Make VSL synchronous") DEBUG_BIT(HASHEDGE, hashedge, "Edge cases in Hash") DEBUG_BIT(VCLREL, vclrel, "Rapid VCL release") DEBUG_BIT(LURKER, lurker, "VSL Ban lurker") DEBUG_BIT(ESI_CHOP, esi_chop, "Chop ESI fetch to bits") DEBUG_BIT(FLUSH_HEAD, flush_head, "Flush after http1 head") DEBUG_BIT(VTC_MODE, vtc_mode, "Varnishtest Mode") DEBUG_BIT(WITNESS, witness, "Emit WITNESS lock records") DEBUG_BIT(VSM_KEEP, vsm_keep, "Keep the VSM file on restart") /*lint -restore */ varnish-4.1.1/include/tbl/body_status.h0000644000201500234410000000315612652366721015040 00000000000000/*- * Copyright (c) 2011 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. * * Various ways to handle the body coming from the backend. */ /*lint -save -e525 -e539 */ BODYSTATUS(NONE, none) BODYSTATUS(ERROR, error) BODYSTATUS(CHUNKED, chunked) BODYSTATUS(LENGTH, length) BODYSTATUS(EOF, eof) /*lint -restore */ varnish-4.1.1/include/tbl/http_headers.h0000644000201500234410000001153612652366721015153 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2010 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. * * Argument list: * --------------------------------------- * a Http header name * b enum name * c Supress header in filter ops * * see [RFC2616 13.5.1 End-to-end and Hop-by-hop Headers] * */ /*lint -save -e525 -e539 */ #ifndef HTTPH_R_PASS #define HTTPH_R_PASS (1 << 0) /* Request (c->b) in pass mode */ #define HTTPH_R_FETCH (1 << 1) /* Request (c->b) for fetch */ #define HTTPH_A_INS (1 << 2) /* Response (b->o) for insert */ #endif /* Shorthand for this file only, to keep table narrow */ #if defined(P) || defined(F) || defined(I) || defined(H) #error "Macro overloading" // Trust but verify #endif #define P HTTPH_R_PASS #define F HTTPH_R_FETCH #define I HTTPH_A_INS #define H(s,e,f) HTTPH(s, e, f) H("Keep-Alive", H_Keep_Alive, P|F ) // 2068 H("Accept", H_Accept, 0 ) // 2616 14.1 H("Accept-Charset", H_Accept_Charset, 0 ) // 2616 14.2 H("Accept-Encoding", H_Accept_Encoding, 0 ) // 2616 14.3 H("Accept-Language", H_Accept_Language, 0 ) // 2616 14.4 H("Accept-Ranges", H_Accept_Ranges, F|I) // 2616 14.5 H("Age", H_Age, I) // 2616 14.6 H("Allow", H_Allow, 0 ) // 2616 14.7 H("Authorization", H_Authorization, 0 ) // 2616 14.8 H("Cache-Control", H_Cache_Control, F ) // 2616 14.9 H("Connection", H_Connection, P|F|I) // 2616 14.10 H("Content-Encoding", H_Content_Encoding, 0 ) // 2616 14.11 H("Content-Language", H_Content_Language, 0 ) // 2616 14.12 H("Content-Length", H_Content_Length, F ) // 2616 14.13 H("Content-Location", H_Content_Location, 0 ) // 2616 14.14 H("Content-MD5", H_Content_MD5, 0 ) // 2616 14.15 H("Content-Range", H_Content_Range, F|I) // 2616 14.16 H("Content-Type", H_Content_Type, 0 ) // 2616 14.17 H("Cookie", H_Cookie, 0 ) // 6265 4.2 H("Date", H_Date, 0 ) // 2616 14.18 H("ETag", H_ETag, 0 ) // 2616 14.19 H("Expect", H_Expect, 0 ) // 2616 14.20 H("Expires", H_Expires, 0 ) // 2616 14.21 H("From", H_From, 0 ) // 2616 14.22 H("Host", H_Host, 0 ) // 2616 14.23 H("HTTP2-Settings", H_HTTP2_Settings, P|F|I) // httpbis-http2-16.txt H("If-Match", H_If_Match, F ) // 2616 14.24 H("If-Modified-Since", H_If_Modified_Since, F ) // 2616 14.25 H("If-None-Match", H_If_None_Match, F ) // 2616 14.26 H("If-Range", H_If_Range, F ) // 2616 14.27 H("If-Unmodified-Since",H_If_Unmodified_Since, F ) // 2616 14.28 H("Last-Modified", H_Last_Modified, 0 ) // 2616 14.29 H("Location", H_Location, 0 ) // 2616 14.30 H("Max-Forwards", H_Max_Forwards, 0 ) // 2616 14.31 H("Pragma", H_Pragma, 0 ) // 2616 14.32 H("Proxy-Authenticate", H_Proxy_Authenticate, F|I) // 2616 14.33 H("Proxy-Authorization",H_Proxy_Authorization, F|I) // 2616 14.34 H("Range", H_Range, F|I) // 2616 14.35 H("Referer", H_Referer, 0 ) // 2616 14.36 H("Retry-After", H_Retry_After, 0 ) // 2616 14.37 H("Server", H_Server, 0 ) // 2616 14.38 H("Set-Cookie", H_Set_Cookie, 0 ) // 6265 4.1 H("TE", H_TE, P|F|I) // 2616 14.39 H("Trailer", H_Trailer, P|F|I) // 2616 14.40 H("Transfer-Encoding", H_Transfer_Encoding, P|F|I) // 2616 14.41 H("Upgrade", H_Upgrade, P|F|I) // 2616 14.42 H("User-Agent", H_User_Agent, 0 ) // 2616 14.43 H("Vary", H_Vary, 0 ) // 2616 14.44 H("Via", H_Via, 0 ) // 2616 14.45 H("Warning", H_Warning, 0 ) // 2616 14.46 H("WWW-Authenticate", H_WWW_Authenticate, 0 ) // 2616 14.47 H("X-Forwarded-For", H_X_Forwarded_For, 0 ) // No RFC #undef P #undef F #undef I #undef H /*lint -restore */ varnish-4.1.1/include/tbl/symbol_kind.h0000644000201500234410000000342112652366721015005 00000000000000/*- * Copyright (c) 2010-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 */ VCC_SYMB(NONE, none) VCC_SYMB(VAR, var) VCC_SYMB(FUNC, func) /* VMOD function */ VCC_SYMB(PROC, proc) /* VMOD procedure */ VCC_SYMB(VMOD, vmod) VCC_SYMB(ACL, acl) VCC_SYMB(SUB, sub) /* VCL subroutine */ VCC_SYMB(BACKEND, backend) VCC_SYMB(PROBE, probe) VCC_SYMB(WILDCARD, wildcard) VCC_SYMB(OBJECT, object) VCC_SYMB(METHOD, method) /*lint -restore */ varnish-4.1.1/include/tbl/acct_fields_req.h0000644000201500234410000000326312652366721015606 00000000000000/*- * Copyright (c) 2008 Verdens Gang AS * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * These are the stats we keep track of per request. * NB: Remember to mark those in vsc_fields.h to be included in struct dstat. */ /*lint -save -e525 -e539 */ ACCT(req_hdrbytes) ACCT(req_bodybytes) ACCT(resp_hdrbytes) ACCT(resp_bodybytes) /*lint -restore */ varnish-4.1.1/include/tbl/bo_flags.h0000644000201500234410000000336312652366721014254 00000000000000/*- * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ /*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(was_304, 1, 0, "") /*lint -restore */ varnish-4.1.1/include/vsa.h0000644000201500234410000000420012652366721012477 00000000000000/*- * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #ifndef VSA_H_INCLUDED #define VSA_H_INCLUDED struct suckaddr; extern const int vsa_suckaddr_len; int VSA_Sane(const struct suckaddr *); unsigned VSA_Port(const struct suckaddr *); int VSA_Compare(const struct suckaddr *, const struct suckaddr *); struct suckaddr *VSA_Clone(const struct suckaddr *sua); const struct sockaddr *VSA_Get_Sockaddr(const struct suckaddr *, socklen_t *sl); int VSA_Get_Proto(const struct suckaddr *); /* * 's' is a sockaddr of some kind, 'sal' is its length */ struct suckaddr *VSA_Malloc(const void *s, unsigned sal); /* * 'd' SHALL point to vsa_suckaddr_len aligned bytes of storage, * 's' is a sockaddr of some kind, 'sal' is its length. */ struct suckaddr *VSA_Build(void *d, const void *s, unsigned sal); #endif varnish-4.1.1/include/vav.h0000644000201500234410000000327712652366721012517 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ void VAV_Free(char **argv); char **VAV_Parse(const char *s, int *argc, int flag); char *VAV_BackSlashDecode(const char *s, const char *e); int VAV_BackSlash(const char *s, char *res); #define ARGV_COMMENT (1 << 0) #define ARGV_COMMA (1 << 1) #define ARGV_NOESC (1 << 2) varnish-4.1.1/include/flopen.h0000644000201500234410000000314112652366721013174 00000000000000/*- * Copyright (c) 2007 Dag-Erling Coïdan Smørgrav * All rights reserved. * * 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 * in this position and unchanged. * 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 THE 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. * * Derived from: * $FreeBSD: src/lib/libutil/libutil.h,v 1.44 2007/05/10 15:01:42 des Exp $ */ #ifndef FLOPEN_H_INCLUDED #define FLOPEN_H_INCLUDED int flopen(const char *, int, ...); int fltest(int fd, pid_t *pid); #endif varnish-4.1.1/include/vdef.h0000644000201500234410000000554712652366721012651 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2012 Fastly Inc * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * Author: Rogier 'DocWilco' Mulhuijzen * * Inspired by FreeBSD's * * 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. * */ #ifndef VDEF_H_INCLUDED #define VDEF_H_INCLUDED /* Safe printf into a fixed-size buffer */ #define bprintf(buf, fmt, ...) \ do { \ assert(snprintf(buf, sizeof buf, fmt, __VA_ARGS__) \ < sizeof buf); \ } while (0) /* Safe printf into a fixed-size buffer */ #define vbprintf(buf, fmt, ap) \ do { \ assert(vsnprintf(buf, sizeof buf, fmt, ap) \ < sizeof buf); \ } while (0) #ifndef __GNUC_PREREQ # if defined __GNUC__ && defined __GNUC_MINOR__ # define __GNUC_PREREQ(maj, min) \ (__GNUC__ > (maj) || (__GNUC__ == (maj) && __GNUC_MINOR__ >= (min))) # else # define __GNUC_PREREQ(maj, min) 0 # endif #endif #ifdef __printflike # define __v_printflike(f,a) __printflike(f,a) #elif __GNUC_PREREQ(2, 95) || defined(__INTEL_COMPILER) # define __v_printflike(f,a) __attribute__((format(printf, f, a))) #else # define __v_printflike(f,a) #endif /********************************************************************** * FlexeLint and compiler shutuppery */ /* * In OO-light situations, functions have to match their prototype * even if that means not const'ing a const'able argument. * The typedef should be specified as argument to the macro. */ #define __match_proto__(xxx) /*lint -e{818} */ #define NEEDLESS_RETURN(foo) return (foo) #endif /* VDEF_H_INCLUDED */ varnish-4.1.1/include/vcs.h0000644000201500234410000000302112652366721012501 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ /* from libvarnish/version.c */ extern const char *VCS_version; void VCS_Message(const char *); varnish-4.1.1/include/vcurses.h0000644000201500234410000000341412652366721013406 00000000000000/*- * Copyright (c) 2014 Varnish Software AS * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * include the right curses headers */ #if defined HAVE_NCURSESW_CURSES_H # include #elif defined HAVE_NCURSESW_H # include #elif defined HAVE_NCURSES_CURSES_H # include #elif defined HAVE_NCURSES_H # define GCC_PRINTF # define GCC_SCANF # include #elif defined HAVE_CURSES_H # include #else # error "SysV or X/Open-compatible Curses header file required" #endif varnish-4.1.1/include/vmod_abi.h0000644000201500234410000000006112652366743013473 00000000000000#define VMOD_ABI_Version "Varnish 4.1.1 66bb824" varnish-4.1.1/include/vrt.h0000644000201500234410000002142612652366721012532 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Runtime support for compiled VCL programs and VMODs. * * NB: When this file is changed, lib/libvcc/generate.py *MUST* be rerun. */ /*********************************************************************** * Major and minor VRT API versions. * * Whenever something is added, increment MINOR version * Whenever something is deleted or changed in a way which is not * binary/load-time compatible, increment MAJOR version * * changes to consider with next VRT_MAJOR_VERSION bump: * - cache_vrt.c: -> ssize_t VRT_CacheReqBody(VRT_CTX, size_t) */ #define VRT_MAJOR_VERSION 3U #define VRT_MINOR_VERSION 1U /***********************************************************************/ struct VCL_conf; struct busyobj; struct director; struct http; struct req; struct suckaddr; struct vcl; struct vmod; struct vsb; struct vsl_log; struct ws; /*********************************************************************** * This is the central definition of the mapping from VCL types to * C-types. The python scripts read these from here. * (alphabetic order) */ typedef const struct director * VCL_BACKEND; typedef const struct vmod_priv * VCL_BLOB; typedef unsigned VCL_BOOL; typedef double VCL_BYTES; typedef double VCL_DURATION; typedef const char * VCL_ENUM; typedef const struct gethdr_s * VCL_HEADER; typedef struct http * VCL_HTTP; typedef long VCL_INT; typedef const struct suckaddr * VCL_IP; typedef const struct vrt_backend_probe * VCL_PROBE; typedef double VCL_REAL; typedef const char * VCL_STRING; typedef double VCL_TIME; typedef void VCL_VOID; /*********************************************************************** * This is the composite argument we pass to compiled VCL and VRT * functions. */ struct vrt_ctx { unsigned magic; #define VRT_CTX_MAGIC 0x6bb8f0db unsigned method; unsigned *handling; struct vsb *msg; // Only in ...init() struct vsl_log *vsl; struct vcl *vcl; struct ws *ws; struct req *req; struct http *http_req; struct http *http_req_top; struct http *http_resp; struct busyobj *bo; struct http *http_bereq; struct http *http_beresp; double now; /* * method specific argument: * hash: struct SHA256Context * synth+error: struct vsb * */ void *specific; }; #define VRT_CTX const struct vrt_ctx *ctx /***********************************************************************/ struct vmod_data { /* The version/id fields must be first, they protect the rest */ unsigned vrt_major; unsigned vrt_minor; const char *file_id; const char *name; const void *func; int func_len; const char *proto; const char * const *spec; const char *abi; }; /***********************************************************************/ enum gethdr_e { HDR_REQ, HDR_REQ_TOP, HDR_RESP, HDR_OBJ, HDR_BEREQ, HDR_BERESP }; struct gethdr_s { enum gethdr_e where; const char *what; }; extern const void * const vrt_magic_string_end; extern const void * const vrt_magic_string_unset; /*********************************************************************** * We want the VCC to spit this structs out as const, but when VMODs * come up with them we want to clone them into malloc'ed space which * we can free again. * We collect all the knowledge here by macroizing the fields and make * a macro for handling them all. * See also: cache_backend.h & cache_backend_cfg.c * One of those things... */ #define VRT_BACKEND_FIELDS(rigid) \ rigid char *vcl_name; \ rigid char *ipv4_addr; \ rigid char *ipv6_addr; \ rigid char *port; \ rigid char *hosthdr; \ double connect_timeout; \ double first_byte_timeout; \ double between_bytes_timeout; \ unsigned max_connections; #define VRT_BACKEND_HANDLE() \ do { \ DA(vcl_name); \ DA(ipv4_addr); \ DA(ipv6_addr); \ DA(port); \ DA(hosthdr); \ DN(connect_timeout); \ DN(first_byte_timeout); \ DN(between_bytes_timeout); \ DN(max_connections); \ } while(0) struct vrt_backend { unsigned magic; #define VRT_BACKEND_MAGIC 0x4799ce6b VRT_BACKEND_FIELDS(const) const struct suckaddr *ipv4_suckaddr; const struct suckaddr *ipv6_suckaddr; const struct vrt_backend_probe *probe; }; #define VRT_BACKEND_PROBE_FIELDS(rigid) \ double timeout; \ double interval; \ unsigned exp_status; \ unsigned window; \ unsigned threshold; \ unsigned initial; #define VRT_BACKEND_PROBE_HANDLE() \ do { \ DN(timeout); \ DN(interval); \ DN(exp_status); \ DN(window); \ DN(threshold); \ DN(initial); \ } while (0) struct vrt_backend_probe { unsigned magic; #define VRT_BACKEND_PROBE_MAGIC 0x84998490 const char *url; const char *request; VRT_BACKEND_PROBE_FIELDS(const) }; /***********************************************************************/ /* * other stuff. * XXX: document when bored */ struct vrt_ref { unsigned source; unsigned offset; unsigned line; unsigned pos; const char *token; }; /* ACL related */ #define VRT_ACL_MAXADDR 16 /* max(IPv4, IPv6) */ void VRT_acl_log(VRT_CTX, const char *msg); /* req related */ int VRT_CacheReqBody(VRT_CTX, long long maxsize); /* Regexp related */ void VRT_re_init(void **, const char *); void VRT_re_fini(void *); int VRT_re_match(VRT_CTX, const char *, void *re); const char *VRT_regsub(VRT_CTX, int all, const char *, void *, const char *); void VRT_ban_string(VRT_CTX, const char *); void VRT_purge(VRT_CTX, double ttl, double grace, double keep); void VRT_count(VRT_CTX, unsigned); void VRT_synth(VRT_CTX, unsigned, const char *); struct http *VRT_selecthttp(VRT_CTX, enum gethdr_e); const char *VRT_GetHdr(VRT_CTX, const struct gethdr_s *); void VRT_SetHdr(VRT_CTX, const struct gethdr_s *, const char *, ...); void VRT_handling(VRT_CTX, unsigned hand); void VRT_hashdata(VRT_CTX, const char *str, ...); /* Simple stuff */ int VRT_strcmp(const char *s1, const char *s2); void VRT_memmove(void *dst, const void *src, unsigned len); void VRT_Rollback(VRT_CTX, const struct http *); /* Synthetic pages */ void VRT_synth_page(VRT_CTX, const char *, ...); /* Backend related */ struct director *VRT_new_backend(VRT_CTX, const struct vrt_backend *); void VRT_delete_backend(VRT_CTX, struct director **); /* Suckaddr related */ int VRT_VSA_GetPtr(const struct suckaddr *sua, const unsigned char ** dst); /* VMOD/Modules related */ int VRT_Vmod_Init(struct vmod **hdl, void *ptr, int len, const char *nm, const char *path, const char *file_id, VRT_CTX); void VRT_Vmod_Fini(struct vmod **hdl); struct vmod_priv; typedef void vmod_priv_free_f(void *); struct vmod_priv { void *priv; int len; vmod_priv_free_f *free; }; #ifdef VCL_RET_MAX typedef int vmod_event_f(VRT_CTX, struct vmod_priv *, enum vcl_event_e); #endif struct vclref; struct vclref * VRT_ref_vcl(VRT_CTX, const char *); void VRT_rel_vcl(VRT_CTX, struct vclref **); void VRT_priv_fini(const struct vmod_priv *p); struct vmod_priv *VRT_priv_task(VRT_CTX, void *vmod_id); struct vmod_priv *VRT_priv_top(VRT_CTX, void *vmod_id); /* Stevedore related functions */ int VRT_Stv(const char *nm); /* Convert things to string */ char *VRT_IP_string(VRT_CTX, VCL_IP); char *VRT_INT_string(VRT_CTX, VCL_INT); char *VRT_REAL_string(VRT_CTX, VCL_REAL); char *VRT_TIME_string(VRT_CTX, VCL_TIME); const char *VRT_BOOL_string(VCL_BOOL); const char *VRT_BACKEND_string(VCL_BACKEND); const char *VRT_CollectString(VRT_CTX, const char *p, ...); varnish-4.1.1/include/vapi/0000755000201500234410000000000012652366756012570 500000000000000varnish-4.1.1/include/vapi/vsc_int.h0000644000201500234410000000372512652366721014325 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #define VSC_CLASS "Stat" /* vsc levels */ enum VSC_level_e { #define VSC_LEVEL_F(v,l,e,d) \ VSC_level_##v, #include "tbl/vsc_levels.h" #undef VSC_LEVEL_F VSC_level_MAX, }; /* Forward declare the static vsc type names */ #define VSC_TYPE_F(n,t,l,e,d) extern const char *VSC_type_##n; #include "tbl/vsc_types.h" #undef VSC_TYPE_F /* Define the vsc type structs */ #define VSC_DO(u,l,t) struct VSC_C_##l { #define VSC_F(n,t,l,s,f,v,d,e) t n; #define VSC_DONE(u,l,t) }; #include "tbl/vsc_all.h" #undef VSC_DO #undef VSC_F #undef VSC_DONE varnish-4.1.1/include/vapi/vsc.h0000644000201500234410000001427512652366721013455 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This is the public API for the VSC access. * * VSC is a "subclass" of VSM. * */ #ifndef VAPI_VSC_H_INCLUDED #define VAPI_VSC_H_INCLUDED #include "vapi/vsc_int.h" struct VSM_data; struct VSM_fantom; /*--------------------------------------------------------------------- * VSC level access functions */ #define VSC_ARGS "f:n:N:" #define VSC_n_USAGE VSM_n_USAGE " " VSM_N_USAGE #define VSC_f_USAGE "[-f field_name,...]" #define VSC_USAGE VSC_n_USAGE \ VSC_f_USAGE int VSC_Arg(struct VSM_data *vd, int arg, const char *opt); /* * Handle standard stat-presenter arguments * Return: * -1 error, VSM_Error() returns diagnostic string * 0 not handled * 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); /* * Looks up and returns the management stats and the child main * stats structure. If fantom is non-NULL, it can later be used * with VSM_StillValid. Returns NULL until the management process * has finished initialization or the child has been started. * * The returned structure is valid for at most 60 seconds after * VSM_StillValid(,fantom) starts returning VSM_invalid. Using the * pointer after this event gives undefined behavior. * * Arguments: * vd: The VSM_data context * fantom: Pointer to a fantom. Can be NULL. * * Return values: * NULL: Failure * non-NULL: Success */ 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 * VSM_StillValid. * * Arguments: * vd: The VSM_data context * fantom: Pointer to a fantom. Can be NULL. * type: The type of the counter segment * ident: The identifier of the counter segment * * Return values: * NULL: Failure * non-NULL: A void pointer to the stats structure. */ struct VSC_level_desc; struct VSC_type_desc; struct VSC_section; struct VSC_desc; struct VSC_point; struct VSC_level_desc { unsigned verbosity; const char *label; /* label */ const char *sdesc; /* short description */ const char *ldesc; /* long description */ }; struct VSC_type_desc { const char *label; /* label */ const char *sdesc; /* short description */ const char *ldesc; /* long description */ }; struct VSC_section { const char *type; const char *ident; const struct VSC_type_desc *desc; struct VSM_fantom *fantom; }; /* See include/tbl/vsc_fields.h for descriptions */ struct VSC_desc { const char *name; /* field name */ const char *ctype; /* C-type */ int semantics; /* semantics */ int format; /* display format */ const struct VSC_level_desc *level; /* verbosity level */ const char *sdesc; /* short description */ const char *ldesc; /* long description */ }; struct VSC_point { const struct VSC_desc *desc; /* point description */ const volatile void *ptr; /* field value */ const struct VSC_section *section; }; typedef int VSC_iter_f(void *priv, const struct VSC_point *const pt); int VSC_Iter(struct VSM_data *vd, struct VSM_fantom *fantom, VSC_iter_f *func, void *priv); /* * Iterate over all statistics counters, calling "func" for * each counter not suppressed by any "-f" arguments. * * fantom points to a struct VSM_fantom. If non-NULL, it can be * used with VSM_StillValid to check the validity of the points * returned. * * The returned points are valid for at most 60 seconds after * VSM_StillValid(,fantom) starts returning anything but * VSM_valid, or until the next call to VSC_Iter. Using the point * values after any of these events gives undefined behavior. * * Func is called with pt == NULL, whenever VSM allocations * change (child restart, allocations/deallocations) * * Arguments: * vd: The VSM_data context * fantom: Pointer to a fantom. Can be NULL. * func: The callback function * priv: Passed as argument to func * * Returns: * !=0: func returned non-zero * -1: No VSC's available * 0: Done */ const struct VSC_level_desc *VSC_LevelDesc(unsigned level); /********************************************************************** * Precompiled VSC_type_desc's and VSC_desc's for all know VSCs. */ #define VSC_LEVEL_F(v,l,e,d) \ extern const struct VSC_level_desc VSC_level_desc_##v; #include "tbl/vsc_levels.h" #undef VSC_LEVEL_F #define VSC_TYPE_F(n,t,l,e,d) \ extern const struct VSC_type_desc VSC_type_desc_##n; #include "tbl/vsc_types.h" #undef VSC_TYPE_F #define VSC_DO(U,l,t) extern const struct VSC_desc VSC_desc_##l[]; #define VSC_F(n,t,l,s,f,v,d,e) #define VSC_DONE(U,l,t) #include "tbl/vsc_all.h" #undef VSC_DO #undef VSC_F #undef VSC_DONE #endif /* VAPI_VSC_H_INCLUDED */ varnish-4.1.1/include/vapi/voptget.h0000644000201500234410000000461512652366721014347 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-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. */ /* * Legend: VOPT(o,s,r,d,l) where * o: Option string part * s: Synopsis * d: Description * l: Long description */ extern const char vopt_optstring[]; extern const char vopt_synopsis[]; extern const char *vopt_usage[]; struct vopt_list { const char *option; const char *synopsis; const char *desc; const char *ldesc; }; extern const struct vopt_list vopt_list[]; extern unsigned vopt_list_n; #ifdef VOPT_DEFINITION #ifndef VOPT_INC #error "VOPT_INC undefined" #endif #define VOPT(o,s,d,l) o const char vopt_optstring[] = #include VOPT_INC ; #undef VOPT #define VOPT(o,s,d,l) " " s const char vopt_synopsis[] = #include VOPT_INC ; #undef VOPT #define VOPT(o,s,d,l) s, d, const char *vopt_usage[] = { #include VOPT_INC NULL, NULL, }; #undef VOPT #define VOPT(o,s,d,l) { o,s,d,l }, const struct vopt_list vopt_list[] = { #include VOPT_INC }; #undef VOPT unsigned vopt_list_n = sizeof vopt_list / sizeof vopt_list[0]; #endif /* VOPT_DEFINITION */ varnish-4.1.1/include/vapi/vsm_int.h0000644000201500234410000000346612652366721014341 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Define the internal details which must be kept in sync between * vsm_priv.h and vapi/vsm.h, and this file SHALL not be included * from anywhere but those two files. * * NB: THIS IS NOT A PUBLIC API TO VARNISH! * */ #ifndef VSM_INT_H_INCLUDED #define VSM_INT_H_INCLUDED #define VSM_FILENAME "_.vsm" #define VSM_MARKER_LEN 8 #define VSM_IDENT_LEN 128 #endif /* VSM_INT_H_INCLUDED */ varnish-4.1.1/include/vapi/vapi_options.h0000644000201500234410000001026212652366721015364 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-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. */ /* VSL options */ #define VSL_iI_PS \ "If a tag include option is the first of any tag selection" \ " options, all tags are first marked excluded." #define VSL_OPT_b \ VOPT("b", "[-b]", "Only display backend records", \ "Only display transactions and log records coming from" \ " backend communication." \ ) #define VSL_OPT_c \ VOPT("c", "[-c]", "Only display client records", \ "Only display transactions and log records coming from" \ " client communication." \ ) #define VSL_OPT_C \ VOPT("C", "[-C]", "Caseless regular expressions", \ "Do all regular expression and string matching caseless." \ ) #define VSL_OPT_i \ VOPT("i:", "[-i taglist]", "Include tags", \ "Include log records of these tags in output. Taglist is" \ " a comma-separated list of tag globs. Multiple -i" \ " options may be given.\n" \ "\n" \ VSL_iI_PS \ ) #define VSL_OPT_I \ VOPT("I:", "[-I <[taglist:]regex>]", "Include by regex", \ "Include by regex matching. Output only records matching" \ " taglist and regular expression. Applies to any tag if" \ " taglist is absent.\n" \ "\n" \ VSL_iI_PS \ ) #define VSL_OPT_L \ VOPT("L:", "[-L limit]", "Incomplete transaction limit", \ "Sets the upper limit of incomplete transactions kept" \ " before the oldest transaction is force completed. A" \ " warning record is synthesized when this happens. This" \ " setting keeps an upper bound on the memory usage of" \ " running queries. Defaults to 1000 transactions." \ ) #define VSL_OPT_T \ VOPT("T:", "[-T seconds]", "Transaction end timeout", \ "Sets the transaction timeout in seconds. This defines the" \ " maximum number of seconds elapsed between a Begin tag" \ " and the End tag. If the timeout expires, a warning" \ " record is synthesized and the transaction is force" \ " completed. Defaults to 120 seconds." \ ) #define VSL_OPT_v \ VOPT("v", "[-v]", "Verbose record printing", \ "Use verbose output on record set printing, giving the" \ " VXID on every log line. Without this option, the VXID" \ " will only be given on the header of that transaction." \ ) #define VSL_OPT_x \ VOPT("x:", "[-x taglist]", "Exclude tags", \ "Exclude log records of these tags in output. Taglist is" \ " a comma-separated list of tag globs. Multiple -x" \ " options may be given.\n" \ ) #define VSL_OPT_X \ VOPT("X:", "[-X <[taglist:]regex>]", "Exclude by regex", \ "Exclude by regex matching. Do not output records matching" \ " taglist and regular expression. Applies to any tag if" \ " taglist is absent." \ ) varnish-4.1.1/include/vapi/vsl_int.h0000644000201500234410000000723612652366721014337 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * 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. * * Define the layout of the shared memory log segment. * * This file SHALL only be included from: * bin/varnishd/cache/cache.h * include/vsl_priv.h * include/vapi/vsl.h * */ #ifndef VAPI_VSL_INT_H_INCLUDED #define VAPI_VSL_INT_H_INCLUDED #define VSL_CLASS "Log" #define VSL_SEGMENTS 8U /* * Shared memory log format * * The log member points to an array of 32bit unsigned integers containing * log records. * * Each logrecord consist of: * [n] = ((type & 0xff) << 24) | (length & 0xffff) * [n + 1] = ((marker & 0x03) << 30) | (identifier & 0x3fffffff) * [n + 2] ... [m] = content (NUL-terminated) * * Logrecords are NUL-terminated so that string functions can be run * directly on the shmlog data. * * Notice that the constants in these macros cannot be changed without * changing corresponding magic numbers in varnishd/cache/cache_shmlog.c */ #define VSL_CLIENTMARKER (1U<<30) #define VSL_BACKENDMARKER (1U<<31) #define VSL_IDENTMASK (~(3U<<30)) #define VSL_LENMASK 0xffff #define VSL_WORDS(len) (((len) + 3) / 4) #define VSL_BYTES(words) ((words) * 4) #define VSL_END(ptr, len) ((ptr) + 2 + VSL_WORDS(len)) #define VSL_NEXT(ptr) VSL_END(ptr, VSL_LEN(ptr)) #define VSL_LEN(ptr) ((ptr)[0] & VSL_LENMASK) #define VSL_TAG(ptr) ((ptr)[0] >> 24) #define VSL_ID(ptr) (((ptr)[1]) & VSL_IDENTMASK) #define VSL_CLIENT(ptr) (((ptr)[1]) & VSL_CLIENTMARKER) #define VSL_BACKEND(ptr) (((ptr)[1]) & VSL_BACKENDMARKER) #define VSL_DATA(ptr) ((char*)((ptr)+2)) #define VSL_CDATA(ptr) ((const char*)((ptr)+2)) #define VSL_BATCHLEN(ptr) ((ptr)[1]) #define VSL_BATCHID(ptr) (VSL_ID((ptr) + 2)) #define VSL_ENDMARKER (((uint32_t)SLT__Reserved << 24) | 0x454545) /* "EEE" */ #define VSL_WRAPMARKER (((uint32_t)SLT__Reserved << 24) | 0x575757) /* "WWW" */ /* * The identifiers in shmlogtag are "SLT_" + XML tag. A script may be run * on this file to extract the table rather than handcode it */ #define SLT__MAX 256 enum VSL_tag_e { SLT__Bogus = 0, #define SLTM(foo,flags,sdesc,ldesc) SLT_##foo, #include "tbl/vsl_tags.h" #undef SLTM SLT__Reserved = 254, SLT__Batch = 255 }; /* VSL tag flags */ #define SLT_F_UNUSED (1 << 0) #define SLT_F_BINARY (1 << 1) #endif /* VAPI_VSL_INT_H_INCLUDED */ varnish-4.1.1/include/vapi/vsl.h0000644000201500234410000003351212652366721013461 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * 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. * * This is the public API for the VSL access. * */ #ifndef VAPI_VSL_H_INCLUDED #define VAPI_VSL_H_INCLUDED #include #include "vapi/vsl_int.h" struct VSM_data; /* * enum VSL_tag_e enumerates the SHM log tags, where the identifiers are * "SLT_" + XML tag, as defined in tbl/vsl_tags.h. Use the macro SLT__MAX * for the highest possible value of the enum. * (VSL_tag_e and SLT__MAX included from vsl_int.h) */ struct VSL_data; struct VSLQ; struct VSLC_ptr { const uint32_t *ptr; /* Record pointer */ unsigned priv; }; /* * Use these macros to access fields of a VSLC_ptr record * (included from vsl_int.h): * * VSL_TAG(ptr) * SLT tag (enum VSL_tag_e) * * VSL_ID(ptr) * VXID * * VSL_CDATA(ptr) * Payload (as const char *) * * VSL_LEN(ptr) * Length of the payload in bytes * * VSL_CLIENT(ptr) * Non-zero if this is a client transaction * * VSL_BACKEND(ptr) * Non-zero if this is a backend transaction */ struct VSL_cursor { /* The record this cursor points to */ struct VSLC_ptr rec; /* Private data */ const void *priv_tbl; void *priv_data; }; enum VSL_transaction_e { VSL_t_unknown, VSL_t_sess, VSL_t_req, VSL_t_bereq, VSL_t_raw, 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_pipe, 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; }; enum VSL_grouping_e { VSL_g_raw, VSL_g_vxid, VSL_g_request, VSL_g_session, VSL_g__MAX, }; typedef int VSLQ_dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const trans[], void *priv); /* * The callback function type for use with VSLQ_Dispatch. * * Arguments: * vsl: The VSL_data context * trans[]: A NULL terminated array of pointers to VSL_transaction. * priv: The priv argument from VSL_Dispatch * * Return value: * 0: OK - continue * !=0: Makes VSLQ_Dispatch return with this return value immediatly */ typedef void VSL_tagfind_f(int tag, void *priv); /* * The callback function type for use with VSL_Glob2Tags and * VSL_List2Tags.. * * Arguments: * tag: Tag number (= enum VSL_tag_e) * priv: The priv argument */ extern const char * const VSL_tags[SLT__MAX]; /* * Tag to string array. Contains NULL for invalid tags. */ extern const unsigned VSL_tagflags[SLT__MAX]; /* * Tag flags array. * Use these macros with VSL_tagflags (included from vsl_int.h): * * VSL_tagflags[tag] & SLT_F_BINARY * Non-zero if the payload with this tag may include * non-printable characters * * VSL_tagflags[tag] & SLT_F_UNUSED * Non-zero if this tag is reserved for future use */ int VSL_Name2Tag(const char *name, int l); /* * Convert string to tag number (= enum VSL_tag_e). Name can be a * substring from the beginning of a tag when that substring is * unique. Matching is case insensitive. * * Arguments: * name: A tag name (or substring) to match against * l: The length of name, or -1 to use strlen. * * Return values: * >=0: Tag number * -1: No tag matches * -2: Multiple tags match substring */ int VSL_Glob2Tags(const char *glob, int l, VSL_tagfind_f *func, void *priv); /* * Convert a string to multiple tag matches. The string can have * either a prefix or postfix wildcard (*) character. For each * matching tag func is called. Matching is done case insensitive. * * Arguments: * glob: The string to match * l: The length of glob. -1 to use strlen. * func: The function to call (can be NULL) * priv: An argument that will be passed to func. * * Return values: * >0: Number of times func was called for matching tags. * -1: No tag matches * -2: Multiple tags match non-glob input * -3: Syntax error */ int VSL_List2Tags(const char *list, int l, VSL_tagfind_f *func, void *priv); /* * Convert a comma-separated list of tag globs to tag * matches. Calls VSL_Glob2Tags for each comma-separated part of * list. * * Arguments: * list: The list of globs * l: The length of list. -1 to use strlen * func: The function to call (can be NULL) * priv: An argument that will be passed to func. * * Return values: * >0: Number of times func was called for matching tags. * -1: No tag matches for list element * -2: Multiple tags match non-glob list element * -3: Syntax error */ extern const char *VSLQ_grouping[VSL_g__MAX]; /* * Grouping mode to string array. */ int VSLQ_Name2Grouping(const char *name, int l); /* * Convert string to grouping (= enum VSL_grouping_e) * * Return values: * >=0: Grouping value * -1: No grouping type matches * -2: Multiple grouping types match substring */ struct VSL_data *VSL_New(void); int VSL_Arg(struct VSL_data *vsl, int opt, const char *arg); /* * Handle standard log-presenter arguments * Return: * -1 error, VSL_Error() returns diagnostic string * 0 not handled * 1 Handled. */ void VSL_Delete(struct VSL_data *vsl); /* * Delete a VSL context, freeing up the resources */ const char *VSL_Error(const struct VSL_data *vsl); /* * Return the latest error message. */ void VSL_ResetError(struct VSL_data *vsl); /* * Reset any error message. */ #define VSL_COPT_TAIL (1 << 0) #define VSL_COPT_BATCH (1 << 1) #define VSL_COPT_TAILSTOP (1 << 2) struct VSL_cursor *VSL_CursorVSM(struct VSL_data *vsl, struct VSM_data *vsm, unsigned options); /* * Set the cursor pointed to by cursor up as a raw cursor in the * log. Cursor points at the current log head. * * Options: * VSL_COPT_TAIL Start cursor at log tail * VSL_COPT_BATCH Return batch records * VSL_COPT_TAILSTOP Return EOF when reaching the log tail * * Return values: * non-NULL: Pointer to cursor * NULL: Error, see VSL_Error */ struct VSL_cursor *VSL_CursorFile(struct VSL_data *vsl, const char *name, unsigned options); /* * Create a cursor pointing to the beginning of the binary VSL log * in file name. If name is '-' reads from stdin. * * Options: * NONE * * Return values: * non-NULL: Pointer to cursor * NULL: Error, see VSL_Error */ void VSL_DeleteCursor(const struct VSL_cursor *c); /* * Delete the cursor pointed to by c */ int VSL_ResetCursor(const struct VSL_cursor *c); /* * Reset the cursor position to the head, so that the next call to * VSL_Next returns the first record. For VSM cursor, it will * point close to the head of the log, but at least 2 segments away * from the tail. * * Return values: * -1: Operation not supported */ int VSL_Check(const struct VSL_cursor *c, const struct VSLC_ptr *ptr); /* * Check if the VSLC_ptr structure points to a value that is still * valid: * * Return values: * -1: Operation not supported * 0: Not valid * 1: Valid - warning level * 2: Valid */ int VSL_Next(const struct VSL_cursor *c); /* * Return raw pointer to next VSL record. * * Return values: * 1: Cursor points to next log record * 0: End of log * -1: End of file * -2: Remote abandoned or closed * -3: Overrun * -4: I/O read error - see errno */ int VSL_Match(struct VSL_data *vsl, const struct VSL_cursor *c); /* * Returns true if the record pointed to by cursor matches the * record current record selectors * * Return value: * 1: Match * 0: No match */ int VSL_Print(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo); /* * Print the log record pointed to by cursor to stream. * * Format: (t=type) * 1234567890 12345678901234 1 ... * vxid tag t content * * Arguments: * vsl: The VSL_data context * c: A VSL_cursor * fo: A FILE* pointer * * Return values: * 0: OK * -5: I/O write error - see errno */ int VSL_PrintTerse(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo); /* * Print the log record pointed to by cursor to stream. * * Format: * 12345678901234 ... * tag content * * Arguments: * vsl: The VSL_data context * c: A VSL_cursor * fo: A FILE* pointer * * Return values: * 0: OK * -5: I/O write error - see errno */ int VSL_PrintAll(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo); /* * Calls VSL_Next on c until c is exhausted. In turn calls * VSL_Print on all records where VSL_Match returns true. * * Arguments: * vsl: The VSL_data context * c: A VSL_cursor * fo: A FILE* pointer, stdout if NULL * * Return values: * 0: OK * !=0: Return value from either VSL_Next or VSL_Print */ VSLQ_dispatch_f VSL_PrintTransactions; /* * Prints out each transaction in the array ptrans. For * transactions of level > 0 it will print a header before the log * records. The records will for level == 0 (single records) or if * v_opt is set, be printed by VSL_Print. Else VSL_PrintTerse is * used. * * Arguments: * vsl: The VSL_data context * cp: A NULL-terminated array of VSL_cursor pointers * fo: A FILE* pointer, stdout if NULL * * Return values: * 0: OK * !=0: Return value from either VSL_Next or VSL_Print */ FILE *VSL_WriteOpen(struct VSL_data *vsl, const char *name, int append, int unbuffered); /* * Open file name for writing using the VSL_Write* functions. If * append is true, the file will be opened for appending. * * Arguments: * vsl: The VSL data context * name: The file name * append: If true, the file will be appended instead of truncated * unbuf: If true, use unbuffered mode * * Return values: * NULL: Error - see VSL_Error * non-NULL: Success */ int VSL_Write(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo); /* * Write the currect record pointed to be c to the FILE* fo * * Return values: * 0: Success * -5: I/O error - see VSL_Error */ int VSL_WriteAll(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo); /* * Calls VSL_Next on c until c is exhausted. In turn calls * VSL_Write on all records where VSL_Match returns true. * * Return values: * 0: OK * !=0: Return value from either VSL_Next or VSL_Write */ VSLQ_dispatch_f VSL_WriteTransactions; /* * Write all transactions in ptrans using VSL_WriteAll * Return values: * 0: OK * !=0: Return value from either VSL_Next or VSL_Write */ struct VSLQ *VSLQ_New(struct VSL_data *vsl, struct VSL_cursor **cp, enum VSL_grouping_e grouping, const char *query); /* * Create a new query context. * * If cp is not NULL, the cursor pointed to by cp will be * transferred to the query, and *cp set to NULL. * * Arguments: * vsl: The VSL_data context * cp: Pointer to the cursor to use or NULL * grouping: VXID grouping to report on * query: Query match expression * * Return values: * non-NULL: OK * NULL: Error - see VSL_Error */ void VSLQ_Delete(struct VSLQ **pvslq); /* * Delete the query pointed to by pvslq, freeing up the resources. * * Any cursor owned by the query will be deleted. */ void VSLQ_SetCursor(struct VSLQ *vslq, struct VSL_cursor **cp); /* * Set the cursor to use. * * Any previous cursor owned by the query will be deleted. Will * call VSLQ_Flush. * * Arguments: * vslq: The VSLQ query * cp: Pointer to the cursor to use or NULL */ int VSLQ_Dispatch(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv); /* * Process log and call func for each set matching the specified * query * * Arguments: * vslq: The VSLQ query * func: The callback function to call. Can be NULL to ignore records. * priv: An argument passed to func * * Return values: * 1: Call again * 0: No more log records available * !=0: The error code from VSL_Next() or func returned non-zero */ int VSLQ_Flush(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv); /* * Flush any pending record sets from the query until func * (if given) returns non-zero. * * Arguments: * vslq: The VSL context * func: The callback function to call. Pass NULL to discard the * pending messages or call repeatedly until 0 is returned. * priv: An argument passed to func * * Return values: * 0: OK * !=0: The return value from func */ #endif /* VAPI_VSL_H_INCLUDED */ varnish-4.1.1/include/vapi/vsm.h0000644000201500234410000001460512652366721013464 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * 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. * * This is the public API for the VSM access. * * The VSM "class" acts as parent class for the VSL and VSC subclasses. * */ #ifndef VAPI_VSM_H_INCLUDED #define VAPI_VSM_H_INCLUDED #include "vsm_int.h" struct VSM_chunk; struct VSM_data; /* * This structure is used to reference a VSM chunk */ struct VSM_fantom { struct VSM_chunk *chunk; void *b; /* first byte of payload */ void *e; /* first byte past payload */ uintptr_t priv; /* VSM private */ char class[VSM_MARKER_LEN]; char type[VSM_MARKER_LEN]; char ident[VSM_IDENT_LEN]; }; #define VSM_FANTOM_NULL { 0, 0, 0, 0, {0}, {0}, {0} } /*--------------------------------------------------------------------- * VSM level access functions */ struct VSM_data *VSM_New(void); /* * Allocate and initialize a VSL_data handle structure. * This is the first thing you will have to do, always. * You can have multiple active VSM_data handles at the same time * referencing the same or different shared memory files. * Returns: * Pointer to usable VSL_data handle. * NULL: malloc failed. */ void VSM_Delete(struct VSM_data *vd); /* * Close and deallocate all storage and mappings. * (including any VSC and VSL "sub-classes") */ const char *VSM_Error(const struct VSM_data *vd); /* * Return the latest error message. */ void VSM_ResetError(struct VSM_data *vd); /* * Reset any error message. */ #define VSM_n_USAGE "[-n varnish_name]" int VSM_n_Arg(struct VSM_data *vd, const char *n_arg); /* * Configure which varnishd instance to access. * Uses hostname if n_arg is NULL or "". * * Returns: * 1 on success * <0 on failure, VSM_Error() returns diagnostic string */ #define VSM_N_USAGE "[-N filename]" int VSM_N_Arg(struct VSM_data *vd, const char *N_arg); /* * Configure the library to use the specified VSM file name. This * bypasses abandonment checks and allows looking at stale VSM * files without a running Varnish instance. * * Returns: * 1 on success */ const char *VSM_Name(const struct VSM_data *vd); /* * Return the instance name. */ int VSM_Open(struct VSM_data *vd); /* * Attempt to open and map the VSM file. * * Returns: * 0 on success, or the VSM log was already open * <0 on failure, VSM_Error() returns diagnostic string */ int VSM_IsOpen(const struct VSM_data *vd); /* * Check if the VSM is open. * * Returns: * 1: Is open * 0: Is closed */ int VSM_Abandoned(struct VSM_data *vd); /* * Find out if the VSM file has been abandoned or closed and should * be reopened. This function calls stat(2) and should only be * used when lack of activity or invalidation of fantoms indicate * abandonment. * * Returns: * 0 No reopen needed. * 1 VSM abandoned. */ void VSM_Close(struct VSM_data *vd); /* * Close and unmap shared memory, if open. Any reference to * previously returned memory areas will cause segmentation * fault. This includes any VSC counter areas or any VSL SHM * record references. */ void VSM__iter0(const struct VSM_data *vd, struct VSM_fantom *vf); int VSM__itern(const struct VSM_data *vd, struct VSM_fantom *vf); #define VSM_FOREACH(vf, vd) \ for(VSM__iter0((vd), (vf)); VSM__itern((vd), (vf));) /* * Iterate over all chunks in shared memory * vf = "struct VSM_fantom *" * vd = "struct VSM_data *" */ enum VSM_valid_e { VSM_invalid, VSM_valid, VSM_similar, }; enum VSM_valid_e VSM_StillValid(const struct VSM_data *vd, struct VSM_fantom *vf); /* * Check the validity of a previously looked up VSM_fantom. * * VSM_invalid means that the SHM chunk this fantom points to does * not exist in the log file any longer. Using the fantom's * pointer gives undefined results. Further checking with * VSM_Abandoned() may be a good idea. * * VSM_valid means that the SHM structure has not changed since * the fantom was looked up or since the last call to * VSM_StillValid(). * * VSM_similar means that the SHM structure has changed, but there * is still a valid chunk present with the same the same type and * identifier. The fantom's pointers and dimensions haven't * changed. The next call to VSM_StillValid() on this fantom will * return VSM_valid. * * Applications using the fantom to monitor a single chunk can * treat VSM_similar as equal to VSM_valid. Applications using a * fantom to monitor the SHM file for new or removed chunks, * should reiterate over the chunks on VSM_similar as the * structure has changed. * * Return: * VSM_invalid: fantom is not valid any more. * VSM_valid: fantom is still the same. * VSM_similar: a fantom with same dimensions exist in same position. */ int VSM_Get(const struct VSM_data *vd, struct VSM_fantom *vf, const char *class, const char *type, const char *ident); /* * Find a chunk, produce fantom for it. * Returns zero on failure. * class is mandatory, type and ident optional. */ #endif /* VAPI_VSM_H_INCLUDED */ varnish-4.1.1/include/vtim.h0000644000201500234410000000331412652366721012672 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ /* from libvarnish/vtim.c */ #define VTIM_FORMAT_SIZE 30 void VTIM_format(double t, char *p); double VTIM_parse(const char *p); double VTIM_mono(void); double VTIM_real(void); void VTIM_sleep(double t); struct timespec VTIM_timespec(double t); struct timeval VTIM_timeval(double t); varnish-4.1.1/include/vct.h0000644000201500234410000000517612652366721012517 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 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. * */ /* from libvarnish/vct.c */ #define VCT_SP (1<<0) #define VCT_CRLF (1<<1) #define VCT_LWS (VCT_CRLF | VCT_SP) #define VCT_CTL (1<<2) #define VCT_ALPHA (1<<3) #define VCT_SEPARATOR (1<<4) #define VCT_DIGIT (1<<5) #define VCT_HEX (1<<6) #define VCT_XMLNAMESTART (1<<7) #define VCT_XMLNAME (1<<8) #define VCT_TCHAR (1<<9) extern const uint16_t vct_typtab[256]; static inline int vct_is(int x, uint16_t y) { x &= 0xff; return (vct_typtab[x] & (y)); } #define vct_issp(x) vct_is(x, VCT_SP) #define vct_ishex(x) vct_is(x, VCT_HEX) #define vct_islws(x) vct_is(x, VCT_LWS) #define vct_isctl(x) vct_is(x, VCT_CTL) #define vct_isdigit(x) vct_is(x, VCT_DIGIT) #define vct_isalpha(x) vct_is(x, VCT_ALPHA) #define vct_issep(x) vct_is(x, VCT_SEPARATOR) #define vct_issepctl(x) vct_is(x, VCT_SEPARATOR | VCT_CTL) #define vct_isxmlnamestart(x) vct_is(x, VCT_XMLNAMESTART) #define vct_isxmlname(x) vct_is(x, VCT_XMLNAMESTART | VCT_XMLNAME) #define vct_istchar(x) vct_is(x, VCT_ALPHA | VCT_DIGIT | VCT_TCHAR) #define vct_iscrlf(p) (((p)[0] == '\r' && (p)[1] == '\n') || (p)[0] == '\n') /* NB: VCT always operate in ASCII, don't replace 0x0d with \r etc. */ #define vct_skipcrlf(p) ((p)[0] == 0x0d && (p)[1] == 0x0a ? 2 : 1) varnish-4.1.1/include/vcs_version.h0000644000201500234410000000026112652366743014255 00000000000000/* 66bb824 */ /* * NB: This file is machine generated, DO NOT EDIT! * * Run make to regenerate * */ /* 66bb824 */ #define VCS_Version "66bb824" #define VCS_Branch "HEAD" varnish-4.1.1/include/Makefile.in0000644000201500234410000004515112652366726013621 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = include DIST_COMMON = $(nobase_noinst_HEADERS) $(nobase_pkginclude_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(nobase_noinst_HEADERS) $(nobase_pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ # API headers # Headers for use with vmods nobase_pkginclude_HEADERS = tbl/acct_fields_req.h \ tbl/acct_fields_bereq.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 tbl/http_headers.h tbl/http_response.h \ tbl/locks.h tbl/obj_attr.h tbl/params.h tbl/req_body.h \ tbl/req_flags.h tbl/sess_attr.h tbl/sess_close.h tbl/steps.h \ tbl/symbol_kind.h tbl/vcc_types.h tbl/vcl_returns.h \ tbl/vrt_stv_var.h tbl/vsc_types.h tbl/vsc_all.h \ tbl/vsc_fields.h tbl/vsc_levels.h tbl/vsc_f_main.h \ tbl/vsl_tags.h tbl/vsl_tags_http.h vapi/vsm.h vapi/vsm_int.h \ vapi/vsc.h vapi/vsc_int.h vapi/vsl.h vapi/vsl_int.h \ vapi/voptget.h vapi/vapi_options.h vcli.h miniobj.h vas.h \ vav.h vbm.h vcl.h vcs.h vmod_abi.h vqueue.h vre.h vdef.h vrt.h \ vrt_obj.h vsa.h vsb.h vsha256.h vtcp.h vtim.h # Private headers nobase_noinst_HEADERS = \ binary_heap.h \ compat/daemon.h \ compat/execinfo.h \ flopen.h \ libvcc.h \ vcli_common.h \ vcli_priv.h \ vcli_serve.h \ vcs_version.h \ vct.h \ vcurses.h \ vend.h \ vev.h \ vfil.h \ vin.h \ vlu.h \ vmb.h \ vnum.h \ vpf.h \ vrnd.h \ vsl_priv.h \ vsm_priv.h \ vsub.h \ vss.h \ vtcp.h \ vtree.h \ vut.h \ vut_options.h BUILT_SOURCES = vcs_version.h vmod_abi.h MAINTAINERCLEANFILES = vcs_version.h CLEANFILES = \ tbl/vcl_returns.h \ tbl/vrt_stv_var.h \ vcl.h \ vrt_obj.h \ vmod_abi.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign include/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-nobase_pkgincludeHEADERS: $(nobase_pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" @list='$(nobase_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ $(am__nobase_list) | while read dir files; do \ xfiles=; for file in $$files; do \ if test -f "$$file"; then xfiles="$$xfiles $$file"; \ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ test -z "$$xfiles" || { \ test "x$$dir" = x. || { \ echo "$(MKDIR_P) '$(DESTDIR)$(pkgincludedir)/$$dir'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)/$$dir"; }; \ echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(pkgincludedir)/$$dir'"; \ $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(pkgincludedir)/$$dir" || exit $$?; }; \ done uninstall-nobase_pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(nobase_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-nobase_pkgincludeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-nobase_pkgincludeHEADERS .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-nobase_pkgincludeHEADERS \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-nobase_pkgincludeHEADERS tbl/vrt_stv_var.h tbl/vcl_returns.h tbl/vcc_types.h vrt_obj.h: vcl.h vcl.h: $(top_srcdir)/lib/libvcc/generate.py $(top_srcdir)/include/vrt.h mkdir -p tbl @PYTHON@ $(top_srcdir)/lib/libvcc/generate.py $(top_srcdir) $(top_builddir) vcs_version.h: FORCE @if [ -d "$(top_srcdir)/.git" ]; then \ V="$$(git show -s --pretty=format:%h)" \ B="$$(git rev-parse --abbrev-ref HEAD)" \ H="$$(head -n 1 vcs_version.h 2>/dev/null || true)"; \ if [ "/* $$V */" != "$$H" ]; then \ ( \ echo "/* $$V */" ;\ echo '/*' ;\ echo ' * NB: This file is machine generated, DO NOT EDIT!' ;\ echo ' *' ;\ echo ' * Run make to regenerate' ;\ echo ' *' ;\ echo ' */' ;\ echo "/* $$V */" ;\ echo '' ;\ echo "#define VCS_Version \"$$V\"" ; \ echo "#define VCS_Branch \"$$B\"" \ ) > vcs_version.h ; \ fi \ else \ if [ ! -f vcs_version.h ]; then \ ( \ echo "/* NOGIT */" ; \ echo '/* No git commit ID available, see include/Makefile.am for explanation */' ; \ echo '#define VCS_Version "NOGIT"' ; \ echo '#define VCS_Branch "NOGIT"' \ ) > vcs_version.h ; \ fi \ fi FORCE: # If vcs_version contains NOGIT, Varnish has not been built from a # tarball made with make dist, nor from a git checkout, so there's no # way for us to give strong guarantees about what version you're # actually running. # # The way to fix this is to either build Varnish from a tarball made # with `make dist` or a git checkout. vmod_abi.h: vcs_version.h @GITID=$$(sed 's/[^0-9a-f]//g;q' vcs_version.h) ; \ if [ -z "$$GITID" ]; then \ echo "warning: weak VMOD ABI checking, see include/Makefile.am" ; \ fi ; \ echo "#define VMOD_ABI_Version \"@PACKAGE_STRING@ $$GITID\"" > vmod_abi.h # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/include/vut_options.h0000644000201500234410000000730212652366721014305 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 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. */ /* VUT options */ #define VUT_OPT_d \ VOPT("d", "[-d]", "Process old log entries on startup", \ "Start processing log records at the head of the log" \ " instead of the tail." \ ) #define VUT_OPT_D \ VOPT("D", "[-D]", "Daemonize", \ "Daemonize." \ ) #define VUT_OPT_g \ VOPT("g:", "[-g ]", "Grouping mode (default: vxid)", \ "The grouping of the log records. The default is to group" \ " by vxid." \ ) #define VUT_OPT_h \ VOPT("h", "[-h]", "Usage help", \ "Print program usage and exit" \ ) #define VUT_OPT_k \ VOPT("k:", "[-k num]", "Limit transactions", \ "Process this number of matching log transactions before" \ " exiting." \ ) #define VUT_OPT_n \ VOPT("n:", "[-n name]", "Varnish instance name", \ "Specify the name of the varnishd instance to get logs" \ " from. If -n is not specified, the host name is used." \ ) #define VUT_OPT_N \ VOPT("N:", "[-N filename]", "VSM filename", \ "Specify the filename of a stale VSM instance. When using" \ " this option the abandonment checking is disabled." \ ) #define VUT_OPT_P \ VOPT("P:", "[-P file]", "PID file", \ "Write the process' PID to the specified file." \ ) #define VUT_OPT_q \ VOPT("q:", "[-q query]", "VSL query", \ "Specifies the VSL query to use." \ ) #define VUT_OPT_r \ VOPT("r:", "[-r filename]", "Binary file input", \ "Read log in binary file format from this file. The file" \ " can be created with ``varnishlog -w filename``." \ ) #define VUT_OPT_t \ VOPT("t:", "[-t ]", "VSM connection timeout", \ "Timeout before returning error on initial VSM connection." \ " If set the VSM connection is retried every 0.5 seconds" \ " for this many seconds. If zero the connection is" \ " attempted only once and will fail immediately if" \ " unsuccessful. If set to \"off\", the connection will not" \ " fail, allowing the utility to start and wait" \ " indefinetely for the Varnish instance to appear. " \ " Defaults to 5 seconds." \ ) #define VUT_OPT_V \ VOPT("V", "[-V]", "Version", \ "Print version information and exit." \ ) varnish-4.1.1/include/compat/0000755000201500234410000000000012652366756013114 500000000000000varnish-4.1.1/include/compat/daemon.h0000644000201500234410000000315712652366721014446 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Smørgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #ifndef COMPAT_DAEMON_H_INCLUDED #define COMPAT_DAEMON_H_INCLUDED #ifndef HAVE_DAEMON int varnish_daemon(int nochdir, int noclose); #else #define varnish_daemon(a,b) daemon(a,b) #endif #endif varnish-4.1.1/include/compat/execinfo.h0000644000201500234410000000315112652366721014775 00000000000000/* * Copyright (c) 2003 Maxim Sobolev * All rights reserved. * * 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 THE 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. * */ #ifndef COMPAT_EXECINFO_H_INCLUDED #define COMPAT_EXECINFO_H_INCLUDED #ifdef __cplusplus extern "C" { #endif int backtrace(void **, int); char ** backtrace_symbols(void *const *, int); #ifdef __cplusplus } #endif #endif /* COMPAT_EXECINFO_H_INCLUDED */ varnish-4.1.1/include/vas.h0000644000201500234410000000577612652366721012522 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * assert(), AN() and AZ() are static checks that should not happen. * In general asserts should be cheap, such as checking return * values and similar. * diagnostic() are asserts which are so expensive that we may want * to compile them out for performance at a later date. * xxxassert(), XXXAN() and XXXAZ() marks conditions we ought to * handle gracefully, such as malloc failure. */ #ifndef VAS_H_INCLUDED #define VAS_H_INCLUDED enum vas_e { VAS_WRONG, VAS_MISSING, VAS_ASSERT, VAS_INCOMPLETE, VAS_VCL, }; typedef void vas_f(const char *, const char *, int, const char *, enum vas_e); extern vas_f *VAS_Fail __attribute__((__noreturn__)); #ifdef WITHOUT_ASSERTS #define assert(e) ((void)(e)) #else /* WITH_ASSERTS */ #define assert(e) \ do { \ if (!(e)) { \ VAS_Fail(__func__, __FILE__, __LINE__, \ #e, VAS_ASSERT); \ } \ } while (0) #endif #define xxxassert(e) \ do { \ if (!(e)) { \ VAS_Fail(__func__, __FILE__, __LINE__, \ #e, VAS_MISSING); \ } \ } while (0) /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0) #define AN(foo) do { assert((foo) != 0); } while (0) #define XXXAZ(foo) do { xxxassert((foo) == 0); } while (0) #define XXXAN(foo) do { xxxassert((foo) != 0); } while (0) #define diagnostic(foo) assert(foo) #define WRONG(expl) \ do { \ VAS_Fail(__func__, __FILE__, __LINE__, expl, VAS_WRONG); \ } while (0) #define INCOMPL() \ do { \ VAS_Fail(__func__, __FILE__, __LINE__, \ "", VAS_INCOMPLETE); \ } while (0) #endif varnish-4.1.1/include/vcli.h0000644000201500234410000001314312652366721012651 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Public definition of the CLI protocol, part of the published Varnish-API. * * The overall structure of the protocol is a command-line like * "command+arguments" request and a IETF style "number + string" response. * * Arguments can contain arbitrary sequences of bytes which are encoded * in back-slash notation in double-quoted, if necessary. */ /* * These macros define the common data for requests in the CLI protocol. * The fields are: * const char * request_name * const char * request_syntax (for short help) * const char * request_help (for long help) * unsigned minimum_arguments * unsigned maximum_arguments */ #define CLI_BAN \ "ban", \ "ban [&& ...]", \ "\tMark obsolete all objects where all the conditions match.", \ 3, UINT_MAX #define CLI_BAN_LIST \ "ban.list", \ "ban.list", \ "\tList the active bans.", \ 0, 0 #define CLI_VCL_LOAD \ "vcl.load", \ "vcl.load [auto|cold|warm]", \ "\tCompile and load the VCL file under the name provided.", \ 2, 3 #define CLI_VCL_INLINE \ "vcl.inline", \ "vcl.inline [auto|cold|warm]", \ "\tCompile and load the VCL data under the name provided.", \ 2, 3 #define CLI_VCL_STATE \ "vcl.state", \ "vcl.state [auto|cold|warm]", \ "\tForce the state of the named configuration.", \ 2, 2 #define CLI_VCL_DISCARD \ "vcl.discard", \ "vcl.discard ", \ "\tUnload the named configuration (when possible).", \ 1, 1 #define CLI_VCL_LIST \ "vcl.list", \ "vcl.list", \ "\tList all loaded configuration.", \ 0, 0 #define CLI_VCL_SHOW \ "vcl.show", \ "vcl.show [-v] ", \ "\tDisplay the source code for the specified configuration.", \ 1, 2 #define CLI_VCL_USE \ "vcl.use", \ "vcl.use ", \ "\tSwitch to the named configuration immediately.", \ 1, 1 #define CLI_PARAM_SHOW \ "param.show", \ "param.show [-l] []", \ "\tShow parameters and their values.", \ 0, 2 #define CLI_PARAM_SET \ "param.set", \ "param.set ", \ "\tSet parameter value.", \ 2,2 #define CLI_SERVER_STOP \ "stop", \ "stop", \ "\tStop the Varnish cache process.", \ 0, 0 #define CLI_SERVER_START \ "start", \ "start", \ "\tStart the Varnish cache process.", \ 0, 0 #define CLI_PING \ "ping", \ "ping []", \ "\tKeep connection alive.", \ 0, 1 #define CLI_HELP \ "help", \ "help []", \ "\tShow command/protocol help.", \ 0, 1 #define CLI_QUIT \ "quit", \ "quit", \ "\tClose connection.", \ 0, 0 #define CLI_SERVER_STATUS \ "status", \ "status", \ "\tCheck status of Varnish cache process.", \ 0, 0 #define CLI_BANNER \ "banner", \ "banner", \ "\tPrint welcome banner.", \ 0, 0 #define CLI_AUTH \ "auth", \ "auth ", \ "\tAuthenticate.", \ 1, 1 #define CLI_PANIC_SHOW \ "panic.show", \ "panic.show", \ "\tReturn the last panic, if any.", \ 0, 0 #define CLI_PANIC_CLEAR \ "panic.clear", \ "panic.clear [-z]", \ "\tClear the last panic, if any. -z will clear related varnishstat counter(s)", \ 0, 1 /* * Status/return codes in the CLI protocol */ enum VCLI_status_e { CLIS_SYNTAX = 100, CLIS_UNKNOWN = 101, CLIS_UNIMPL = 102, CLIS_TOOFEW = 104, CLIS_TOOMANY = 105, CLIS_PARAM = 106, CLIS_AUTH = 107, CLIS_OK = 200, CLIS_TRUNCATED = 201, CLIS_CANT = 300, CLIS_COMMS = 400, CLIS_CLOSE = 500 }; /* Length of first line of response */ #define CLI_LINE0_LEN 13 #define CLI_AUTH_RESPONSE_LEN 64 /* 64 hex + NUL */ #if !defined(VCLI_PROTOCOL_ONLY) /* Convenience functions exported in libvarnishapi */ int VCLI_WriteResult(int fd, unsigned status, const char *result); int VCLI_ReadResult(int fd, unsigned *status, char **ptr, double tmo); void VCLI_AuthResponse(int S_fd, const char *challenge, char reponse[CLI_AUTH_RESPONSE_LEN + 1]); #endif varnish-4.1.1/include/vnum.h0000644000201500234410000000313612652366721012702 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ /* from libvarnish/vnum.c */ double VNUM(const char *p); double VNUMpfx(const char *p, const char **e); const char *VNUM_2bytes(const char *p, uintmax_t *r, uintmax_t rel); varnish-4.1.1/include/vsb.h0000644000201500234410000000613212652366721012506 00000000000000/*- * Copyright (c) 2000-2011 Poul-Henning Kamp * Copyright (c) 2000-2008 Dag-Erling Coïdan Smørgrav * All rights reserved. * * 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 * in this position and unchanged. * 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 THE 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. * * $FreeBSD: head/sys/sys/vsb.h 221993 2011-05-16 16:18:40Z phk $ */ #ifndef VSB_H_INCLUDED #define VSB_H_INCLUDED /* * Structure definition */ struct vsb { unsigned magic; #define VSB_MAGIC 0x4a82dd8a int s_error; /* current error code */ char *s_buf; /* storage buffer */ ssize_t s_size; /* size of storage buffer */ ssize_t s_len; /* current length of string */ #define VSB_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ #define VSB_AUTOEXTEND 0x00000001 /* automatically extend buffer */ #define VSB_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ #define VSB_DYNAMIC 0x00010000 /* s_buf must be freed */ #define VSB_FINISHED 0x00020000 /* set by VSB_finish() */ #define VSB_DYNSTRUCT 0x00080000 /* vsb must be freed */ int s_flags; /* flags */ int s_indent; /* Ident level */ }; #ifdef __cplusplus extern "C" { #endif /* * API functions */ struct vsb *VSB_new(struct vsb *, char *, int, int); #define VSB_new_auto() \ VSB_new(NULL, NULL, 0, VSB_AUTOEXTEND) void VSB_clear(struct vsb *); int VSB_bcat(struct vsb *, const void *, ssize_t); int VSB_cat(struct vsb *, const char *); int VSB_printf(struct vsb *, const char *, ...) __v_printflike(2, 3); #ifdef va_start int VSB_vprintf(struct vsb *, const char *, va_list) __v_printflike(2, 0); #endif int VSB_putc(struct vsb *, int); int VSB_error(const struct vsb *); int VSB_finish(struct vsb *); char *VSB_data(const struct vsb *); ssize_t VSB_len(const struct vsb *); void VSB_delete(struct vsb *); #define VSB_QUOTE_NONL 1 void VSB_quote(struct vsb *s, const char *p, int len, int how); void VSB_indent(struct vsb *, int); #ifdef __cplusplus }; #endif #endif varnish-4.1.1/include/vin.h0000644000201500234410000000315512652366721012512 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ #ifndef VIN_H_INCLUDED #define VIN_H_INCLUDED /* This function lives in both libvarnish and libvarnishapi */ int VIN_N_Arg(const char *n_arg, char **name, char **dir, char **vsl); #endif varnish-4.1.1/include/vpf.h0000644000201500234410000000327612652366721012515 00000000000000/*- * Copyright (c) 2005 Pawel Jakub Dawidek * All rights reserved. * * 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 AUTHORS 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 THE AUTHORS 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. * * Derived from: * $FreeBSD: src/lib/libutil/libutil.h,v 1.41 2005/08/24 17:21:38 pjd Exp $ */ #ifndef VPF_H_INCLUDED #define VPF_H_INCLUDED struct vpf_fh; struct vpf_fh *VPF_Open(const char *path, mode_t mode, pid_t *pidptr); int VPF_Write(struct vpf_fh *pfh); int VPF_Close(struct vpf_fh *pfh); int VPF_Remove(struct vpf_fh *pfh); #endif varnish-4.1.1/include/vtree.h0000644000201500234410000006344112652366721013047 00000000000000/* $NetBSD: tree.h,v 1.8 2004/03/28 19:38:30 provos Exp $ */ /* $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $ */ /* $FreeBSD: release/9.0.0/sys/sys/tree.h 189204 2009-03-01 04:57:23Z bms $ */ /*- * Copyright 2002 Niels Provos * All rights reserved. * * 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 ``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 THE AUTHOR 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. */ #ifndef _VTREE_H_ #define _VTREE_H_ #ifndef __unused #define __unused __attribute__((__unused__)) #endif /* * This file defines data structures for different types of trees: * splay trees and red-black trees. * * A splay tree is a self-organizing data structure. Every operation * on the tree causes a splay to happen. The splay moves the requested * node to the root of the tree and partly rebalances it. * * This has the benefit that request locality causes faster lookups as * the requested nodes move to the top of the tree. On the other hand, * every lookup causes memory writes. * * The Balance Theorem bounds the total access time for m operations * and n inserts on an initially empty tree as O((m + n)lg n). The * amortized cost for a sequence of m accesses to a splay tree is O(lg n); * * A red-black tree is a binary search tree with the node color as an * extra attribute. It fulfills a set of conditions: * - every search path from the root to a leaf consists of the * same number of black nodes, * - each red node (except for the root) has a black parent, * - each leaf node is black. * * Every operation on a red-black tree is bounded as O(lg n). * The maximum height of a red-black tree is 2lg (n+1). */ #define VSPLAY_HEAD(name, type) \ struct name { \ struct type *sph_root; /* root of the tree */ \ } #define VSPLAY_INITIALIZER(root) \ { NULL } #define VSPLAY_INIT(root) do { \ (root)->sph_root = NULL; \ } while (/*CONSTCOND*/ 0) #define VSPLAY_ENTRY(type) \ struct { \ struct type *spe_left; /* left element */ \ struct type *spe_right; /* right element */ \ } #define VSPLAY_LEFT(elm, field) (elm)->field.spe_left #define VSPLAY_RIGHT(elm, field) (elm)->field.spe_right #define VSPLAY_ROOT(head) (head)->sph_root #define VSPLAY_EMPTY(head) (VSPLAY_ROOT(head) == NULL) /* VSPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold VSPLAY_{RIGHT,LEFT} */ #define VSPLAY_ROTATE_RIGHT(head, tmp, field) do { \ VSPLAY_LEFT((head)->sph_root, field) = VSPLAY_RIGHT(tmp, field);\ VSPLAY_RIGHT(tmp, field) = (head)->sph_root; \ (head)->sph_root = tmp; \ } while (/*CONSTCOND*/ 0) #define VSPLAY_ROTATE_LEFT(head, tmp, field) do { \ VSPLAY_RIGHT((head)->sph_root, field) = VSPLAY_LEFT(tmp, field);\ VSPLAY_LEFT(tmp, field) = (head)->sph_root; \ (head)->sph_root = tmp; \ } while (/*CONSTCOND*/ 0) #define VSPLAY_LINKLEFT(head, tmp, field) do { \ VSPLAY_LEFT(tmp, field) = (head)->sph_root; \ tmp = (head)->sph_root; \ (head)->sph_root = VSPLAY_LEFT((head)->sph_root, field); \ } while (/*CONSTCOND*/ 0) #define VSPLAY_LINKRIGHT(head, tmp, field) do { \ VSPLAY_RIGHT(tmp, field) = (head)->sph_root; \ tmp = (head)->sph_root; \ (head)->sph_root = VSPLAY_RIGHT((head)->sph_root, field); \ } while (/*CONSTCOND*/ 0) #define VSPLAY_ASSEMBLE(head, node, left, right, field) do { \ VSPLAY_RIGHT(left, field) = VSPLAY_LEFT((head)->sph_root, field);\ VSPLAY_LEFT(right, field) = VSPLAY_RIGHT((head)->sph_root, field);\ VSPLAY_LEFT((head)->sph_root, field) = VSPLAY_RIGHT(node, field);\ VSPLAY_RIGHT((head)->sph_root, field) = VSPLAY_LEFT(node, field);\ } while (/*CONSTCOND*/ 0) /* Generates prototypes and inline functions */ #define VSPLAY_PROTOTYPE(name, type, field, cmp) \ void name##_VSPLAY(struct name *, struct type *); \ void name##_VSPLAY_MINMAX(struct name *, int); \ struct type *name##_VSPLAY_INSERT(struct name *, struct type *); \ struct type *name##_VSPLAY_REMOVE(struct name *, struct type *); \ \ /* Finds the node with the same key as elm */ \ static __inline struct type * \ name##_VSPLAY_FIND(struct name *head, struct type *elm) \ { \ if (VSPLAY_EMPTY(head)) \ return(NULL); \ name##_VSPLAY(head, elm); \ if ((cmp)(elm, (head)->sph_root) == 0) \ return (head->sph_root); \ return (NULL); \ } \ \ static __inline struct type * \ name##_VSPLAY_NEXT(struct name *head, struct type *elm) \ { \ name##_VSPLAY(head, elm); \ if (VSPLAY_RIGHT(elm, field) != NULL) { \ elm = VSPLAY_RIGHT(elm, field); \ while (VSPLAY_LEFT(elm, field) != NULL) { \ elm = VSPLAY_LEFT(elm, field); \ } \ } else \ elm = NULL; \ return (elm); \ } \ \ static __inline struct type * \ name##_VSPLAY_MIN_MAX(struct name *head, int val) \ { \ name##_VSPLAY_MINMAX(head, val); \ return (VSPLAY_ROOT(head)); \ } /* Main splay operation. * Moves node close to the key of elm to top */ #define VSPLAY_GENERATE(name, type, field, cmp) \ struct type * \ name##_VSPLAY_INSERT(struct name *head, struct type *elm) \ { \ if (VSPLAY_EMPTY(head)) { \ VSPLAY_LEFT(elm, field) = VSPLAY_RIGHT(elm, field) = NULL; \ } else { \ int __comp; \ name##_VSPLAY(head, elm); \ __comp = (cmp)(elm, (head)->sph_root); \ if(__comp < 0) { \ VSPLAY_LEFT(elm, field) = VSPLAY_LEFT((head)->sph_root, field);\ VSPLAY_RIGHT(elm, field) = (head)->sph_root; \ VSPLAY_LEFT((head)->sph_root, field) = NULL; \ } else if (__comp > 0) { \ VSPLAY_RIGHT(elm, field) = VSPLAY_RIGHT((head)->sph_root, field);\ VSPLAY_LEFT(elm, field) = (head)->sph_root; \ VSPLAY_RIGHT((head)->sph_root, field) = NULL; \ } else \ return ((head)->sph_root); \ } \ (head)->sph_root = (elm); \ return (NULL); \ } \ \ struct type * \ name##_VSPLAY_REMOVE(struct name *head, struct type *elm) \ { \ struct type *__tmp; \ if (VSPLAY_EMPTY(head)) \ return (NULL); \ name##_VSPLAY(head, elm); \ if ((cmp)(elm, (head)->sph_root) == 0) { \ if (VSPLAY_LEFT((head)->sph_root, field) == NULL) { \ (head)->sph_root = VSPLAY_RIGHT((head)->sph_root, field);\ } else { \ __tmp = VSPLAY_RIGHT((head)->sph_root, field); \ (head)->sph_root = VSPLAY_LEFT((head)->sph_root, field);\ name##_VSPLAY(head, elm); \ VSPLAY_RIGHT((head)->sph_root, field) = __tmp; \ } \ return (elm); \ } \ return (NULL); \ } \ \ void \ name##_VSPLAY(struct name *head, struct type *elm) \ { \ struct type __node, *__left, *__right, *__tmp; \ int __comp; \ \ VSPLAY_LEFT(&__node, field) = VSPLAY_RIGHT(&__node, field) = NULL;\ __left = __right = &__node; \ \ while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) { \ if (__comp < 0) { \ __tmp = VSPLAY_LEFT((head)->sph_root, field); \ if (__tmp == NULL) \ break; \ if ((cmp)(elm, __tmp) < 0){ \ VSPLAY_ROTATE_RIGHT(head, __tmp, field);\ if (VSPLAY_LEFT((head)->sph_root, field) == NULL)\ break; \ } \ VSPLAY_LINKLEFT(head, __right, field); \ } else if (__comp > 0) { \ __tmp = VSPLAY_RIGHT((head)->sph_root, field); \ if (__tmp == NULL) \ break; \ if ((cmp)(elm, __tmp) > 0){ \ VSPLAY_ROTATE_LEFT(head, __tmp, field); \ if (VSPLAY_RIGHT((head)->sph_root, field) == NULL)\ break; \ } \ VSPLAY_LINKRIGHT(head, __left, field); \ } \ } \ VSPLAY_ASSEMBLE(head, &__node, __left, __right, field); \ } \ \ /* Splay with either the minimum or the maximum element \ * Used to find minimum or maximum element in tree. \ */ \ void name##_VSPLAY_MINMAX(struct name *head, int __comp) \ { \ struct type __node, *__left, *__right, *__tmp; \ \ VSPLAY_LEFT(&__node, field) = VSPLAY_RIGHT(&__node, field) = NULL;\ __left = __right = &__node; \ \ while (1) { \ if (__comp < 0) { \ __tmp = VSPLAY_LEFT((head)->sph_root, field); \ if (__tmp == NULL) \ break; \ if (__comp < 0){ \ VSPLAY_ROTATE_RIGHT(head, __tmp, field);\ if (VSPLAY_LEFT((head)->sph_root, field) == NULL)\ break; \ } \ VSPLAY_LINKLEFT(head, __right, field); \ } else if (__comp > 0) { \ __tmp = VSPLAY_RIGHT((head)->sph_root, field); \ if (__tmp == NULL) \ break; \ if (__comp > 0) { \ VSPLAY_ROTATE_LEFT(head, __tmp, field); \ if (VSPLAY_RIGHT((head)->sph_root, field) == NULL)\ break; \ } \ VSPLAY_LINKRIGHT(head, __left, field); \ } \ } \ VSPLAY_ASSEMBLE(head, &__node, __left, __right, field); \ } #define VSPLAY_NEGINF -1 #define VSPLAY_INF 1 #define VSPLAY_INSERT(name, x, y) name##_VSPLAY_INSERT(x, y) #define VSPLAY_REMOVE(name, x, y) name##_VSPLAY_REMOVE(x, y) #define VSPLAY_FIND(name, x, y) name##_VSPLAY_FIND(x, y) #define VSPLAY_NEXT(name, x, y) name##_VSPLAY_NEXT(x, y) #define VSPLAY_MIN(name, x) (VSPLAY_EMPTY(x) ? NULL \ : name##_VSPLAY_MIN_MAX(x, VSPLAY_NEGINF)) #define VSPLAY_MAX(name, x) (VSPLAY_EMPTY(x) ? NULL \ : name##_VSPLAY_MIN_MAX(x, VSPLAY_INF)) #define VSPLAY_FOREACH(x, name, head) \ for ((x) = VSPLAY_MIN(name, head); \ (x) != NULL; \ (x) = VSPLAY_NEXT(name, head, x)) /* Macros that define a red-black tree */ #define VRB_HEAD(name, type) \ struct name { \ struct type *rbh_root; /* root of the tree */ \ } #define VRB_INITIALIZER(root) \ { NULL } #define VRB_INIT(root) do { \ (root)->rbh_root = NULL; \ } while (/*CONSTCOND*/ 0) #define VRB_BLACK 0 #define VRB_RED 1 #define VRB_ENTRY(type) \ struct { \ struct type *rbe_left; /* left element */ \ struct type *rbe_right; /* right element */ \ struct type *rbe_parent; /* parent element */ \ int rbe_color; /* node color */ \ } #define VRB_LEFT(elm, field) (elm)->field.rbe_left #define VRB_RIGHT(elm, field) (elm)->field.rbe_right #define VRB_PARENT(elm, field) (elm)->field.rbe_parent #define VRB_COLOR(elm, field) (elm)->field.rbe_color #define VRB_ROOT(head) (head)->rbh_root #define VRB_EMPTY(head) (VRB_ROOT(head) == NULL) #define VRB_SET(elm, parent, field) do { \ VRB_PARENT(elm, field) = parent; \ VRB_LEFT(elm, field) = VRB_RIGHT(elm, field) = NULL; \ VRB_COLOR(elm, field) = VRB_RED; \ } while (/*CONSTCOND*/ 0) #define VRB_SET_BLACKRED(black, red, field) do { \ VRB_COLOR(black, field) = VRB_BLACK; \ VRB_COLOR(red, field) = VRB_RED; \ } while (/*CONSTCOND*/ 0) #ifndef VRB_AUGMENT #define VRB_AUGMENT(x) do {} while (0) #endif #define VRB_ROTATE_LEFT(head, elm, tmp, field) do { \ (tmp) = VRB_RIGHT(elm, field); \ if ((VRB_RIGHT(elm, field) = VRB_LEFT(tmp, field)) != NULL) { \ VRB_PARENT(VRB_LEFT(tmp, field), field) = (elm); \ } \ VRB_AUGMENT(elm); \ if ((VRB_PARENT(tmp, field) = VRB_PARENT(elm, field)) != NULL) {\ if ((elm) == VRB_LEFT(VRB_PARENT(elm, field), field)) \ VRB_LEFT(VRB_PARENT(elm, field), field) = (tmp);\ else \ VRB_RIGHT(VRB_PARENT(elm, field), field) = (tmp);\ } else \ (head)->rbh_root = (tmp); \ VRB_LEFT(tmp, field) = (elm); \ VRB_PARENT(elm, field) = (tmp); \ VRB_AUGMENT(tmp); \ if ((VRB_PARENT(tmp, field))) \ VRB_AUGMENT(VRB_PARENT(tmp, field)); \ } while (/*CONSTCOND*/ 0) #define VRB_ROTATE_RIGHT(head, elm, tmp, field) do { \ (tmp) = VRB_LEFT(elm, field); \ if ((VRB_LEFT(elm, field) = VRB_RIGHT(tmp, field)) != NULL) { \ VRB_PARENT(VRB_RIGHT(tmp, field), field) = (elm); \ } \ VRB_AUGMENT(elm); \ if ((VRB_PARENT(tmp, field) = VRB_PARENT(elm, field)) != NULL) {\ if ((elm) == VRB_LEFT(VRB_PARENT(elm, field), field)) \ VRB_LEFT(VRB_PARENT(elm, field), field) = (tmp);\ else \ VRB_RIGHT(VRB_PARENT(elm, field), field) = (tmp);\ } else \ (head)->rbh_root = (tmp); \ VRB_RIGHT(tmp, field) = (elm); \ VRB_PARENT(elm, field) = (tmp); \ VRB_AUGMENT(tmp); \ if ((VRB_PARENT(tmp, field))) \ VRB_AUGMENT(VRB_PARENT(tmp, field)); \ } while (/*CONSTCOND*/ 0) /* Generates prototypes and inline functions */ #define VRB_PROTOTYPE(name, type, field, cmp) \ VRB_PROTOTYPE_INTERNAL(name, type, field, cmp,) #define VRB_PROTOTYPE_STATIC(name, type, field, cmp) \ VRB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static) #define VRB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ /*lint -esym(528, name##_VRB_*) */ \ attr void name##_VRB_INSERT_COLOR(struct name *, struct type *); \ attr void name##_VRB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ attr struct type *name##_VRB_REMOVE(struct name *, struct type *); \ attr struct type *name##_VRB_INSERT(struct name *, struct type *); \ attr struct type *name##_VRB_FIND(const struct name *, const struct type *); \ attr struct type *name##_VRB_NFIND(const struct name *, const struct type *); \ attr struct type *name##_VRB_NEXT(struct type *); \ attr struct type *name##_VRB_PREV(struct type *); \ attr struct type *name##_VRB_MINMAX(const struct name *, int); \ \ /* Main rb operation. * Moves node close to the key of elm to top */ #define VRB_GENERATE(name, type, field, cmp) \ VRB_GENERATE_INTERNAL(name, type, field, cmp,) #define VRB_GENERATE_STATIC(name, type, field, cmp) \ VRB_GENERATE_INTERNAL(name, type, field, cmp, __unused static) #define VRB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ attr void \ name##_VRB_INSERT_COLOR(struct name *head, struct type *elm) \ { \ struct type *parent, *gparent, *tmp; \ while ((parent = VRB_PARENT(elm, field)) != NULL && \ VRB_COLOR(parent, field) == VRB_RED) { \ gparent = VRB_PARENT(parent, field); \ if (parent == VRB_LEFT(gparent, field)) { \ tmp = VRB_RIGHT(gparent, field); \ if (tmp && VRB_COLOR(tmp, field) == VRB_RED) { \ VRB_COLOR(tmp, field) = VRB_BLACK; \ VRB_SET_BLACKRED(parent, gparent, field);\ elm = gparent; \ continue; \ } \ if (VRB_RIGHT(parent, field) == elm) { \ VRB_ROTATE_LEFT(head, parent, tmp, field);\ tmp = parent; \ parent = elm; \ elm = tmp; \ } \ VRB_SET_BLACKRED(parent, gparent, field); \ VRB_ROTATE_RIGHT(head, gparent, tmp, field); \ } else { \ tmp = VRB_LEFT(gparent, field); \ if (tmp && VRB_COLOR(tmp, field) == VRB_RED) { \ VRB_COLOR(tmp, field) = VRB_BLACK; \ VRB_SET_BLACKRED(parent, gparent, field);\ elm = gparent; \ continue; \ } \ if (VRB_LEFT(parent, field) == elm) { \ VRB_ROTATE_RIGHT(head, parent, tmp, field);\ tmp = parent; \ parent = elm; \ elm = tmp; \ } \ VRB_SET_BLACKRED(parent, gparent, field); \ VRB_ROTATE_LEFT(head, gparent, tmp, field); \ } \ } \ VRB_COLOR(head->rbh_root, field) = VRB_BLACK; \ } \ \ attr void \ name##_VRB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \ { \ struct type *tmp; \ while ((elm == NULL || VRB_COLOR(elm, field) == VRB_BLACK) && \ elm != VRB_ROOT(head)) { \ AN(parent); \ if (VRB_LEFT(parent, field) == elm) { \ tmp = VRB_RIGHT(parent, field); \ if (VRB_COLOR(tmp, field) == VRB_RED) { \ VRB_SET_BLACKRED(tmp, parent, field); \ VRB_ROTATE_LEFT(head, parent, tmp, field);\ tmp = VRB_RIGHT(parent, field); \ } \ if ((VRB_LEFT(tmp, field) == NULL || \ VRB_COLOR(VRB_LEFT(tmp, field), field) == VRB_BLACK) &&\ (VRB_RIGHT(tmp, field) == NULL || \ VRB_COLOR(VRB_RIGHT(tmp, field), field) == VRB_BLACK)) {\ VRB_COLOR(tmp, field) = VRB_RED; \ elm = parent; \ parent = VRB_PARENT(elm, field); \ } else { \ if (VRB_RIGHT(tmp, field) == NULL || \ VRB_COLOR(VRB_RIGHT(tmp, field), field) == VRB_BLACK) {\ struct type *oleft; \ if ((oleft = VRB_LEFT(tmp, field)) \ != NULL) \ VRB_COLOR(oleft, field) = VRB_BLACK;\ VRB_COLOR(tmp, field) = VRB_RED;\ VRB_ROTATE_RIGHT(head, tmp, oleft, field);\ tmp = VRB_RIGHT(parent, field); \ } \ VRB_COLOR(tmp, field) = VRB_COLOR(parent, field);\ VRB_COLOR(parent, field) = VRB_BLACK; \ if (VRB_RIGHT(tmp, field)) \ VRB_COLOR(VRB_RIGHT(tmp, field), field) = VRB_BLACK;\ VRB_ROTATE_LEFT(head, parent, tmp, field);\ elm = VRB_ROOT(head); \ break; \ } \ } else { \ tmp = VRB_LEFT(parent, field); \ if (VRB_COLOR(tmp, field) == VRB_RED) { \ VRB_SET_BLACKRED(tmp, parent, field); \ VRB_ROTATE_RIGHT(head, parent, tmp, field);\ tmp = VRB_LEFT(parent, field); \ } \ if ((VRB_LEFT(tmp, field) == NULL || \ VRB_COLOR(VRB_LEFT(tmp, field), field) == VRB_BLACK) &&\ (VRB_RIGHT(tmp, field) == NULL || \ VRB_COLOR(VRB_RIGHT(tmp, field), field) == VRB_BLACK)) {\ VRB_COLOR(tmp, field) = VRB_RED; \ elm = parent; \ parent = VRB_PARENT(elm, field); \ } else { \ if (VRB_LEFT(tmp, field) == NULL || \ VRB_COLOR(VRB_LEFT(tmp, field), field) == VRB_BLACK) {\ struct type *oright; \ if ((oright = VRB_RIGHT(tmp, field)) \ != NULL) \ VRB_COLOR(oright, field) = VRB_BLACK;\ VRB_COLOR(tmp, field) = VRB_RED;\ VRB_ROTATE_LEFT(head, tmp, oright, field);\ tmp = VRB_LEFT(parent, field); \ } \ VRB_COLOR(tmp, field) = VRB_COLOR(parent, field);\ VRB_COLOR(parent, field) = VRB_BLACK; \ if (VRB_LEFT(tmp, field)) \ VRB_COLOR(VRB_LEFT(tmp, field), field) = VRB_BLACK;\ VRB_ROTATE_RIGHT(head, parent, tmp, field);\ elm = VRB_ROOT(head); \ break; \ } \ } \ } \ if (elm) \ VRB_COLOR(elm, field) = VRB_BLACK; \ } \ \ attr struct type * \ name##_VRB_REMOVE(struct name *head, struct type *elm) \ { \ struct type *child, *parent, *old = elm; \ int color; \ if (VRB_LEFT(elm, field) == NULL) \ child = VRB_RIGHT(elm, field); \ else if (VRB_RIGHT(elm, field) == NULL) \ child = VRB_LEFT(elm, field); \ else { \ struct type *left; \ elm = VRB_RIGHT(elm, field); \ while ((left = VRB_LEFT(elm, field)) != NULL) \ elm = left; \ child = VRB_RIGHT(elm, field); \ parent = VRB_PARENT(elm, field); \ color = VRB_COLOR(elm, field); \ if (child) \ VRB_PARENT(child, field) = parent; \ if (parent) { \ if (VRB_LEFT(parent, field) == elm) \ VRB_LEFT(parent, field) = child; \ else \ VRB_RIGHT(parent, field) = child; \ VRB_AUGMENT(parent); \ } else \ VRB_ROOT(head) = child; \ if (VRB_PARENT(elm, field) == old) \ parent = elm; \ (elm)->field = (old)->field; \ if (VRB_PARENT(old, field)) { \ if (VRB_LEFT(VRB_PARENT(old, field), field) == old)\ VRB_LEFT(VRB_PARENT(old, field), field) = elm;\ else \ VRB_RIGHT(VRB_PARENT(old, field), field) = elm;\ VRB_AUGMENT(VRB_PARENT(old, field)); \ } else \ VRB_ROOT(head) = elm; \ VRB_PARENT(VRB_LEFT(old, field), field) = elm; \ if (VRB_RIGHT(old, field)) \ VRB_PARENT(VRB_RIGHT(old, field), field) = elm; \ if (parent) { \ left = parent; \ do { \ VRB_AUGMENT(left); \ } while ((left = VRB_PARENT(left, field)) != NULL); \ } \ goto color; \ } \ parent = VRB_PARENT(elm, field); \ color = VRB_COLOR(elm, field); \ if (child) \ VRB_PARENT(child, field) = parent; \ if (parent) { \ if (VRB_LEFT(parent, field) == elm) \ VRB_LEFT(parent, field) = child; \ else \ VRB_RIGHT(parent, field) = child; \ VRB_AUGMENT(parent); \ } else \ VRB_ROOT(head) = child; \ color: \ if (color == VRB_BLACK) { \ name##_VRB_REMOVE_COLOR(head, parent, child); \ } \ return (old); \ } \ \ /* Inserts a node into the RB tree */ \ attr struct type * \ name##_VRB_INSERT(struct name *head, struct type *elm) \ { \ struct type *tmp; \ struct type *parent = NULL; \ int comp = 0; \ tmp = VRB_ROOT(head); \ while (tmp) { \ parent = tmp; \ comp = (cmp)(elm, parent); \ if (comp < 0) \ tmp = VRB_LEFT(tmp, field); \ else if (comp > 0) \ tmp = VRB_RIGHT(tmp, field); \ else \ return (tmp); \ } \ VRB_SET(elm, parent, field); \ if (parent != NULL) { \ if (comp < 0) \ VRB_LEFT(parent, field) = elm; \ else \ VRB_RIGHT(parent, field) = elm; \ VRB_AUGMENT(parent); \ } else \ VRB_ROOT(head) = elm; \ name##_VRB_INSERT_COLOR(head, elm); \ return (NULL); \ } \ \ /* Finds the node with the same key as elm */ \ attr struct type * \ name##_VRB_FIND(const struct name *head, const struct type *elm) \ { \ struct type *tmp = VRB_ROOT(head); \ int comp; \ while (tmp) { \ comp = cmp(elm, tmp); \ if (comp < 0) \ tmp = VRB_LEFT(tmp, field); \ else if (comp > 0) \ tmp = VRB_RIGHT(tmp, field); \ else \ return (tmp); \ } \ return (NULL); \ } \ \ /* Finds the first node greater than or equal to the search key */ \ attr struct type * \ name##_VRB_NFIND(const struct name *head, const struct type *elm) \ { \ struct type *tmp = VRB_ROOT(head); \ struct type *res = NULL; \ int comp; \ while (tmp) { \ comp = cmp(elm, tmp); \ if (comp < 0) { \ res = tmp; \ tmp = VRB_LEFT(tmp, field); \ } \ else if (comp > 0) \ tmp = VRB_RIGHT(tmp, field); \ else \ return (tmp); \ } \ return (res); \ } \ \ /* ARGSUSED */ \ attr struct type * \ name##_VRB_NEXT(struct type *elm) \ { \ if (VRB_RIGHT(elm, field)) { \ elm = VRB_RIGHT(elm, field); \ while (VRB_LEFT(elm, field)) \ elm = VRB_LEFT(elm, field); \ } else { \ if (VRB_PARENT(elm, field) && \ (elm == VRB_LEFT(VRB_PARENT(elm, field), field))) \ elm = VRB_PARENT(elm, field); \ else { \ while (VRB_PARENT(elm, field) && \ (elm == VRB_RIGHT(VRB_PARENT(elm, field), field)))\ elm = VRB_PARENT(elm, field); \ elm = VRB_PARENT(elm, field); \ } \ } \ return (elm); \ } \ \ /* ARGSUSED */ \ attr struct type * \ name##_VRB_PREV(struct type *elm) \ { \ if (VRB_LEFT(elm, field)) { \ elm = VRB_LEFT(elm, field); \ while (VRB_RIGHT(elm, field)) \ elm = VRB_RIGHT(elm, field); \ } else { \ if (VRB_PARENT(elm, field) && \ (elm == VRB_RIGHT(VRB_PARENT(elm, field), field))) \ elm = VRB_PARENT(elm, field); \ else { \ while (VRB_PARENT(elm, field) && \ (elm == VRB_LEFT(VRB_PARENT(elm, field), field)))\ elm = VRB_PARENT(elm, field); \ elm = VRB_PARENT(elm, field); \ } \ } \ return (elm); \ } \ \ attr struct type * \ name##_VRB_MINMAX(const struct name *head, int val) \ { \ struct type *tmp = VRB_ROOT(head); \ struct type *parent = NULL; \ while (tmp) { \ parent = tmp; \ if (val < 0) \ tmp = VRB_LEFT(tmp, field); \ else \ tmp = VRB_RIGHT(tmp, field); \ } \ return (parent); \ } #define VRB_NEGINF -1 #define VRB_INF 1 #define VRB_INSERT(name, x, y) name##_VRB_INSERT(x, y) #define VRB_REMOVE(name, x, y) name##_VRB_REMOVE(x, y) #define VRB_FIND(name, x, y) name##_VRB_FIND(x, y) #define VRB_NFIND(name, x, y) name##_VRB_NFIND(x, y) #define VRB_NEXT(name, x, y) name##_VRB_NEXT(y) #define VRB_PREV(name, x, y) name##_VRB_PREV(y) #define VRB_MIN(name, x) name##_VRB_MINMAX(x, VRB_NEGINF) #define VRB_MAX(name, x) name##_VRB_MINMAX(x, VRB_INF) #define VRB_FOREACH(x, name, head) \ for ((x) = VRB_MIN(name, head); \ (x) != NULL; \ (x) = name##_VRB_NEXT(x)) #define VRB_FOREACH_FROM(x, name, y) \ for ((x) = (y); \ ((x) != NULL) && ((y) = name##_VRB_NEXT(x), (x) != NULL); \ (x) = (y)) #define VRB_FOREACH_SAFE(x, name, head, y) \ for ((x) = VRB_MIN(name, head); \ ((x) != NULL) && ((y) = name##_VRB_NEXT(x), (x) != NULL); \ (x) = (y)) #define VRB_FOREACH_REVERSE(x, name, head) \ for ((x) = VRB_MAX(name, head); \ (x) != NULL; \ (x) = name##_VRB_PREV(x)) #define VRB_FOREACH_REVERSE_FROM(x, name, y) \ for ((x) = (y); \ ((x) != NULL) && ((y) = name##_VRB_PREV(x), (x) != NULL); \ (x) = (y)) #define VRB_FOREACH_REVERSE_SAFE(x, name, head, y) \ for ((x) = VRB_MAX(name, head); \ ((x) != NULL) && ((y) = name##_VRB_PREV(x), (x) != NULL); \ (x) = (y)) #endif /* _VTREE_H_ */ varnish-4.1.1/include/vbm.h0000644000201500234410000000577012652366721012507 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2010 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. * * Self-sizeing bitmap operations */ /********************************************************************** * Generic bitmap functions, may be generalized at some point. */ #define VBITMAP_TYPE unsigned /* Our preferred wordsize */ #define VBITMAP_LUMP (1024) /* How many bits we alloc at a time */ #define VBITMAP_WORD (sizeof(VBITMAP_TYPE) * 8) #define VBITMAP_IDX(n) (n / VBITMAP_WORD) #define VBITMAP_BIT(n) (1U << (n % VBITMAP_WORD)) struct vbitmap { VBITMAP_TYPE *bits; unsigned nbits; }; static inline void vbit_expand(struct vbitmap *vb, unsigned bit) { unsigned char *p; bit += VBITMAP_LUMP - 1; bit -= (bit % VBITMAP_LUMP); p = realloc(vb->bits, bit / 8); assert(p != NULL); memset(p + vb->nbits / 8, 0, (bit - vb->nbits) / 8); vb->bits = (void*)p; vb->nbits = bit; } static inline struct vbitmap * vbit_init(unsigned initial) { struct vbitmap *vb; vb = calloc(sizeof *vb, 1); assert(vb != NULL); if (initial == 0) initial = VBITMAP_LUMP; vbit_expand(vb, initial); return (vb); } static inline void vbit_destroy(struct vbitmap *vb) { if (vb == NULL) return; free(vb->bits); free(vb); } static inline void vbit_set(struct vbitmap *vb, unsigned bit) { if (bit >= vb->nbits) vbit_expand(vb, bit); vb->bits[VBITMAP_IDX(bit)] |= VBITMAP_BIT(bit); } static inline void vbit_clr(const struct vbitmap *vb, unsigned bit) { if (bit < vb->nbits) vb->bits[VBITMAP_IDX(bit)] &= ~VBITMAP_BIT(bit); } static inline int vbit_test(const struct vbitmap *vb, unsigned bit) { if (bit >= vb->nbits) return (0); return (vb->bits[VBITMAP_IDX(bit)] & VBITMAP_BIT(bit)); } varnish-4.1.1/include/vfil.h0000644000201500234410000000367712652366721012667 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ struct vfil_path; /* from libvarnish/vfil.c */ int seed_random(void); char *VFIL_readfile(const char *pfx, const char *fn, ssize_t *sz); int VFIL_nonblocking(int fd); int VFIL_fsinfo(int fd, unsigned *pbs, uintmax_t *size, uintmax_t *space); int VFIL_allocate(int fd, off_t size, int insist); void VFIL_setpath(struct vfil_path**, const char *path); typedef int vfil_path_func_f(void *priv, const char *fn); int VFIL_searchpath(const struct vfil_path *, vfil_path_func_f *func, void *priv, const char *fni, char **fno); varnish-4.1.1/include/binary_heap.h0000644000201500234410000000521412652366721014175 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 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. * * Binary Heap API (see: http://en.wikipedia.org/wiki/Binary_heap) * * XXX: doesn't scale back the array of pointers when items are deleted. */ /* Public Interface --------------------------------------------------*/ struct binheap; typedef int binheap_cmp_t(void *priv, const void *a, const void *b); /* * Comparison function. * Should return true if item 'a' should be closer to the root * than item 'b' */ typedef void binheap_update_t(void *priv, void *a, unsigned newidx); /* * Update function (optional) * When items move in the tree, this function gets called to * notify the item of its new index. * Only needed if deleting non-root items. */ struct binheap *binheap_new(void *priv, binheap_cmp_t, binheap_update_t); /* * Create Binary tree * 'priv' is passed to cmp and update functions. */ void binheap_insert(struct binheap *, void *); /* * Insert an item */ void binheap_reorder(const struct binheap *, unsigned idx); /* * Move an order after changing its key value. */ void binheap_delete(struct binheap *, unsigned idx); /* * Delete an item * The root item has 'idx' zero */ void *binheap_root(const struct binheap *); /* * Return the root item */ #define BINHEAP_NOIDX 0 varnish-4.1.1/include/vlu.h0000644000201500234410000000324712652366721012526 00000000000000/*- * Copyright (c) 2005-2008 Poul-Henning Kamp * All rights reserved. * * 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. * * Functions for assembling a bytestream into text-lines and calling * a function on each. */ #ifndef VLU_H_INCLUDED #define VLU_H_INCLUDED typedef int (vlu_f)(void *, const char *); struct vlu *VLU_New(void *priv, vlu_f *func, unsigned bufsize); int VLU_Fd(int fd, struct vlu *l); void VLU_Destroy(struct vlu *l); #endif varnish-4.1.1/include/vqueue.h0000644000201500234410000004673212652366721013240 00000000000000/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * 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. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 THE REGENTS 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. * * @(#)queue.h 8.5 (Berkeley) 8/20/94 * $FreeBSD: head/sys/sys/queue.h 251887 2013-06-18 02:57:56Z lstewart $ */ #ifndef VARNISH_QUEUE_H #define VARNISH_QUEUE_H /* * This file defines four types of data structures: singly-linked lists, * singly-linked tail queues, lists and tail queues. * * A singly-linked list is headed by a single forward pointer. The elements * are singly linked for minimum space and pointer manipulation overhead at * the expense of O(n) removal for arbitrary elements. New elements can be * added to the list after an existing element or at the head of the list. * Elements being removed from the head of the list should use the explicit * macro for this purpose for optimum efficiency. A singly-linked list may * only be traversed in the forward direction. Singly-linked lists are ideal * for applications with large datasets and few or no removals or for * implementing a LIFO queue. * * A singly-linked tail queue is headed by a pair of pointers, one to the * head of the list and the other to the tail of the list. The elements are * singly linked for minimum space and pointer manipulation overhead at the * expense of O(n) removal for arbitrary elements. New elements can be added * to the list after an existing element, at the head of the list, or at the * end of the list. Elements being removed from the head of the tail queue * should use the explicit macro for this purpose for optimum efficiency. * A singly-linked tail queue may only be traversed in the forward direction. * Singly-linked tail queues are ideal for applications with large datasets * and few or no removals or for implementing a FIFO queue. * * A list is headed by a single forward pointer (or an array of forward * pointers for a hash table header). The elements are doubly linked * so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before * or after an existing element or at the head of the list. A list * may be traversed in either direction. * * A tail queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or * after an existing element, at the head of the list, or at the end of * the list. A tail queue may be traversed in either direction. * * For details on the use of these macros, see the queue(3) manual page. * * * VSLIST VLIST VSTAILQ VTAILQ * _HEAD + + + + * _HEAD_INITIALIZER + + + + * _ENTRY + + + + * _INIT + + + + * _EMPTY + + + + * _FIRST + + + + * _NEXT + + + + * _PREV - + - + * _LAST - - + + * _FOREACH + + + + * _FOREACH_FROM + + + + * _FOREACH_SAFE + + + + * _FOREACH_FROM_SAFE + + + + * _FOREACH_REVERSE - - - + * _FOREACH_REVERSE_FROM - - - + * _FOREACH_REVERSE_SAFE - - - + * _FOREACH_REVERSE_FROM_SAFE - - - + * _INSERT_HEAD + + + + * _INSERT_BEFORE - + - + * _INSERT_AFTER + + + + * _INSERT_TAIL - - + + * _CONCAT - - + + * _REMOVE_AFTER + - + - * _REMOVE_HEAD + - + - * _REMOVE + + + + * _SWAP + + + + * */ #define TRACEBUF #define TRACEBUF_INITIALIZER #define TRASHIT(x) /* * Singly-linked List declarations. */ #define VSLIST_HEAD(name, type) \ struct name { \ struct type *vslh_first; /* first element */ \ } #define VSLIST_HEAD_INITIALIZER(head) \ { NULL } #define VSLIST_ENTRY(type) \ struct { \ struct type *vsle_next; /* next element */ \ } /* * Singly-linked List functions. */ #define VSLIST_EMPTY(head) ((head)->vslh_first == NULL) #define VSLIST_FIRST(head) ((head)->vslh_first) #define VSLIST_FOREACH(var, head, field) \ for ((var) = VSLIST_FIRST((head)); \ (var); \ (var) = VSLIST_NEXT((var), field)) #define VSLIST_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : VSLIST_FIRST((head))); \ (var); \ (var) = VSLIST_NEXT((var), field)) #define VSLIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = VSLIST_FIRST((head)); \ (var) && ((tvar) = VSLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define VSLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : VSLIST_FIRST((head))); \ (var) && ((tvar) = VSLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define VSLIST_FOREACH_PREVPTR(var, varp, head, field) \ for ((varp) = &VSLIST_FIRST((head)); \ ((var) = *(varp)) != NULL; \ (varp) = &VSLIST_NEXT((var), field)) #define VSLIST_INIT(head) do { \ VSLIST_FIRST((head)) = NULL; \ } while (0) #define VSLIST_INSERT_AFTER(slistelm, elm, field) do { \ VSLIST_NEXT((elm), field) = VSLIST_NEXT((slistelm), field); \ VSLIST_NEXT((slistelm), field) = (elm); \ } while (0) #define VSLIST_INSERT_HEAD(head, elm, field) do { \ VSLIST_NEXT((elm), field) = VSLIST_FIRST((head)); \ VSLIST_FIRST((head)) = (elm); \ } while (0) #define VSLIST_NEXT(elm, field) ((elm)->field.vsle_next) #define VSLIST_REMOVE(head, elm, type, field) do { \ if (VSLIST_FIRST((head)) == (elm)) { \ VSLIST_REMOVE_HEAD((head), field); \ } \ else { \ struct type *curelm = VSLIST_FIRST((head)); \ while (VSLIST_NEXT(curelm, field) != (elm)) \ curelm = VSLIST_NEXT(curelm, field); \ VSLIST_REMOVE_AFTER(curelm, field); \ } \ TRASHIT(*oldnext); \ } while (0) #define VSLIST_REMOVE_AFTER(elm, field) do { \ VSLIST_NEXT(elm, field) = \ VSLIST_NEXT(VSLIST_NEXT(elm, field), field); \ } while (0) #define VSLIST_REMOVE_HEAD(head, field) do { \ VSLIST_FIRST((head)) = VSLIST_NEXT(VSLIST_FIRST((head)), field);\ } while (0) #define VSLIST_SWAP(head1, head2, type) do { \ struct type *swap_first = VSLIST_FIRST(head1); \ VSLIST_FIRST(head1) = VSLIST_FIRST(head2); \ VSLIST_FIRST(head2) = swap_first; \ } while (0) /* * Singly-linked Tail queue declarations. */ #define VSTAILQ_HEAD(name, type) \ struct name { \ struct type *vstqh_first;/* first element */ \ struct type **vstqh_last;/* addr of last next element */ \ } #define VSTAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).vstqh_first } #define VSTAILQ_ENTRY(type) \ struct { \ struct type *vstqe_next; /* next element */ \ } /* * Singly-linked Tail queue functions. */ #define VSTAILQ_CONCAT(head1, head2) do { \ if (!VSTAILQ_EMPTY((head2))) { \ *(head1)->vstqh_last = (head2)->vstqh_first; \ (head1)->vstqh_last = (head2)->vstqh_last; \ VSTAILQ_INIT((head2)); \ } \ } while (0) #define VSTAILQ_EMPTY(head) ((head)->vstqh_first == NULL) #define VSTAILQ_FIRST(head) ((head)->vstqh_first) #define VSTAILQ_FOREACH(var, head, field) \ for((var) = VSTAILQ_FIRST((head)); \ (var); \ (var) = VSTAILQ_NEXT((var), field)) #define VSTAILQ_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : VSTAILQ_FIRST((head))); \ (var); \ (var) = VSTAILQ_NEXT((var), field)) #define VSTAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = VSTAILQ_FIRST((head)); \ (var) && ((tvar) = VSTAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define VSTAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : VSTAILQ_FIRST((head))); \ (var) && ((tvar) = VSTAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define VSTAILQ_INIT(head) do { \ VSTAILQ_FIRST((head)) = NULL; \ (head)->vstqh_last = &VSTAILQ_FIRST((head)); \ } while (0) #define VSTAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ if ((VSTAILQ_NEXT((elm), field) = VSTAILQ_NEXT((tqelm), field)) == NULL)\ (head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \ VSTAILQ_NEXT((tqelm), field) = (elm); \ } while (0) #define VSTAILQ_INSERT_HEAD(head, elm, field) do { \ if ((VSTAILQ_NEXT((elm), field) = VSTAILQ_FIRST((head))) == NULL)\ (head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \ VSTAILQ_FIRST((head)) = (elm); \ } while (0) #define VSTAILQ_INSERT_TAIL(head, elm, field) do { \ VSTAILQ_NEXT((elm), field) = NULL; \ *(head)->vstqh_last = (elm); \ (head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \ } while (0) #define VSTAILQ_LAST(head, type, field) \ (VSTAILQ_EMPTY((head)) ? NULL : \ __containerof((head)->vstqh_last, struct type, field.vstqe_next)) #define VSTAILQ_NEXT(elm, field) ((elm)->field.vstqe_next) #define VSTAILQ_REMOVE(head, elm, type, field) do { \ if (VSTAILQ_FIRST((head)) == (elm)) { \ VSTAILQ_REMOVE_HEAD((head), field); \ } \ else { \ struct type *curelm = VSTAILQ_FIRST((head)); \ while (VSTAILQ_NEXT(curelm, field) != (elm)) \ curelm = VSTAILQ_NEXT(curelm, field); \ VSTAILQ_REMOVE_AFTER(head, curelm, field); \ } \ TRASHIT(*oldnext); \ } while (0) #define VSTAILQ_REMOVE_AFTER(head, elm, field) do { \ if ((VSTAILQ_NEXT(elm, field) = \ VSTAILQ_NEXT(VSTAILQ_NEXT(elm, field), field)) == NULL) \ (head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \ } while (0) #define VSTAILQ_REMOVE_HEAD(head, field) do { \ if ((VSTAILQ_FIRST((head)) = \ VSTAILQ_NEXT(VSTAILQ_FIRST((head)), field)) == NULL) \ (head)->vstqh_last = &VSTAILQ_FIRST((head)); \ } while (0) #define VSTAILQ_SWAP(head1, head2, type) do { \ struct type *swap_first = VSTAILQ_FIRST(head1); \ struct type **swap_last = (head1)->vstqh_last; \ VSTAILQ_FIRST(head1) = VSTAILQ_FIRST(head2); \ (head1)->vstqh_last = (head2)->vstqh_last; \ VSTAILQ_FIRST(head2) = swap_first; \ (head2)->vstqh_last = swap_last; \ if (VSTAILQ_EMPTY(head1)) \ (head1)->vstqh_last = &VSTAILQ_FIRST(head1); \ if (VSTAILQ_EMPTY(head2)) \ (head2)->vstqh_last = &VSTAILQ_FIRST(head2); \ } while (0) /* * List declarations. */ #define VLIST_HEAD(name, type) \ struct name { \ struct type *vlh_first; /* first element */ \ } #define VLIST_HEAD_INITIALIZER(head) \ { NULL } #define VLIST_ENTRY(type) \ struct { \ struct type *vle_next; /* next element */ \ struct type **vle_prev; /* address of previous next element */ \ } /* * List functions. */ #define VLIST_EMPTY(head) ((head)->vlh_first == NULL) #define VLIST_FIRST(head) ((head)->vlh_first) #define VLIST_FOREACH(var, head, field) \ for ((var) = VLIST_FIRST((head)); \ (var); \ (var) = VLIST_NEXT((var), field)) #define VLIST_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : VLIST_FIRST((head))); \ (var); \ (var) = VLIST_NEXT((var), field)) #define VLIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = VLIST_FIRST((head)); \ (var) && ((tvar) = VLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define VLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : VLIST_FIRST((head))); \ (var) && ((tvar) = VLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define VLIST_INIT(head) do { \ VLIST_FIRST((head)) = NULL; \ } while (0) #define VLIST_INSERT_AFTER(listelm, elm, field) do { \ if ((VLIST_NEXT((elm), field) = VLIST_NEXT((listelm), field)) != NULL)\ VLIST_NEXT((listelm), field)->field.vle_prev = \ &VLIST_NEXT((elm), field); \ VLIST_NEXT((listelm), field) = (elm); \ (elm)->field.vle_prev = &VLIST_NEXT((listelm), field); \ } while (0) #define VLIST_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.vle_prev = (listelm)->field.vle_prev; \ VLIST_NEXT((elm), field) = (listelm); \ *(listelm)->field.vle_prev = (elm); \ (listelm)->field.vle_prev = &VLIST_NEXT((elm), field); \ } while (0) #define VLIST_INSERT_HEAD(head, elm, field) do { \ if ((VLIST_NEXT((elm), field) = VLIST_FIRST((head))) != NULL) \ VLIST_FIRST((head))->field.vle_prev = &VLIST_NEXT((elm), field);\ VLIST_FIRST((head)) = (elm); \ (elm)->field.vle_prev = &VLIST_FIRST((head)); \ } while (0) #define VLIST_NEXT(elm, field) ((elm)->field.vle_next) #define VLIST_PREV(elm, head, type, field) \ ((elm)->field.vle_prev == &VLIST_FIRST((head)) ? NULL : \ __containerof((elm)->field.vle_prev, struct type, field.vle_next)) #define VLIST_REMOVE(elm, field) do { \ if (VLIST_NEXT((elm), field) != NULL) \ VLIST_NEXT((elm), field)->field.vle_prev = \ (elm)->field.vle_prev; \ *(elm)->field.vle_prev = VLIST_NEXT((elm), field); \ TRASHIT(*oldnext); \ TRASHIT(*oldprev); \ } while (0) #define VLIST_SWAP(head1, head2, type, field) do { \ struct type *swap_tmp = VLIST_FIRST((head1)); \ VLIST_FIRST((head1)) = VLIST_FIRST((head2)); \ VLIST_FIRST((head2)) = swap_tmp; \ if ((swap_tmp = VLIST_FIRST((head1))) != NULL) \ swap_tmp->field.vle_prev = &VLIST_FIRST((head1)); \ if ((swap_tmp = VLIST_FIRST((head2))) != NULL) \ swap_tmp->field.vle_prev = &VLIST_FIRST((head2)); \ } while (0) /* * Tail queue declarations. */ #define VTAILQ_HEAD(name, type) \ struct name { \ struct type *vtqh_first; /* first element */ \ struct type **vtqh_last; /* addr of last next element */ \ TRACEBUF \ } #define VTAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).vtqh_first, TRACEBUF_INITIALIZER } #define VTAILQ_ENTRY(type) \ struct { \ struct type *vtqe_next; /* next element */ \ struct type **vtqe_prev; /* address of previous next element */\ TRACEBUF \ } /*lint -e(18) */ /* * Tail queue functions. */ #define VTAILQ_CONCAT(head1, head2, field) do { \ if (!VTAILQ_EMPTY(head2)) { \ *(head1)->vtqh_last = (head2)->vtqh_first; \ (head2)->vtqh_first->field.vtqe_prev = (head1)->vtqh_last;\ (head1)->vtqh_last = (head2)->vtqh_last; \ VTAILQ_INIT((head2)); \ } \ } while (0) #define VTAILQ_EMPTY(head) ((head)->vtqh_first == NULL) #define VTAILQ_FIRST(head) ((head)->vtqh_first) #define VTAILQ_FOREACH(var, head, field) \ for ((var) = VTAILQ_FIRST((head)); \ (var); \ (var) = VTAILQ_NEXT((var), field)) #define VTAILQ_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : VTAILQ_FIRST((head))); \ (var); \ (var) = VTAILQ_NEXT((var), field)) #define VTAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = VTAILQ_FIRST((head)); \ (var) && ((tvar) = VTAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define VTAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : VTAILQ_FIRST((head))); \ (var) && ((tvar) = VTAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define VTAILQ_FOREACH_REVERSE(var, head, headname, field) \ for ((var) = VTAILQ_LAST((head), headname); \ (var); \ (var) = VTAILQ_PREV((var), headname, field)) #define VTAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \ for ((var) = ((var) ? (var) : VTAILQ_LAST((head), headname)); \ (var); \ (var) = VTAILQ_PREV((var), headname, field)) #define VTAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ for ((var) = VTAILQ_LAST((head), headname); \ (var) && ((tvar) = VTAILQ_PREV((var), headname, field), 1); \ (var) = (tvar)) #define VTAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \ for ((var) = ((var) ? (var) : VTAILQ_LAST((head), headname)); \ (var) && ((tvar) = VTAILQ_PREV((var), headname, field), 1); \ (var) = (tvar)) #define VTAILQ_INIT(head) do { \ VTAILQ_FIRST((head)) = NULL; \ (head)->vtqh_last = &VTAILQ_FIRST((head)); \ } while (0) #define VTAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if ((VTAILQ_NEXT((elm), field) = VTAILQ_NEXT((listelm), field)) != NULL)\ VTAILQ_NEXT((elm), field)->field.vtqe_prev = \ &VTAILQ_NEXT((elm), field); \ else { \ (head)->vtqh_last = &VTAILQ_NEXT((elm), field); \ } \ VTAILQ_NEXT((listelm), field) = (elm); \ (elm)->field.vtqe_prev = &VTAILQ_NEXT((listelm), field); \ } while (0) #define VTAILQ_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.vtqe_prev = (listelm)->field.vtqe_prev; \ VTAILQ_NEXT((elm), field) = (listelm); \ *(listelm)->field.vtqe_prev = (elm); \ (listelm)->field.vtqe_prev = &VTAILQ_NEXT((elm), field); \ } while (0) #define VTAILQ_INSERT_HEAD(head, elm, field) do { \ if ((VTAILQ_NEXT((elm), field) = VTAILQ_FIRST((head))) != NULL) \ VTAILQ_FIRST((head))->field.vtqe_prev = \ &VTAILQ_NEXT((elm), field); \ else \ (head)->vtqh_last = &VTAILQ_NEXT((elm), field); \ VTAILQ_FIRST((head)) = (elm); \ (elm)->field.vtqe_prev = &VTAILQ_FIRST((head)); \ } while (0) #define VTAILQ_INSERT_TAIL(head, elm, field) do { \ VTAILQ_NEXT((elm), field) = NULL; \ (elm)->field.vtqe_prev = (head)->vtqh_last; \ *(head)->vtqh_last = (elm); \ (head)->vtqh_last = &VTAILQ_NEXT((elm), field); \ } while (0) #define VTAILQ_LAST(head, headname) \ (*(((struct headname *)((head)->vtqh_last))->vtqh_last)) #define VTAILQ_NEXT(elm, field) ((elm)->field.vtqe_next) #define VTAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.vtqe_prev))->vtqh_last)) #define VTAILQ_REMOVE(head, elm, field) do { \ if ((VTAILQ_NEXT((elm), field)) != NULL) \ VTAILQ_NEXT((elm), field)->field.vtqe_prev = \ (elm)->field.vtqe_prev; \ else { \ (head)->vtqh_last = (elm)->field.vtqe_prev; \ } \ *(elm)->field.vtqe_prev = VTAILQ_NEXT((elm), field); \ TRASHIT(*oldnext); \ TRASHIT(*oldprev); \ } while (0) #define VTAILQ_SWAP(head1, head2, type, field) do { \ struct type *swap_first = (head1)->vtqh_first; \ struct type **swap_last = (head1)->vtqh_last; \ (head1)->vtqh_first = (head2)->vtqh_first; \ (head1)->vtqh_last = (head2)->vtqh_last; \ (head2)->vtqh_first = swap_first; \ (head2)->vtqh_last = swap_last; \ if ((swap_first = (head1)->vtqh_first) != NULL) \ swap_first->field.vtqe_prev = &(head1)->vtqh_first; \ else \ (head1)->vtqh_last = &(head1)->vtqh_first; \ if ((swap_first = (head2)->vtqh_first) != NULL) \ swap_first->field.vtqe_prev = &(head2)->vtqh_first; \ else \ (head2)->vtqh_last = &(head2)->vtqh_first; \ } while (0) #endif /* !VARNISH_QUEUE_H */ varnish-4.1.1/include/vrnd.h0000644000201500234410000000271412652366721012667 00000000000000/*- * Copyright (c) 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. * * Random functions */ void VRND_Seed(void); /* Seed random(3) properly */ varnish-4.1.1/include/miniobj.h0000644000201500234410000000305512652366721013344 00000000000000/* * Written by Poul-Henning Kamp * * This file is in the public domain. * */ #define INIT_OBJ(to, type_magic) \ do { \ (void)memset(to, 0, sizeof *to); \ (to)->magic = (type_magic); \ } while (0) #define ALLOC_OBJ(to, type_magic) \ do { \ (to) = calloc(sizeof *(to), 1); \ if ((to) != NULL) \ (to)->magic = (type_magic); \ } while (0) #define FREE_OBJ(to) \ do { \ (to)->magic = (0); \ free(to); \ to = NULL; \ } while (0) #define VALID_OBJ(ptr, type_magic) \ ((ptr) != NULL && (ptr)->magic == (type_magic)) #define CHECK_OBJ(ptr, type_magic) \ do { \ assert((ptr)->magic == type_magic); \ } while (0) #define CHECK_OBJ_NOTNULL(ptr, type_magic) \ do { \ assert((ptr) != NULL); \ assert((ptr)->magic == type_magic); \ } while (0) #define CHECK_OBJ_ORNULL(ptr, type_magic) \ do { \ if ((ptr) != NULL) \ assert((ptr)->magic == type_magic); \ } while (0) #define CAST_OBJ(to, from, type_magic) \ do { \ (to) = (from); \ if ((to) != NULL) \ CHECK_OBJ((to), (type_magic)); \ } while (0) #define CAST_OBJ_NOTNULL(to, from, type_magic) \ do { \ (to) = (from); \ assert((to) != NULL); \ CHECK_OBJ((to), (type_magic)); \ } while (0) #define REPLACE(ptr, val) \ do { \ free(ptr); \ if ((val) != NULL) { \ ptr = strdup(val); \ AN((ptr)); \ } else { \ ptr = NULL; \ } \ } while (0) varnish-4.1.1/include/vcl.h0000644000201500234410000000417212652366743012506 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ struct vrt_ctx; #define VRT_CTX const struct vrt_ctx *ctx struct req; struct busyobj; struct ws; struct cli; struct worker; enum vcl_event_e { VCL_EVENT_LOAD, VCL_EVENT_WARM, VCL_EVENT_USE, VCL_EVENT_COLD, VCL_EVENT_DISCARD, }; typedef int vcl_event_f(VRT_CTX, enum vcl_event_e); typedef int vcl_init_f(VRT_CTX); typedef void vcl_fini_f(VRT_CTX); typedef int vcl_func_f(VRT_CTX); /* VCL Methods */ #define VCL_MET_RECV (1U << 1) #define VCL_MET_PIPE (1U << 2) #define VCL_MET_PASS (1U << 3) #define VCL_MET_HASH (1U << 4) #define VCL_MET_PURGE (1U << 5) #define VCL_MET_MISS (1U << 6) #define VCL_MET_HIT (1U << 7) #define VCL_MET_DELIVER (1U << 8) #define VCL_MET_SYNTH (1U << 9) #define VCL_MET_BACKEND_FETCH (1U << 10) #define VCL_MET_BACKEND_RESPONSE (1U << 11) #define VCL_MET_BACKEND_ERROR (1U << 12) #define VCL_MET_INIT (1U << 13) #define VCL_MET_FINI (1U << 14) #define VCL_MET_MAX 15 #define VCL_MET_MASK 0x7fff /* VCL Returns */ #define VCL_RET_ABANDON 0 #define VCL_RET_DELIVER 1 #define VCL_RET_FAIL 2 #define VCL_RET_FETCH 3 #define VCL_RET_HASH 4 #define VCL_RET_LOOKUP 5 #define VCL_RET_MISS 6 #define VCL_RET_OK 7 #define VCL_RET_PASS 8 #define VCL_RET_PIPE 9 #define VCL_RET_PURGE 10 #define VCL_RET_RESTART 11 #define VCL_RET_RETRY 12 #define VCL_RET_SYNTH 13 #define VCL_RET_MAX 14 struct VCL_conf { unsigned magic; #define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */ struct director **default_director; const struct vrt_backend_probe *default_probe; unsigned nref; struct vrt_ref *ref; unsigned nsrc; const char **srcname; const char **srcbody; vcl_event_f *event_vcl; vcl_func_f *recv_func; vcl_func_f *pipe_func; vcl_func_f *pass_func; vcl_func_f *hash_func; vcl_func_f *purge_func; vcl_func_f *miss_func; vcl_func_f *hit_func; vcl_func_f *deliver_func; vcl_func_f *synth_func; vcl_func_f *backend_fetch_func; vcl_func_f *backend_response_func; vcl_func_f *backend_error_func; vcl_func_f *init_func; vcl_func_f *fini_func; }; varnish-4.1.1/include/vsha256.h0000644000201500234410000000340412652366721013111 00000000000000/*- * Copyright 2005 Colin Percival * All rights reserved. * * 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 THE 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. * * $FreeBSD: head/lib/libmd/sha256.h 154479 2006-01-17 15:35:57Z phk $ */ #ifndef _SHA256_H_ #define _SHA256_H_ #define SHA256_LEN 32 typedef struct SHA256Context { uint32_t state[8]; uint64_t count; unsigned char buf[64]; } SHA256_CTX; void SHA256_Init(SHA256_CTX *); void SHA256_Update(SHA256_CTX *, const void *, size_t); void SHA256_Final(unsigned char [SHA256_LEN], SHA256_CTX *); void SHA256_Test(void); #endif /* !_SHA256_H_ */ varnish-4.1.1/include/vsub.h0000644000201500234410000000316112652366721012672 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ /* from libvarnish/subproc.c */ typedef void vsub_func_f(void*); unsigned VSUB_run(struct vsb *, vsub_func_f *, void *priv, const char *name, int maxlines); void VSUB_closefrom(int fd); varnish-4.1.1/include/vcli_serve.h0000644000201500234410000000377212652366721014064 00000000000000/*- * Copyright (c) 2010-2011 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. * */ struct VCLS; typedef void cls_cb_f(void *priv); typedef void cls_cbc_f(const struct cli*); struct VCLS *VCLS_New(cls_cbc_f *before, cls_cbc_f *after, volatile unsigned *maxlen, volatile unsigned *limit); struct cli *VCLS_AddFd(struct VCLS *cs, int fdi, int fdo, cls_cb_f *closefunc, void *priv); int VCLS_AddFunc(struct VCLS *cs, unsigned auth, struct cli_proto *clp); int VCLS_Poll(struct VCLS *cs, int timeout); int VCLS_PollFd(struct VCLS *cs, int fd, int timeout); void VCLS_Destroy(struct VCLS **); /* From libvarnish/cli.c */ cli_func_t VCLS_func_close; cli_func_t VCLS_func_help; cli_func_t VCLS_func_ping; varnish-4.1.1/include/vcli_priv.h0000644000201500234410000000431712652366721013714 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * * Varnish process internal CLI stuff. * * XXX: at a latter date we may want to move some to cli.h/libvarnishapi */ #define CLI_PRIV_H struct cli; /* NB: struct cli is opaque at this level. */ typedef void cli_func_t(struct cli*, const char * const *av, void *priv); struct cli_proto { /* These must match the CLI_* macros in cli.h */ const char *request; const char *syntax; const char *help; unsigned minarg; unsigned maxarg; char flags[4]; /* Dispatch information */ cli_func_t *func; void *priv; }; /* The implementation must provide these functions */ int VCLI_Overflow(struct cli *cli); void VCLI_Out(struct cli *cli, const char *fmt, ...) __v_printflike(2, 3); void VCLI_Quote(struct cli *cli, const char *str); void VCLI_SetResult(struct cli *cli, unsigned r); varnish-4.1.1/include/vcli_common.h0000644000201500234410000000330112652366721014214 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 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. * */ struct vlu; struct VCLS; struct cli { unsigned magic; #define CLI_MAGIC 0x4038d570 struct vsb *sb; enum VCLI_status_e result; char *cmd; unsigned auth; char challenge[34]; char *ident; struct vlu *vlu; struct VCLS *cls; volatile unsigned *limit; }; varnish-4.1.1/include/vut.h0000644000201500234410000000435712652366721012541 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 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. * * Common functions for the utilities */ typedef int VUT_cb_f(void); struct VUT { const char *progname; char *name; /* Options */ int d_opt; int D_opt; int g_arg; int k_arg; char *n_arg; char *N_arg; char *P_arg; char *q_arg; char *r_arg; double t_arg; /* State */ struct VSL_data *vsl; struct VSM_data *vsm; struct VSLQ *vslq; struct vpf_fh *pfh; int sighup; int sigint; int sigusr1; /* Callback functions */ VUT_cb_f *idle_f; VUT_cb_f *sighup_f; VSLQ_dispatch_f *dispatch_f; void *dispatch_priv; }; extern struct VUT VUT; void VUT_Error(int status, const char *fmt, ...) __v_printflike(2, 3); int VUT_g_Arg(const char *arg); int VUT_Arg(int opt, const char *arg); void VUT_Setup(void); void VUT_Init(const char *progname); void VUT_Fini(void); int VUT_Main(void); varnish-4.1.1/include/vend.h0000644000201500234410000000672212652366721012655 00000000000000/*- * Copyright (c) 2003,2010 Poul-Henning Kamp * All rights reserved. * * 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 AUTHORS 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 THE AUTHORS 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. * * From: * $FreeBSD: head/sys/sys/endian.h 121122 2003-10-15 20:05:57Z obrien $ * * Endian conversion functions */ #ifndef VEND_H_INCLUDED #define VEND_H_INCLUDED /* Alignment-agnostic encode/decode bytestream to/from little/big endian. */ static __inline uint16_t vbe16dec(const void *pp) { uint8_t const *p = (uint8_t const *)pp; return ((p[0] << 8) | p[1]); } static __inline uint32_t vbe32dec(const void *pp) { uint8_t const *p = (uint8_t const *)pp; return (((unsigned)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); } static __inline uint64_t vbe64dec(const void *pp) { uint8_t const *p = (uint8_t const *)pp; return (((uint64_t)vbe32dec(p) << 32) | vbe32dec(p + 4)); } #if 0 static __inline uint16_t vle16dec(const void *pp) { uint8_t const *p = (uint8_t const *)pp; return ((p[1] << 8) | p[0]); } #endif static __inline uint32_t vle32dec(const void *pp) { uint8_t const *p = (uint8_t const *)pp; return (((unsigned)p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]); } #if 0 static __inline uint64_t vle64dec(const void *pp) { uint8_t const *p = (uint8_t const *)pp; return (((uint64_t)vle32dec(p + 4) << 32) | vle32dec(p)); } #endif static __inline void vbe16enc(void *pp, uint16_t u) { uint8_t *p = (uint8_t *)pp; p[0] = (u >> 8) & 0xff; p[1] = u & 0xff; } static __inline void vbe32enc(void *pp, uint32_t u) { uint8_t *p = (uint8_t *)pp; p[0] = (u >> 24) & 0xff; p[1] = (u >> 16) & 0xff; p[2] = (u >> 8) & 0xff; p[3] = u & 0xff; } static __inline void vbe64enc(void *pp, uint64_t u) { uint8_t *p = (uint8_t *)pp; vbe32enc(p, (uint32_t)(u >> 32)); vbe32enc(p + 4, (uint32_t)(u & 0xffffffffU)); } static __inline void vle16enc(void *pp, uint16_t u) { uint8_t *p = (uint8_t *)pp; p[0] = u & 0xff; p[1] = (u >> 8) & 0xff; } static __inline void vle32enc(void *pp, uint32_t u) { uint8_t *p = (uint8_t *)pp; p[0] = u & 0xff; p[1] = (u >> 8) & 0xff; p[2] = (u >> 16) & 0xff; p[3] = (u >> 24) & 0xff; } #if 0 static __inline void vle64enc(void *pp, uint64_t u) { uint8_t *p = (uint8_t *)pp; vle32enc(p, (uint32_t)(u & 0xffffffffU)); vle32enc(p + 4, (uint32_t)(u >> 32)); } #endif #endif varnish-4.1.1/Makefile.in0000644000201500234410000007106412652366730012173 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/varnishapi-uninstalled.pc.in \ $(srcdir)/varnishapi.pc.in $(top_srcdir)/configure ChangeLog \ INSTALL build-aux/config.guess build-aux/config.sub \ build-aux/depcomp build-aux/install-sh build-aux/ltmain.sh \ build-aux/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = varnishapi.pc varnishapi-uninstalled.pc CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(m4dir)" "$(DESTDIR)$(pkgconfigdir)" DATA = $(m4_DATA) $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = include lib bin etc doc man pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = varnishapi.pc m4dir = $(datadir)/aclocal m4_DATA = varnish.m4 CLEANFILES = cscope.in.out cscope.out cscope.po.out EXTRA_DIST = README.Packaging LICENSE autogen.sh varnishapi.pc.in varnish.m4 DISTCHECK_CONFIGURE_FLAGS = \ --enable-developer-warnings \ --enable-debugging-symbols \ --enable-dependency-tracking \ --enable-tests distcleancheck_listfiles = \ find . -type f -exec sh -c 'test -f $(srcdir)/$$1 || echo $$1' \ sh '{}' ';' all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 varnishapi.pc: $(top_builddir)/config.status $(srcdir)/varnishapi.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ varnishapi-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/varnishapi-uninstalled.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-m4DATA: $(m4_DATA) @$(NORMAL_INSTALL) test -z "$(m4dir)" || $(MKDIR_P) "$(DESTDIR)$(m4dir)" @list='$(m4_DATA)'; test -n "$(m4dir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(m4dir)" || exit $$?; \ done uninstall-m4DATA: @$(NORMAL_UNINSTALL) @list='$(m4_DATA)'; test -n "$(m4dir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(m4dir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(m4dir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local install-m4DATA \ install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-m4DATA uninstall-pkgconfigDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-generic distclean-hdr \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-local install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-m4DATA install-man install-pdf \ install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-m4DATA uninstall-pkgconfigDATA install-data-local: $(install_sh) -d -m 0755 $(DESTDIR)$(localstatedir)/varnish # XXX: This is a hack to ensure we have a built source tree when # running make dist If we had used non-recursive make we could have # solved it better, but we don't, so use this at least for now. LICENSE: all cscope: -rm -f cscope* find . -name '*.[hcS]' > cscope.files cscope -b .PHONY: cscope # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/varnishapi.pc.in0000644000201500234410000000066212652366721013217 00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ sbindir=@sbindir@ libdir=@libdir@ includedir=@includedir@ pkgincludedir=${includedir}/@PACKAGE@ datarootdir=@datarootdir@ datadir=@datadir@ pkgdatadir=${datadir}/@PACKAGE@ vmoddir=${libdir}/@PACKAGE@/vmods vmodtool=${pkgdatadir}/vmodtool.py Name: VarnishAPI Description: Varnish API Version: @PACKAGE_VERSION@ Cflags: -I${includedir}/@PACKAGE@ Libs: -L${libdir} -lvarnishapi varnish-4.1.1/varnishapi-uninstalled.pc.in0000644000201500234410000000070312652366721015533 00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ sbindir=@sbindir@ libdir=@libdir@ includedir=@includedir@ pkgincludedir=${includedir}/@PACKAGE@ datarootdir=@datarootdir@ datadir=@datadir@ pkgdatadir=${datadir}/@PACKAGE@ vmoddir=${libdir}/@PACKAGE@/vmods builddir=@abs_top_builddir@ srcdir=@abs_top_srcdir@ Name: VarnishAPI Description: Varnish API Version: @PACKAGE_VERSION@ Cflags: -I${includedir}/@PACKAGE@ Libs: -L${libdir} -lvarnishapi varnish-4.1.1/build-aux/0000755000201500234410000000000012652366756012100 500000000000000varnish-4.1.1/build-aux/depcomp0000755000201500234410000004755612652366725013412 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2011-12-04.11; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test "$stat" = 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/ \1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/ / G p }' >> "$depfile" rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: varnish-4.1.1/build-aux/config.guess0000755000201500234410000012743212652366725014345 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: varnish-4.1.1/build-aux/config.sub0000755000201500234410000010517612652366725014011 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-02-10' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: varnish-4.1.1/build-aux/missing0000755000201500234410000002415212652366725013417 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: varnish-4.1.1/build-aux/install-sh0000755000201500234410000003325612652366725014031 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: varnish-4.1.1/build-aux/ltmain.sh0000644000201500234410000105204012652366722013633 00000000000000 # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.2 Debian-2.4.2-1ubuntu1" TIMESTAMP="" package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 varnish-4.1.1/autogen.sh0000755000201500234410000000151412652366721012120 00000000000000#!/bin/sh # warn() { echo "WARNING: $@" 1>&2 } case `uname -s` in Darwin) LIBTOOLIZE=glibtoolize ;; FreeBSD) LIBTOOLIZE=libtoolize ;; NetBSD) LIBTOOLIZE=libtoolize ;; OpenBSD) LIBTOOLIZE=libtoolize ;; Linux) LIBTOOLIZE=libtoolize ;; SunOS) LIBTOOLIZE=libtoolize ;; *) warn "unrecognized platform:" `uname -s` LIBTOOLIZE=libtoolize esac automake_version=`automake --version | tr ' ' '\n' | egrep '^[0-9]\.[0-9a-z.-]+'` if [ -z "$automake_version" ] ; then warn "unable to determine automake version" else case $automake_version in 0.*|1.[0-8]|1.[0-8][.-]*) warn "automake ($automake_version) detected; 1.9 or newer recommended" ;; *) ;; esac fi set -ex $LIBTOOLIZE --copy --force aclocal -I m4 autoheader automake --add-missing --copy --foreign autoconf varnish-4.1.1/doc/0000755000201500234410000000000012652366773010752 500000000000000varnish-4.1.1/doc/Makefile.am0000644000201500234410000000063212652366721012720 00000000000000# # RST2ANY_FLAGS = --halt=2 EXTRA_DIST = changes.rst changes.html changes.html: changes.rst if HAVE_RST2HTML ${RST2HTML} ${RST2ANY_FLAGS} $? $@ else @echo "========================================" @echo "You need rst2html installed to make dist" @echo "========================================" @false endif # build graphviz before sphinx, so sphinx docs can use svg output SUBDIRS = graphviz sphinx varnish-4.1.1/doc/sphinx/0000755000201500234410000000000012652366762012261 500000000000000varnish-4.1.1/doc/sphinx/index.rst0000644000201500234410000000453512652366721014044 00000000000000 Varnish Administrator Documentation =================================== Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. Varnish Cache is really, really fast. It typically speeds up delivery with a factor of 300 - 1000x, depending on your architecture. To get started with Varnish-Cache we recommend that you read the installation guide :ref:`install-index`. Once you have Varnish up and running we recommend that you go through our tutorial - :ref:`tutorial-index`, and finally the :ref:`users-guide-index`. If you need to find out how to use a specific Varnish tool, the :ref:`reference-index` contains detailed documentation over the tools. Changes from previous versions are located in the :ref:`whats-new-index` chapter. In closing, we have :ref:`phk`, a collection of blog posts from Poul-Henning Kamp related to Varnish and HTTP. Conventions used in this manual include: ``service varnish restart`` A command you can run, or a shortkey you can press. Used either in the terminal or after starting one of the tools. `/usr/local/`, `varnishadm`, `sess_timeout` A utility, Varnish configurable parameter or path. https://www.varnish-cache.org/ A hyperlink. Longer listings like example command output and VCL look like this:: $ /opt/varnish/sbin/varnishd -V varnishd (varnish-trunk revision 199de9b) Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2015 Varnish Software AS .. For maintainers: .. * always write Varnish with a capital V: Varnish, Varnish Cache. .. * Write Varnish tools as their executable name: `varnishd`, `varnishadm`. .. * if part of a command actually runable by the reader, use double backticks: .. ``varnishd -f foo.c`` .. * wrap lines at 80 characters, ident with 4 spaces. No tabs, please. .. We use the following header indicators .. For titles: .. H1 .. %%%%% .. Title .. %%%%% .. H2 - H5 .. ====================== .. ---------------------- .. ~~~~~~~~~~~~~~~~~~~~~~ .. ...................... .. toctree:: :maxdepth: 1 installation/index.rst tutorial/index.rst users-guide/index.rst reference/index.rst whats-new/index.rst phk/index.rst glossary/index.rst Indices and tables ------------------ * :ref:`genindex` * :ref:`search` varnish-4.1.1/doc/sphinx/Makefile.am0000644000201500234410000001442512652366721014236 00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -W -q -N PAPER = a4 BUILDDIR = build ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees -D latex_paper_size=$(PAPER) $(SPHINXOPTS) $(builddir) .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* # use index.rst as an indicator if we have copied already .PHONY: link_srcdir link_srcdir: if test "x$(srcdir)" != "x$(builddir)" && test ! -f index.rst ; then \ d=`pwd`/$(builddir) ; \ cd $(srcdir) && find . -type f | cpio -ldmp $${d} ; \ fi # work around for make html called within doc/sphinx .PHONY: graphviz graphviz: cd ../graphviz && $(MAKE) html sphinx_prereq: link_srcdir graphviz conf.py html: sphinx_prereq $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: sphinx_prereq $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." pickle: sphinx_prereq $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: sphinx_prereq $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: sphinx_prereq $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: sphinx_prereq $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Varnish.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Varnish.qhc" latex: sphinx_prereq $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." changes: sphinx_prereq $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: sphinx_prereq $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: sphinx_prereq $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." EXTRA_DIST = \ conf.py \ index.rst \ include \ glossary \ installation \ phk \ tutorial \ users-guide \ whats-new dist-hook: $(MAKE) html rm -rf $(BUILDDIR)/doctrees cp -r $(BUILDDIR)/html $(distdir)/../ @ # Remove build artifacts. rm $(distdir)/../html/.buildinfo $(distdir)/../html/*.inv distclean-local: rm -rf $(BUILDDIR) include/params.rst: $(top_builddir)/bin/varnishd/varnishd $(top_builddir)/bin/varnishd/varnishd -x dumprstparam > include/params.rst BUILT_SOURCES = include/params.rst include/counters.rst: $(top_builddir)/bin/varnishstat/vsc2rst $(top_builddir)/bin/varnishstat/vsc2rst > $@ BUILT_SOURCES += include/counters.rst # XXX add varnishstat here when it's been _opt2rst'ed include/varnishncsa_options.rst: $(top_builddir)/bin/varnishncsa/varnishncsa_opt2rst $(top_builddir)/bin/varnishncsa/varnishncsa_opt2rst options > $@ include/varnishncsa_synopsis.rst: $(top_builddir)/bin/varnishncsa/varnishncsa_opt2rst $(top_builddir)/bin/varnishncsa/varnishncsa_opt2rst synopsis > $@ BUILT_SOURCES += include/varnishncsa_options.rst \ include/varnishncsa_synopsis.rst include/varnishlog_options.rst: $(top_builddir)/bin/varnishlog/varnishlog_opt2rst $(top_builddir)/bin/varnishlog/varnishlog_opt2rst options > $@ include/varnishlog_synopsis.rst: $(top_builddir)/bin/varnishlog/varnishlog_opt2rst $(top_builddir)/bin/varnishlog/varnishlog_opt2rst synopsis > $@ BUILT_SOURCES += include/varnishlog_options.rst \ include/varnishlog_synopsis.rst include/varnishtop_options.rst: $(top_builddir)/bin/varnishtop/varnishtop_opt2rst $(top_builddir)/bin/varnishtop/varnishtop_opt2rst options > $@ include/varnishtop_synopsis.rst: $(top_builddir)/bin/varnishtop/varnishtop_opt2rst $(top_builddir)/bin/varnishtop/varnishtop_opt2rst synopsis > $@ BUILT_SOURCES += include/varnishtop_options.rst \ include/varnishtop_synopsis.rst include/varnishhist_options.rst: $(top_builddir)/bin/varnishhist/varnishhist_opt2rst $(top_builddir)/bin/varnishhist/varnishhist_opt2rst options > $@ include/varnishhist_synopsis.rst: $(top_builddir)/bin/varnishhist/varnishhist_opt2rst $(top_builddir)/bin/varnishhist/varnishhist_opt2rst synopsis > $@ BUILT_SOURCES += include/varnishhist_options.rst \ include/varnishhist_synopsis.rst .PHONY: reference reference: test -d $@ || mkdir $@ BUILT_SOURCES += reference reference/vmod_std.generated.rst: reference $(top_builddir)/lib/libvmod_std/vmod_std.rst cp $(top_builddir)/lib/libvmod_std/vmod_std.rst $@ BUILT_SOURCES += reference/vmod_std.generated.rst reference/vmod_directors.generated.rst: reference $(top_builddir)/lib/libvmod_directors/vmod_directors.rst cp $(top_builddir)/lib/libvmod_directors/vmod_directors.rst $@ BUILT_SOURCES += reference/vmod_directors.generated.rst EXTRA_DIST += $(BUILT_SOURCES) MAINTAINERCLEANFILES = $(EXTRA_DIST) varnish-4.1.1/doc/sphinx/conf.py.in0000644000201500234410000001543312652366721014106 00000000000000# -*- coding: utf-8 -*- # # Varnish documentation build configuration file, created by # sphinx-quickstart on Tue Apr 20 13:02:15 2010. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.append(os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.todo'] # Add any paths that contain templates here, relative to this directory. templates_path = ['=templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Varnish Cache' copyright = u'2010-2014, 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 # built documents. # # The short X.Y version. version = '@VERSION@' # The full version, including alpha/beta/rc tags. release = '@VERSION@' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. #unused_docs = [] # List of directories, relative to source directory, that shouldn't be searched # for source files. exclude_patterns = ['build','include/*.rst','reference/vcl_var.rst'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # # topp background: #437EB2 # left column: #EEEEEE; # h3: #222222; # color: #222222; # a: #336590 html_theme_options = { "bgcolor" : "white", "relbarbgcolor" : "#437EB2", "relbartextcolor" : "white", "sidebarbgcolor" : "#EEEEEE", "sidebartextcolor" : "#222222", "sidebarlinkcolor" : "#336590", "textcolor" : "#222222", "linkcolor" : "#336590", # "codebgcolor" : "#EEEEEE", "codetextcolor" : "#222222", "headtextcolor" : "#222222", "headlinkcolor" : "#336590", } # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". html_title = "Varnish version @VERSION@ documentation" # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". #html_static_path = ['=static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. html_use_smartypants = False # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'Varnishdoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'Varnish.tex', u'Varnish Administrator documentation', u'Varnish Cache Project', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # Additional stuff for the LaTeX preamble. # latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True varnish-4.1.1/doc/sphinx/phk/0000755000201500234410000000000012652366721013036 500000000000000varnish-4.1.1/doc/sphinx/phk/vcl_expr.rst0000644000201500234410000000347012652366721015336 00000000000000.. _phk_vcl_expr: =============== VCL Expressions =============== I have been working on VCL expressions recently, and we are approaching the home stretch now. The data types in VCL are "sort of weird" seen with normal programming language eyes, in that they are not "general purpose" types, but rather tailored types for the task at hand. For instance, we have both a TIME and a DURATION type, a quite unusual constellation for a programming language. But in HTTP context, it makes a lot of sense, you really have to keep track of what is a relative time (age) and what is absolute time (Expires). Obviously, you can add a TIME and DURATION, the result is a TIME. Equally obviously, you can not add TIME to TIME, but you can subtract TIME from TIME, resulting in a DURATION. VCL do also have "naked" numbers, like INT and REAL, but what you can do with them is very limited. For instance you can multiply a duration by a REAL, but you can not multiply a TIME by anything. Given that we have our own types, the next question is what precedence operators have. The C programming language is famous for having a couple of gottchas in its precedence rules and given our limited and narrow type repetoire, blindly importing a set of precedence rules may confuse a lot more than it may help. Here are the precedence rules I have settled on, from highest to lowest precedence: Atomic 'true', 'false', constants function calls variables '(' expression ')' Multiply/Divide INT * INT INT / INT DURATION * REAL Add/Subtract STRING + STRING INT +/- INT TIME +/- DURATION TIME - TIME DURATION +/- DURATION Comparisons '==', '!=', '<', '>', '~' and '!~' string existence check (-> BOOL) Boolean not '!' Boolean and '&&' Boolean or '||' Input and feedback most welcome! Until next time, Poul-Henning, 2010-09-21 varnish-4.1.1/doc/sphinx/phk/thoughts.rst0000644000201500234410000000266312652366721015364 00000000000000.. _phk_thoughts: ========================= What were they thinking ? ========================= The reason I try to write these notes is the chinese wall. Ever since I first saw it on a school-book map, I have been wondering what the decision making process were like. We would like to think that the emperor asked for ideas, and that advisors came up with analyses, budgets, cost/benefit calculations and project plans for various proposals, and that the emperor applied his wisdom to choose the better idea. But it could also be, that The Assistant to The Deputy Viceminister of Northern Affairs, edged in sideways, at a carefully chosen time where the emperor looked relaxed and friendly, and sort of happend to mention that 50 villages had been sort of raided by the barbarians, hoping for the reply, which would not be a career opportunity for The Assistant to The Assistant to The Deputy Viceminister of Northern Affairs. And likely as not, the emperor absentmindedly grunted "Why don't you just build a wall to keep them out or something ?" probably wondering about the competence of an administration, which could not figure out to build palisades around border villages without bothering him and causing a monument to the Peter Principle and Parkinssons Law to be built, which can be seen from orbit, and possibly from the moon, if you bring your binoculars. If somebody had written some notes, we might have known. Poul-Henning, 2010-05-28 varnish-4.1.1/doc/sphinx/phk/http20.rst0000644000201500234410000002740512652366721014641 00000000000000.. _phk_http20_lack_of_interest: ====================================== Why HTTP/2.0 does not seem interesting ====================================== This is the email I sent to the IETF HTTP Working Group:: From: Poul-Henning Kamp Subject: HTTP/2 Expression of luke-warm interest: Varnish To: HTTP Working Group Message-Id: <41677.1342136900@critter.freebsd.dk> Date: Thu, 12 Jul 2012 23:48:20 GMT This is Varnish' response to the call for expression of interest in HTTP/2[1]. Varnish ------- Presently Varnish[2] only implements a subset of HTTP/1.1 consistent with its hybrid/dual "http-server" / "http-proxy" role. I cannot at this point say much about what Varnish will or will not implement protocol wise in the future. Our general policy is to only add protocols if we can do a better job than the alternative, which is why we have not implemented HTTPS for instance. Should the outcome of the HTTP/2.0 effort result in a protocol which gains traction, Varnish will probably implement it, but we are unlikely to become an early implementation, given the current proposals at the table. Why I'm not impressed --------------------- I have read all, and participated in one, of the three proposals presently on the table. Overall, I find all three proposals are focused on solving yesteryears problems, rather than on creating a protocol that stands a chance to last us the next 20 years. Each proposal comes out of a particular "camp" and therefore all seem to suffer a certain amount from tunnel-vision. It is my considered opinion that none of the proposals have what it will take to replace HTTP/1.1 in practice. What if they made a new protocol, and nobody used it ? ------------------------------------------------------ We have learned, painfully, that an IPv6 which is only marginally better than IPv4 and which offers no tangible benefit for the people who have the cost/trouble of the upgrade, does not penetrate the network on its own, and barely even on governments mandate. We have also learned that a protocol which delivers the goods can replace all competition in virtually no time. See for instance how SSH replaced TELNET, REXEC, RSH, SUPDUP, and to a large extent KERBEROS, in a matter of a few years. Or I might add, how HTTP replaced GOPHER[3]. HTTP/1.1 is arguably in the top-five most used protocols, after IP, TCP, UDP and, sadly, ICMP, and therefore coming up with a replacement should be approached humbly. Beating HTTP/1.1 ---------------- Fortunately, there are many ways to improve over HTTP/1.1, which lacks support for several widely used features, and sports many trouble-causing weeds, both of which are ripe for HTTP/2.0 to pounce on. Most notably HTTP/1.1 lacks a working session/endpoint-identity facility, a shortcoming which people have pasted over with the ill-conceived Cookie hack. Cookies are, as the EU commission correctly noted, fundamentally flawed, because they store potentially sensitive information on whatever computer the user happens to use, and as a result of various abuses and incompetences, EU felt compelled to legislate a "notice and announce" policy for HTTP-cookies. But it doesn't stop there: The information stored in cookies have potentially very high value for the HTTP server, and because the server has no control over the integrity of the storage, we are now seeing cookies being crypto-signed, to prevent forgeries. The term "bass ackwards" comes to mind. Cookies are also one of the main wasters of bandwidth, disabling caching by default, sending lots of cookies were they are are not needed, which made many sites register separate domains for image content, to "save" bandwidth by avoiding cookies. The term "not really helping" also comes to mind. In my view, HTTP/2.0 should kill Cookies as a concept, and replace it with a session/identity facility, which makes it easier to do things right with HTTP/2.0 than with HTTP/1.1. Being able to be "automatically in compliance" by using HTTP/2.0 no matter how big dick-heads your advertisers are or how incompetent your web-developers are, would be a big selling point for HTTP/2.0 over HTTP/1.1. However, as I read them, none of the three proposals try to address, much less remedy, this situation, nor for that matter any of the many other issues or troubles with HTTP/1.x. What's even worse, they are all additive proposals, which add a new layer of complexity without removing any of the old complexity from the protocol. My conclusion is that HTTP/2.0 is really just a grandiose name for HTTP/1.2: An attempt to smooth out some sharp corners, to save a bit of bandwidth, but not get anywhere near all the architectural problems of HTTP/1.1 and to preserve faithfully its heritage of badly thought out sedimentary hacks. And therefore, I don't see much chance that the current crop of HTTP/2.0 proposals will fare significantly better than IPv6 with respect to adoption. HTTP Routers ------------ One particular hot-spot in the HTTP world these days is the "load-balancer" or as I prefer to call it, the "HTTP router". These boxes sit at the DNS resolved IP numbers and distributes client requests to a farm of HTTP servers, based on simple criteria such as "Host:", URI patterns and/or server availability, sometimes with an added twist of geo-location[4]. HTTP routers see very high traffic densities, the highest traffic densities, because they are the focal point of DoS mitigation, flash mobs and special event traffic spikes. In the time frame where HTTP/2.0 will become standardized, HTTP routers will routinely deal with 40Gbit/s traffic and people will start to architect for 1Tbit/s traffic. HTTP routers are usually only interested in a small part of the HTTP request and barely in the response at all, usually only the status code. The demands for bandwidth efficiency has made makers of these devices take many unwarranted shortcuts, for instance assuming that requests always start on a packet boundary, "nulling out" HTTP headers by changing the first character and so on. Whatever HTTP/2.0 becomes, I strongly urge IETF and the WG to formally recognize the role of HTTP routers, and to actively design the protocol to make life easier for HTTP routers, so that they can fulfill their job, while being standards compliant. The need for HTTP routers does not disappear just because HTTPS is employed, and serious thought should be turned to the question of mixing HTTP and HTTPS traffic on the same TCP connection, while allowing a HTTP router on the server side to correctly distribute requests to different servers. One simple way to gain a lot of benefit for little cost in this area, would be to assign "flow-labels" which each are restricted to one particular Host: header, allowing HTTP routers to only examine the first request on each flow. SPDY ---- SPDY has come a long way, and has served as a very worthwhile proof of concept prototype, to document that there are gains to be had. But as Frederick P. Brooks admonishes us: Always throw the prototype away and start over, because you will throw it away eventually, and doing so early saves time and effort. Overall, I find the design approach taken in SPDY deeply flawed. For instance identifying the standardized HTTP headers, by a 4-byte length and textual name, and then applying a deflate compressor to save bandwidth is totally at odds with the job of HTTP routers which need to quickly extract the Host: header in order to route the traffic, preferably without committing extensive resources to each request. It is also not at all clear if the built-in dictionary is well researched or just happens to work well for some subset of present day websites, and at the very least some kind of versioning of this dictionary should be incorporated. It is still unclear for me if or how SPDY can be used on TCP port 80 or if it will need a WKS allocation of its own, which would open a ton of issues with firewalling, filtering and proxying during deployment. (This is one of the things which makes it hard to avoid the feeling that SPDY really wants to do away with all the "middle-men") With my security-analyst hat on, I see a lot of DoS potential in the SPDY protocol, many ways in which the client can make the server expend resources, and foresee a lot of complexity in implementing the server side to mitigate and deflect malicious traffic. Server Push breaks the HTTP transaction model, and opens a pile of cans of security and privacy issues, which would not be sneaked in during the design of a transport-encoding for HTTP/1+ traffic, but rather be standardized as an independent and well analysed extension to HTTP in general. HTTP Speed+Mobility ------------------- Is really just SPDY with WebSockets underneath. I'm really not sure I see any benefit to that, except that the encoding chosen is marginally more efficient to implement in hardware than SPDY. I have not understood why it has "mobility" in the name, a word which only makes an appearance in the ID as part of the name. If the use of the word "mobility" only refers only to bandwidth usage, I would call its use borderline-deceptive. If it covers session stability across IP# changes for mobile devices, I have missed it in my reading. draft-tarreau-httpbis-network-friendly-00 ----------------------------------------- I have participated a little bit in this draft initially, but it uses a number of concepts which I think are very problematic for high performance (as in 1Tbit/s) implementations, for instance variant-size length fields etc. I do think the proposal is much better than the other two, taking a much more fundamental view of the task, and if for no other reason, because it takes an approach to bandwidth-saving based on enumeration and repeat markers, rather than throwing everything after deflate and hope for a miracle. I think this protocol is the best basis to start from, but like the other two, it has a long way to go, before it can truly earn the name HTTP/2.0. Conclusion ---------- Overall, I don't see any of the three proposals offer anything that will make the majority of web-sites go "Ohh we've been waiting for that!" Bigger sites will be enticed by small bandwidth savings, but the majority of the HTTP users will see scant or no net positive benefit if one or more of these three proposals were to become HTTP/2.0 Considering how sketchy the HTTP/1.1 interop is described it is hard to estimate how much trouble (as in: "Why doesn't this website work ?") their deployment will cause, nor is it entirely clear to what extent the experience with SPDY is representative of a wider deployment or only of 'flying under the radar' with respect to people with an interest in intercepting HTTP traffic. Given the role of HTTP/1.1 in the net, I fear that the current rush to push out a HTTP/2.0 by purely additive means is badly misguided, and approaching a critical mass which will delay or prevent adoption on its own. At the end of the day, a HTTP request or a HTTP response is just some metadata and an optional chunk of bytes as body, and if it already takes 700 pages to standardize that, and HTTP/2.0 will add another 100 pages to it, we're clearly doing something wrong. I think it would be far better to start from scratch, look at what HTTP/2.0 should actually do, and then design a simple, efficient and future proof protocol to do just that, and leave behind all the aggregations of badly thought out hacks of HTTP/1.1. But to the extent that the WG produces a HTTP/2.0 protocol which people will start to use, the Varnish project will be interested. Poul-Henning Kamp Author of Varnish [1] http://trac.tools.ietf.org/wg/httpbis/trac/wiki/Http2CfI [2] https://www.varnish-cache.org/ [3] Yes, I'm that old. [4] Which is really a transport level job, but it was left out of IPv6 along with other useful features, to not delay adoption[5]. [5] No, I'm not kidding. varnish-4.1.1/doc/sphinx/phk/brinch_hansens_arrows_1.svg0000644000201500234410000007301212652366721020303 00000000000000 %3 ROOT ROOT lck_cli lck_cli ROOT->lck_cli cli_cb_before(81) lck_vbe lck_vbe ROOT->lck_vbe VBE_Delete(172) lck_exp lck_exp ROOT->lck_exp exp_thread(588) lck_backend lck_backend ROOT->lck_backend vbe_dir_finish(185) ROOT->lck_backend vbp_thread(361) lck_objhdr lck_objhdr ROOT->lck_objhdr hcb_deref(401) ROOT->lck_objhdr hcl_lookup(141) ROOT->lck_objhdr hcb_lookup(438) ROOT->lck_objhdr HSH_Unbusy(702) ROOT->lck_objhdr HSH_DerefObjCore(778) lck_ban lck_ban ROOT->lck_ban ban_lurker_getfirst(1019) lck_lru lck_lru ROOT->lck_lru EXP_NukeOne(333) lck_smp lck_smp ROOT->lck_smp smp_open(328) lck_cli->lck_vbe VRT_new_backend(100) lck_cli->lck_vbe backend_find(243) lck_cli->lck_vbe VBE_Delete(172) lck_vcl lck_vcl lck_cli->lck_vcl VCL_AddBackend(195) lck_cli->lck_vcl VCL_Load(466) lck_cli->lck_vcl ccf_config_use(617) lck_cli->lck_vcl VCL_Get(134) lck_cli->lck_vcl VCL_Rel(177) lck_cli->lck_vcl ccf_config_discard(579) lck_cli->lck_backend vbp_update_backend(158) lck_cli->lck_backend VBP_Control(525) lck_cli->lck_backend VBP_Remove(578) lck_cli->lck_ban BAN_Insert(533) lck_cli->lck_ban BAN_Insert(572) lck_cli->lck_ban BAN_TailRef(210) lck_cli->lck_ban BAN_TailDeref(225) lck_cli->lck_ban ccf_ban_list(1312) lck_cli->lck_smp debug_persistent(653) lck_backend_tcp lck_backend_tcp lck_vbe->lck_backend_tcp VBT_Rel(193) lck_wstat lck_wstat lck_exp->lck_wstat Pool_Sumstat(72) lck_backend->lck_backend_tcp VBT_Recycle(264) lck_wq lck_wq lck_backend->lck_wq Pool_Task_Any(98) lck_backend->lck_wq Pool_Task(231) lck_waiter lck_waiter lck_backend_tcp->lck_waiter vwk_enter(147) lck_objhdr->lck_exp exp_mail_it(145) lck_hcb lck_hcb lck_objhdr->lck_hcb hcb_deref(405) lck_objhdr->lck_ban BAN_CheckObject(927) lck_objhdr->lck_ban BAN_CheckObject(948) lck_objhdr->lck_lru EXP_Rearm(299) lck_objhdr->lck_wq Pool_Task(231) lck_objhdr->lck_smp smp_oc_getobj(425) lck_objhdr? lck_objhdr? lck_ban->lck_objhdr? ban_lurker_getfirst(1029) lck_lru->lck_objhdr? EXP_NukeOne(352) lck_smp->lck_ban BAN_Reload(773) lck_smp->lck_ban BAN_TailRef(210) varnish-4.1.1/doc/sphinx/phk/varnish_does_not_hash.rst0000644000201500234410000001207712652366721020066 00000000000000.. _phk_varnish_does_not_hash: ===================== Varnish Does Not Hash ===================== A spate of security advisories related to hash-collisions have made a lot of people stare at Varnish and wonder if it is affected. The answer is no, but the explanation is probably not what most of you expected: Varnish does not hash, at least not by default, and even if it does, it's still as immune to the attacks as can be. To understand what is going on, I have to introduce a concept from Shannon's information theory: "entropy." Entropy is hard to explain, and according to legend, that is exactly why Shannon recycled that term from thermodynamics. In this context, we can get away with thinking about entropy as how much our "keys" differ:: Low entropy (1 bit): /foo/bar/barf/some/cms/content/article?article=2 /foo/bar/barf/some/cms/content/article?article=3 High entropy (65 bits): /i?ee30d0770eb460634e9d5dcfb562a2c5.html /i?bca3633d52607f38a107cb5297fd66e5.html Hashing consists of calculating a hash-index from the key and storing the objects in an array indexed by that key. Typically, but not always, the key is a string and the index is a (smallish) integer, and the job of the hash-function is to squeeze the key into the integer, without losing any of the entropy. Needless to say, the more entropy you have to begin with, the more of it you can afford to lose, and lose some you almost invariably will. There are two families of hash-functions, the fast ones, and the good ones, and the security advisories are about the fast ones. The good ones are slower, but probably not so much slower that you care, and therefore, if you want to fix your web-app: Change:: foo=somedict[$somekey] To:: foo=somedict[md5($somekey)] and forget about the advisories. Yes, that's right: Cryptographic hash algorithms are the good ones, they are built to not throw any entropy away, and they are built to have very hard to predict collisions, which is exactly the problem with the fast hash-functions in the advisories. ----------------- What Varnish Does ----------------- The way to avoid having hash-collisions is to not use a hash: Use a tree instead. There every object has its own place and there are no collisions. Varnish does that, but with a twist. The "keys" in Varnish can be very long; by default they consist of:: sub vcl_hash { hash_data(req.url); if (req.http.host) { hash_data(req.http.host); } else { hash_data(server.ip); } return (hash); } But some users will add cookies, user identification and many other bits and pieces of string in there, and in the end the keys can be kilobytes in length, and quite often, as in the first example above, the first difference may not come until pretty far into the keys. Trees generally need to have a copy of the key around to be able to tell if they have a match, and more importantly to compare tree-leaves in order to "re-balance" the tree and other such arcanae of data structures. This would add another per-object memory load to Varnish, and it would feel particularly silly to store 48 identical characters for each object in the far too common case seen above. But furthermore, we want the tree to be very fast to do lookups in, preferably it should be lockless for lookups, and that means that we cannot (realistically) use any of the "smart" trees which automatically balance themselves, etc. You (generally) don't need a "smart" tree if your keys look like random data in the order they arrive, but we can pretty much expect the opposite as article number 4, 5, 6 etc are added to the CMS in the first example. But we can make the keys look random, and make them small and fixed size at the same time, and the perfect functions designed for just that task are the "good" hash-functions, the cryptographic ones. So what Varnish does is "key-compression": All the strings fed to hash_data() are pushed through a cryptographic hash algorithm called SHA256, which, as the name says, always spits out 256 bits (= 32 bytes), no matter how many bits you feed it. This does not eliminate the key-storage requirement, but now all the keys are 32 bytes and can be put directly into the data structure:: struct objhead { [...] unsigned char digest[DIGEST_LEN]; }; In the example above, the output of SHA256 for the 1 bit difference in entropy becomes:: /foo/bar/barf/some/cms/content/article?article=2 -> 14f0553caa5c796650ec82256e3f111ae2f20020a4b9029f135a01610932054e /foo/bar/barf/some/cms/content/article?article=3 -> 4d45b9544077921575c3c5a2a14c779bff6c4830d1fbafe4bd7e03e5dd93ca05 That should be random enough. But the key-compression does introduce a risk of collisions, since not even SHA256 can guarantee different outputs for all possible inputs: Try pushing all the possible 33-byte files through SHA256 and sooner or later you will get collisions. The risk of collision is very small however, and I can all but promise you, that you will be fully offset in fame and money for any inconvenience a collision might cause, because you will be the first person to find a SHA256 collision. Poul-Henning, 2012-01-03 varnish-4.1.1/doc/sphinx/phk/persistent.rst0000644000201500234410000000645012652366721015715 00000000000000.. _phk_pesistent: ==================== A persistent message ==================== This message is about -spersistent and why you should not use it, even though it is still present in Varnish 4.x. TL;DR: ------ Under narrow and ill defined circumstances, -spersistent works well, but in general it is more trouble than it is worth for you to run it, and we don't presently have the development resources to fix that. If you think you have these circumstances, you need to specify -sdeprecated_persistent in order to use it. The long story -------------- When we added -spersistent, to Varnish, it was in response to, and sponsored by a specific set of customers who really wanted this. A persistent storage module is an entirely different kettle of vax than a non-persistent module, because of all the ugly consistency issues it raises. Let me give you an example. Imagine a cluster of some Varnish servers on which bans are used. Without persistent storage, if one of them goes down and comes back up, all the old cached objects are gone, and so are, by definition all the banned objects. With persistent storage, we not only have to store the still live bans with the cached objects, and keep the two painfully in sync, so the bans gets revived with the objects, we also have to worry about missing bans during the downtime, since those might ban objects we will recover on startup. Ouch: Straight into database/filesystem consistency territory. But we knew that, and I thought I had a good strategy to deal with this. And in a sense I did. Varnish has the advantage over databases and filesystems that we can actually loose objects without it being a catastrophy. It would be better if we didn't, but we can simply ditch stuff which doesn't look consistent and we'll be safe. The strategy was to do a "Log Structured Filesystem", a once promising concept which soon proved very troublesome to implement well. Interestingly, today the ARM chip in your SSD most likely implements a LFS for wear-levelling, but with a vastly reduced feature set: All "files" are one sector long, filenames are integers and there are no subdirectories or rename operations. On the other hand, there is extra book-keeping about the state of the flash array. A LFS consists of two major components: The bit that reads and writes, which is pretty trivial, and the bit which makes space available which isn't. Initially we didn't even do the second part, because in varnish objects expire, and provided they do so fast enough, the space will magically make itself available. This worked well enough for our initial users, and they only used bans sporadically so that was cool too. In other words, a classic 20% effort, 80% benefit. Unfortunately we have not been able to find time and money for the other 80% effort which gives the last 20% benefit, and therefor -spersistent has ended up in limbo. Today we decided to officially deprecate -spersistent, and start warning people against using it, but we will leave it in the source code for now, in order to keep the interfaces necessary for a persistent storage working, in the hope that we will get to use them again later. So you can still use persistent storage, if you really want to, and if you know what you're doing, by using: -sdeprecated_persistent You've been warned. Poul-Henning, 2014-05-26 varnish-4.1.1/doc/sphinx/phk/ssl_again.rst0000644000201500234410000001350212652366721015451 00000000000000.. _phk_ssl_again: ============= SSL revisited ============= Four years ago, I wrote a rant about why Varnish has no SSL support (:ref:`phk_ssl`) and the upcoming 4.1 release is good excuse to revisit that issue. A SSL/TLS library ~~~~~~~~~~~~~~~~~ In 2011 I critized OpenSSL's source-code as being a nightmare, and as much as I Hate To Say I Told You So, I Told You So: See also "HeartBleed". The good news is that HeartBleed made people realize that FOSS maintainers also have mortgages and hungry kids. Various initiatives have been launched to make prevent critical infrastructure software from being maintained sunday evening between 11 and 12PM by a sleep-deprived and overworked parent, worried about about being able to pay the bills come the next month. We're not there yet, but it's certainly getting better. However, implementing TLS and SSL is stil insanely complex, and thanks to Edward Snowdens whistle-blowing, we have very good reasons to belive that didn't happen by accident. The issue of finding a good TLS/SSL implementation is still the same and I still don't see one I would want my name associated with. OpenBSD's LibreSSL is certainly a step in a right direction, but time will show if it is viable in the long run -- they do have a tendency to be -- "SQUIRREL!!" -- distracted. Handling Certificates ~~~~~~~~~~~~~~~~~~~~~ I still don't see a way to do that. The Varnish worker-process is not built to compartementalize bits at a cryptographic level and making it do that would be a non-trivial undertaking. But there is new loop-hole here. One night, waiting for my flight home in Oslo airport, I went though the entire TLS/SSL handshake process to see if there were anything one could do, and I realized that you can actually terminate TLS/SSL without holding the certificate, provided you can ask some process which does to do a tiny bit of work. The next morning `CloudFlare announced the very same thing`_: .. _CloudFlare announced the very same thing: https://blog.cloudflare.com/keyless-ssl-the-nitty-gritty-technical-details/ This could conceivably be a way to terminate TLS/SSL in the Varnish-worker process, while keeping the most valuable crypto-bits away from it. But it's still a bad idea ~~~~~~~~~~~~~~~~~~~~~~~~~ As I write this, the news that `apps with 350 million downloads`_ in total are (still) vulnerable to some SSL/TLS Man-In-The-Middle attack is doing the rounds. .. _apps with 350 million downloads: http://arstechnica.com/security/2015/04/27/android-apps-still-suffer-game-over-https-defects-7-months-later/ Code is hard, crypto code is double-plus-hard, if not double-squared-hard, and the world really don't need another piece of code that does an half-assed job at cryptography. If I, or somebody else, were to implement SSL/TLS in Varnish, it would talk at least half a year to bring the code to a point where I would be willing to show it to the world. Until I get my time-machine working, that half year would be taken away of other Varnish development, so the result had better be worth it: If it isn't, we have just increased the total attack-surface and bug-probability for no better reason than "me too!". When I look at something like Willy Tarreau's `HAProxy`_ I have a hard time to see any significant opportunity for improvement. .. _HAProxy: http://www.haproxy.org/ Conclusion ~~~~~~~~~~ No, Varnish still won't add SSL/TLS support. Instead in Varnish 4.1 we have added support for Willys `PROXY`_ protocol which makes it possible to communicate the extra details from a SSL-terminating proxy, such as `HAProxy`_, to Varnish. .. _PROXY: http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt From a security point of view, this is also much better solution than having SSL/TLS integrated in Varnish. When (not if!) the SSL/TLS proxy you picked is compromised by a possibly planted software bug, you can pick another one to replace it, without loosing all the benefits of Varnish. That idea is called the "Software Tools Principle", it's a very old idea, but it is still one of the best we have. Political PostScript ~~~~~~~~~~~~~~~~~~~~ I realize that the above is a pretty strange stance to take in the current "SSL Everywhere" political climate. I'm not too thrilled about the "SSL Everywhere" idea, for a large number of reasons. The most obvious example is that you don't want to bog down your country's civil defence agency with SSL/TLS protocol negotiations, if their website is being deluged by people trying to survive a natural disaster. The next big issue is that there are people who do not have a right to privacy. In many countries this includes children, prisoners, stock-traders, flight-controllers, first responders and so on. SSL Everywhere will force institutions to either block any internet connectivity or impose Man-in-The-Middle proxies to comply with legal requirements of logging and inspection. A clear step in the wrong direction in my view. But one of the biggest problem I have with SSL Everywhere is that it gives privacy to the actors I think deserve it the least. Again and again shady behaviour of big transnational, and therefore law-less, companies have been exposed by security researchers (or just interested lay-people) who ran tcpdump. snort or similar traffic capture programs and saw what went on. Remember all the different kind of "magic cookies" used to track users across the web, against their wish and against laws and regulations ? Pretty much all of those were exposed with trivial packet traces. With SSL Everywhere, these actors get much more privacy to invade the privacy of every human being with an internet connection, because it takes a lot more skill to look into a SSL connection than a plaintext HTTP connection. "Sunshine is said to be the best of disinfectantants" wrote supreme court justice Brandeis, SSL Everywhere puts all traffic in the shade. Poul-Henning, 2015-04-28 varnish-4.1.1/doc/sphinx/phk/index.rst0000644000201500234410000000073412652366721014623 00000000000000.. _phk: Poul-Hennings random outbursts ============================== You may or may not want to know what Poul-Henning thinks. .. toctree:: :maxdepth: 1 brinch-hansens-arrows.rst ssl_again.rst persistent.rst dough.rst wanton_destruction.rst spdy.rst http20.rst varnish_does_not_hash.rst thetoolsweworkwith.rst three-zero.rst ssl.rst gzip.rst vcl_expr.rst ipv6suckage.rst backends.rst platforms.rst barriers.rst thoughts.rst autocrap.rst sphinx.rst varnish-4.1.1/doc/sphinx/phk/thetoolsweworkwith.rst0000644000201500234410000001751312652366721017513 00000000000000.. _phk_thetoolsweworkwith: ====================== The Tools We Work With ====================== "Only amateurs were limited by their tools" is an old wisdom, and the world is littered with art and architecture that very much proves this point. But as amazing as the Aquaeduct of Segovia is, tools are the reason why it looks nowhere near as fantastic as the Sydney Opera House. Concrete has been known since antiquity, but steel-reinforced concrete and massive numerical calculations of stress-distribution, is the tools that makes the difference between using concrete as a filler material between stones, and as gravity-defying curved but perfectly safe load-bearing wall. My tool for writing Varnish is the C-language which in many ways is unique amongst all of the computer programming languages for having no ambitions. The C language was invented as a portable assembler language, it doesn't do objects and garbage-collection, it does numbers and pointers, just like your CPU. Compared to the high ambitions, then as now, of new programming languages, that was almost ridiculous unambitious. Other people were trying to make their programming languages provably correct, or safe for multiprogramming and quite an effort went into using natural languages as programming languages. But C was written to write programs, not to research computer science and that's exactly what made it useful and popular. Unfortunately C fell in bad company over the years, and the reason for this outburst is that I just browsed the latest draft from the ISO-C standardisation working-group 14. I won't claim that it is enough to make grown men cry, but it certainly was enough to make me angry. Let me give you an example of their utter sillyness: The book which defined the C langauge had a list af reserved identifiers, all of them lower-case words. The UNIX libraries defined a lot of functions, all of them lower-case words. When compiled, the assembler saw all of these words prefixed with an underscore, which made it easy to mix assembler and C code. All the macros for the C-preprocessor on the other hand, were UPPERCASE, making them easy to spot. Which meant that if you mixed upper and lower case, in your identifiers, you were safe: That wouldn't collide with anything. First the ISO-C standards people got confused about the leading underscore, and I'll leave you guessing as to what the current text actually means: All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use. Feel free to guess, there's more such on pdf page 200 of the draft. Next, they broke the upper/lower rule, by adding special keywords in mixed case, probably because they thought it looked nicer:: _Atomic, _Bool, _Noreturn &c Then, presumably, somebody pointed out that this looked ugly:: void _Noreturn foo(int bar); So they have come up with a #include file called so that instead you can write:: #include void noreturn foo(int bar); The file according to the standard shall have exactly this content:: #define noreturn _Noreturn Are you crying or laughing yet ? You should be. Another thing brought by the new draft is an entirely new thread API, which is incompatible with the POSIX 'pthread' API which have been used for about 20 years now. If they had improved on the shortcomings of the pthreads, I would have cheered them on, because there are some very annoying mistakes in pthreads. But they didn't, in fact, as far as I can tell, the C1X draft's threads are worse than the 20 years older pthreads in all relevant aspects. For instance, neither pthreads nor C1X-threads offer a "assert I'm holding this mutex locked" facility. I will posit that you cannot successfully develop real-world threaded programs and APIs without that, or without wasting a lot of time debugging silly mistakes. If you look in the Varnish source code, which uses pthreads, you will see that I have wrapped pthread mutexes in my own little datastructure, to be able to do those asserts, and to get some usable statistics on lock-contention. Another example where C1X did not improve on pthreads at all, was in timed sleeps, where you say "get me this lock, but give up if it takes longer than X time". The way both pthreads and C1X threads do this, is you specify a UTC wall clock time you want to sleep until. The only problem with that is that UTC wall clock time is not continuous when implemented on a computer, and it may not even be monotonously increasing, since NTPD or other timesync facilites may step the clock backwards, particularly in the first minutes after boot. If the practice of saying "get me this lock before 16:00Z" was widespread, I could see the point, but I have actually never seen that in any source code. What I have seen are wrappers that take the general shape of:: int get_lock_timed(lock, timeout) { while (timeout > 0) { t0 = time(); i = get_lock_before(lock, t + timeout)); if (i == WASLOCKED) return (i); t1 = time(); timeout -= (t1 - t0); } return (TIMEDOUT); } Because it's not like the call is actually guaranteed to return at 16:00Z if you ask it to, you are only promised it will not return later than that, so you have to wrap the call in a loop. Whoever defined the select(2) and poll(2) systemcalls knew better than the POSIX and ISO-C group-think: They specifed a maximum duration for the call, because then it doesn't matter what time it is, only how long time has transpired. Ohh, and setting the stack-size for a new thread ? That is apparently "too dangerous" so there is no argument in the C1X API for doing so, a clear step backwards from pthreads. But guess what: Thread stacks are like T-shirts: There is no "one size fits all." I have no idea what the "danger" they perceived were, my best guess is that feared it might make the API useful ? This single idiocy will single-handedly doom the C1X thread API to uselessness. Now, don't get me wrong: There are lot of ways to improve the C language that would make sense: Bitmaps, defined structure packing (think: communication protocol packets), big/little endian variables (data sharing), sensible handling of linked lists etc. As ugly as it is, even the printf()/scanf() format strings could be improved, by offering a sensible plugin mechanism, which the compiler can understand and use to issue warnings. Heck, even a simple basic object facility would be good addition, now that C++ have become this huge bloated monster language. But none of that is apparently as important as and a new, crippled and therefore useless thread API. The neat thing about the C language, and the one feature that made it so popular, is that not even an ISO-C working group can prevent you from implementing all these things using macros and other tricks. But it would be better to have them in the language, so the compiler could issue sensible warnings and programmers won't have to write monsters like:: #define VTAILQ_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.vtqe_prev = (listelm)->field.vtqe_prev; \ VTAILQ_NEXT((elm), field) = (listelm); \ *(listelm)->field.vtqe_prev = (elm); \ (listelm)->field.vtqe_prev = &VTAILQ_NEXT((elm), field); \ } while (0) To put an element on a linked list. I could go on like this, but it would rapidly become boring for both you and me, because the current C1X draft is 701 pages, and it contains not a single explanatory example if how to use any of the verbiage in practice. Compare this with The C Programming Language, a book of 274 pages which in addition to define the C language, taught people how to program through well-thought-out examples. From where I sit, ISO WG14 are destroying the C language I use and love. Poul-Henning, 2011-12-20 varnish-4.1.1/doc/sphinx/phk/dough.rst0000644000201500234410000002545312652366721014627 00000000000000.. _phk_dough: ==================================================== Raking in the dough on Free and Open Source Software ==================================================== I'm writing this on the third day after the "Heartbleed" bug in OpenSSL devasted internet security, and while I have been very critical of the OpenSSL source code since I first saw it, I have nothing but admiration for the OpenSSL crew and their effort. In particular considering what they're paid for it. Inspired by an article in `Wall Street Journal`_ which tangentially touches on the lack of funding for OpenSSL development, I have decided to write up my own experiences with funding Open Source Software development in some detail. I've been in the software industry for 30 years now, and I have made a living more or less directly from Open Source Software for the most recent 15 years. Sometimes the money came from helping a customer use Open Source Software, some times I wrote the Open Source Software for their needs and sometimes, as with the `Varnish Moral License`_ I get paid to develop and maintain Open Source Software for the greater common good. FreeBSD community funding ========================= My first crowd-funding of Free and Open Source Software, was in 2004, where I `solicited the FreeBSD community`_ for money, so that I could devote three to six months of my time to the FreeBSD disk-I/O subsystem. At that time I had spent 10 years as one of the central and key FreeBSD developers, so there were no question about my ability or suitability for the task at hand. But in 2004 crowd-funding was not yet "in", and I had to figure out how to do it myself. My parents brought me up to think that finances is a private matter but I concluded that the only way you could ask strangers to throw money at you, would be to run an open book, where they could see what happened to them, so I did open books. My next dilemma was about my rate, again I had always perceived my rate to be a private matter between me and my customers. My rate is about half of what most people expect -- because I wont work for most people: I only work on things I really *care* about. One of my worries therefore were that publishing my rate would undercut friends and colleagues in the FreeBSD project who made a living consulting. But again, there were no way around it, so I published my rate but made every attempt to distinguish it from a consulting rate, and I never heard any complaints. And so, having agonized over the exact text and sounded it off on a couple of close friends in the FreeBSD project, I threw the proposal out there -- and wondered what would happen next. I had a perfectly safe fall-back plan, you have to when you have two kids and a mortgage to feed, but I really had no idea what would happen. Worst case, I'd cause the mother of all `bikesheds`_ get thrown out of the FreeBSD project, and be denounced for my "ideological impurity" with respect to Free and Open Source Software. Best case, I expected to get maybe one or two months funded. The FreeBSD community responded overwhelmingly, my company has never sent as many invoices as it did in 2004, and my accountant nearly blew a fuse. And suddenly I found myself in a situation I had never even considered how to handle: How to stop people from sending me money. I had simply set up a PayPal account, (more on that in a bit), and at least at that time, there were no way to prevent people from dropping money into it, no matter how much you wanted to stop them. In the end I managed to yell loud enough and only got overfunded a few percent, and I belive that my attempt to deflect the surplus to the FreeBSD Foundation gave them a little boost that year. So about PayPal: The first thing they did was to shut my account, and demand all kinds of papers to be faxed to them, including a copy of my passport, despite the fact that Danish law was quite clear on that being illegal. Then, as now, their dispute resolution process was less than user-friendly, and in the end it took an appeal to a high-ranking officer in PayPal and quite a bit of time to actually get the money people had donated. I swore to myself that next time, if there ever came a next time, PayPal would not be involved. Besides, I found their fees quite excessive. In total I made EUR27K, and it kept my kids fed and my bank happy for the six months I worked on it. And work I did. I've never had a harsher boss than those six months, and it surprised me how much it stressed me, because I felt like I was working on a stage, with the entire FreeBSD project in audience, wondering if I were going to deliver the goods or not. As a result, the 187 donors certainly got their moneys worth, most of that half year I worked 80 hour weeks, which made me decide not to continue, despite many donors indicating that they were perfectly willing to fund several more months. Varnish community funding ========================= Five years later, having developed Varnish 1.0 for Norways "Verdens Gang" newspaper, I decided to give community funding a go again. Wiser from experience, I structured the `Varnish Moral License`_ to tackle the issues which had caused me grief the first time around: Contact first, then send money, not the other way around, and also a focus on fewer larger sponsors, rather than people sending me EUR10 or USD15 or even, in one case, the EUR1 which happened to linger in his PayPal Account. I ran even more open books this time, on the VML webpages you can see how many hours and a one-line description of what I did in them, for every single day I've been working under the VML since 2010. I also decided to be honest with myself and my donors, one hour of work was one hour of work -- nobody would benefit from me dying from stress. In practice it doesn't quite work like that, there are plenty of thinking in the shower, emails and IRC answers at all hours of the day and a lot of "just checking a detail" that happens off the clock, because I like my job, and nothing could stop me anyway. In each of 2010, 2011 and 2013 I worked around 950 hours work on Varnish, funded by the community. In 2012 I only worked 589 hours, because I was building a prototype computer cluster to do adaptive optics real-time calculations for the ESO `Extremely Large Telescope`_ ("ELT") -- There was no way I could say no to that contract :-) In 2014 I actually have hours available do even more Varnish work, and I have done so in the ramp up to the 4.0.0 release, but despite my not so subtle hints, the current outlook is still only for 800 hours to be funded, but I'm crossing my fingers that more sponsors will appear now that V4 is released. (Nudge, nudge, wink, wink, he said knowingly! :-) Why Free and Open Source costs money ==================================== Varnish is about 90.000 lines of code, the VML brings in about EUR90K a year, and that means that Varnish has me working and caring about issues big and small. Not that I am satisfied with our level of effort, we should have much better documentation, our wish-list of features is far too long and we take too long to close tickets. But I'm not going to complain, because the Heartbleed vulnerability revealed that even though OpenSSL is about three to five times larger in terms of code, the OpenSSL Foundation Inc. took in only about EUR700K last year. And most of that EUR700K was for consulting and certification, not for "free-range" development and maintenance of the OpenSSL source code base so badly needs. I really hope that the Heartbleed vulnerability helps bring home the message to other communities, that Free and Open Source Software does not materialize out of empty space, it is written by people. People who love what we do, which is why I'm sitting here, way past midnight on a friday evening, writing this pamphlet. But software *is* written by people, real people with kids, cars, mortgages, leaky roofs, sick pets, infirm parents and all other kinds of perfectly normal worries of an adult human being. The best way to improve the quality of Free and Open Source Software, is to make it possible for these people to spend time on it. They need time to review submissions carefully, time to write and run test-cases, time to respond and fix to bug-reports, time to code and most of all, time to think about the code. But it would not even be close to morally defensible to ask these people to forego time to play with their kids, so that they instead develop and maintain the software that drives other peoples companies. The right way to go -- the moral way to go -- and by far the most productive way to go, is to pay the developers so they can make the software they love their living. How to fund Free and Open Source Software ========================================= One way is to hire them, with the understanding that they spend some company time on the software. Experience has shown that these people almost invariably have highly desirable brains which employers love to throw at all sorts of interesting problems, which tends to erode the "donated" company time. But a lot of Free and Open Source Software has been, and still is developed and maintained this way, with or without written agreements or even knowledge of this being the case. Another way is for software projects to set up foundations to collect money and hire developers. This is a relatively complex thing to do, and it will only be available for larger projects. The Apache Foundation "adopts" smaller projects inside their field of interest, and I belive that works OK, but I'm not sure if it can easily be transplanted to different topics. The final way is to simply throw money a the developers, the way the FreeBSD and Varnish communities have done with me. It is a far more flexible solution with respect to level of engangement, national boundaries etc. etc, but in many ways it demands more from both sides of the deal, in particular with respect to paperwork, taxes and so on. Conclusion ========== I am obiously biased, I derive a large fraction of my relatively modest income from community funding, for which I am the Varnish community deeply grateful. But biased as I may be, I belive that the Varnish community and I has shown that a tiny investment goes a long way in Free and Open Source Software. I hope to see that mutual benefit spread to other communities and projects, not just to OpenSSL and not just because they found a really bad bug the other day, but to any community around any piece of software which does serious work for serious companies. Thanks in advance, Poul-Henning, 2014-04-11 .. _Wall Street Journal: http://online.wsj.com/news/articles/SB10001424052702303873604579491350251315132 .. _Varnish Moral License: http://phk.freebsd.dk/VML .. _solicited the FreeBSD community: https://people.freebsd.org/~phk/funding.html .. _Extremely Large Telescope: http://www.eso.org/public/teles-instr/e-elt/ .. _bikesheds: http://bikeshed.org/ varnish-4.1.1/doc/sphinx/phk/autocrap.rst0000644000201500234410000000577412652366721015343 00000000000000.. _phk_autocrap: ==================================== Did you call them *autocrap* tools ? ==================================== Yes, in fact I did, because they are the worst possible non-solution to a self-inflicted problem. Back in the 1980'ies, the numerous mini- and micro-computer companies all jumped on the UNIX band-wagon, because it gave them an operating system for their hardware, but they also tried to "distinguish" themselves from the competitors, by "adding value". That "value" was incompatibility. You never knew where they put stuff, what arguments the compiler needed to behave sensibly, or for that matter, if there were a compiler to begin with. So some deranged imagination, came up with the idea of the ``configure`` script, which sniffed at your system and set up a ``Makefile`` that would work. Writing configure scripts was hard work, for one thing you needed a ton of different systems to test them on, so copy&paste became the order of the day. Then some even more deranged imagination, came up with the idea of writing a script for writing configure scripts, and in an amazing and daring attempt at the "all time most deranged" crown, used an obscure and insufferable macro-processor called ``m4`` for the implementation. Now, as it transpires, writing the specification for the configure producing macros was tedious, so somebody wrote a tool to... ...do you detect the pattern here ? Now, if the result of all this crap, was that I could write my source-code and tell a tool where the files were, and not only assume, but actually *trust* that things would just work out, then I could live with it. But as it transpires, that is not the case. For one thing, all the autocrap tools add another layer of version-madness you need to get right before you can even think about compiling the source code. Second, it doesn't actually work, you still have to do the hard work and figure out the right way to explain to the autocrap tools what you are trying to do and how to do it, only you have to do so in a language which is used to produce M4 macro invocations etc. etc. In the meantime, the UNIX diversity has shrunk from 50+ significantly different dialects to just a handful: Linux, \*BSD, Solaris and AIX and the autocrap tools have become part of the portability problem, rather than part of the solution. Amongst the silly activities of the autocrap generated configure script in Varnish are: * Looks for ANSI-C header files (show me a system later than 1995 without them ?) * Existence and support for POSIX mandated symlinks, (which are not used by Varnish btw.) * Tests, 19 different ways, that the compiler is not a relic from SYS III days. (Find me just one SYS III running computer with an ethernet interface ?) * Checks if the ISO-C and POSIX mandated ``cos()`` function exists in ``libm`` (No, I have no idea either...) &c. &c. &c. Some day when I have the time, I will rip out all the autocrap stuff and replace it with a 5 line shellscript that calls ``uname -s``. Poul-Henning, 2010-04-20 varnish-4.1.1/doc/sphinx/phk/spdy.rst0000644000201500234410000001447612652366721014503 00000000000000.. _phk_spdy: =================================== What SPDY did to my summer vacation =================================== It's dawning on me that I'm sort of the hipster of hipsters, in the sense that I tend to do things far before other people do, but totally fail to communicate what's going on out there in the future, and thus by the time the "real hipsters" catch up, I'm already somewhere different and more interesting. My one lucky break was the `bikeshed email `_ where I actually did sit down and compose some of my thoughts, thus firmly sticking a stick in the ground as one of the first to seriously think about how you organize open source collaborations. I mention this because what I am going to write probably seems very unimportant for most of the Varnish users right now, but down the road, three, five or maybe even ten years ahead, I think it will become important. Feel free to not read it until then. The evolution of Varnish ------------------------ When we started out, seven years ago, our only and entire goal was to build a server-side cache better than squid. That we did. Since then we have added stuff to Varnish (ESI:includes, gzip support, VMODS) and I'm staring at streaming and conditional backend fetches right now. Varnish is a bit more than a web-cache now, but it is still, basically, a layer of polish you put in front of your webserver to get it to look and work better. Google's experiments with SPDY have forced a HTTP/2.0 effort into motion, but if past performance is any indication, that is not something we have to really worry about for a number of years. The IETF WG has still to manage to "clarify" RFC2616 which defines HTTP/1.1, and to say there is anything even remotely resembling consensus behind SPDY would be a downright lie. RFC2616 is from June 1999, which, to me, means that we should look at 2035 when we design HTTP/2.0, and predicting things is well known to be hard, in particular with respect to the future. So what's a Varnish architect to do? What I did this summer vacation, was to think a lot about how Varnish can be architected to cope with the kind of changes SPDY and maybe HTTP/2.0 drag in: Pipelining, multiplexing, etc., without committing us to one particular path of science fiction about life in 2035. Profound insights often sound incredibly simplistic, bordering trivial, until you consider the full ramifications. The implementation of "Do Not Kill" in current law is surprisingly voluminous. (If you don't think so, you probably forgot to #include the Vienna Treaty and the convention about chemical and biological weapons.) So my insight about Varnish, that it has to become a socket-wrench-like toolchest for doing things with HTTP traffic, will probably elicit a lot of "duh!" reactions, until people, including me, understand the ramifications more fully. Things you cannot do with Varnish today --------------------------------------- As much as Varnish can be bent, tweaked and coaxed into doing today, there are things you cannot do, or at least things which are very hard and very inefficient to do with Varnish. For instance we consider "a transaction" something that starts with a request from a client, and involves zero or more backend fetches of finite sized data elements. That is not how the future looks. For instance one of the things SPDY has tried out is "server push", where you fetch index.html and the webserver says "you'll also want main.css and cat.gif then" and pushes those objects on the client, to save the round-trip times wasted waiting for the client to ask for them. Today, something like that is impossible in Varnish, since objects are independent and you can only look up one at a time. I already can hear some of you amazing VCL wizards say "Well, if you inline-C grab a refcount, then restart and ..." but let's be honest, that's not how it should look. You should be able to do something like:: if (req.proto == "SPDY" && req.url ~ "index.html") { req.obj1 = lookup(backend1, "/main.css") if (req.obj1.status == 200) { sess.push(req.obj1, bla, bla, bla); } req.obj2 = lookup(backend1, "/cat.gif") if (req.obj1.status == 200) { sess.push(req.obj2, bla, bla, bla); } } And doing that is not really *that* hard, I think. We just need to keep track of all the objects we instantiate and make sure they disappear and die when nobody is using them any more. A lot of the assumptions we made back in 2006 are no longer valid under such an architecture, but those same assumptions are what gives Varnish such astonishing performance, so just replacing them with standard CS-textbook solutions like "garbage collection" would make Varnish lose a lot of its lustre. As some of you know, there is a lot of modularity hidden inside Varnish but not quite released for public use in VCL. Much of what is going to happen will be polishing up and documenting that modularity and releasing it for you guys to have fun with, so it is not like we are starting from scratch or anything. But some of that modularity stands on foundations which are no longer firm; for instance, the initiating request exists for the full duration of a backend fetch. Those will take some work to fix. But, before you start to think I have a grand plan or even a clear-cut road map, I'd better make it absolutely clear that is not the case: I perceive some weird shapes in the fog of the future and I'll aim in that direction and either they are the doorways I suspect or they are trapdoors to tar-pits, time will show. I'm going to be making a lot of changes and things that used to be will no longer be as they used to be, but I think they will be better in the long run, so please bear with me, if your favourite detail of how Varnish works changes. Varnish is not speedy, Varnish is fast! --------------------------------------- As I said I'm not a fan of SPDY and I sincerely hope that no bit of the current proposal survives unchallenged in whatever HTTP/2.0 standard emerges down the road. But I do want to thank the people behind that mess, not for the mess, but for having provoked me to spend some summertime thinking hard about what it is that I'm trying to do with Varnish and what problem Varnish is here to solve. This is going to be FUN! Poul-Henning 2012-09-14 Author of Varnish PS: See you at `VUG6 `_ where I plan to talk more about this. varnish-4.1.1/doc/sphinx/phk/gzip.rst0000644000201500234410000001320712652366721014464 00000000000000.. _phk_gzip: ======================================= How GZIP, and GZIP+ESI works in Varnish ======================================= First of all, everything you read about GZIP here, is controlled by the parameter: http_gzip_support Which defaults to "on" if you do not want Varnish to try to be smart about compression, set it to "off" instead. What does http_gzip_support do ------------------------------ A request which is sent into 'pipe' or 'pass' mode from vcl_recv{} will not experience any difference, this processing only affects cache hit/miss requests. Unless vcl_recv{} results in "pipe" or "pass", we determine if the client is capable of receiving gzip'ed content. The test amounts to: Is there a Accept-Encoding header that mentions gzip, and if is has a q=# number, is it larger than zero. Clients which can do gzip, gets their header rewritten to: Accept-Encoding: gzip And clients which do not support gzip gets their Accept-Encoding header removed. This ensures conformity with respect to creating Vary: strings during object creation. During lookup, we ignore any "Accept-encoding" in objects Vary: strings, to avoid having a gzip and gunzip'ed version of the object, varnish can gunzip on demand. (We implement this bit of magic at lookup time, so that any objects stored in persistent storage can be used with or without gzip support enabled.) Varnish will not do any other types of compressions than gzip, in particular we will not do deflate, as there are browser bugs in that case. Before vcl_miss{} is called, the backend requests Accept-Encoding is always set to: Accept-Encoding: gzip Even if this particular client does not support To always entice the backend into sending us gzip'ed content. Varnish will not gzip any content on its own (but see below), we trust the backend to know what content can be sensibly gzip'ed (html) and what can not (jpeg) If in vcl_backend_response{} we find out that we are trying to deliver a gzip'ed object to a client that has not indicated willingness to receive gzip, we will ungzip the object during deliver. Tuning, tweaking and frobbing ----------------------------- In vcl_recv{} you have a chance to modify the client's Accept-Encoding: header before anything else happens. In vcl_pass{} the clients Accept-Encoding header is copied to the backend request unchanged. Even if the client does not support gzip, you can force the A-C header to "gzip" to save bandwidth between the backend and varnish, varnish will gunzip the object before delivering to the client. In vcl_miss{} you can remove the "Accept-Encoding: gzip" header, if you do not want the backend to gzip this object. In vcl_backend_response{} two new variables allow you to modify the gzip-ness of objects during fetch: set beresp.do_gunzip = true; Will make varnish gunzip an already gzip'ed object from the backend during fetch. (I have no idea why/when you would use this...) set beresp.do_gzip = true; Will make varnish gzip the object during fetch from the backend, provided the backend didn't send us a gzip'ed object. Remember that a lot of content types cannot sensibly be gziped, most notably compressed image formats like jpeg, png and similar, so a typical use would be:: sub vcl_backend_response { if (bereq.url ~ "html$") { set beresp.do_gzip = true; } } GZIP and ESI ------------ First, note the new syntax for activating ESI:: sub vcl_backend_response { set beresp.do_esi = true; } In theory, and hopefully in practice, all you read above should apply also when you enable ESI, if not it is a bug you should report. But things are vastly more complicated now. What happens for instance, when the backend sends a gzip'ed object we ESI process it and it includes another object which is not gzip'ed, and we want to send the result gziped to the client ? Things can get really hairy here, so let me explain it in stages. Assume we have a ungzipped object we want to ESI process. The ESI parser will run through the object looking for the various magic strings and produce a byte-stream we call the "VEC" for Varnish ESI Codes. The VEC contains instructions like "skip 234 bytes", "deliver 12919 bytes", "include /foobar", "deliver 122 bytes" etc and it is stored with the object. When we deliver an object, and it has a VEC, special esi-delivery code interprets the VEC string and sends the output to the client as ordered. When the VEC says "include /foobar" we do what amounts to a restart with the new URL and possibly Host: header, and call vcl_recv{} etc. You can tell that you are in an ESI include by examining the 'req.esi_level' variable in VCL. The ESI-parsed object is stored gzip'ed under the same conditions as above: If the backend sends gzip'ed and VCL did not ask for do_gunzip, or if the backend sends ungzip'ed and VCL asked for do_gzip. Please note that since we need to insert flush and reset points in the gzip file, it will be slightly larger than a normal gzip file of the same object. When we encounter gzip'ed include objects which should not be, we gunzip them, but when we encounter gunzip'ed objects which should be, we gzip them, but only at compression level zero. So in order to avoid unnecessary work, and in order to get maximum compression efficiency, you should:: sub vcl_miss { if (object needs ESI processing) { unset req.http.accept-encoding; } } sub vcl_backend_response { if (object needs ESI processing) { set beresp.do_esi = true; set beresp.do_gzip = true; } } So that the backend sends these objects uncompressed to varnish. You should also attempt to make sure that all objects which are esi:included are gziped, either by making the backend do it or by making varnish do it. varnish-4.1.1/doc/sphinx/phk/wanton_destruction.rst0000644000201500234410000000631312652366721017444 00000000000000.. _phk_wanton: ======================================= Wanton destruction for the greater good ======================================= We live in an old house, and it's all wrong for us. When I bought this house, it was perfect, or at least perfect enough. But times have changed. I have no small kids anymore, and rather than just right for two kids to tumble in, the garden is now too small for all the flowers we want. And the rooms are not where we want them, there are too many stairs in all the wrong places, and the kitchen needs to be torn out and a new built. I'm sure that some other family will be able to fall in love with this house, the way we did, but there is no realistic way to rebuild it, to become the house we want now. For one thing, doing major surgery on a house while you live in it is double-minus-fun and it always slows the rebuild project down when you have to keep at least one toilet working and sanitary and be able to cook and sleep on the building site. So we'll be building a new house on a plot of land on the other side of the road, one of the coming years, a house which is right for us, and then we will sell this old house, to a family with small children, who will love it, and rip out the old funky kitchen and make a new one before they move in. One would think that software would be nothing like an old house, but they are more alike than most people imagine. Using a major piece of software, is like moving into a house: You need to adapt your life and the house or the software to each other, since nothing is ever quite perfect, there will be limitations. And those limitations affect how you think: If you live in a 2 bedroom apartment, you won't even be considering inviting 80 guests to a party. A lot of Varnish-users have taken time to figure out how Varnish fits into their lives and made the compromises necessary to make it work, and once you've done that, you moved on to other problems, but the limitations of Varnish keeps affecting how you think about your website, even if you don't realize this. Well, I've got news for you: You'll be moving into a new house in the next couple of years, it'll be called Varnish V4 and that means that you will have to decide who gets which room and where to store the towels and grandmothers old china, all over again. I'm sure you'll hate me for it, "Why do we have to move ?", "It really wasn't that bad after all" and so on and so forth. But if I do my job right, that will soon turn into "Ohh, that's pretty neat, I always wanted one of those..." and "Hey... Watch me do THIS!" etc. I could have started with a fresh GIT repository, to make it clear that what is happening right now is the construction of an entirely new house, but software isn't built from physical objects, so I don't need to do that: You can keep using Varnish, while I rebuild it, and thanks to the wonder of bits, you won't see a trace of dirt or dust while it happens. So don't be alarmed by the wanton destruction you will see in -trunk the coming weeks, it is not destroying the Varnish you are using for your website today, it is building the new one you will be using in the future. And it's going to be perfect for you, at least for some years... Poul-Henning, 2013-03-18 varnish-4.1.1/doc/sphinx/phk/sphinx.rst0000644000201500234410000000612312652366721015023 00000000000000.. _phk_sphinx: =================================== Why Sphinx_ and reStructuredText_ ? =================================== The first school of thought on documentation, is the one we subscribe to in Varnish right now: "Documentation schmocumentation..." It does not work for anybody. The second school is the "Write a {La}TeX document" school, where the documentation is seen as a stand alone product, which is produced independently. This works great for PDF output, and sucks royally for HTML and TXT output. The third school is the "Literate programming" school, which abandons readability of *both* the program source code *and* the documentation source, which seems to be one of the best access protections one can put on the source code of either. The fourth school is the "DoxyGen" school, which lets a program collect a mindless list of hyperlinked variable, procedure, class and filenames, and call that "documentation". And the fifth school is anything that uses a fileformat that cannot be put into a version control system, because it is binary and non-diff'able. It doesn't matter if it is OpenOffice, LyX or Word, a non-diffable doc source is a no go with programmers. Quite frankly, none of these works very well in practice. One of the very central issues, is that writing documentation must not become a big and clear context-switch from programming. That precludes special graphical editors, browser-based (wiki!) formats etc. Yes, if you write documentation for half your workday, that works, but if you write code most of your workday, that does not work. Trust me on this, I have 25 years of experience avoiding using such tools. I found one project which has thought radically about the problem, and their reasoning is interesting, and quite attractive to me: #. TXT files are the lingua franca of computers, even if you are logged with TELNET using IP over Avian Carriers (Which is more widespread in Norway than you would think) you can read documentation in a .TXT format. #. TXT is the most restrictive typographical format, so rather than trying to neuter a high-level format into .TXT, it is smarter to make the .TXT the source, and reinterpret it structurally into the more capable formats. In other words: we are talking about the ReStructuredText_ of the Python project, as wrapped by the Sphinx_ project. Unless there is something I have totally failed to spot, that is going to be the new documentation platform in Varnish. Take a peek at the Python docs, and try pressing the "show source" link at the bottom of the left menu: (link to random python doc page:) https://docs.python.org/py3k/reference/expressions.html Dependency wise, that means you can edit docs with no special tools, you need python+docutils+sphinx to format HTML and a LaTex (pdflatex ?) to produce PDFs, something I only expect to happen on the project server on a regular basis. I can live with that, I might even rewrite the VCC scripts from Tcl to Python in that case. Poul-Henning, 2010-04-11 .. _Sphinx: http://sphinx.pocoo.org/ .. _reStructuredText: http://docutils.sourceforge.net/rst.html varnish-4.1.1/doc/sphinx/phk/platforms.rst0000644000201500234410000000710212652366721015517 00000000000000.. _phk_platforms: ================= Picking platforms ================= Whenever you write Open Source Software, you have to make a choice of what platforms you are going to support. Generally you want to make your program as portable as possible and cover as many platforms, distros and weird computers as possible. But making your program run on everything is hard work very hard work. For instance, did you know that: sizeof(void*) != sizeof(void * const) is legal in a ISO-C compliant environment ? Varnish `runs on a Nokia N900 `_ but I am not going to go out of my way to make sure that is always the case. To make sense for Varnish, a platform has to be able to deliver, both in terms of performance, but also in terms of the APIs we use to get that performance. In the FreeBSD project where I grew up, we ended up instituting platform-tiers, in an effort to document which platforms we cared about and which we did love quite as much. If we did the same for Varnish, the result would look something like: A - Platforms we care about --------------------------- We care about these platforms because our users use them and because they deliver a lot of bang for the buck with Varnish. These platforms are in our "tinderbox" tests, we use them ourselves and they pass all regression tests all the time. Platform specific bug reports gets acted on. *FreeBSD* *Linux* Obviously you can forget about running Varnish on your `WRT54G `_ but if you have a real computer, you can expect Varnish to work "ok or better" on any distro that has a package available. B - Platforms we try not to break --------------------------------- We try not to break these platforms, because they basically work, possibly with some footnotes or minor limitations, and they have an active userbase. We may or may not test on these platforms on a regular basis, or we may rely on contributors to alert us to problems. Platform specific bug reports without patches will likely live a quiet life. *Mac OS/X* *Solaris-decendants* (Oracle Solaris, OmniOS, Joyent SmartOS) Mac OS/X is regarded as a developer platform, not as a production platform. Solaris-decendants are regarded as a production platform. NetBSD, AIX and HP-UX are conceivably candidates for this level, but so far I have not heard much, if any, user interest. C - Platforms we tolerate ------------------------- We tolerate any other platform, as long as the burden of doing so is proportional to the benefit to the Varnish community. Do not file bug reports specific to these platforms without attaching a patch that solves the problem, we will just close it. For now, anything else goes here, certainly the N900 and the WRT54G. I'm afraid I have to put OpenBSD here for now, it is seriously behind on socket APIs and working around those issues is just not worth the effort. If people send us a small non-intrusive patches that makes Varnish run on these platforms, we'll take it. If they send us patches that reorganizes everything, hurts code readability, quality or just generally do not satisfy our taste, they get told that thanks, but no thanks. Is that it ? Abandon all hope etc. ? ------------------------------------- These tiers are not static, if for some reason Varnish suddenly becomes a mandatory accessory to some technically sensible platform, (zOS anyone ?) that platform will get upgraded. If the pessimists are right about Oracles intentions, Solaris may get demoted. Until next time, Poul-Henning, 2010-08-03 Edited Nils, 2014-03-18 with Poul-Hennings concent varnish-4.1.1/doc/sphinx/phk/ssl.rst0000644000201500234410000000537112652366721014317 00000000000000.. _phk_ssl: ============ Why no SSL ? ============ This is turning into a bit of a FAQ, but the answer is too big to fit in the margin we use for those. There are a number of reasons why there are no plans in sight that will grow SSL support in Varnish. First, I have yet to see a SSL library where the source code is not a nightmare. As I am writing this, the varnish source-code tree contains 82.595 lines of .c and .h files, including JEmalloc (12.236 lines) and Zlib (12.344 lines). OpenSSL, as imported into FreeBSD, is 340.722 lines of code, nine times larger than the Varnish source code, 27 times larger than each of Zlib or JEmalloc. This should give you some indication of how insanely complex the canonical implementation of SSL is. Second, it is not exactly the best source-code in the world. Even if I have no idea what it does, there are many aspect of it that scares me. Take this example in a comment, randomly found in s3-srvr.c:: /* Throw away what we have done so far in the current handshake, * which will now be aborted. (A full SSL_clear would be too much.) * I hope that tmp.dh is the only thing that may need to be cleared * when a handshake is not completed ... */ I hope they know what they are doing, but this comment doesn't exactly carry that point home, does it ? But let us assume that a good SSL library can be found, what would Varnish do with it ? We would terminate SSL sessions, and we would burn CPU cycles doing that. You can kiss the highly optimized delivery path in Varnish goodbye for SSL, we cannot simply tell the kernel to put the bytes on the socket, rather, we have to corkscrew the data through the SSL library and then write it to the socket. Will that be significantly different, performance wise, from running a SSL proxy in separate process ? No, it will not, because the way varnish would have to do it would be to ... start a separate process to do the SSL handling. There is no other way we can guarantee that secret krypto-bits do not leak anywhere they should not, than by fencing in the code that deals with them in a child process, so the bulk of varnish never gets anywhere near the certificates, not even during a core-dump. Would I be able to write a better stand-alone SSL proxy process than the many which already exists ? Probably not, unless I also write my own SSL implementation library, including support for hardware crypto engines and the works. That is not one of the things I dreamt about doing as a kid and if I dream about it now I call it a nightmare. So the balance sheet, as far as I can see it, lists "It would be a bit easier to configure" on the plus side, and everything else piles up on the minus side, making it a huge waste of time and effort to even think about it.. Poul-Henning, 2011-02-15 varnish-4.1.1/doc/sphinx/phk/barriers.rst0000644000201500234410000001344512652366721015330 00000000000000.. _phk_barriers: ============================ Security barriers in Varnish ============================ Security is a very important design driver in Varnish, more likely than not, if you find yourself thinking "Why did he do _that_ ? the answer has to do with security. The Varnish security model is based on some very crude but easy to understand barriers between the various components:: .-->- provides ->---------------------------------------. | | | (ADMIN)--+-->- runs ----->---. | | | | | | |-->- cli_req -->---| v v '--<- cli_resp -<---| VCL MODULE | | | (OPER) | |reads | | | | | |runs | | | | .-<- create -<-. | .->- fork ->-. v | v |->- check -->-|-- MGR --| |-- VCC <- loads -| VSM |-<- write --<-' | '-<- wait -<-' | | TOOLS | | | | ^ | .-------------' | | | | | |writes | |reads | |->- fork ----->-. | | | | |->- cli_req -->-| | | VSM ----' |-<- cli_resp -<-| v | | '-<- wait -----<-| VCL.SO | | | | | | | | | |---->----- inherit --->------|--<-- loads -------' | |---->----- reads ---->------| | '----<----- writes ----<------|--<-- loads --------------------' | | | .--->-- http_req --->--. | .-->-- http_req --->--. (ANON) --| |-- CLD --| |-- (BACKEND) '---<-- http_resp --<--' '--<-- http_resp --<--' (ASCII-ART rules!) The really Important Barrier ============================ The central actor in Varnish is the Manager process, "MGR", which is the process the administrator "(ADMIN)" starts to get web-cache service. Having been there myself, I do not subscribe to the "I feel cool and important when I get woken up at 3AM to restart a dead process" school of thought, in fact, I think that is a clear sign of mindless stupidity: If we cannot get a computer to restart a dead process, why do we even have them ? The task of the Manager process is therefore not cache web content, but to make sure there always is a process which does that, the Child "CLD" process. That is the major barrier in Varnish: All management happens in one process all actual movement of traffic happens in another, and the Manager process does not trust the Child process at all. The Child process is in a the totally unprotected domain: Any computer on the InterNet "(ANON)" can connect to the Child process and ask for some web-object. If John D. Criminal manages to exploit a security hole in Varnish, it is the Child process he subverts. If he carries out a DoS attack, it is the Child process he tries to fell. Therefore the Manager starts the Child with as low priviledge as practically possible, and we close all filedescriptors it should not have access to and so on. There are only three channels of communication back to the Manager process: An exit code, a CLI response or writing stuff into the shared memory file "VSM" used for statistics and logging, all of these are well defended by the Manager process. The Admin/Oper Barrier ====================== If you look at the top left corner of the diagram, you will see that Varnish operates with separate Administrator "(ADMIN)" and Operator "(OPER)" roles. The Administrator does things, changes stuff etc. The Operator keeps an eye on things to make sure they are as they should be. These days Operators are often scripts and data collection tools, and there is no reason to assume they are bugfree, so Varnish does not trust the Operator role, that is a pure one-way relationship. (Trick: If the Child process us run under user "nobody", you can allow marginally trusted operations personel access to the "nobody" account (for instance using .ssh/authorized_keys2), and they will be able to kill the Child process, prompting the Manager process to restart it again with the same parameters and settings.) The Administrator has the final say, and of course, the administrator can decide under which circumstances that authority will be shared. Needless to say, if the system on which Varnish runs is not properly secured, the Administrator's monopoly of control will be compromised. All the other barriers ====================== There are more barriers, you can spot them by following the arrows in the diagram, but they are more sort of "technical" than "political" and generally try to guard against programming flaws as much as security compromise. For instance the VCC compiler runs in a separate child process, to make sure that a memory leak or other flaw in the compiler does not accumulate trouble for the Manager process. Hope this explanation helps understand why Varnish is not just a single process like all other server programs. Poul-Henning, 2010-06-28 varnish-4.1.1/doc/sphinx/phk/ipv6suckage.rst0000644000201500234410000000445512652366721015747 00000000000000.. _phk_ipv6suckage: ============ IPv6 Suckage ============ In my drawer full of cassette tapes, is a 6 tape collection published by Carl Malamuds "Internet Talk Radio", the first and by far the geekiest radio station on the internet. The tapes are from 1994 and the topic is "IPng", the IPv4 replacement that eventually became IPv6. To say that I am a bit jaded about IPv6 by now, is accusing the pope of being religious. IPv4 addresses in numeric form, are written as 192.168.0.1 and to not confuse IPv6 with IPv4, it was decided in RFC1884 that IPv6 would use colons and groups of 16 bits, and because 128 bits are a lot of bits, the secret '::' trick was introduced, to supress all the zero bits that we may not ever need anyway: 1080::8:800:200C:417A Colon was chosen because it was already used in MAC/ethernet addresses and did no damage there and it is not a troublesome metacharacter in shells. No worries. Most protocols have a Well Known Service number, TELNET is 23, SSH is 22 and HTTP is 80 so usually people will only have to care about the IP number. Except when they don't, for instance when they run more than one webserver on the same machine. No worries, says the power that controls what URLs look like, we will just stick the port number after the IP# with a colon: http://192.168.0.1:8080/... That obviously does not work with IPv6, so RFC3986 comes around and says "darn, we didn't think of that" and puts the IPV6 address in [...] giving us: http://[1080::8:800:200C:417A]:8080/ Remember that "harmless in shells" detail ? Yeah, sorry about that. Now, there are also a RFC sanctioned API for translating a socket address into an ascii string, getnameinfo(), and if you tell it that you want a numeric return, you get a numeric return, and you don't even need to know if it is a IPv4 or IPv6 address in the first place. But it returns the IP# in one buffer and the port number in another, so if you want to format the sockaddr in the by RFC5952 recommended way (the same as RFC3986), you need to inspect the version field in the sockaddr to see if you should do "%s:%s", host, port or "[%s]:%s", host, port Careless standardization costs code, have I mentioned this before ? Varnish reports socket addresses as two fields: IP space PORT, now you know why. Until next time, Poul-Henning, 2010-08-24 varnish-4.1.1/doc/sphinx/phk/backends.rst0000644000201500234410000001021312652366721015257 00000000000000.. _phk_backends: =============================== What do you mean by 'backend' ? =============================== Given that we are approaching Varnish 3.0, you would think I had this question answered conclusively long time ago, but once you try to be efficient, things get hairy fast. One of the features of Varnish we are very fundamental about, is the ability to have multiple VCLs loaded at the same time, and to switch between them instantly and seamlessly. So imagine you have 1000 backends in your VCL, not an unreasonable number, each configured with health-polling. Now you fiddle your vcl_recv{} a bit and load the VCL again, but since you are not sure which is the best way to do it, you keep both VCL's loaded so you can switch forth and back seamlessly. To switch seamlessly, the health status of each backend needs to be up to date the instant we switch to the other VCL. This basically means that either all VCLs poll all their backends, or they must share, somehow. We can dismiss the all VCLs poll all their backends scenario, because it scales truly horribly, and would pummel backends with probes if people forget to vcl.discard their old dusty VCLs. Share And Enjoy =============== In addition to health-status (including the saint-list), we also want to share cached open connections and stats counters. It would be truly stupid to close 100 ready and usable connections to a backend, and open 100 other, just because we switch to a different VCL that has an identical backend definition. But what is an identical backend definition in this context? It is important to remember that we are not talking physical backends: For instance, there is nothing preventing a VCL for having the same physical backend declared as 4 different VCL backends. The most obvious thing to do, is to use the VCL name of the backend as identifier, but that is not enough. We can have two different VCLs where backend "b1" points at two different physical machines, for instance when we migrate or upgrade the backend. The identity of the state than can be shared is therefore the triplet: {VCL-name, IPv4+port, IPv6+port} No Information without Representation ===================================== Since the health-status will be for each of these triplets, we will need to find a way to represent them in CLI and statistics contexts. As long as we just print them out, that is not a big deal, but what if you just want the health status for one of your 1000 backends, how do you tell which one ? The syntax-nazi way of doing that, is forcing people to type it all every time:: backend.health b1(127.0.0.1:8080,[::1]:8080) That will surely not be a hit with people who have just one backend. I think, but until I implement I will not commit to, that the solution is a wildcard-ish scheme, where you can write things like:: b1 # The one and only backend b1 or error b1() # All backends named b1 b1(127.0.0.1) # All b1s on IPv4 lookback b1(:8080) # All b1s on port 8080, (IPv4 or IPv6) b1(192.168.60.1,192.168.60.2) # All b1s on one of those addresses. (Input very much welcome) The final question is if we use shortcut notation for output from :ref:`varnishd(1)`, and the answer is no, because we do not want the stats-counters to change name because we load another VCL and suddenly need disabiguation. Sharing Health Status ===================== To avoid the over-polling, we define that maximum one VCL polls at backend at any time, and the active VCL gets preference. It is not important which particular VCL polls the backends not in the active VCL, as long as one of them do. Implementation ============== The poll-policy can be implemented by updating a back-pointer to the poll-specification for all backends on vcl.use execution. On vcl.discard, if this vcl was the active poller, it needs to walk the list of vcls and substitute another. If the list is empty the backend gets retired anyway. We should either park a thread on each backend, or have a poller thread which throws jobs into the work-pool as the backends needs polled. The pattern matching is confined to CLI and possibly libvarnishapi I think this will work, Until next time, Poul-Henning, 2010-08-09 varnish-4.1.1/doc/sphinx/phk/three-zero.rst0000644000201500234410000000524012652366721015575 00000000000000.. _phk_3.0: ================================== Thoughts on the eve of Varnish 3.0 ================================== Five years ago, I was busy transforming my pile of random doddles on 5mm squared paper into software, according to "git log" working on the first stevedores. In two weeks I will be attending the Varnish 3.0 release party in Oslo. Sometimes I feel that development of Varnish takes for ever and ever, and that it must be like watching paint dry for the users, but 3 major releases in 5 years is actually not too shabby come to think of it. Varnish 3.0 "only" has two big new features, VMOD and GZIP, and a host of smaller changes, which you will notice if they are new features, and not notice if they are bug fixes. GZIP will probably be most important to the ESI users, and I wonder if all the time I spent fiddling bits in the middle of compressed data pays off, or if the concept of patchwork-quilting GZIP files was a bad idea from end to other. VMODs on the other hand, was an instant success, because they make it much easier for people to extend Varnish with new functionality, and I know of several VMODs in the pipeline which will make it possible to do all sorts of wonderful things from VCL. All in all, I feel happy about the 3.0 release, and I hope the users will too. We are not finished of course, ideas and patches for Varnish 4.0 are already starting to pile up, and hopefully we can get that into a sensible shape 18 months from now, late 2012-ish. "Life is what happens to you while you're busy making other plans" said John Lennon, a famous murder victim from New York. I feel a similar irony in the way Varnish happened to me: My homepage is written in raw HTML using the vi(1) editor, runs on a book-sized Soekris NET5501 computer, averages 50 hits a day with an Alexa rank just north of the 3.5 million mark. A normal server with Varnish could deliver all traffic my webserver has ever delivered, in less than a second. But varnish-cache.org has Alexa rank around 30.000, "varnish cache" shows a nice trend on Google and #varnish confuses the heck out of teenage girls and wood workers on Twitter, so clearly I am doing something right. I still worry about the `The Fraud Police `_ though, "I have no idea what I'm doing, and I totally make shit up as I go along." is a disturbingly precise summary of how I feel about my work in Varnish. The Varnish 3.0 release is therefore dedicated to all the kind Varnish developers and users, who have tested, reported bugs, suggested ideas and generally put up with me and my bumbling ways for these past five years. Much appreciated, Poul-Henning, 2011-06-02 varnish-4.1.1/doc/sphinx/phk/brinch-hansens-arrows.rst0000644000201500234410000000453612652366721017735 00000000000000.. _phk_brinch_hansens_arrows: ===================== Brinch-Hansens Arrows ===================== As you may have noticed, I am a bit of a IT-history nerd, and we do have some rather important early IT history in Denmark. If you have a solid CS background, you have undoubtedly heard about both dining philosophers and Brinch-Hansens work in multiprogramming. Multiprogramming is fundamentally hard, because you cannot have one thread holding lock A trying to get lock B, while another holds lock B trying to get lock A. Brinch-Hansen did a lot of both theoretical and practical work in the area of multiprogramming and being both good at it and one of the pioneers, he was awarded the ACM Turing Prize for it. You can read more about him here: `Brinch-Hansen Archive `_ Along the way he came up with a trivial and practical way to guarantee that a given multiprogramming system was free of deadlocks: Draw the locking order and make sure all the arrows point to the right. When we started working with multi-core systems in FreeBSD, we were sure to have deadlocks in our future, and we adopted and expanded a facility called "WITNESS" originally written for BSDI, which keeps an eye on Brinch-Hansens arrows in real time. Historically I have been pretty good at avoiding deadlocks, it seems to come natural to me to think about locking order, but not everybody feels that way about them, and WITNESS have caught a lot of "Ohh, didn't think about *that*" situations over the years. It is no accident that Varnish has a very simple locking structure, but as we add more and more flexibility and extensibility to Varnish it grows a little here and there, and I managed to introduce a lock-order reversal the other day - my first in about five years I think. Since I'm obviously getting old and slipping up here, I though it was about time I carried out the Brinch-Hansen check on Varnish. I briefly pondered porting WITNESS into Varnish, but it's 3k lines and we have extremely good code coverage in our regression tests so I decided to KISS and do it as post-processing. I have added default-off debug code to emit VSL "Witness" records, taught varnishtest how to enable that code, and added a small python script to process the records into a nice plot: .. image:: brinch_hansens_arrows_1.svg And yo and behold: All the arrows point to the right. *phk* varnish-4.1.1/doc/sphinx/include/0000755000201500234410000000000012652366754013705 500000000000000varnish-4.1.1/doc/sphinx/include/varnishncsa_synopsis.rst0000644000201500234410000000030312652366754020641 00000000000000.. |synopsis| replace:: [-a] [-C] [-d] [-D] [-F format] [-f formatfile] [-g ] [-h] [-n name] [-N filename] [-P file] [-q query] [-r filename] [-t ] [-V] [-w filename] varnish-4.1.1/doc/sphinx/include/counters.rst0000644000201500234410000004141212652366754016223 00000000000000COUNTER LEVELS ============== INFO – Informational counters Counters giving runtime information DIAG – Diagnostic counters Counters giving diagnostic information DEBUG – Debug counters Counters giving Varnish internals debug information MAIN COUNTERS (MAIN.*) ====================== uptime – How long the child process has been running. (INFO) Child process uptime sess_conn – Count of sessions successfully accepted (INFO) Sessions accepted sess_drop – Count of sessions silently dropped due to lack of worker thread. (INFO) Sessions dropped sess_fail – Count of failures to accept TCP connection. Either the client changed its mind, or the kernel ran out of some resource like file descriptors. (INFO) Session accept failures client_req_400 – 400 means we couldn't make sense of the request, it was malformed in some drastic way. (INFO) Client requests received, subject to 400 errors client_req_417 – 417 means that something went wrong with an Expect: header. (INFO) Client requests received, subject to 417 errors client_req – The count of parseable client requests seen. (INFO) Good client requests received cache_hit – Count of cache hits. A cache hit indicates that an object has been delivered to a client without fetching it from a backend server. (INFO) Cache hits cache_hitpass – Count of hits for pass A cache hit for pass indicates that Varnish is going to pass the request to the backend and this decision has been cached in it self. This counts how many times the cached decision is being used. (INFO) Cache hits for pass cache_miss – Count of misses A cache miss indicates the object was fetched from the backend before delivering it to the backend. (INFO) Cache misses backend_conn – How many backend connections have successfully been established. (INFO) Backend conn. success backend_unhealthy – (INFO) Backend conn. not attempted backend_busy – (INFO) Backend conn. too many backend_fail – (INFO) Backend conn. failures backend_reuse – Count of backend connection reuses This counter is increased whenever we reuse a recycled connection. (INFO) Backend conn. reuses backend_recycle – Count of backend connection recycles This counter is increased whenever we have a keep-alive connection that is put back into the pool of connections. It has not yet been used, but it might be, unless the backend closes it. (INFO) Backend conn. recycles backend_retry – (INFO) Backend conn. retry fetch_head – beresp with no body because the request is HEAD. (INFO) Fetch no body (HEAD) fetch_length – beresp.body with Content-Length. (INFO) Fetch with Length fetch_chunked – beresp.body with Chunked. (INFO) Fetch chunked fetch_eof – beresp.body with EOF. (INFO) Fetch EOF fetch_bad – beresp.body length/fetch could not be determined. (INFO) Fetch bad T-E fetch_none – beresp.body empty (INFO) Fetch no body fetch_1xx – beresp with no body because of 1XX response. (INFO) Fetch no body (1xx) fetch_204 – beresp with no body because of 204 response. (INFO) Fetch no body (204) fetch_304 – beresp with no body because of 304 response. (INFO) Fetch no body (304) fetch_failed – beresp fetch failed. (INFO) Fetch failed (all causes) fetch_no_thread – beresp fetch failed, no thread available. (INFO) Fetch failed (no thread) pools – Number of thread pools. See also parameter thread_pools. NB: Presently pools cannot be removed once created. (INFO) Number of thread pools threads – Number of threads in all pools. See also parameters thread_pools, thread_pool_min and thread_pool_max. (INFO) Total number of threads threads_limited – Number of times more threads were needed, but limit was reached in a thread pool. See also parameter thread_pool_max. (INFO) Threads hit max threads_created – Total number of threads created in all pools. (INFO) Threads created threads_destroyed – Total number of threads destroyed in all pools. (INFO) Threads destroyed threads_failed – Number of times creating a thread failed. See VSL::Debug for diagnostics. See also parameter thread_fail_delay. (INFO) Thread creation failed thread_queue_len – Length of session queue waiting for threads. NB: Only updates once per second. See also parameter queue_max. (INFO) Length of session queue busy_sleep – Number of requests sent to sleep without a worker thread because they found a busy object. (INFO) Number of requests sent to sleep on busy objhdr busy_wakeup – Number of requests taken of the busy object sleep list and and rescheduled. (INFO) Number of requests woken after sleep on busy objhdr busy_killed – Number of requests killed from the busy object sleep list due to lack of resources. (INFO) Number of requests killed after sleep on busy objhdr sess_queued – Number of times session was queued waiting for a thread. See also parameter queue_max. (INFO) Sessions queued for thread sess_dropped – Number of times session was dropped because the queue were too long already. See also parameter queue_max. (INFO) Sessions dropped for thread n_object – Number of object structs made (INFO) object structs made n_vampireobject – Number of unresurrected objects (DIAG) unresurrected objects n_objectcore – Number of objectcore structs made (INFO) objectcore structs made n_objecthead – Number of objecthead structs made (INFO) objecthead structs made n_waitinglist – Number of waitinglist structs made (DEBUG) waitinglist structs made n_backend – Number of backends known to us. (INFO) Number of backends n_expired – Number of objects that expired from cache because of old age. (INFO) Number of expired objects n_lru_nuked – How many objects have been forcefully evicted from storage to make room for a new object. (INFO) Number of LRU nuked objects n_lru_moved – Number of move operations done on the LRU list. (DIAG) Number of LRU moved objects losthdr – (INFO) HTTP header overflows s_sess – (INFO) Total sessions seen s_req – (INFO) Total requests seen s_pipe – (INFO) Total pipe sessions seen s_pass – (INFO) Total pass-ed requests seen s_fetch – (INFO) Total backend fetches initiated s_synth – (INFO) Total synthethic responses made s_req_hdrbytes – Total request header bytes received (INFO) Request header bytes s_req_bodybytes – Total request body bytes received (INFO) Request body bytes s_resp_hdrbytes – Total response header bytes transmitted (INFO) Response header bytes s_resp_bodybytes – Total response body bytes transmitted (INFO) Response body bytes s_pipe_hdrbytes – Total request bytes received for piped sessions (INFO) Pipe request header bytes s_pipe_in – Total number of bytes forwarded from clients in pipe sessions (INFO) Piped bytes from client s_pipe_out – Total number of bytes forwarded to clients in pipe sessions (INFO) Piped bytes to client sess_closed – (INFO) Session Closed sess_closed_err – Total number of sessions closed with errors. See sc_* diag counters for detailed breakdown (INFO) Session Closed with error sess_readahead – (INFO) Session Read Ahead sess_herd – (DIAG) Session herd sc_rem_close – Number of session closes with REM_CLOSE (Client Closed) (DIAG) Session OK REM_CLOSE sc_req_close – Number of session closes with REQ_CLOSE (Client requested close) (DIAG) Session OK REQ_CLOSE sc_req_http10 – Number of session closes with Error REQ_HTTP10 (Proto < HTTP/1.1) (DIAG) Session Err REQ_HTTP10 sc_rx_bad – Number of session closes with Error RX_BAD (Received bad req/resp) (DIAG) Session Err RX_BAD sc_rx_body – Number of session closes with Error RX_BODY (Failure receiving req.body) (DIAG) Session Err RX_BODY sc_rx_junk – Number of session closes with Error RX_JUNK (Received junk data) (DIAG) Session Err RX_JUNK sc_rx_overflow – Number of session closes with Error RX_OVERFLOW (Received buffer overflow) (DIAG) Session Err RX_OVERFLOW sc_rx_timeout – Number of session closes with Error RX_TIMEOUT (Receive timeout) (DIAG) Session Err RX_TIMEOUT sc_tx_pipe – Number of session closes with TX_PIPE (Piped transaction) (DIAG) Session OK TX_PIPE sc_tx_error – Number of session closes with Error TX_ERROR (Error transaction) (DIAG) Session Err TX_ERROR sc_tx_eof – Number of session closes with TX_EOF (EOF transmission) (DIAG) Session OK TX_EOF sc_resp_close – Number of session closes with RESP_CLOSE (Backend/VCL requested close) (DIAG) Session OK RESP_CLOSE sc_overload – Number of session closes with Error OVERLOAD (Out of some resource) (DIAG) Session Err OVERLOAD sc_pipe_overflow – Number of session closes with Error PIPE_OVERFLOW (Session pipe overflow) (DIAG) Session Err PIPE_OVERFLOW sc_range_short – Number of session closes with Error RANGE_SHORT (Insufficient data for range) (DIAG) Session Err RANGE_SHORT shm_records – (DIAG) SHM records shm_writes – (DIAG) SHM writes shm_flushes – (DIAG) SHM flushes due to overflow shm_cont – (DIAG) SHM MTX contention shm_cycles – (DIAG) SHM cycles through buffer backend_req – (INFO) Backend requests made n_vcl – (INFO) Number of loaded VCLs in total n_vcl_avail – (DIAG) Number of VCLs available n_vcl_discard – (DIAG) Number of discarded VCLs bans – Number of all bans in system, including bans superseded by newer bans and bans already checked by the ban-lurker. (INFO) Count of bans bans_completed – Number of bans which are no longer active, either because they got checked by the ban-lurker or superseded by newer identical bans. (DIAG) Number of bans marked 'completed' bans_obj – Number of bans which use obj.* variables. These bans can possibly be washed by the ban-lurker. (DIAG) Number of bans using obj.* bans_req – Number of bans which use req.* variables. These bans can not be washed by the ban-lurker. (DIAG) Number of bans using req.* bans_added – Counter of bans added to ban list. (DIAG) Bans added bans_deleted – Counter of bans deleted from ban list. (DIAG) Bans deleted bans_tested – Count of how many bans and objects have been tested against each other during hash lookup. (DIAG) Bans tested against objects (lookup) bans_obj_killed – Number of objects killed by bans during object lookup. (DIAG) Objects killed by bans (lookup) bans_lurker_tested – Count of how many bans and objects have been tested against each other by the ban-lurker. (DIAG) Bans tested against objects (lurker) bans_tests_tested – Count of how many tests and objects have been tested against each other during lookup. 'ban req.url == foo && req.http.host == bar' counts as one in 'bans_tested' and as two in 'bans_tests_tested' (DIAG) Ban tests tested against objects (lookup) bans_lurker_tests_tested – Count of how many tests and objects have been tested against each other by the ban-lurker. 'ban req.url == foo && req.http.host == bar' counts as one in 'bans_tested' and as two in 'bans_tests_tested' (DIAG) Ban tests tested against objects (lurker) bans_lurker_obj_killed – Number of objects killed by ban-lurker. (DIAG) Objects killed by bans (lurker) bans_dups – Count of bans replaced by later identical bans. (DIAG) Bans superseded by other bans bans_lurker_contention – Number of times the ban-lurker had to wait for lookups. (DIAG) Lurker gave way for lookup bans_persisted_bytes – Number of bytes used by the persisted ban lists. (DIAG) Bytes used by the persisted ban lists bans_persisted_fragmentation – Number of extra bytes accumulated through dropped and completed bans in the persistent ban lists. (DIAG) Extra bytes in persisted ban lists due to fragmentation n_purges – (INFO) Number of purge operations executed n_obj_purged – (INFO) Number of purged objects exp_mailed – Number of objects mailed to expiry thread for handling. (DIAG) Number of objects mailed to expiry thread exp_received – Number of objects received by expiry thread for handling. (DIAG) Number of objects received by expiry thread hcb_nolock – (DEBUG) HCB Lookups without lock hcb_lock – (DEBUG) HCB Lookups with lock hcb_insert – (DEBUG) HCB Inserts esi_errors – (DIAG) ESI parse errors (unlock) esi_warnings – (DIAG) ESI parse warnings (unlock) vmods – (INFO) Loaded VMODs n_gzip – (INFO) Gzip operations n_gunzip – (INFO) Gunzip operations vsm_free – Number of bytes free in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DIAG) Free VSM space vsm_used – Number of bytes used in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DIAG) Used VSM space vsm_cooling – Number of bytes which will soon (max 1 minute) be freed in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DEBUG) Cooling VSM space vsm_overflow – Number of bytes which does not fit in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DIAG) Overflow VSM space vsm_overflowed – Total number of bytes which did not fit in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DIAG) Overflowed VSM space MANAGEMENT PROCESS COUNTERS (MGT.*) =================================== uptime – Uptime in seconds of the management process (INFO) Management process uptime child_start – Number of times the child process has been started (DIAG) Child process started child_exit – Number of times the child process has been cleanly stopped (DIAG) Child process normal exit child_stop – Number of times the child process has exited with an unexpected return code (DIAG) Child process unexpected exit child_died – Number of times the child process has died due to signals (DIAG) Child process died (signal) child_dump – Number of times the child process has produced core dumps (DIAG) Child process core dumped child_panic – Number of times the management process has caught a child panic (DIAG) Child process panic PER MEMORY POOL COUNTERS (MEMPOOL.*) ==================================== live – (DEBUG) In use pool – (DEBUG) In Pool sz_wanted – (DEBUG) Size requested sz_actual – (DEBUG) Size allocated allocs – (DEBUG) Allocations frees – (DEBUG) Frees recycle – (DEBUG) Recycled from pool timeout – (DEBUG) Timed out from pool toosmall – (DEBUG) Too small to recycle surplus – (DEBUG) Too many for pool randry – (DEBUG) Pool ran dry PER MALLOC STORAGE COUNTERS (SMA.*) =================================== c_req – Number of times the storage has been asked to provide a storage segment. (INFO) Allocator requests c_fail – Number of times the storage has failed to provide a storage segment. (INFO) Allocator failures c_bytes – Number of total bytes allocated by this storage. (INFO) Bytes allocated c_freed – Number of total bytes returned to this storage. (INFO) Bytes freed g_alloc – Number of storage allocations outstanding. (INFO) Allocations outstanding g_bytes – Number of bytes allocated from the storage. (INFO) Bytes outstanding g_space – Number of bytes left in the storage. (INFO) Bytes available PER FILE STORAGE COUNTERS (SMF.*) ================================= c_req – Number of times the storage has been asked to provide a storage segment. (INFO) Allocator requests c_fail – Number of times the storage has failed to provide a storage segment. (INFO) Allocator failures c_bytes – Number of total bytes allocated by this storage. (INFO) Bytes allocated c_freed – Number of total bytes returned to this storage. (INFO) Bytes freed g_alloc – Number of storage allocations outstanding. (INFO) Allocations outstanding g_bytes – Number of bytes allocated from the storage. (INFO) Bytes outstanding g_space – Number of bytes left in the storage. (INFO) Bytes available g_smf – (INFO) N struct smf g_smf_frag – (INFO) N small free smf g_smf_large – (INFO) N large free smf PER BACKEND COUNTERS (VBE.*) ============================ happy – (INFO) Happy health probes bereq_hdrbytes – Total backend request header bytes sent (INFO) Request header bytes bereq_bodybytes – Total backend request body bytes sent (INFO) Request body bytes beresp_hdrbytes – Total backend response header bytes received (INFO) Response header bytes beresp_bodybytes – Total backend response body bytes received (INFO) Response body bytes pipe_hdrbytes – Total request bytes sent for piped sessions (INFO) Pipe request header bytes pipe_out – Total number of bytes forwarded to backend in pipe sessions (INFO) Piped bytes to backend pipe_in – Total number of bytes forwarded from backend in pipe sessions (INFO) Piped bytes from backend conn – (INFO) Concurrent connections to backend req – (INFO) Backend requests sent LOCK COUNTERS (LCK.*) ===================== creat – (DEBUG) Created locks destroy – (DEBUG) Destroyed locks locks – (DEBUG) Lock Operations varnish-4.1.1/doc/sphinx/include/varnishhist_synopsis.rst0000644000201500234410000000033012652366754020664 00000000000000.. |synopsis| replace:: [-C] [-d] [-g ] [-h] [-L limit] [-n name] [-N filename] [-p period] [-P ] [-q query] [-r filename] [-t ] [-T seconds] [-V] varnish-4.1.1/doc/sphinx/include/varnishlog_options.rst0000644000201500234410000000667212652366754020321 00000000000000-a When writing output to a file with the -w option, append to it rather than overwrite it. -A When writing output to a file with the -w option, output data in ascii format. -b Only display transactions and log records coming from backend communication. -c Only display transactions and log records coming from client communication. -C Do all regular expression and string matching caseless. -d Start processing log records at the head of the log instead of the tail. -D Daemonize. -g The grouping of the log records. The default is to group by vxid. -h Print program usage and exit -i taglist Include log records of these tags in output. Taglist is a comma-separated list of tag globs. Multiple -i options may be given. If a tag include option is the first of any tag selection options, all tags are first marked excluded. -I <[taglist:]regex> Include by regex matching. Output only records matching taglist and regular expression. Applies to any tag if taglist is absent. If a tag include option is the first of any tag selection options, all tags are first marked excluded. -k num Process this number of matching log transactions before exiting. -L limit Sets the upper limit of incomplete transactions kept before the oldest transaction is force completed. A warning record is synthesized when this happens. This setting keeps an upper bound on the memory usage of running queries. Defaults to 1000 transactions. -n name Specify the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. -N filename Specify the filename of a stale VSM instance. When using this option the abandonment checking is disabled. -P file Write the process' PID to the specified file. -q query Specifies the VSL query to use. -r filename Read log in binary file format from this file. The file can be created with ``varnishlog -w filename``. -t Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this many seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. Defaults to 5 seconds. -T seconds Sets the transaction timeout in seconds. This defines the maximum number of seconds elapsed between a Begin tag and the End tag. If the timeout expires, a warning record is synthesized and the transaction is force completed. Defaults to 120 seconds. -v Use verbose output on record set printing, giving the VXID on every log line. Without this option, the VXID will only be given on the header of that transaction. -V Print version information and exit. -w filename Redirect output to file. The file will be overwritten unless the -a option was specified. If the application receives a SIGHUP in daemon mode the file will be reopened allowing the old one to be rotated away. The file can then be read by varnishlog and other tools with the -r option, unless the -A option was specified. This option is required when running in daemon mode. -x taglist Exclude log records of these tags in output. Taglist is a comma-separated list of tag globs. Multiple -x options may be given. -X <[taglist:]regex> Exclude by regex matching. Do not output records matching taglist and regular expression. Applies to any tag if taglist is absent. varnish-4.1.1/doc/sphinx/include/vcl_var.rst0000644000201500234410000003072512652366743016020 00000000000000 bereq ~~~~~ bereq Type: HTTP Readable from: backend The entire backend request HTTP data structure bereq.backend Type: BACKEND Readable from: vcl_pipe, backend Writable from: vcl_pipe, backend This is the backend or director we attempt to fetch from. bereq.between_bytes_timeout Type: DURATION Readable from: backend Writable from: backend The time in seconds to wait between each received byte from the backend. Not available in pipe mode. bereq.connect_timeout Type: DURATION Readable from: vcl_pipe, backend Writable from: vcl_pipe, backend The time in seconds to wait for a backend connection. bereq.first_byte_timeout Type: DURATION Readable from: backend Writable from: backend The time in seconds to wait for the first byte from the backend. Not available in pipe mode. bereq.http. Type: HEADER Readable from: vcl_pipe, backend Writable from: vcl_pipe, backend The corresponding HTTP header. bereq.method Type: STRING Readable from: vcl_pipe, backend Writable from: vcl_pipe, backend The request type (e.g. "GET", "HEAD"). bereq.proto Type: STRING Readable from: vcl_pipe, backend Writable from: vcl_pipe, backend The HTTP protocol version used to talk to the server. bereq.retries Type: INT Readable from: backend A count of how many times this request has been retried. bereq.uncacheable Type: BOOL Readable from: backend Indicates whether this request is uncacheable due to a pass in the client side or a hit on an existing uncacheable object (aka hit-for-pass). bereq.url Type: STRING Readable from: vcl_pipe, backend Writable from: vcl_pipe, backend The requested URL. bereq.xid Type: STRING Readable from: backend Unique ID of this request. beresp ~~~~~~ beresp Type: HTTP Readable from: vcl_backend_response, vcl_backend_error The entire backend response HTTP data structure beresp.age Type: DURATION Readable from: vcl_backend_response, vcl_backend_error The age of the object. beresp.backend Type: BACKEND Readable from: vcl_backend_response, vcl_backend_error This is the backend we fetched from. If bereq.backend was set to a director, this will be the backend selected by the director. beresp.backend.ip Type: IP Readable from: vcl_backend_response, vcl_backend_error IP of the backend this response was fetched from. beresp.backend.name Type: STRING Readable from: vcl_backend_response, vcl_backend_error Name of the backend this response was fetched from. beresp.do_esi Type: BOOL Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error Boolean. ESI-process the object after fetching it. Defaults to false. Set it to true to parse the object for ESI directives. Will only be honored if req.esi is true. beresp.do_gunzip Type: BOOL Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error Boolean. Unzip the object before storing it in the cache. Defaults to false. beresp.do_gzip Type: BOOL Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error Boolean. Gzip the object before storing it. Defaults to false. When http_gzip_support is on Varnish will request already compressed content from the backend and as such compression in Varnish is not needed. beresp.do_stream Type: BOOL Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error Deliver the object to the client directly without fetching the whole object into varnish. If this request is pass'ed it will not be stored in memory. beresp.grace Type: DURATION Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error Set to a period to enable grace. beresp.http. Type: HEADER Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error The corresponding HTTP header. beresp.keep Type: DURATION Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error Set to a period to enable conditional backend requests. The keep time is cache lifetime in addition to the ttl. Objects with ttl expired but with keep time left may be used to issue conditional (If-Modified-Since / If-None-Match) requests to the backend to refresh them. beresp.proto Type: STRING Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error The HTTP protocol version used the backend replied with. beresp.reason Type: STRING Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error The HTTP status message returned by the server. beresp.status Type: INT Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error The HTTP status code returned by the server. beresp.storage_hint Type: STRING Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error Hint to Varnish that you want to save this object to a particular storage backend. beresp.ttl Type: DURATION Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error The object's remaining time to live, in seconds. beresp.uncacheable Type: BOOL Readable from: vcl_backend_response, vcl_backend_error Writable from: vcl_backend_response, vcl_backend_error Inherited from bereq.uncacheable, see there. Setting this variable makes the object uncacheable, which may get stored as a hit-for-pass object in the cache. Clearing the variable has no effect and will log the warning "Ignoring attempt to reset beresp.uncacheable". beresp.was_304 Type: BOOL Readable from: vcl_backend_response, vcl_backend_error Boolean. If this is a successful 304 response to a backend conditional request refreshing an existing cache object. client ~~~~~~ client.identity Type: STRING Readable from: client Writable from: client Identification of the client, used to load balance in the client director. client.ip Type: IP Readable from: client The client's IP address. local ~~~~~ local.ip Type: IP Readable from: client The IP address of the local end of the TCP connection. now ~~~ now Type: TIME Readable from: all The current time, in seconds since the epoch. When used in string context it returns a formatted string. obj ~~~ obj.age Type: DURATION Readable from: vcl_hit The age of the object. obj.grace Type: DURATION Readable from: vcl_hit The object's remaining grace period in seconds. obj.hits Type: INT Readable from: vcl_hit, vcl_deliver The count of cache-hits on this object. A value of 0 indicates a cache miss. obj.http. Type: HEADER Readable from: vcl_hit The corresponding HTTP header. obj.keep Type: DURATION Readable from: vcl_hit The object's remaining keep period in seconds. obj.proto Type: STRING Readable from: vcl_hit The HTTP protocol version used when the object was retrieved. obj.reason Type: STRING Readable from: vcl_hit The HTTP status message returned by the server. obj.status Type: INT Readable from: vcl_hit The HTTP status code returned by the server. obj.ttl Type: DURATION Readable from: vcl_hit The object's remaining time to live, in seconds. obj.uncacheable Type: BOOL Readable from: vcl_deliver Whether the object is uncacheable (pass or hit-for-pass). remote ~~~~~~ remote.ip Type: IP Readable from: client The IP address of the other end of the TCP connection. This can either be the clients IP, or the outgoing IP of a proxy server. req ~~~ req Type: HTTP Readable from: client The entire request HTTP data structure req.backend_hint Type: BACKEND Readable from: client Writable from: client Set bereq.backend to this if we attempt to fetch. req.can_gzip Type: BOOL Readable from: client Does the client accept the gzip transfer encoding. req.esi Type: BOOL Readable from: client Writable from: client Boolean. Set to false to disable ESI processing regardless of any value in beresp.do_esi. Defaults to true. This variable is subject to change in future versions, you should avoid using it. req.esi_level Type: INT Readable from: client A count of how many levels of ESI requests we're currently at. req.hash_always_miss Type: BOOL Readable from: vcl_recv Writable from: vcl_recv Force a cache miss for this request. If set to true Varnish will disregard any existing objects and always (re)fetch from the backend. req.hash_ignore_busy Type: BOOL Readable from: vcl_recv Writable from: vcl_recv Ignore any busy object during cache lookup. You would want to do this if you have two server looking up content from each other to avoid potential deadlocks. req.http. Type: HEADER Readable from: client Writable from: client The corresponding HTTP header. req.method Type: STRING Readable from: client Writable from: client The request type (e.g. "GET", "HEAD"). req.proto Type: STRING Readable from: client Writable from: client The HTTP protocol version used by the client. req.restarts Type: INT Readable from: client A count of how many times this request has been restarted. req.ttl Type: DURATION Readable from: client Writable from: client req.url Type: STRING Readable from: client Writable from: client The requested URL. req.xid Type: STRING Readable from: client Unique ID of this request. req_top ~~~~~~~ req_top.http. Type: HEADER Readable from: client HTTP headers of the top-level request in a tree of ESI requests. Identical to req.http. in non-ESI requests. req_top.method Type: STRING Readable from: client The request method of the top-level request in a tree of ESI requests. (e.g. "GET", "HEAD"). Identical to req.method in non-ESI requests. req_top.proto Type: STRING Readable from: client HTTP protocol version of the top-level request in a tree of ESI requests. Identical to req.proto in non-ESI requests. req_top.url Type: STRING Readable from: client The requested URL of the top-level request in a tree of ESI requests. Identical to req.url in non-ESI requests. resp ~~~~ resp Type: HTTP Readable from: vcl_deliver, vcl_synth The entire response HTTP data structure. resp.http. Type: HEADER Readable from: vcl_deliver, vcl_synth Writable from: vcl_deliver, vcl_synth The corresponding HTTP header. resp.is_streaming Type: BOOL Readable from: vcl_deliver, vcl_synth Returns true when the response will be streamed from the backend. resp.proto Type: STRING Readable from: vcl_deliver, vcl_synth Writable from: vcl_deliver, vcl_synth The HTTP protocol version to use for the response. resp.reason Type: STRING Readable from: vcl_deliver, vcl_synth Writable from: vcl_deliver, vcl_synth The HTTP status message that will be returned. resp.status Type: INT Readable from: vcl_deliver, vcl_synth Writable from: vcl_deliver, vcl_synth The HTTP status code that will be returned. Assigning a HTTP standardized code to resp.status will also set resp.reason to the corresponding status message. server ~~~~~~ server.hostname Type: STRING Readable from: all The host name of the server. server.identity Type: STRING Readable from: all The identity of the server, as set by the -i parameter. If the -i parameter is not passed to varnishd, server.identity will be set to the name of the instance, as specified by the -n parameter. server.ip Type: IP Readable from: client The IP address of the socket on which the client connection was received. storage ~~~~~~~ storage..free_space Type: BYTES Readable from: client, backend Free space available in the named stevedore. Only available for the malloc stevedore. storage..used_space Type: BYTES Readable from: client, backend Used space in the named stevedore. Only available for the malloc stevedore. storage..happy Type: BOOL Readable from: client, backend Health status for the named stevedore. Not available in any of the current stevedores. varnish-4.1.1/doc/sphinx/include/varnishtop_synopsis.rst0000644000201500234410000000042112652366754020520 00000000000000.. |synopsis| replace:: [-1] [-b] [-c] [-C] [-d] [-f] [-g ] [-h] [-i taglist] [-I <[taglist:]regex>] [-L limit] [-n name] [-N filename] [-p period] [-q query] [-r filename] [-t ] [-T seconds] [-x taglist] [-X <[taglist:]regex>] [-V] varnish-4.1.1/doc/sphinx/include/varnishhist_options.rst0000644000201500234410000000403012652366754020471 00000000000000-C Do all regular expression and string matching caseless. -d Start processing log records at the head of the log instead of the tail. -g The grouping of the log records. The default is to group by vxid. -h Print program usage and exit -L limit Sets the upper limit of incomplete transactions kept before the oldest transaction is force completed. A warning record is synthesized when this happens. This setting keeps an upper bound on the memory usage of running queries. Defaults to 1000 transactions. -n name Specify the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. -N filename Specify the filename of a stale VSM instance. When using this option the abandonment checking is disabled. -p period Specified the number of seconds between screen refreshes. Default is 1 second, and can be changed at runtime by pressing the [1-9] keys. -P Either specify "size" or "responsetime" profile or create a new one. Define the tag we'll look for, and the field number of the value we are interested in. min and max are the boundaries of the graph (these are power of tens). -q query Specifies the VSL query to use. -r filename Read log in binary file format from this file. The file can be created with ``varnishlog -w filename``. -t Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this many seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. Defaults to 5 seconds. -T seconds Sets the transaction timeout in seconds. This defines the maximum number of seconds elapsed between a Begin tag and the End tag. If the timeout expires, a warning record is synthesized and the transaction is force completed. Defaults to 120 seconds. -V Print version information and exit. varnish-4.1.1/doc/sphinx/include/params.rst0000644000201500234410000006376012652366754015656 00000000000000 .. The following is the autogenerated output from varnishd -x dumprstparam .. _ref_param_accept_filter: accept_filter ~~~~~~~~~~~~~ * Units: bool * Default: off * Flags: must_restart Enable kernel accept-filters (if available in the kernel). .. _ref_param_acceptor_sleep_decay: acceptor_sleep_decay ~~~~~~~~~~~~~~~~~~~~ * Default: 0.9 * Minimum: 0 * Maximum: 1 * Flags: experimental If we run out of resources, such as file descriptors or worker threads, the acceptor will sleep between accepts. This parameter (multiplicatively) reduce the sleep duration for each successful accept. (ie: 0.9 = reduce by 10%) .. _ref_param_acceptor_sleep_incr: acceptor_sleep_incr ~~~~~~~~~~~~~~~~~~~ * Units: seconds * Default: 0.000 * Minimum: 0.000 * Maximum: 1.000 * Flags: experimental If we run out of resources, such as file descriptors or worker threads, the acceptor will sleep between accepts. This parameter control how much longer we sleep, each time we fail to accept a new connection. .. _ref_param_acceptor_sleep_max: acceptor_sleep_max ~~~~~~~~~~~~~~~~~~ * Units: seconds * Default: 0.050 * Minimum: 0.000 * Maximum: 10.000 * Flags: experimental If we run out of resources, such as file descriptors or worker threads, the acceptor will sleep between accepts. This parameter limits how long it can sleep between attempts to accept new connections. .. _ref_param_auto_restart: auto_restart ~~~~~~~~~~~~ * Units: bool * Default: on Automatically restart the child/worker process if it dies. .. _ref_param_backend_idle_timeout: backend_idle_timeout ~~~~~~~~~~~~~~~~~~~~ * Units: seconds * Default: 60.000 * Minimum: 1.000 Timeout before we close unused backend connections. .. _ref_param_ban_dups: ban_dups ~~~~~~~~ * Units: bool * Default: on Eliminate older identical bans when a new ban is added. This saves CPU cycles by not comparing objects to identical bans. This is a waste of time if you have many bans which are never identical. .. _ref_param_ban_lurker_age: ban_lurker_age ~~~~~~~~~~~~~~ * Units: seconds * Default: 60.000 * Minimum: 0.000 The ban lurker will ignore bans until they are this old. When a ban is added, the active traffic will be tested against it as part of object lookup. This parameter holds the ban-lurker off, until the rush is over. .. _ref_param_ban_lurker_batch: ban_lurker_batch ~~~~~~~~~~~~~~~~ * Default: 1000 * Minimum: 1 The ban lurker sleeps ${ban_lurker_sleep} after examining this many objects. Use this to pace the ban-lurker if it eats too many resources. .. _ref_param_ban_lurker_sleep: ban_lurker_sleep ~~~~~~~~~~~~~~~~ * Units: seconds * Default: 0.010 * Minimum: 0.000 How long the ban lurker sleeps after examining ${ban_lurker_batch} objects. Use this to pace the ban-lurker if it eats too many resources. A value of zero will disable the ban lurker entirely. .. _ref_param_between_bytes_timeout: between_bytes_timeout ~~~~~~~~~~~~~~~~~~~~~ * Units: seconds * Default: 60.000 * Minimum: 0.000 We only wait for this many seconds between bytes received from the backend before giving up the fetch. A value of zero means never give up. VCL values, per backend or per backend request take precedence. This parameter does not apply to pipe'ed requests. .. _ref_param_cc_command: cc_command ~~~~~~~~~~ * Default: "exec gcc -std=gnu99 -g -O2 -Wall -Werror -Wno-error=unused-result \t-Werror \t-Wall \t-Wno-format-y2k \t-W \t-Wstrict-prototypes \t-Wmissing-prototypes \t-Wpointer-arith \t-Wreturn-type \t-Wcast-qual \t-Wwrite-strings \t-Wswitch \t-Wshadow \t-Wunused-parameter \t-Wcast-align \t-Wchar-subscripts \t-Wnested-externs \t-Wextra \t-Wno-sign-compare -fstack-protector -Wno-pointer-sign -Wno-address -Wno-missing-field-initializers -pthread -fpic -shared -Wl,-x -o %o %s" * Flags: must_reload Command used for compiling the C source code to a dlopen(3) loadable object. Any occurrence of %s in the string will be replaced with the source file name, and %o will be replaced with the output file name. .. _ref_param_cli_buffer: cli_buffer ~~~~~~~~~~ * Units: bytes * Default: 8k * Minimum: 4k Size of buffer for CLI command input. You may need to increase this if you have big VCL files and use the vcl.inline CLI command. NB: Must be specified with -p to have effect. .. _ref_param_cli_limit: cli_limit ~~~~~~~~~ * Units: bytes * Default: 48k * Minimum: 128b * Maximum: 99999999b Maximum size of CLI response. If the response exceeds this limit, the response code will be 201 instead of 200 and the last line will indicate the truncation. .. _ref_param_cli_timeout: cli_timeout ~~~~~~~~~~~ * Units: seconds * Default: 60.000 * Minimum: 0.000 Timeout for the childs replies to CLI requests from the mgt_param. .. _ref_param_clock_skew: clock_skew ~~~~~~~~~~ * Units: seconds * Default: 10 * Minimum: 0 How much clockskew we are willing to accept between the backend and our own clock. .. _ref_param_connect_timeout: connect_timeout ~~~~~~~~~~~~~~~ * Units: seconds * Default: 3.500 * Minimum: 0.000 Default connection timeout for backend connections. We only try to connect to the backend for this many seconds before giving up. VCL can override this default value for each backend and backend request. .. _ref_param_critbit_cooloff: critbit_cooloff ~~~~~~~~~~~~~~~ * Units: seconds * Default: 180.000 * Minimum: 60.000 * Maximum: 254.000 * Flags: wizard How long the critbit hasher keeps deleted objheads on the cooloff list. .. _ref_param_debug: debug ~~~~~ * Default: none Enable/Disable various kinds of debugging. *none* Disable all debugging Use +/- prefix to set/reset individual bits: *req_state* VSL Request state engine *workspace* VSL Workspace operations *waiter* VSL Waiter internals *waitinglist* VSL Waitinglist events *syncvsl* Make VSL synchronous *hashedge* Edge cases in Hash *vclrel* Rapid VCL release *lurker* VSL Ban lurker *esi_chop* Chop ESI fetch to bits *flush_head* Flush after http1 head *vtc_mode* Varnishtest Mode *witness* Emit WITNESS lock records *vsm_keep* Keep the VSM file on restart .. _ref_param_default_grace: default_grace ~~~~~~~~~~~~~ * Units: seconds * Default: 10.000 * Minimum: 0.000 * Flags: obj_sticky Default grace period. We will deliver an object this long after it has expired, provided another thread is attempting to get a new copy. .. _ref_param_default_keep: default_keep ~~~~~~~~~~~~ * Units: seconds * Default: 0.000 * Minimum: 0.000 * Flags: obj_sticky Default keep period. We will keep a useless object around this long, making it available for conditional backend fetches. That means that the object will be removed from the cache at the end of ttl+grace+keep. .. _ref_param_default_ttl: default_ttl ~~~~~~~~~~~ * Units: seconds * Default: 120.000 * Minimum: 0.000 * Flags: obj_sticky The TTL assigned to objects if neither the backend nor the VCL code assigns one. .. _ref_param_feature: feature ~~~~~~~ * Default: none Enable/Disable various minor features. *none* Disable all features. Use +/- prefix to enable/disable individual feature: *short_panic* Short panic message. *wait_silo* Wait for persistent silo. *no_coredump* No coredumps. *esi_ignore_https* Treat HTTPS as HTTP in ESI:includes *esi_disable_xml_check* Don't check of body looks like XML *esi_ignore_other_elements* Ignore non-esi XML-elements *esi_remove_bom* Remove UTF-8 BOM .. _ref_param_fetch_chunksize: fetch_chunksize ~~~~~~~~~~~~~~~ * Units: bytes * Default: 16k * Minimum: 4k * Flags: experimental The default chunksize used by fetcher. This should be bigger than the majority of objects with short TTLs. Internal limits in the storage_file module makes increases above 128kb a dubious idea. .. _ref_param_fetch_maxchunksize: fetch_maxchunksize ~~~~~~~~~~~~~~~~~~ * Units: bytes * Default: 0.25G * Minimum: 64k * Flags: experimental The maximum chunksize we attempt to allocate from storage. Making this too large may cause delays and storage fragmentation. .. _ref_param_first_byte_timeout: first_byte_timeout ~~~~~~~~~~~~~~~~~~ * Units: seconds * Default: 60.000 * Minimum: 0.000 Default timeout for receiving first byte from backend. We only wait for this many seconds for the first byte before giving up. A value of 0 means it will never time out. VCL can override this default value for each backend and backend request. This parameter does not apply to pipe. .. _ref_param_gzip_buffer: gzip_buffer ~~~~~~~~~~~ * Units: bytes * Default: 32k * Minimum: 2k * Flags: experimental Size of malloc buffer used for gzip processing. These buffers are used for in-transit data, for instance gunzip'ed data being sent to a client.Making this space to small results in more overhead, writes to sockets etc, making it too big is probably just a waste of memory. .. _ref_param_gzip_level: gzip_level ~~~~~~~~~~ * Default: 6 * Minimum: 0 * Maximum: 9 Gzip compression level: 0=debug, 1=fast, 9=best .. _ref_param_gzip_memlevel: gzip_memlevel ~~~~~~~~~~~~~ * Default: 8 * Minimum: 1 * Maximum: 9 Gzip memory level 1=slow/least, 9=fast/most compression. Memory impact is 1=1k, 2=2k, ... 9=256k. .. _ref_param_http_gzip_support: http_gzip_support ~~~~~~~~~~~~~~~~~ * Units: bool * Default: on Enable gzip support. When enabled Varnish request compressed objects from the backend and store them compressed. If a client does not support gzip encoding Varnish will uncompress compressed objects on demand. Varnish will also rewrite the Accept-Encoding header of clients indicating support for gzip to: Accept-Encoding: gzip Clients that do not support gzip will have their Accept-Encoding header removed. For more information on how gzip is implemented please see the chapter on gzip in the Varnish reference. .. _ref_param_http_max_hdr: http_max_hdr ~~~~~~~~~~~~ * Units: header lines * Default: 64 * Minimum: 32 * Maximum: 65535 Maximum number of HTTP header lines we allow in {req|resp|bereq|beresp}.http (obj.http is autosized to the exact number of headers). Cheap, ~20 bytes, in terms of workspace memory. Note that the first line occupies five header lines. .. _ref_param_http_range_support: http_range_support ~~~~~~~~~~~~~~~~~~ * Units: bool * Default: on Enable support for HTTP Range headers. .. _ref_param_http_req_hdr_len: http_req_hdr_len ~~~~~~~~~~~~~~~~ * Units: bytes * Default: 8k * Minimum: 40b Maximum length of any HTTP client request header we will allow. The limit is inclusive its continuation lines. .. _ref_param_http_req_size: http_req_size ~~~~~~~~~~~~~ * Units: bytes * Default: 32k * Minimum: 0.25k Maximum number of bytes of HTTP client request we will deal with. This is a limit on all bytes up to the double blank line which ends the HTTP request. The memory for the request is allocated from the client workspace (param: workspace_client) and this parameter limits how much of that the request is allowed to take up. .. _ref_param_http_resp_hdr_len: http_resp_hdr_len ~~~~~~~~~~~~~~~~~ * Units: bytes * Default: 8k * Minimum: 40b Maximum length of any HTTP backend response header we will allow. The limit is inclusive its continuation lines. .. _ref_param_http_resp_size: http_resp_size ~~~~~~~~~~~~~~ * Units: bytes * Default: 32k * Minimum: 0.25k Maximum number of bytes of HTTP backend response we will deal with. This is a limit on all bytes up to the double blank line which ends the HTTP request. The memory for the request is allocated from the backend workspace (param: workspace_backend) and this parameter limits how much of that the request is allowed to take up. .. _ref_param_idle_send_timeout: idle_send_timeout ~~~~~~~~~~~~~~~~~ * Units: seconds * Default: 60.000 * Minimum: 0.000 * Flags: delayed Time to wait with no data sent. If no data has been transmitted in this many seconds the session is closed. See setsockopt(2) under SO_SNDTIMEO for more information. .. _ref_param_listen_depth: listen_depth ~~~~~~~~~~~~ * Units: connections * Default: 1024 * Minimum: 0 * Flags: must_restart Listen queue depth. .. _ref_param_lru_interval: lru_interval ~~~~~~~~~~~~ * Units: seconds * Default: 2.000 * Minimum: 0.000 * Flags: experimental Grace period before object moves on LRU list. Objects are only moved to the front of the LRU list if they have not been moved there already inside this timeout period. This reduces the amount of lock operations necessary for LRU list access. .. _ref_param_max_esi_depth: max_esi_depth ~~~~~~~~~~~~~ * Units: levels * Default: 5 * Minimum: 0 Maximum depth of esi:include processing. .. _ref_param_max_restarts: max_restarts ~~~~~~~~~~~~ * Units: restarts * Default: 4 * Minimum: 0 Upper limit on how many times a request can restart. Be aware that restarts are likely to cause a hit against the backend, so don't increase thoughtlessly. .. _ref_param_max_retries: max_retries ~~~~~~~~~~~ * Units: retries * Default: 4 * Minimum: 0 Upper limit on how many times a backend fetch can retry. .. _ref_param_nuke_limit: nuke_limit ~~~~~~~~~~ * Units: allocations * Default: 50 * Minimum: 0 * Flags: experimental Maximum number of objects we attempt to nuke in order to make space for a object body. .. _ref_param_pcre_match_limit: pcre_match_limit ~~~~~~~~~~~~~~~~ * Default: 10000 * Minimum: 1 The limit for the number of calls to the internal match() function in pcre_exec(). (See: PCRE_EXTRA_MATCH_LIMIT in pcre docs.) This parameter limits how much CPU time regular expression matching can soak up. .. _ref_param_pcre_match_limit_recursion: pcre_match_limit_recursion ~~~~~~~~~~~~~~~~~~~~~~~~~~ * Default: 20 * Minimum: 1 The recursion depth-limit for the internal match() function in a pcre_exec(). (See: PCRE_EXTRA_MATCH_LIMIT_RECURSION in pcre docs.) This puts an upper limit on the amount of stack used by PCRE for certain classes of regular expressions. We have set the default value low in order to prevent crashes, at the cost of possible regexp matching failures. Matching failures will show up in the log as VCL_Error messages with regexp errors -27 or -21. Testcase r01576 can be useful when tuning this parameter. .. _ref_param_ping_interval: ping_interval ~~~~~~~~~~~~~ * Units: seconds * Default: 3 * Minimum: 0 * Flags: must_restart Interval between pings from parent to child. Zero will disable pinging entirely, which makes it possible to attach a debugger to the child. .. _ref_param_pipe_timeout: pipe_timeout ~~~~~~~~~~~~ * Units: seconds * Default: 60.000 * Minimum: 0.000 Idle timeout for PIPE sessions. If nothing have been received in either direction for this many seconds, the session is closed. .. _ref_param_pool_req: pool_req ~~~~~~~~ * Default: 10,100,10 Parameters for per worker pool request memory pool. The three numbers are: *min_pool* minimum size of free pool. *max_pool* maximum size of free pool. *max_age* max age of free element. .. _ref_param_pool_sess: pool_sess ~~~~~~~~~ * Default: 10,100,10 Parameters for per worker pool session memory pool. The three numbers are: *min_pool* minimum size of free pool. *max_pool* maximum size of free pool. *max_age* max age of free element. .. _ref_param_pool_vbo: pool_vbo ~~~~~~~~ * Default: 10,100,10 Parameters for backend object fetch memory pool. The three numbers are: *min_pool* minimum size of free pool. *max_pool* maximum size of free pool. *max_age* max age of free element. .. _ref_param_prefer_ipv6: prefer_ipv6 ~~~~~~~~~~~ * Units: bool * Default: off Prefer IPv6 address when connecting to backends which have both IPv4 and IPv6 addresses. .. _ref_param_rush_exponent: rush_exponent ~~~~~~~~~~~~~ * Units: requests per request * Default: 3 * Minimum: 2 * Flags: experimental How many parked request we start for each completed request on the object. NB: Even with the implict delay of delivery, this parameter controls an exponential increase in number of worker threads. .. _ref_param_send_timeout: send_timeout ~~~~~~~~~~~~ * Units: seconds * Default: 600.000 * Minimum: 0.000 * Flags: delayed Send timeout for client connections. If the HTTP response hasn't been transmitted in this many seconds the session is closed. See setsockopt(2) under SO_SNDTIMEO for more information. .. _ref_param_session_max: session_max ~~~~~~~~~~~ * Units: sessions * Default: 100000 * Minimum: 1000 Maximum number of sessions we will allocate from one pool before just dropping connections. This is mostly an anti-DoS measure, and setting it plenty high should not hurt, as long as you have the memory for it. .. _ref_param_shm_reclen: shm_reclen ~~~~~~~~~~ * Units: bytes * Default: 255b * Minimum: 16b * Maximum: 4084 Old name for vsl_reclen, use that instead. .. _ref_param_shortlived: shortlived ~~~~~~~~~~ * Units: seconds * Default: 10.000 * Minimum: 0.000 Objects created with (ttl+grace+keep) shorter than this are always put in transient storage. .. _ref_param_sigsegv_handler: sigsegv_handler ~~~~~~~~~~~~~~~ * Units: bool * Default: on * Flags: must_restart Install a signal handler which tries to dump debug information on segmentation faults, bus errors and abort signals. .. _ref_param_syslog_cli_traffic: syslog_cli_traffic ~~~~~~~~~~~~~~~~~~ * Units: bool * Default: on Log all CLI traffic to syslog(LOG_INFO). .. _ref_param_tcp_keepalive_intvl: tcp_keepalive_intvl ~~~~~~~~~~~~~~~~~~~ * Units: seconds * Default: 75.000 * Minimum: 1.000 * Maximum: 100.000 * Flags: experimental The number of seconds between TCP keep-alive probes. .. _ref_param_tcp_keepalive_probes: tcp_keepalive_probes ~~~~~~~~~~~~~~~~~~~~ * Units: probes * Default: 9 * Minimum: 1 * Maximum: 100 * Flags: experimental 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. .. _ref_param_tcp_keepalive_time: tcp_keepalive_time ~~~~~~~~~~~~~~~~~~ * Units: seconds * Default: 7200.000 * Minimum: 1.000 * Maximum: 7200.000 * Flags: experimental The number of seconds a connection needs to be idle before TCP begins sending out keep-alive probes. .. _ref_param_thread_pool_add_delay: thread_pool_add_delay ~~~~~~~~~~~~~~~~~~~~~ * Units: seconds * Default: 0.000 * Minimum: 0.000 * Flags: experimental Wait at least this long after creating a thread. Some (buggy) systems may need a short (sub-second) delay between creating threads. Set this to a few milliseconds if you see the 'threads_failed' counter grow too much. Setting this too high results in insuffient worker threads. .. _ref_param_thread_pool_destroy_delay: thread_pool_destroy_delay ~~~~~~~~~~~~~~~~~~~~~~~~~ * Units: seconds * Default: 1.000 * Minimum: 0.010 * Flags: delayed, experimental Wait this long after destroying a thread. This controls the decay of thread pools when idle(-ish). .. _ref_param_thread_pool_fail_delay: thread_pool_fail_delay ~~~~~~~~~~~~~~~~~~~~~~ * Units: seconds * Default: 0.200 * Minimum: 0.010 * Flags: experimental Wait at least this long after a failed thread creation before trying to create another thread. Failure to create a worker thread is often a sign that the end is near, because the process is running out of some resource. This delay tries to not rush the end on needlessly. If thread creation failures are a problem, check that thread_pool_max is not too high. It may also help to increase thread_pool_timeout and thread_pool_min, to reduce the rate at which treads are destroyed and later recreated. .. _ref_param_thread_pool_max: thread_pool_max ~~~~~~~~~~~~~~~ * Units: threads * Default: 5000 * Minimum: 100 * Flags: delayed The maximum number of worker threads in each pool. Do not set this higher than you have to, since excess worker threads soak up RAM and CPU and generally just get in the way of getting work done. .. _ref_param_thread_pool_min: thread_pool_min ~~~~~~~~~~~~~~~ * Units: threads * Default: 100 * Maximum: 5000 * Flags: delayed The minimum number of worker threads in each pool. Increasing this may help ramp up faster from low load situations or when threads have expired. Minimum is 10 threads. .. _ref_param_thread_pool_stack: thread_pool_stack ~~~~~~~~~~~~~~~~~ * Units: bytes * Default: 48k * Minimum: 16k * Flags: experimental Worker thread stack size. This will likely be rounded up to a multiple of 4k (or whatever the page_size might be) by the kernel. .. _ref_param_thread_pool_timeout: thread_pool_timeout ~~~~~~~~~~~~~~~~~~~ * Units: seconds * Default: 300.000 * Minimum: 10.000 * Flags: delayed, experimental Thread idle threshold. Threads in excess of thread_pool_min, which have been idle for at least this long, will be destroyed. .. _ref_param_thread_pools: thread_pools ~~~~~~~~~~~~ * Units: pools * Default: 2 * Minimum: 1 * Flags: delayed, experimental Number of worker thread pools. Increasing number of worker pools decreases lock contention. Too many pools waste CPU and RAM resources, and more than one pool for each CPU is probably detrimal to performance. Can be increased on the fly, but decreases require a restart to take effect. .. _ref_param_thread_queue_limit: thread_queue_limit ~~~~~~~~~~~~~~~~~~ * Default: 20 * Minimum: 0 * Flags: experimental Permitted queue length per thread-pool. This sets the number of requests we will queue, waiting for an available thread. Above this limit sessions will be dropped instead of queued. .. _ref_param_thread_stats_rate: thread_stats_rate ~~~~~~~~~~~~~~~~~ * Units: requests * Default: 10 * Minimum: 0 * Flags: experimental Worker threads accumulate statistics, and dump these into the global stats counters if the lock is free when they finish a job (request/fetch etc.) This parameters defines the maximum number of jobs a worker thread may handle, before it is forced to dump its accumulated stats into the global counters. .. _ref_param_timeout_idle: timeout_idle ~~~~~~~~~~~~ * Units: seconds * Default: 5.000 * Minimum: 0.000 Idle timeout for client connections. A connection is considered idle, until we have received the full request headers. .. _ref_param_timeout_linger: timeout_linger ~~~~~~~~~~~~~~ * Units: seconds * Default: 0.050 * Minimum: 0.000 * Flags: experimental How long the worker thread lingers on an idle session before handing it over to the waiter. When sessions are reused, as much as half of all reuses happen within the first 100 msec of the previous request completing. Setting this too high results in worker threads not doing anything for their keep, setting it too low just means that more sessions take a detour around the waiter. .. _ref_param_vcc_allow_inline_c: vcc_allow_inline_c ~~~~~~~~~~~~~~~~~~ * Units: bool * Default: off Allow inline C code in VCL. .. _ref_param_vcc_err_unref: vcc_err_unref ~~~~~~~~~~~~~ * Units: bool * Default: on Unreferenced VCL objects result in error. .. _ref_param_vcc_unsafe_path: vcc_unsafe_path ~~~~~~~~~~~~~~~ * Units: bool * Default: on Allow '/' in vmod & include paths. Allow 'import ... from ...'. .. _ref_param_vcl_cooldown: vcl_cooldown ~~~~~~~~~~~~ * Units: seconds * Default: 600.000 * Minimum: 0.000 How long a VCL is kept warm after being replaced as the active VCL (granularity approximately 30 seconds). .. _ref_param_vcl_dir: vcl_dir ~~~~~~~ * Default: /opt/varnish/etc/varnish Directory (or colon separated list of directories) from which relative VCL filenames (vcl.load and include) are to be found. .. _ref_param_vmod_dir: vmod_dir ~~~~~~~~ * Default: /opt/varnish/lib/varnish/vmods Directory (or colon separated list of directories) where VMODs are to be found. .. _ref_param_vsl_buffer: vsl_buffer ~~~~~~~~~~ * Units: bytes * Default: 4k * Minimum: 267 Bytes of (req-/backend-)workspace dedicated to buffering VSL records. Setting this too high costs memory, setting it too low will cause more VSL flushes and likely increase lock-contention on the VSL mutex. The minimum tracks the vsl_reclen parameter + 12 bytes. .. _ref_param_vsl_mask: vsl_mask ~~~~~~~~ * Default: -VCL_trace,-WorkThread,-Hash,-VfpAcct Mask individual VSL messages from being logged. *default* Set default value Use +/- prefix in front of VSL tag name, to mask/unmask individual VSL messages. .. _ref_param_vsl_reclen: vsl_reclen ~~~~~~~~~~ * Units: bytes * Default: 255b * Minimum: 16b * Maximum: 4084b Maximum number of bytes in SHM log record. The maximum tracks the vsl_buffer parameter - 12 bytes. .. _ref_param_vsl_space: vsl_space ~~~~~~~~~ * Units: bytes * Default: 80M * Minimum: 1M * Flags: must_restart The amount of space to allocate for the VSL fifo buffer in the VSM memory segment. If you make this too small, varnish{ncsa|log} etc will not be able to keep up. Making it too large just costs memory resources. .. _ref_param_vsm_space: vsm_space ~~~~~~~~~ * Units: bytes * Default: 1M * Minimum: 1M * Flags: must_restart The amount of space to allocate for stats counters in the VSM memory segment. If you make this too small, some counters will be invisible. Making it too large just costs memory resources. .. _ref_param_workspace_backend: workspace_backend ~~~~~~~~~~~~~~~~~ * Units: bytes * Default: 64k * Minimum: 1k * Flags: delayed Bytes of HTTP protocol workspace for backend HTTP req/resp. If larger than 4k, use a multiple of 4k for VM efficiency. .. _ref_param_workspace_client: workspace_client ~~~~~~~~~~~~~~~~ * Units: bytes * Default: 64k * Minimum: 9k * Flags: delayed Bytes of HTTP protocol workspace for clients HTTP req/resp. If larger than 4k, use a multiple of 4k for VM efficiency. .. _ref_param_workspace_session: workspace_session ~~~~~~~~~~~~~~~~~ * Units: bytes * Default: 0.50k * Minimum: 0.25k * Flags: delayed Allocation size for session structure and workspace. The workspace is primarily used for TCP connection addresses. If larger than 4k, use a multiple of 4k for VM efficiency. .. _ref_param_workspace_thread: workspace_thread ~~~~~~~~~~~~~~~~ * Units: bytes * Default: 2k * Minimum: 0.25k * Maximum: 8k * Flags: delayed Bytes of auxiliary workspace per thread. This workspace is used for certain temporary data structures during the operation of a worker thread. One use is for the io-vectors for writing requests and responses to sockets, having too little space will result in more writev(2) system calls, having too much just wastes the space. varnish-4.1.1/doc/sphinx/include/varnishncsa_options.rst0000644000201500234410000000326512652366754020457 00000000000000-a When writing output to a file, append to it rather than overwrite it. -C Do all regular expression and string matching caseless. -d Start processing log records at the head of the log instead of the tail. -D Daemonize. -F format Set the output log format string. -f formatfile Read output format from a file. Will read a single line from the specified file, and use that line as the format. -g The grouping of the log records. The default is to group by vxid. -h Print program usage and exit -n name Specify the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. -N filename Specify the filename of a stale VSM instance. When using this option the abandonment checking is disabled. -P file Write the process' PID to the specified file. -q query Specifies the VSL query to use. -r filename Read log in binary file format from this file. The file can be created with ``varnishlog -w filename``. -t Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this many seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. Defaults to 5 seconds. -V Print version information and exit. -w filename Redirect output to file. The file will be overwritten unless the -a option was specified. If the application receives a SIGHUP in daemon mode the file will be reopened allowing the old one to be rotated away. This option is required when running in daemon mode. varnish-4.1.1/doc/sphinx/include/varnishtop_options.rst0000644000201500234410000000600212652366754020325 00000000000000-1 Instead of a continuously updated display, print the statistics once and exit. Implies ``-d``. -b Only display transactions and log records coming from backend communication. -c Only display transactions and log records coming from client communication. -C Do all regular expression and string matching caseless. -d Start processing log records at the head of the log instead of the tail. -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. -g The grouping of the log records. The default is to group by vxid. -h Print program usage and exit -i taglist Include log records of these tags in output. Taglist is a comma-separated list of tag globs. Multiple -i options may be given. If a tag include option is the first of any tag selection options, all tags are first marked excluded. -I <[taglist:]regex> Include by regex matching. Output only records matching taglist and regular expression. Applies to any tag if taglist is absent. If a tag include option is the first of any tag selection options, all tags are first marked excluded. -L limit Sets the upper limit of incomplete transactions kept before the oldest transaction is force completed. A warning record is synthesized when this happens. This setting keeps an upper bound on the memory usage of running queries. Defaults to 1000 transactions. -n name Specify the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. -N filename Specify the filename of a stale VSM instance. When using this option the abandonment checking is disabled. -p 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. -q query Specifies the VSL query to use. -r filename Read log in binary file format from this file. The file can be created with ``varnishlog -w filename``. -t Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this many seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. Defaults to 5 seconds. -T seconds Sets the transaction timeout in seconds. This defines the maximum number of seconds elapsed between a Begin tag and the End tag. If the timeout expires, a warning record is synthesized and the transaction is force completed. Defaults to 120 seconds. -x taglist Exclude log records of these tags in output. Taglist is a comma-separated list of tag globs. Multiple -x options may be given. -X <[taglist:]regex> Exclude by regex matching. Do not output records matching taglist and regular expression. Applies to any tag if taglist is absent. -V Print version information and exit. varnish-4.1.1/doc/sphinx/include/varnishlog_synopsis.rst0000644000201500234410000000046012652366754020502 00000000000000.. |synopsis| replace:: [-a] [-A] [-b] [-c] [-C] [-d] [-D] [-g ] [-h] [-i taglist] [-I <[taglist:]regex>] [-k num] [-L limit] [-n name] [-N filename] [-P file] [-q query] [-r filename] [-t ] [-T seconds] [-v] [-V] [-w filename] [-x taglist] [-X <[taglist:]regex>] varnish-4.1.1/doc/sphinx/Makefile.in0000644000201500234410000004300612652366726014251 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Makefile for Sphinx documentation # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = doc/sphinx DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/conf.py.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = conf.py CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -W -q -N PAPER = a4 BUILDDIR = build ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees -D latex_paper_size=$(PAPER) $(SPHINXOPTS) $(builddir) EXTRA_DIST = conf.py index.rst include glossary installation phk \ tutorial users-guide whats-new $(BUILT_SOURCES) BUILT_SOURCES = include/params.rst include/counters.rst \ include/varnishncsa_options.rst \ include/varnishncsa_synopsis.rst \ include/varnishlog_options.rst include/varnishlog_synopsis.rst \ include/varnishtop_options.rst include/varnishtop_synopsis.rst \ include/varnishhist_options.rst \ include/varnishhist_synopsis.rst reference \ reference/vmod_std.generated.rst \ reference/vmod_directors.generated.rst MAINTAINERCLEANFILES = $(EXTRA_DIST) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/sphinx/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign doc/sphinx/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): conf.py: $(top_builddir)/config.status $(srcdir)/conf.py.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-local dvi: dvi-am dvi-am: html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: all check install install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ dist-hook distclean distclean-generic distclean-libtool \ distclean-local distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* # use index.rst as an indicator if we have copied already .PHONY: link_srcdir link_srcdir: if test "x$(srcdir)" != "x$(builddir)" && test ! -f index.rst ; then \ d=`pwd`/$(builddir) ; \ cd $(srcdir) && find . -type f | cpio -ldmp $${d} ; \ fi # work around for make html called within doc/sphinx .PHONY: graphviz graphviz: cd ../graphviz && $(MAKE) html sphinx_prereq: link_srcdir graphviz conf.py html: sphinx_prereq $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: sphinx_prereq $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." pickle: sphinx_prereq $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: sphinx_prereq $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: sphinx_prereq $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: sphinx_prereq $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Varnish.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Varnish.qhc" latex: sphinx_prereq $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." changes: sphinx_prereq $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: sphinx_prereq $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: sphinx_prereq $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." dist-hook: $(MAKE) html rm -rf $(BUILDDIR)/doctrees cp -r $(BUILDDIR)/html $(distdir)/../ @ # Remove build artifacts. rm $(distdir)/../html/.buildinfo $(distdir)/../html/*.inv distclean-local: rm -rf $(BUILDDIR) include/params.rst: $(top_builddir)/bin/varnishd/varnishd $(top_builddir)/bin/varnishd/varnishd -x dumprstparam > include/params.rst include/counters.rst: $(top_builddir)/bin/varnishstat/vsc2rst $(top_builddir)/bin/varnishstat/vsc2rst > $@ # XXX add varnishstat here when it's been _opt2rst'ed include/varnishncsa_options.rst: $(top_builddir)/bin/varnishncsa/varnishncsa_opt2rst $(top_builddir)/bin/varnishncsa/varnishncsa_opt2rst options > $@ include/varnishncsa_synopsis.rst: $(top_builddir)/bin/varnishncsa/varnishncsa_opt2rst $(top_builddir)/bin/varnishncsa/varnishncsa_opt2rst synopsis > $@ include/varnishlog_options.rst: $(top_builddir)/bin/varnishlog/varnishlog_opt2rst $(top_builddir)/bin/varnishlog/varnishlog_opt2rst options > $@ include/varnishlog_synopsis.rst: $(top_builddir)/bin/varnishlog/varnishlog_opt2rst $(top_builddir)/bin/varnishlog/varnishlog_opt2rst synopsis > $@ include/varnishtop_options.rst: $(top_builddir)/bin/varnishtop/varnishtop_opt2rst $(top_builddir)/bin/varnishtop/varnishtop_opt2rst options > $@ include/varnishtop_synopsis.rst: $(top_builddir)/bin/varnishtop/varnishtop_opt2rst $(top_builddir)/bin/varnishtop/varnishtop_opt2rst synopsis > $@ include/varnishhist_options.rst: $(top_builddir)/bin/varnishhist/varnishhist_opt2rst $(top_builddir)/bin/varnishhist/varnishhist_opt2rst options > $@ include/varnishhist_synopsis.rst: $(top_builddir)/bin/varnishhist/varnishhist_opt2rst $(top_builddir)/bin/varnishhist/varnishhist_opt2rst synopsis > $@ .PHONY: reference reference: test -d $@ || mkdir $@ reference/vmod_std.generated.rst: reference $(top_builddir)/lib/libvmod_std/vmod_std.rst cp $(top_builddir)/lib/libvmod_std/vmod_std.rst $@ reference/vmod_directors.generated.rst: reference $(top_builddir)/lib/libvmod_directors/vmod_directors.rst cp $(top_builddir)/lib/libvmod_directors/vmod_directors.rst $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/doc/sphinx/reference/0000755000201500234410000000000012652366754014220 500000000000000varnish-4.1.1/doc/sphinx/reference/vmod.rst0000644000201500234410000003660412652366721015642 00000000000000.. _ref-vmod: %%%%%%%%%%%%%%%%%%%%%% VMOD - Varnish Modules %%%%%%%%%%%%%%%%%%%%%% For all you can do in VCL, there are things you can not do. Look an IP number up in a database file for instance. VCL provides for inline C code, and there you can do everything, but it is not a convenient or even readable way to solve such problems. This is where VMODs come into the picture: A VMOD is a shared library with some C functions which can be called from VCL code. For instance:: import std; sub vcl_deliver { set resp.http.foo = std.toupper(req.url); } The "std" vmod is one you get with Varnish, it will always be there and we will put "boutique" functions in it, such as the "toupper" function shown above. The full contents of the "std" module is documented in vmod_std(3). 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 can find contributed VMODs etc. This explanation will use the "std" VMOD as example, having a Varnish source tree handy may be a good idea. VMOD Directory ============== The VMOD directory is an up-to-date compilation of maintained extensions written for Varnish Cache: https://www.varnish-cache.org/vmods The vmod.vcc file ================= The interface between your VMOD and the VCL compiler ("VCC") and the VCL runtime ("VRT") is defined in the vmod.vcc file which a python script called "vmodtool.py" turns into thaumaturgically challenged C data structures that does all the hard work. The std VMODs vmod.vcc file looks somewhat like this:: $Module std 3 $Event event_function $Function STRING toupper(STRING_LIST) $Function STRING tolower(STRING_LIST) $Function VOID set_ip_tos(INT) The first line gives the name of the module and the manual section where the documentation will reside. The second line specifies an optional "Event" function, which will be called whenever a VCL program which imports this VMOD is loaded or transitions to any of the warm, active, cold or discarded states. More on this below. The next three lines define three functions in the VMOD, along with the types of the arguments, and that is probably where the hardest bit of writing a VMOD is to be found, so we will talk about that at length in a moment. Notice that the third function returns VOID, that makes it a "procedure" in VCL lingo, meaning that it cannot be used in expressions, right side of assignments and such. Instead it can be used as a primary action, something functions which return a value can not:: sub vcl_recv { std.set_ip_tos(32); } Running vmodtool.py on the vmod.vcc file, produces a "vcc_if.c" and "vcc_if.h" files, which you must use to build your shared library file. Forget about vcc_if.c everywhere but your Makefile, you will never need to care about its contents, and you should certainly never modify it, that voids your warranty instantly. But vcc_if.h is important for you, it contains the prototypes for the functions you want to export to VCL. For the std VMOD, the compiled vcc_if.h file looks like this:: struct vmod_priv; VCL_STRING vmod_toupper(VRT_CTX, const char *, ...); VCL_STRING vmod_tolower(VRT_CTX, const char *, ...); VCL_VOID vmod_set_ip_tos(VRT_CTX, VCL_INT); vmod_event_f event_function; Those are your C prototypes. Notice the ``vmod_`` prefix on the function names. .. _ref-vmod-vcl-c-types: VCL and C data types ==================== VCL data types are targeted at the job, so for instance, we have data types like "DURATION" and "HEADER", but they all have some kind of C language representation. Here is a description of them. All but the PRIV and STRING_LIST types have typedefs: VCL_INT, VCL_REAL, etc. .. TODO document ACL if patchwork #314 is merged BACKEND C-type: ``const struct director *`` A type for backend and director implementations. See :ref:`ref-writing-a-director`. BLOB C-type: ``const struct vmod_priv *`` An opaque type to pass random bits of memory between VMOD functions. BOOL C-type: ``unsigned`` Zero means false, anything else means true. BYTES C-type: ``double`` Unit: bytes. A storage space, as in 1024 bytes. DURATION C-type: ``double`` Unit: seconds. A time interval, as in 25 seconds. ENUM C-type: ``const char *`` TODO HEADER C-type: ``const struct gethdr_s *`` These are VCL compiler generated constants referencing a particular header in a particular HTTP entity, for instance ``req.http.cookie`` or ``beresp.http.last-modified``. By passing a reference to the header, the VMOD code can both read and write the header in question. If the header was passed as STRING, the VMOD code only sees the value, but not where it came from. HTTP C-type: ``struct http *`` TODO INT C-type: ``long`` A (long) integer as we know and love them. IP C-type: ``const struct suckaddr *`` This is an opaque type, see the ``include/vsa.h`` file for which primitives we support on this type. PRIV_CALL See :ref:`ref-vmod-private-pointers` below. PRIV_TASK See :ref:`ref-vmod-private-pointers` below. PRIV_TOP See :ref:`ref-vmod-private-pointers` below. PRIV_VCL See :ref:`ref-vmod-private-pointers` below. PROBE C-type: ``const struct vrt_backend_probe *`` A named standalone backend probe definition. REAL C-type: ``double`` A floating point value. STRING C-type: ``const char *`` A NUL-terminated text-string. Can be NULL to indicate a nonexistent string, for instance in:: mymod.foo(req.http.foobar); If there were no "foobar" HTTP header, the vmod_foo() function would be passed a NULL pointer as argument. When used as a return value, the producing function is responsible for arranging memory management. Either by freeing the string later by whatever means available or by using storage allocated from the client or backend workspaces. STRING_LIST C-type: ``const char *, ...`` A multi-component text-string. We try very hard to avoid doing text-processing in Varnish, and this is one way we to avoid that, by not editing separate pieces of a string together to one string, unless we have to. Consider this contrived example:: set req.http.foo = std.toupper(req.http.foo + req.http.bar); The usual way to do this, would be be to allocate memory for the concatenated string, then pass that to ``toupper()`` which in turn would return another freshly allocated string with the modified result. Remember: strings in VCL are ``const``, we cannot just modify the string in place. What we do instead, is declare that ``toupper()`` takes a "STRING_LIST" as argument. This makes the C function implementing ``toupper()`` a vararg function (see the prototype above) and responsible for considering all the ``const char *`` arguments it finds, until the magic marker "vrt_magic_string_end" is encountered. Bear in mind that the individual strings in a STRING_LIST can be NULL, as described under STRING, that is why we do not use NULL as the terminator. Right now we only support STRING_LIST being the last argument to a function, we may relax that at a latter time. If you don't want to bother with STRING_LIST, just use STRING and make sure your workspace_client and workspace_backend params are big enough. TIME C-type: ``double`` Unit: seconds since UNIX epoch. An absolute time, as in 1284401161. VOID C-type: ``void`` Can only be used for return-value, which makes the function a VCL procedure. .. _ref-vmod-private-pointers: Private Pointers ================ It is often useful for library functions to maintain local state, this can be anything from a precompiled regexp to open file descriptors and vast data structures. The VCL compiler supports the following private pointers: * ``PRIV_CALL`` "per call" private pointers are useful to cache/store state relative to the specific call or its arguments, for instance a compiled regular expression specific to a regsub() statement or a simply caching the last output of some expensive lookup. * ``PRIV_TASK`` "per task" private pointers are useful for state that applies to calls for either a specific request or a backend request. For instance this can be the result of a parsed cookie specific to a client. Note that ``PRIV_TASK`` contexts are separate for the client side and the backend side, so use in ``vcl_backend_*`` will yield a different private pointer from the one used on the client side. * ``PRIV_TOP`` "per top-request" private pointers live for the duration of one request and all its ESI-includes. They are only defined for the client side. When used from backend VCL subs, a NULL pointer will be passed. * ``PRIV_VCL`` "per vcl" private pointers are useful for such global state that applies to all calls in this VCL, for instance flags that determine if regular expressions are case-sensitive in this vmod or similar. The ``PRIV_VCL`` object is the same object that is passed to the VMOD's event function. The way it works in the vmod code, is that a ``struct vmod_priv *`` is passed to the functions where one of the ``PRIV_*`` argument types is specified. This structure contains three members:: typedef void vmod_priv_free_f(void *); struct vmod_priv { void *priv; int len; vmod_priv_free_f *free; }; The "priv" element can be used for whatever the vmod code wants to use it for, it defaults to a NULL pointer. The "len" element is used primarily for BLOBs to indicate its size. The "free" element defaults to NULL, and it is the modules responsibility to set it to a suitable function, which can clean up whatever the "priv" pointer points to. When a VCL program is discarded, all private pointers are checked to see if both the "priv" and "free" elements are non-NULL, and if they are, the "free" function will be called with the "priv" pointer as the only argument. In the common case where a private data structure is allocated with malloc would look like this:: if (priv->priv == NULL) { priv->priv = calloc(sizeof(struct myfoo), 1); AN(priv->priv); priv->free = free; /* free(3) */ mystate = priv->priv; mystate->foo = 21; ... } else { mystate = priv->priv; } if (foo > 25) { ... } The per-call vmod_privs are freed before the per-vcl vmod_priv. .. _ref-vmod-event-functions: Event functions =============== VMODs can have an "event" function which is called when a VCL which imports the VMOD is loaded, made active, or discarded. This corresponds to the ``VCL_EVENT_LOAD``, and ``VCL_EVENT_DISCARD`` events, respectively. In addition, this function will be called when the VCL temperature is changed to cold or warm, corresponding to the ``VCL_EVENT_COLD`` and ``VCL_EVENT_WARM`` events. The first argument to the event function is a VRT context. The second argument is the vmod_priv specific to this particular VCL, and if necessary, a VCL specific VMOD "fini" function can be attached to its "free" hook. The third argument is the event. If the VMOD has private global state, which includes any sockets or files opened, any memory allocated to global or private variables in the C-code etc, it is the VMODs own responsibility to track how many VCLs were loaded or discarded and free this global state when the count reaches zero. VMOD writers are *strongly* encouraged to release all per-VCL resources for a given VCL when it emits a ``VCL_EVENT_COLD`` event. You will get a chance to reacquire the resources before the VCL becomes active again and be notified first with a ``VCL_EVENT_WARM`` event. Unless a user decides that a given VCL should always be warm, an inactive VMOD will eventually become cold and should manage resources accordingly. An event function must return zero upon success. It is only possible to fail an initialization with the ``VCL_EVENT_LOAD`` or ``VCL_EVENT_WARM`` events. Should such a failure happen, a ``VCL_EVENT_DISCARD`` or ``VCL_EVENT_COLD`` event will be sent to the VMODs that succeeded to put them back in a cold state. The VMOD that failed will not receive this event, and therefore must not be left half-initialized should a failure occur. If your VMOD is running an asynchronous background job you can hold a reference to the VCL to prevent it from going cold too soon and get the same guarantees as backends with ongoing requests for instance. For that, you must acquire the reference by calling ``VRT_ref_vcl`` when you receive a ``VCL_EVENT_WARM`` and later calling ``VRT_rel_vcl`` once the background job is over. Receiving a ``VCL_EVENT_COLD`` is your cue to terminate any background job bound to a VCL. You can find an example of VCL references in vmod-debug:: priv_vcl->vclref = VRT_ref_vcl(ctx, "vmod-debug"); ... VRT_rel_vcl(&ctx, &priv_vcl->vclref); In this simplified version, you can see that you need at least a VCL-bound data structure like a ``PRIV_VCL`` or a VMOD object to keep track of the reference and later release it. You also have to provide a description, it will be printed to the user if they try to warm up a cooling VCL:: $ varnishadm vcl.list available auto/cooling 0 vcl1 active auto/warm 0 vcl2 $ varnishadm vcl.state vcl1 warm Command failed with error code 300 Failed Message: VCL vcl1 is waiting for: - vmod-debug In the case where properly releasing resources may take some time, you can opt for an asynchronous worker, either by spawning a thread and tracking it, or by using Varnish's worker pools. There is also a ``VCL_EVENT_USE`` event. Please note that this event is now deprecated and may be removed in a future release. A warm VCL should be ready to use so no additional task should be postponed at use time. When to lock, and when not to lock ================================== Varnish is heavily multithreaded, so by default VMODs must implement their own locking to protect shared resources. When a VCL is loaded or unloaded, the event and priv->free are run sequentially all in a single thread, and there is guaranteed to be no other activity related to this particular VCL, nor are there init/fini activity in any other VCL or VMOD at this time. That means that the VMOD init, and any object init/fini functions are already serialized in sensible order, and won't need any locking, unless they access VMOD specific global state, shared with other VCLs. Traffic in other VCLs which also import this VMOD, will be happening while housekeeping is going on. Updating VMODs ============== A compiled VMOD is a shared library file which Varnish dlopen(3)'s using flags RTLD_NOW | RTLD_LOCAL. As a general rule, once a file is opened with dlopen(3) you should never modify it, but it is safe to rename it and put a new file under the name it had, which is how most tools installs and updates shared libraries. However, when you call dlopen(3) with the same filename multiple times it will give you the same single copy of the shared library file, without checking if it was updated in the meantime. This is obviously an oversight in the design of the dlopen(3) library function, but back in the late 1980s nobody could imagine why a program would ever want to have multiple different versions of the same shared library mapped at the same time. Varnish does that, and therefore you must restart the worker process before Varnish will discover an updated VMOD. If you want to test a new version of a VMOD, while being able to instantly switch back to the old version, you will have to install each version with a distinct filename or in a distinct subdirectory and use ``import foo from "...";`` to reference it in your VCL. We're not happy about this, but have found no sensible workarounds. varnish-4.1.1/doc/sphinx/reference/vsl-query.rst0000644000201500234410000002116512652366721016640 00000000000000.. role:: ref(emphasis) .. _vsl-query(7): ========= vsl-query ========= ----------------------------- Varnish VSL Query Expressions ----------------------------- :Manual section: 7 OVERVIEW ======== The Varnish VSL Query Expressions extracts transactions from the Varnish shared memory log, and perform queries on the transactions before reporting matches. A transaction is a set of log lines that belongs together, e.g. a client request or a backend request. The API monitors the log, and collects all log records that make up a transaction before reporting on that transaction. Transactions can also be grouped, meaning backend transactions are reported together with the client transaction that initiated it. A query is run on a group of transactions. A query expression is true if there is a log record within the group that satisfies the condition. It is false only if none of the log records satisfies the condition. Query expressions can be combined using boolean functions. GROUPING ======== When grouping transactions, there is a hierarchy structure showing which transaction initiated what. The level increases by one on 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. Request restart transactions don't get their level increased to make it predictable. Levels start counting at 1, except when using raw where it will always be 0. The grouping modes are: * Session All transactions initiated by a client connection are reported together. Client connections are open ended when using HTTP keep-alives, so it is undefined when the session will be reported. If the transaction timeout period is exceeded an incomplete session will be reported. Non-transactional data (VXID == 0) is not reported. * Request Transactions are grouped by request, where the set will include the request itself as well as any backend requests or ESI-subrequests. Session data and non-transactional data (VXID == 0) is not reported. * VXID Transactions are not grouped, so each VXID is reported in it's entirety. Sessions, requests, ESI-requests and backend requests are all reported individually. Non-transactional data is not reported (VXID == 0). This is the default. * Raw Every log record will make up a transaction of it's own. All data, including non-transactional data will be reported. Transaction Hierarchy --------------------- Example transaction hierarchy using request grouping mode :: Lvl 1: Client request (cache miss) Lvl 2: Backend request Lvl 2: ESI subrequest (cache miss) Lvl 3: Backend request Lvl 3: Backend request (VCL restart) Lvl 3: ESI subrequest (cache miss) Lvl 4: Backend request Lvl 2: ESI subrequest (cache hit) MEMORY USAGE ============ The API will use pointers to shared memory log data as long as possible to keep memory usage at a minimum. But as the shared memory log is a ring buffer, data will get overwritten eventually, so the API creates local copies of referenced log data when varnishd comes close to overwriting still unreported content. This process avoids loss of log data in many scenarios, but it is not failsafe: Overruns where varnishd "overtakes" the log reader process in the ring buffer can still happen when API clients cannot keep up reading and/or copying, for instance due to output blocking. Though being unrelated to grouping in principle, copying of log data is particularly relevant for session grouping together with long lasting client connections - for this grouping, the logging API client process is likely to consume relevant amounts of memory. As the vxid grouping also logs (potentially long lasting) sessions, it is also likely to require memory for copies of log entries, but far less than session grouping. QUERY LANGUAGE ============== A query expression consists of record selection criteria, and optionally an operator and a value to match against the selected records. :: Record selection criteria ------------------------- The record selection criteria determines what kind records from the transaction group the expression applies to. Syntax: :: {level}taglist:record-prefix[field] Taglist is mandatory, the other components are optional. The level limits the expression to a transaction at that level. If left unspecified, the expression is applied to transactions at all levels. Level is a positive integer or zero. If level is followed by a '+' character, it expresses greater than or equal. If level is followed by a '-', it expresses less than or equal. The taglist is a comma-separated list of VSL record tags that this expression should be checked against. Each list element can be a tag name or a tag glob. Globs allow a '*' either in the beginning of the name or at the end, and will select all tags that match either the prefix or subscript. A single '*' will select all tags. The record prefix will further limit the matches to those records that has this prefix as it's first part of the record content followed by a colon. The part of the log record matched against will then be limited to what follows the prefix and colon. This is useful when matching against specific HTTP headers. The record prefix matching is done case insensitive. The field will, if present, treat the log record as a white space separated list of fields, and only the nth part of the record will be matched against. Fields start counting at 1. An expression using only a record selection criteria will be true if there is any record in the transaction group that is selected by the criteria. Operators --------- The following matching operators are available: * == != < <= > >= Numerical comparison. The record contents will be converted to either an integer or a float before comparison, depending on the type of the operand. * eq ne String comparison. 'eq' tests string equality, 'ne' tests for not equality. * ~ !~ Regular expression matching. '~' is a positive match, '!~' is a non-match. Operand ------- The operand is the value the selected records will be matched against. An operand can be quoted or unquoted. Quotes can be either single or double quotes, and for quoted operands a backslash can be used to escape the quotes. Unquoted operands can only consist of the following characters: :: a-z A-Z 0-9 + - _ . * The following types of operands are available: * Integer A number without any fractional part, valid for the numerical comparison operators. The integer type is used when the operand does not contain any period (.) characters. * Float A number with a fractional part, valid for the numerical comparison operators. The float type is used when the operand does contain a period (.) character. * String A sequence of characters, valid for the string equality operators. * Regular expression A PCRE regular expression. Valid for the regular expression operators. Boolean functions ----------------- Query expressions can be linked together using boolean functions. The following are available, in decreasing precedence: * not Inverts the result of * and True only if both expr1 and expr2 are true * or True if either of expr1 or expr2 is true Expressions can be grouped using parenthesis. QUERY EXPRESSION EXAMPLES ========================= * Transaction group contains a request URL that equals to "/foo" :: ReqURL eq "/foo" * Transaction group contains a request cookie header :: ReqHeader:cookie * Transaction group doesn't contain a request cookie header :: not ReqHeader:cookie * Client request where internal handling took more than 800ms.:: Timestamp:Process[2] > 0.8 * Transaction group contains a request user-agent header that contains "iPod" and the request delivery time exceeds 1 second :: ReqHeader:user-agent ~ "iPod" and Timestamp:Resp[2] > 1. * Transaction group contains a backend response status larger than or equal to 500 :: BerespStatus >= 500 * Transaction group contains a request response status of 304, but where the request did not contain an if-modified-since header :: ReqStatus == 304 and not ReqHeader:if-modified-since * Transactions that have had backend failures or long delivery time on their ESI subrequests. (Assumes request grouping mode). :: BerespStatus >= 500 or {2+}Timestamp:Process[2] > 1. HISTORY ======= This document was written by Martin Blix Grydeland. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/sphinx/reference/vmod_directors.generated.rst0000644000201500234410000001501712652366762021655 00000000000000.. .. NB: This file is machine generated, DO NOT EDIT! .. .. Edit vmod.vcc and run make instead .. .. role:: ref(emphasis) .. _vmod_directors(3): ============== vmod_directors ============== ------------------------ Varnish Directors Module ------------------------ :Manual section: 3 SYNOPSIS ======== import directors [from "path"] ; DESCRIPTION =========== `vmod_directors` enables backend load balancing in Varnish. The module implements a set of basic load balancing techniques, and also serves as an example on how one could extend the load balancing capabilities of Varnish. To enable load balancing you must import this vmod (directors). Then you define your backends. Once you have the backends declared you can add them to a director. This happens in executed VCL code. If you want to emulate the previous behavior of Varnish 3.0 you can just initialize the directors in vcl_init, like this:: sub vcl_init { new vdir = directors.round_robin(); vdir.add_backend(backend1); vdir.add_backend(backend2); } As you can see there is nothing keeping you from manipulating the directors elsewhere in VCL. So, you could have VCL code that would add more backends to a director when a certain URL is called. Note that directors can use other directors as backends. CONTENTS ======== * :ref:`obj_fallback` * :ref:`func_fallback.add_backend` * :ref:`func_fallback.backend` * :ref:`func_fallback.remove_backend` * :ref:`obj_hash` * :ref:`func_hash.add_backend` * :ref:`func_hash.backend` * :ref:`func_hash.remove_backend` * :ref:`obj_random` * :ref:`func_random.add_backend` * :ref:`func_random.backend` * :ref:`func_random.remove_backend` * :ref:`obj_round_robin` * :ref:`func_round_robin.add_backend` * :ref:`func_round_robin.backend` * :ref:`func_round_robin.remove_backend` .. _obj_round_robin: Object round_robin ================== Description Create a round robin director. This director will pick backends in a round robin fashion. Example new vdir = directors.round_robin(); .. _func_round_robin.add_backend: VOID round_robin.add_backend(BACKEND) ------------------------------------- Prototype VOID round_robin.add_backend(BACKEND) Description Add a backend to the round-robin director. Example vdir.add_backend(backend1); vdir.add_backend(backend2); .. _func_round_robin.remove_backend: VOID round_robin.remove_backend(BACKEND) ---------------------------------------- Prototype VOID round_robin.remove_backend(BACKEND) Description Remove a backend from the round-robin director. Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); .. _func_round_robin.backend: BACKEND round_robin.backend() ----------------------------- Prototype BACKEND round_robin.backend() Description Pick a backend from the director. Example set req.backend_hint = vdir.backend(); .. _obj_fallback: Object fallback =============== Description Create a fallback director. A fallback director will try each of the added backends in turn, and return the first one that is healthy. Example new vdir = directors.fallback(); .. _func_fallback.add_backend: VOID fallback.add_backend(BACKEND) ---------------------------------- Prototype VOID fallback.add_backend(BACKEND) Description Add a backend to the director. Note that the order in which this is done matters for the fallback director. Example vdir.add_backend(backend1); vdir.add_backend(backend2); .. _func_fallback.remove_backend: VOID fallback.remove_backend(BACKEND) ------------------------------------- Prototype VOID fallback.remove_backend(BACKEND) Description Remove a backend from the director. Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); .. _func_fallback.backend: BACKEND fallback.backend() -------------------------- Prototype BACKEND fallback.backend() Description Pick a backend from the director. Example set req.backend_hint = vdir.backend(); .. _obj_random: Object random ============= Description Create a random backend director. The random director distributes load over the backends using a weighted random probability distribution. Example new vdir = directors.random(); .. _func_random.add_backend: VOID random.add_backend(BACKEND, REAL) -------------------------------------- Prototype VOID random.add_backend(BACKEND, REAL) Description Add a backend to the director with a given weight. Each backend backend will receive approximately 100 * (weight / (sum(all_added_weights))) per cent of the traffic sent to this director. Example # 2/3 to backend1, 1/3 to backend2. vdir.add_backend(backend1, 10.0); vdir.add_backend(backend2, 5.0); .. _func_random.remove_backend: VOID random.remove_backend(BACKEND) ----------------------------------- Prototype VOID random.remove_backend(BACKEND) Description Remove a backend from the director. Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); .. _func_random.backend: BACKEND random.backend() ------------------------ Prototype BACKEND random.backend() Description Pick a backend from the director. Example set req.backend_hint = vdir.backend(); .. _obj_hash: Object hash =========== Description Create a hashing backend director. The director chooses the backend server by computing a hash/digest of the string given to .backend(). Commonly used with ``client.ip`` or a session cookie to get sticky sessions. Example new vdir = directors.hash(); .. _func_hash.add_backend: VOID hash.add_backend(BACKEND, REAL) ------------------------------------ Prototype VOID hash.add_backend(BACKEND, REAL) Description Add a backend to the director with a certain weight. Weight is used as in the random director. Recommended value is 1.0 unless you have special needs. Example vdir.add_backend(backend1, 1.0); vdir.add_backend(backend2, 1.0); .. _func_hash.remove_backend: VOID hash.remove_backend(BACKEND) --------------------------------- Prototype VOID hash.remove_backend(BACKEND) Description Remove a backend from the director. Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); .. _func_hash.backend: BACKEND hash.backend(STRING_LIST) --------------------------------- Prototype BACKEND hash.backend(STRING_LIST) Description Pick a backend from the backend director. Use the string or list of strings provided to pick the backend. Example # pick a backend based on the cookie header from the client set req.backend_hint = vdir.backend(req.http.cookie); COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2013-2015 Varnish Software AS varnish-4.1.1/doc/sphinx/reference/varnishstat.rst0000644000201500234410000001146412652366721017240 00000000000000.. role:: ref(emphasis) .. _varnishstat(1): =========== varnishstat =========== ------------------------ Varnish Cache statistics ------------------------ :Manual section: 1 SYNOPSIS ======== varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-t seconds|] [-V] .. TODO: autogenerate this synopsis like the others. DESCRIPTION =========== The varnishstat utility displays statistics from a running varnishd(1) instance. OPTIONS ======= The following options are available: -1 Instead of presenting a continuously updated display, print the statistics to stdout. -f Field inclusion glob. A field glob consists of three parts, type, ident and name, where ident is optional. Each part can contain a '*' character at the end to match a prefix. Use backslash to escape characters. If the argument starts with '^' it is used as an exclusion glob. Multiple -f arguments may be given, and they will be applied in order. -l Lists the available fields to use with the -f option. -n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. -N Specify a the filename of a stale VSM instance. When using this option the abandonment checking is disabled. -t seconds| Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this any seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinitely for the Varnish instance to appear. Defaults to 5 seconds. -V Display the version number and exit. -x Displays the result as XML. -j Displays the result as JSON. CURSES MODE =========== When neither -1, -j or -x options are given, the application starts up in curses mode. This shows a continuously updated view of the counter values, along with their description. The top area shows process uptime information. The center area shows a list of counter values. The bottom area shows the description of the currently selected counter. Columns ------- The following columns are displayed, from left to right: Name The name of the counter Current The current value of the counter. Change The average per second change over the last update interval. Average The average value of this counter over the runtime of the Varnish daemon, or a period if the counter can't be averaged. Avg_10 The moving average over the last 10 update intervals. Avg_100 The moving average over the last 100 update intervals. Avg_1000 The moving average over the last 1000 update intervals. Key bindings ------------ The following keys control the interactive display: Navigate the counter list one line up. Navigate the counter list one line down. or Navigate the counter list one page up. or Navigate the counter list one page down. Toggle between showing and hiding unseen counters. Unseen counters are those that has been zero for the entire runtime of varnishstat. Defaults to hide unseen counters. Toggle scaling of values. Go to the top of the counter list. Go to the bottom of the counter list. Cycle through the verbosity levels. Defaults to only showing informational counters. Quit. Sample now. XML Output ========== When using the -x option, the output is:: FIELD TYPE FIELD IDENT FIELD NAME FIELD VALUE FIELD SEMANTICS FIELD DISPLAY FORMAT FIELD DESCRIPTION [..] JSON OUTPUT =========== With -j the output format is:: { "timestamp": "YYYY-MM-DDTHH:mm:SS", "FIELD NAME": { "description": "FIELD DESCRIPTION", "type": "FIELD TYPE", "ident": "FIELD IDENT", "flag": "FIELD SEMANTICS", "format": "FIELD DISPLAY FORMAT", "value": FIELD VALUE }, "FIELD2 NAME": { "description": "FIELD2 DESCRIPTION", "type": "FIELD2 TYPE", "ident": "FIELD2 IDENT", "flag": "FIELD2 SEMANTICS", "format": "FIELD2 DISPLAY FORMAT", "value": FIELD2 VALUE }, [..] } Type and ident are optional. Timestamp is the time when the report was generated by varnishstat. Repeated output with -1, -x or -j will have a single empty line (\\n) between each block of output. SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`varnishhist(1)` * :ref:`varnishlog(1)` * :ref:`varnishncsa(1)` * :ref:`varnishtop(1)` * curses(3) * :ref:`varnish-counters(7)` AUTHORS ======= This manual page was written by Dag-Erling Smørgrav, Per Buer, Lasse Karstensen and Martin Blix Grydeland. varnish-4.1.1/doc/sphinx/reference/index.rst0000644000201500234410000000177112652366721016001 00000000000000.. _reference-index: %%%%%%%%%%%%%%%%%%%%%%%%%%%% The Varnish Reference Manual %%%%%%%%%%%%%%%%%%%%%%%%%%%% .. toctree:: :maxdepth: 2 vcl.rst states.rst varnish-cli.rst varnishadm.rst varnishd.rst varnishhist.rst varnishlog.rst varnishncsa.rst varnishstat.rst varnishtest.rst varnishtop.rst vsm.rst vmod.rst vmod_std.generated.rst vmod_directors.generated.rst directors.rst varnish-counters.rst vsl.rst vsl-query.rst .. todo:: The programs: . varnishd manual page . varnishstat . - counters explained . common filtering options for shmlog tools . varnishlog .. . varnishtop .. . varnishncsa .. . varnishhist .. The CLI: . connections: -T -S -M . varnishadm . CLI commands and what they do . - vcl.load . - stop . - start . - ... VCL language . The functions: . - vcl_recv . - vcl_miss . --- . The things you can do . - set . - unset . - esi . - rollback Varnishtest . syntax etc. Shared Memory . internals . Log records Libvarnishapi . function descriptions varnish-4.1.1/doc/sphinx/reference/varnishd.rst0000644000201500234410000002461512652366721016512 00000000000000.. role:: ref(emphasis) .. _varnishd(1): ======== varnishd ======== ----------------------- HTTP accelerator daemon ----------------------- :Manual section: 1 SYNOPSIS ======== varnishd [-a address[:port][,PROTO]] [-b host[:port]] [-C] [-d] [-F] [-f config] [-h type[,options]] [-i identity] [-j jail[,jailoptions]] [-l vsl[,vsm]] [-M address:port] [-n name] [-P file] [-p param=value] [-r param[,param...]] [-S secret-file] [-s [name=]kind[,options]] [-T address[:port]] [-t TTL] [-V] [-W waiter] DESCRIPTION =========== The `varnishd` daemon accepts HTTP requests from clients, passes them on to a backend server and caches the returned documents to better satisfy future requests for the same document. .. _ref-varnishd-options: OPTIONS ======= -a Listen for client requests on the specified address and port. The address can be a host 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, port 80 (http) is used. An additional protocol type can be set for the listening socket with PROTO. Valid protocol types are: HTTP/1 (default), and PROXY. Multiple listening addresses can be specified by using multiple -a arguments. -b 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 to compile with the -f option. -d Enables debugging mode: The parent process runs in the foreground with a CLI connection on stdin/stdout, and the child process must be started explicitly with a CLI command. Terminating the parent process will also terminate the child. -F Do not fork, run in the foreground. -f config Use the specified VCL configuration file instead of the builtin default. See :ref:`vcl(7)` for details on VCL syntax. When neither a -f nor a -b argument are given, `varnishd` will not start the worker process but process cli commands. -h Specifies the hash algorithm. See `Hash Algorithm Options`_ for a list of supported algorithms. -i identity Specify the identity of the Varnish server. This can be accessed using ``server.identity`` from VCL. -j Specify the jailing technology to use. -l Specifies size of shmlog file. vsl is the space for the VSL records [80M] and vsm is the space for stats counters [1M]. Scaling suffixes like 'K' and 'M' can be used up to (G)igabytes. Default is 81 Megabytes. -M Connect to this port and offer the command line 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. -n name Specify the name for this instance. Amongst other things, this name is used to construct the name of the directory in which `varnishd` keeps temporary files and persistent state. If the specified name begins with a forward slash, it is interpreted as the absolute path to the directory which should be used for this purpose. -P file Write the PID of the process to the specified file. -p Set the parameter specified by param to the specified value, see `List of Parameters`_ for details. This option can be used multiple times to specify multiple parameters. -r Make the listed parameters read only. This gives the system administrator a way to limit what the Varnish CLI can do. Consider making parameters such as *cc_command*, *vcc_allow_inline_c* and *vmod_dir* read only as these can potentially be used to escalate privileges from the CLI. -S file Path to a file containing a secret used for authorizing access to the management port. If not provided a new secret will be drawn from the system PRNG. -s <[name=]type[,options]> Use the specified storage backend, see `Storage Backend Options`_. This option can be used multiple times to specify multiple storage files. Names are referenced in logs, VCL, statistics, etc. -T Offer a management interface on the specified address and port. See `Management Interface`_ for a list of management commands. -t TTL Specifies the default time to live (TTL) for cached objects. This is a shortcut for specifying the *default_ttl* run-time parameter. -V Display the version number and exit. -W waiter Specifies the waiter type to use. .. _opt_h: Hash Algorithm Options ---------------------- The following hash algorithms are available: -h critbit self-scaling tree structure. The default hash algorithm in Varnish Cache 2.1 and onwards. In comparison to a more traditional B tree the critbit tree is almost completely lockless. Do not change this unless you are certain what you're doing. -h simple_list A simple doubly-linked list. Not recommended for production use. -h A standard hash table. The hash key is the CRC32 of the object's URL modulo the size of the hash table. Each table entry points to a list of elements which share the same hash key. The buckets parameter specifies the number of entries in the hash table. The default is 16383. .. _ref-varnishd-opt_s: Storage Backend Options ----------------------- The following storage types are available: -s malloc is a memory based backend. -s The file backend stores data in a file on disk. The file will be accessed using mmap. The path is mandatory. If path points to a directory, a temporary file will be created in that directory and immediately unlinked. If path points to a non-existing file, the file will be created. If size is omitted, and path points to an existing file with a size greater than zero, the size of that file will be used. If not, an error is reported. Granularity sets the allocation block size. Defaults to the system page size or the filesystem block size, whichever is larger. -s Persistent storage. Varnish will store objects in a file in a manner that will secure the survival of *most* of the objects in the event of a planned or unplanned shutdown of Varnish. The persistent storage backend has multiple issues with it and will likely be removed from a future version of Varnish. .. _ref-varnishd-opt_j: Jail Options ------------ Varnish jails are a generalization over various platform specific methods to reduce the privileges of varnish processes. They may have specific options. Available jails are: -j solaris Reduce privileges(5) for `varnishd` and sub-process to the minimally required set. Only available on platforms which have the setppriv(2) call. -j Default on all other platforms if `varnishd` is either started with an effective uid of 0 ("as root") or as user ``varnish``. With the ``unix`` jail technology activated, varnish will switch to an alternative user for subprocesses and change the effective uid of the master process whenever possible. The optional `user` argument specifies which alternative user to use. It defaults to ``varnish`` The optional `ccgroup` argument specifies a group to add to varnish subprocesses requiring access to a c-compiler. There is no default. -j none last resort jail choice: With jail technology ``none``, varnish will run all processes with the privileges it was started with. .. _ref-varnishd-opt_T: Management Interface -------------------- If the -T option was specified, `varnishd` will offer a command-line management interface on the specified address and port. The recommended way of connecting to the command-line management interface is through varnishadm(1). The commands available are documented in varnish(7). .. _ref-varnishd-params: RUN TIME PARAMETERS =================== Run Time Parameter Flags ------------------------ Runtime parameters are marked with shorthand flags to avoid repeating the same text over and over in the table below. The meaning of the flags are: * `experimental` We have no solid information about good/bad/optimal values for this parameter. Feedback with experience and observations are most welcome. * `delayed` This parameter can be changed on the fly, but will not take effect immediately. * `restart` The worker process must be stopped and restarted, before this parameter takes effect. * `reload` The VCL programs must be reloaded for this parameter to take effect. * `experimental` We're not really sure about this parameter, tell us what you find. * `wizard` Do not touch unless you *really* know what you're doing. * `only_root` Only works if `varnishd` is running as root. Default Value Exceptions on 32 bit Systems ------------------------------------------ Be aware that on 32 bit systems, certain default values are reduced relative to the values listed below, in order to conserve VM space: * workspace_client: 16k * thread_pool_workspace: 16k * http_resp_size: 8k * http_req_size: 12k * gzip_stack_buffer: 4k * thread_pool_stack: 64k List of Parameters ------------------ This text is produced from the same text you will find in the CLI if you use the param.show command: .. include:: ../include/params.rst EXIT CODES ========== Varnish and bundled tools will, in most cases, exit with one of the following codes * `0` OK * `1` Some error which could be system-dependent and/or transient * `2` Serious configuration / parameter error - retrying with the same configuration / parameters is most likely useless The `varnishd` master process may also OR its exit code * with `0x20` when the `varnishd` child process died, * with `0x40` when the `varnishd` child process was terminated by a signal and * with `0x80` when a core was dumped. SEE ALSO ======== * :ref:`varnishlog(1)` * :ref:`varnishhist(1)` * :ref:`varnishncsa(1)` * :ref:`varnishstat(1)` * :ref:`varnishtop(1)` * :ref:`varnish-cli(7)` * :ref:`vcl(7)` HISTORY ======= The `varnishd` daemon was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software. This manual page was written by Dag-Erling Smørgrav with updates by Stig Sandbeck Mathisen , Nils Goroll and others. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2007-2015 Varnish Software AS varnish-4.1.1/doc/sphinx/reference/varnishadm.rst0000644000201500234410000000446212652366721017026 00000000000000.. role:: ref(emphasis) .. _varnishadm(1): ========== varnishadm ========== Control a running Varnish instance ---------------------------------- :Manual section: 1 SYNOPSIS ======== varnishadm [-n ident] [-t timeout] [-S secretfile] [-T [address]:port] [command [...]] DESCRIPTION =========== The `varnishadm` utility establishes a CLI connection to varnishd either using -n *name* or using the -T and -S arguments. If -n *name* is given the location of the secret file and the address:port is looked up in shared memory. If neither is given `varnishadm` will look for an instance without a given name. If a command is given, the command and arguments are sent over the CLI connection and the result returned on stdout. If no command argument is given `varnishadm` will pass commands and replies between the CLI socket and stdin/stdout. OPTIONS ======= -n ident Connect to the instance of `varnishd` with this name. -S secretfile Specify the authentication secret file. This should be the same -S argument as was given to `varnishd`. Only processes which can read the contents of this file, will be able to authenticate the CLI connection. -t timeout Wait no longer than this many seconds for an operation to finish. -T Connect to the management interface at the specified address and port. The syntax and operation of the actual CLI interface is described in the :ref:`varnish-cli(7)` manual page. Parameters are described in :ref:`varnishd(1)` manual page. Additionally, a summary of commands can be obtained by issuing the *help* command, and a summary of parameters can be obtained by issuing the *param.show* command. EXIT STATUS =========== If a command is given, the exit status of the `varnishadm` utility is zero if the command succeeded, and non-zero otherwise. EXAMPLES ======== Some ways you can use varnishadm:: varnishadm -T localhost:999 -S /var/db/secret vcl.use foo echo vcl.use foo | varnishadm -T localhost:999 -S /var/db/secret echo vcl.use foo | ssh vhost varnishadm -T localhost:999 -S /var/db/secret SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`varnish-cli(7)` AUTHORS ======= The `varnishadm` utility and this manual page were written by Cecilie Fritzvold. This man page has later been modified by Per Buer, Federico G. Schwindt and Lasse Karstensen. varnish-4.1.1/doc/sphinx/reference/vsl.rst0000644000201500234410000000523712652366721015477 00000000000000.. role:: ref(emphasis) .. _vsl(7): === VSL === ----------------------------- Varnish Shared Memory Logging ----------------------------- :Manual section: 7 OVERVIEW ======== This document describes the format and content of all the Varnish shared memory logging tags. These tags are used by the varnishlog(1), varnishtop(1), etc. logging tools supplied with Varnish. VSL tags ~~~~~~~~ .. include:: ../../../lib/libvarnishapi/vsl-tags.rst TIMESTAMPS ========== Timestamps are inserted in the log on completing certain events during the worker thread's task handling. The timestamps has a label showing which event was completed. The reported fields show the absolute time of the event, the time spent since the start of the task and the time spent since the last timestamp was logged. The timestamps logged automatically by Varnish are inserted after completing events that are expected to have delays (e.g. network IO or spending time on a waitinglist). Timestamps can also be inserted from VCL using the std.timestamp() method. If one is doing time consuming tasks in the VCL configuration, it's a good idea to log a timestamp after completing that task. This keeps the timing information in subsequent timestamps from including the time spent on the VCL event. Request handling timestamps ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Start The start of request processing (first byte received or restart). Req Complete client request received. ReqBody Client request body processed (discarded, cached or passed to the backend). Waitinglist Came off waitinglist. Fetch Fetch processing finished (completely fetched or ready for streaming). Process Processing finished, ready to deliver the client response. Resp Delivery of response to the client finished. Restart Client request is being restarted. Pipe handling timestamps ~~~~~~~~~~~~~~~~~~~~~~~~ Pipe Opened a pipe to the backend and forwarded the request. PipeSess The pipe session has finished. Backend fetch timestamps ~~~~~~~~~~~~~~~~~~~~~~~~ Start Start of the backend fetch processing. Bereq Backend request sent. Beresp Backend response headers received. BerespBody Backend response body received. Retry Backend request is being retried. Error Backend request failed to vcl_backend_error. HISTORY ======= This document was initially written by Poul-Henning Kamp, and later updated by Martin Blix Grydeland. SEE ALSO ======== * :ref:`varnishhist(1)` * :ref:`varnishlog(1)` * :ref:`varnishncsa(1)` * :ref:`varnishtop(1)` COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/sphinx/reference/varnishhist.rst0000644000201500234410000000242312652366721017227 00000000000000.. role:: ref(emphasis) .. _varnishhist(1): =========== varnishhist =========== ------------------------- Varnish request histogram ------------------------- :Manual section: 1 SYNOPSIS ======== .. include:: ../include/varnishhist_synopsis.rst varnishhist |synopsis| DESCRIPTION =========== The varnishhist utility reads varnishd(1) shared memory logs and 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 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: .. include:: ../include/varnishhist_options.rst SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`varnishlog(1)` * :ref:`varnishncsa(1)` * :ref:`varnishstat(1)` * :ref:`varnishtop(1)` HISTORY ======= The varnishhist 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. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/sphinx/reference/varnishtest.rst0000644000201500234410000000741312652366721017243 00000000000000.. role:: ref(emphasis) .. _varnishtest(1): =========== varnishtest =========== ------------------------ Test program for Varnish ------------------------ :Manual section: 1 SYNOPSIS ======== varnishtest [-hikLlqvW] [-b size] [-D name=val] [-j jobs] [-n iter] [-t duration] file [file ...] DESCRIPTION =========== The varnishtest program is a script driven program used to test the Varnish Cache. The varnishtest program, when started and given one or more script files, can create a number of threads representing backends, some threads representing clients, and a varnishd process. This is then used to simulate a transaction to provoke a specific behavior. The following options are available: -b size Set internal buffer size (default: 512K) -D name=val Define macro for use in scripts -h Show help -i Find varnishd in build tree -j jobs Run this many tests in parallel -k Continue on test failure -L Always leave temporary vtc.* -l Leave temporary vtc.* if test fails -n iterations Run tests this many times -q Quiet mode: report only failures -t duration Time tests out after this long -v Verbose mode: always report test log -W Enable the witness facility for locking file File to use as a script Macro definitions that can be overridden. varnishd Path to varnishd to use [varnishd] If `TMPDIR` is set in the environment, varnishtest creates temporary `vtc.*` directories for each test in `$TMPDIR`, otherwise in `/tmp`. SCRIPTS ======= The script language used for Varnishtest is not a strictly defined language. The best reference for writing scripts is the varnishtest program itself. In the Varnish source code repository, under `bin/varnishtest/tests/`, all the regression tests for Varnish are kept. An example:: varnishtest "#1029" server s1 { rxreq expect req.url == "/bar" txresp -gzipbody {[bar]} rxreq expect req.url == "/foo" txresp -body {

FOOBARF

} } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; if (bereq.url == "/foo") { set beresp.ttl = 0s; } else { set beresp.ttl = 10m; } } } -start client c1 { txreq -url "/bar" -hdr "Accept-Encoding: gzip" rxresp gunzip expect resp.bodylen == 5 txreq -url "/foo" -hdr "Accept-Encoding: gzip" rxresp expect resp.bodylen == 21 } -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 definition to the VCL specified (-vcl+backend). Finally it starts the c1-client, which is a single client sending two requests. SEE ALSO ======== * varnishtest source code repository with tests * :ref:`varnishhist(1)` * :ref:`varnishlog(1)` * :ref:`varnishncsa(1)` * :ref:`varnishstat(1)` * :ref:`varnishtop(1)` * :ref:`vcl(7)` HISTORY ======= The varnishtest program was developed by Poul-Henning Kamp in cooperation with Varnish Software AS. This manual page was originally written by Stig Sandbeck Mathisen and updated by Kristian Lyngstøl . COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2007-2015 Varnish Software AS varnish-4.1.1/doc/sphinx/reference/varnishncsa.rst0000644000201500234410000000655612652366721017217 00000000000000.. role:: ref(emphasis) .. _varnishncsa(1): =========== varnishncsa =========== --------------------------------------------------------- Display Varnish logs in Apache / NCSA combined log format --------------------------------------------------------- :Manual section: 1 SYNOPSIS ======== .. include:: ../include/varnishncsa_synopsis.rst varnishncsa |synopsis| DESCRIPTION =========== The varnishncsa utility reads varnishd(1) shared memory logs and presents them in the Apache / NCSA "combined" log format. Each log line produced is based on a single Request type transaction gathered from the shared memory log. The Request transaction is then scanned for the relevant parts in order to output one log line. To filter the log lines produced, use the query language to select the applicable transactions. Non-request transactions are ignored. The following options are available: .. include:: ../include/varnishncsa_options.rst FORMAT ====== Specify the log format used. If no format is specified the default log format is used. The default log format is:: %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i" Escape sequences \\n and \\t are supported. Supported formatters are: %b Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent. %D Time taken to serve the request, in microseconds. %H The request protocol. Defaults to HTTP/1.0 if not known. %h Remote host. Defaults to '-' if not known. %I Total bytes received from client. %{X}i The contents of request header X. %l Remote logname (always '-') %m Request method. Defaults to '-' if not known. %{X}o The contents of response header X. %O Total bytes sent to client. %q The query string, if no query string exists, an empty string. %r The first line of the request. Synthesized from other fields, so it may not be the request verbatim. %s Status sent to the client %t Time when the request was received, in HTTP date/time format. %{X}t Time when the request was received, in the format specified by X. The time specification format is the same as for strftime(3). %T Time taken to serve the request, in seconds. %U The request URL without any query string. Defaults to '-' if not known. %u Remote user from auth %{X}x Extended variables. Supported variables are: Varnish:time_firstbyte Time from when the request processing starts until the first byte is sent to the client. Varnish:hitmiss Whether the request was a cache hit or miss. Pipe and pass are considered misses. Varnish:handling How the request was handled, whether it was a cache hit, miss, pass, pipe or synth. VCL_Log:key Output value set by std.log("key:value") in VCL. SIGNALS ======= SIGHUP Rotate the log file (see -w option) SIGUSR1 Flush any outstanding transactions SEE ALSO ======== :ref:`varnishd(1)` :ref:`varnishlog(1)` :ref:`varnishstat(1)` HISTORY ======= The varnishncsa utility was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS. This manual page was initially written by Dag-Erling Smørgrav , and later updated by Martin Blix Grydeland. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/sphinx/reference/vcl.rst0000644000201500234410000002357112652366721015460 00000000000000.. role:: ref(emphasis) .. _vcl(7): === VCL === ------------------------------ Varnish Configuration Language ------------------------------ :Manual section: 7 DESCRIPTION =========== The VCL language is a small domain-specific language designed to be used to describe request handling and document caching policies for Varnish Cache. When a new configuration is loaded, the varnishd management process translates the VCL code to C and compiles it to a shared object which is then loaded into the server process. This document focuses on the syntax of the VCL language. For a full description of syntax and semantics, with ample examples, please see the online documentation at https://www.varnish-cache.org/docs/ . Starting with Varnish 4.0, each VCL file must start by declaring its version with a special "vcl 4.0;" marker at the top of the file. Operators --------- The following operators are available in VCL: = Assignment operator. == Comparison. ~ Match. Can either be used with regular expressions or ACLs. ! Negation. && Logical and. || Logical or. Conditionals ------------ VCL has *if* and *else* statements. Nested logic can be implemented with the *elseif* statement (*elsif*/*elif*/*else if* are equivalent). Note that there are no loops or iterators of any kind in VCL. Strings, booleans, time, duration and integers ---------------------------------------------- These are the data types in Varnish. You can *set* or *unset* these. Example:: set req.http.User-Agent = "unknown"; unset req.http.Range; Strings ~~~~~~~ Basic strings are enclosed in double quotes (" ... "), and may not contain newlines. Long strings are enclosed in {" ... "}. They may contain any character including single double quotes ("), newline and other control characters except for the NUL (0x00) character. Booleans ~~~~~~~~ Booleans can be either *true* or *false*. Time ---- VCL has time. The function *now* returns a time. A duration can be added to a time to make another time. In string context they return a formatted string. Durations --------- Durations are defined by a number and a designation. The number can be a real so 1.5w is allowed. ms milliseconds s seconds m minutes h hours d days w weeks y years Integers -------- Certain fields are integers, used as expected. In string context they return a string. Real numbers ------------ VCL understands real numbers. As with integers, when used in a string context they will return a string. Regular Expressions ------------------- Varnish uses Perl-compatible regular expressions (PCRE). For a complete description please see the pcre(3) man page. To send flags to the PCRE engine, such as to do case insensitive matching, add the flag within parens following a question mark, like this:: # If host is NOT example dot com.. if (req.http.host !~ "(?i)example.com$") { ... } Include statement ----------------- To include a VCL file in another file use the include keyword:: include "foo.vcl"; Import statement ---------------- The *import* statement is used to load Varnish Modules (VMODs.) Example:: import std; sub vcl_recv { std.log("foo"); } Comments -------- Single lines of VCL can be commented out using // or #. Multi-line blocks can be commented out with \/\* block \/\*. Example:: sub vcl_recv { // Single line of out-commented VCL. # Another way of commenting out a single line. /* Multi-line block of commented-out VCL. */ } Backend definition ------------------ A backend declaration creates and initialises a named backend object. A declaration start with the keyword *backend* followed by the name of the backend. The actual declaration is in curly brackets, in a key/value fashion.:: backend name { .attribute = "value"; } The only mandatory attribute is *host*. The attributes will inherit their defaults from the global parameters. The following attributes are available: host (mandatory) The host to be used. IP address or a hostname that resolves to a single IP address. port The port on the backend that Varnish should connect to. host_header A host header to add. connect_timeout Timeout for connections. first_byte_timeout Timeout for first byte. between_bytes_timeout Timeout between bytes. probe Attach a probe to the backend. See `Probes`_ max_connections Maximum number of open connections towards this backend. If Varnish reaches the maximum Varnish it will start failing connections. Backends can be used with *directors*. Please see the :ref:`vmod_directors(3)` man page for more information. .. _reference-vcl_probes: Probes ------ Probes will query the backend for status on a regular basis and mark the backend as down it they fail. A probe is defined as this:: probe name { .attribute = "value"; } There are no mandatory options. These are the options you can set: url The URL to query. Defaults to "/". request Specify a full HTTP request using multiple strings. .request will have \\r\\n automatically inserted after every string. If specified, .request will take precedence over .url. expected_response The expected HTTP response code. Defaults to 200. timeout The timeout for the probe. Default is 2s. interval How often the probe is run. Default is 5s. initial How many of the polls in .window are considered good when Varnish starts. Defaults to the value of threshold - 1. In this case, the backend starts as sick and requires one single poll to be considered healthy. window How many of the latest polls we examine to determine backend health. Defaults to 8. threshold How many of the polls in .window must have succeeded for us to consider the backend healthy. Defaults to 3. Access Control List (ACL) ------------------------- An Access Control List (ACL) declaration creates and initialises a named access control list which can later be used to match client addresses:: acl localnetwork { "localhost"; # myself "192.0.2.0"/24; # and everyone on the local network ! "192.0.2.23"; # except for the dial-in router } If an ACL entry specifies a host name which Varnish is unable to resolve, it will match any address it is compared to. Consequently, if it is preceded by a negation mark, it will reject any address it is compared to, which may not be what you intended. If the entry is enclosed in parentheses, however, it will simply be ignored. To match an IP address against an ACL, simply use the match operator:: if (client.ip ~ localnetwork) { return (pipe); } VCL objects ----------- A VCL object can be instantiated with the *new* keyword:: sub vcl_init { new b = directors.round_robin() b.add_backend(node1); } This is only available in vcl_init. Subroutines ----------- A subroutine is used to group code for legibility or reusability:: sub pipe_if_local { if (client.ip ~ localnetwork) { return (pipe); } } Subroutines in VCL do not take arguments, nor do they return values. The built in subroutines all have names beginning with vcl\_, which is reserved. To call a subroutine, use the call keyword followed by the subroutine's name:: sub vcl_recv { call pipe_if_local; } Return statements ~~~~~~~~~~~~~~~~~ The ongoing vcl\_* subroutine execution ends when a return(*action*) statement is made. The *action* specifies how execution should proceed. The context defines which actions are available. Multiple subroutines ~~~~~~~~~~~~~~~~~~~~ If multiple subroutines with the name of one of the built-in ones are defined, they are concatenated in the order in which they appear in the source. The built-in VCL distributed with Varnish will be implicitly concatenated when the VCL is compiled. Variables --------- In VCL you have access to certain variable objects. These contain requests and responses currently being worked on. What variables are available depends on context. .. include:: ../include/vcl_var.rst Functions --------- The following built-in functions are available: ban(expression) Invalidates all objects in cache that match the expression with the ban mechanism. hash_data(input) Adds an input to the hash input. In the built-in VCL hash_data() is called on the host and URL of the *request*. Available in vcl_hash. rollback() Restore *req* HTTP headers to their original state. This function is deprecated. Use std.rollback() instead. synthetic(STRING) Prepare a synthetic response body containing the STRING. Available in vcl_synth and vcl_backend_error. .. list above comes from struct action_table[] in vcc_action.c. regsub(str, regex, sub) Returns a copy of str with the first occurrence of the regular expression regex replaced with sub. Within sub, \\0 (which can also be spelled \\&) is replaced with the entire matched string, and \\n is replaced with the contents of subgroup n in the matched string. regsuball(str, regex, sub) As regsub() but this replaces all occurrences. .. regsub* is in vcc_expr.c For converting or casting VCL values between data types use the functions available in the std VMOD. EXAMPLES ======== For examples, please see the online documentation. SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`vmod_directors(3)` * :ref:`vmod_std(3)` HISTORY ======= VCL was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Redpill Linpro and Varnish Software. This manual page is written by Per Buer, Poul-Henning Kamp, Martin Blix Grydeland, Kristian Lyngstøl, Lasse Karstensen and possibly others. COPYRIGHT ========= This document is licensed under the same license as Varnish itself. See LICENSE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/sphinx/reference/varnishlog.rst0000644000201500234410000000214212652366721017037 00000000000000.. role:: ref(emphasis) .. _varnishlog(1): ========== varnishlog ========== -------------------- Display Varnish logs -------------------- :Manual section: 1 SYNOPSIS ======== .. include:: ../include/varnishlog_synopsis.rst varnishlog |synopsis| OPTIONS ======= The following options are available: .. include:: ../include/varnishlog_options.rst SIGNALS ======= * SIGHUP Rotate the log file (see -w option) * SIGUSR1 Flush any outstanding transactions SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`varnishhist(1)` * :ref:`varnishncsa(1)` * :ref:`varnishstat(1)` * :ref:`varnishtop(1)` * :ref:`vsl(7)` * :ref:`vsl-query(7)` HISTORY ======= The varnishlog utility was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS. This manual page was initially written by Dag-Erling Smørgrav, and later updated by Per Buer and Martin Blix Grydeland. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/sphinx/reference/vsm.rst0000644000201500234410000000772212652366721015501 00000000000000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VSM: Shared Memory Logging and Statistics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Varnish uses shared memory to export parameters, logging and statistics, because it is faster and much more efficient than regular files. "Varnish Shared Memory" or VSM, is the overall mechanism, which manages a number of allocated "chunks" inside the same shared memory file. Each Chunk is just a slap of memory, which has a three-part name (class, type, ident) and a length. The Class indicates what type of data is stored in the chunk, for instance "Arg" for command line arguments useful for establishing an CLI connection to the varnishd, "Stat" for statistics counters (VSC) and "Log" for log records (VSL). The type and ident name parts are mostly used with stats counters, where they identify dynamic counters, such as: SMA.Transient.c_bytes The size of the VSM is a parameter, but changes only take effect when the child process is restarted. Shared memory trickery ---------------------- Shared memory is faster than regular files, but it is also slightly tricky in ways a regular logfile is not. When you open a file in "append" mode, the operating system guarantees that whatever you write will not overwrite existing data in the file. The neat result of this is that multiple processes or threads writing to the same file does not even need to know about each other, it all works just as you would expect. With a shared memory log, we get no such help from the kernel, the writers need to make sure they do not stomp on each other, and they need to make it possible and safe for the readers to access the data. The "CS101" way to deal with that, is to introduce locks, and much time is spent examining the relative merits of the many kinds of locks available. Inside the varnishd (worker) process, we use mutexes to guarantee consistency, both with respect to allocations, log entries and stats counters. We do not want a varnishncsa trying to push data through a stalled ssh connection to stall the delivery of content, so readers like that are purely read-only, they do not get to affect the varnishd process and that means no locks for them. Instead we use "stable storage" concepts, to make sure the view seen by the readers is consistent at all times. As long as you only add stuff, that is trivial, but taking away stuff, such as when a backend is taken out of the configuration, we need to give the readers a chance to discover this, a "cooling off" period. The Varnish way: ---------------- If varnishd starts, and finds a locked shared memory file, it will exit with a message about using different -n arguments if you want multiple instances of varnishd. Otherwise, it will create a new shared memory file each time it starts a child process, since that marks a clean break in operation anyway. To the extent possible, old shared memory files are marked as abandoned by setting the alloc_seq field to zero, which should be monitored by all readers of the VSM. Processes subscribing to VSM files for a long time, should notice if the VSM file goes "silent" and check that the file has not been renamed due to a child restart. Chunks inside the shared memory file form a linked list, and whenever that list changes, the alloc_seq field changes. The linked list and other metadata in the VSM file, works with offsets relative to the start address of where the VSM file is memory mapped, so it need not be mapped at any particular address. When new chunks are allocated, for instance when a new backend is added, they are appended to the list, no matter where they are located in the VSM file. When a chunk is freed, it will be taken out of the linked list of allocations, its length will be set to zero and alloc_seq will be changed to indicate a change of layout. For the next 60 seconds the chunk will not be touched or reused, giving other subscribers a chance to discover the deallocation. The include file provides the supported API for accessing VSM files. varnish-4.1.1/doc/sphinx/reference/varnishtop.rst0000644000201500234410000000321012652366721017055 00000000000000.. role:: ref(emphasis) .. _varnishtop(1): ========== varnishtop ========== ------------------------- Varnish log entry ranking ------------------------- :Manual section: 1 SYNOPSIS ======== .. include:: ../include/varnishtop_synopsis.rst varnishtop |synopsis| DESCRIPTION =========== The varnishtop utility reads :ref:`varnishd(1)` shared memory logs and presents a continuously updated list of the most commonly occurring log entries. With suitable filtering using the ``-I``, ``-i``, ``-X`` and ``-x`` options, it can be used to display a ranking of requested documents, clients, user agents, or any other information which is recorded in the log. The following options are available: .. include:: ../include/varnishtop_options.rst EXAMPLES ======== The following example displays a continuously updated list of the most frequently requested URLs:: varnishtop -i ReqURL The following example displays a continuously updated list of the most commonly used user agents:: varnishtop -C -I ReqHeader:User-Agent SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`varnishhist(1)` * :ref:`varnishlog(1)` * :ref:`varnishncsa(1)` * :ref:`varnishstat(1)` HISTORY ======= The varnishtop utility was originally developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS, and later substantially rewritten by Dag-Erling Smørgrav. This manual page was written by Dag-Erling Smørgrav, and later updated by Martin Blix Grydeland. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/sphinx/reference/directors.rst0000644000201500234410000001611612652366721016667 00000000000000.. _ref-writing-a-director: %%%%%%%%%%%%%%%%%% Writing a Director %%%%%%%%%%%%%%%%%% Varnish already provides a set of general-purpose directors, and since Varnish 4, it is bundled in the built-in :ref:`vmod_directors(3)`. Writing a director boils down to writing a VMOD, using the proper data structures and APIs. Not only can you write your own director if none of the built-ins fit your needs, but since Varnish 4.1 you can even write your own backends. Backends can be categorized as such: - static: native backends declared in VCL - dynamic: native backends created by VMODs - custom: backends created and fully managed by VMODs Backends vs Directors ===================== The intuitive classification for backend and director is an endpoint for the former and a cluster for the latter, but the actual implementation is a bit more subtle. VMODs can accept backend arguments and return backends in VCL (see :ref:`ref-vmod-vcl-c-types`), but the underlying C type is ``struct director``. Under the hood director is a generic concept, and a backend is a kind of director. The line between the two is somewhat blurry at this point, let's look at some code instead:: struct director { unsigned magic; #define DIRECTOR_MAGIC 0x3336351d const char *name; char *vcl_name; vdi_http1pipe_f *http1pipe; vdi_healthy_f *healthy; vdi_resolve_f *resolve; vdi_gethdrs_f *gethdrs; vdi_getbody_f *getbody; vdi_getip_f *getip; vdi_finish_f *finish; vdi_panic_f *panic; void *priv; const void *priv2; }; A director can be summed up as: - a name (used for panics) - a VCL name - a set of operations - the associated state The difference between a *cluster* director and a *backend* director is mainly The functions they will implement. Cluster Directors ================= As in :ref:`vmod_directors(3)`, you can write directors that will group backends sharing the same role, and pick them according to a strategy. If you need more than the built-in strategies (round-robin, hash, ...), even though they can be stacked, it is always possible to write your own. In this case you simply need to implement the ``resolve`` function for the director. Directors are walked until a leaf director is found. A leaf director doesn't have a ``resolve`` function and is used to actually make the backend request, just like the backends you declare in VCL. Dynamic Backends ================ If you want to speak HTTP/1 over TCP, but for some reason VCL does not fit the bill, you can instead reuse the whole backend facility. It allows you for instance to add and remove backends on-demand without the need to reload your VCL. You can then leverage your provisioning system. Consider the following snippet:: backend default { .host = "localhost"; } The VCL compiler turns this declaration into a ``struct vrt_backend``. When the VCL is loaded, Varnish calls ``VRT_new_backend`` in order to create the director. Varnish doesn't expose its data structure for actual backends, only the director abstraction and dynamic backends are built just like static backends, one *struct* at a time. You can get rid of the ``struct vrt_backend`` as soon as you have the ``struct director``. A (dynamic) backend can't exceed its VCL's lifespan, because native backends are *owned* by VCLs. Though a dynamic backend can't outlive its VCL, it can be deleted any time with ``VRT_delete_backend``. The VCL will delete the remaining backends once discarded, you don't need to take care of it. .. XXX Consider using an object (see :ref:`ref-vmod-objects`) to manipulate dynamic Consider using an object to manipulate dynamic backends. They are tied to the VCL life cycle and make a handy data structure to keep track of backends and objects have a VCL name you can reuse for the director. It is also true for *cluster* directors that may reference native backends. Finally, Varnish will take care of event propagation for *all* native backends, but dynamic backends can only be created when the VCL is warm. If your backends are created by an independent thread (basically outside of VCL scope) you must subscribe to VCL events and watch for VCL state (see :ref:`ref-vmod-event-functions`). Varnish will panic if you try to create a backend on a cold VCL, and ``VRT_new_backend`` will return ``NULL`` if the VCL is cooling. You are also encouraged to comply with the :ref:`ref_vcl_temperature` in general. .. _ref-writing-a-director-cluster: Health Probes ============= It is possible in a VCL program to query the health of a director (see :ref:`func_healthy`). A director can report its health if it implements the ``healthy`` function, it is otherwise always considered healthy. Unless you are making a dynamic backend, you need to take care of the health probes yourselves. For *cluster* directors, being healthy typically means having at least one healthy underlying backend or director. For dynamic backends, it is just a matter of assigning the ``probe`` field in the ``struct vrt_backend``. Once the director is created, the probe definition too is no longer needed. It is then Varnish that will take care of the health probe and disable the feature on a cold VCL (see :ref:`ref-vmod-event-functions`). Instead of initializing your own probe definition, you can get a ``VCL_PROBE`` directly built from VCL (see :ref:`ref-vmod-vcl-c-types`). What's the difference ? Custom Backends =============== If you want to implement a custom backend, have a look at how Varnish implements native backends. It is the canonical implementation, and though it provides other services like connection pooling or statistics, it is essentially a director which state is a ``struct backend``. Varnish native backends currently speak HTTP/1 over TCP, and as such, you need to make your own custom backend if you want Varnish to do otherwise such as connect over UDP or UNIX-domain sockets or speak a different protocol. If you want to leverage probes declarations in VCL, which have the advantage of being reusable since they are only specifications, you can. However, you need to implement the whole probing infrastructure from scratch. You may also consider making your custom backend compliant with regards to the VCL state (see :ref:`ref-vmod-event-functions`). Data structure considerations ----------------------------- When you are creating a custom backend, you may want to provide the semantics of the native backends. In this case, instead of repeating the redundant fields between data structures, you can use the macros ``VRT_BACKEND_FIELDS`` and ``VRT_BACKEND_PROBE_FIELDS`` to declare them all at once. This is the little dance Varnish uses to copy data between the ``struct vrt_backend`` and its internal data structure for example. The copy can be automated with the macros ``VRT_BACKEND_HANDLE`` and ``VRT_BACKEND_PROBE_HANDLE``. You can look at how they can be used in the Varnish code base. varnish-4.1.1/doc/sphinx/reference/varnish-cli.rst0000644000201500234410000002277212652366721017115 00000000000000.. role:: ref(emphasis) .. _varnish-cli(7): =========== varnish-cli =========== ------------------------------ Varnish Command Line Interface ------------------------------ :Manual section: 7 DESCRIPTION =========== Varnish as a command line interface (CLI) which can control and change most of the operational parameters and the configuration of Varnish, without interrupting the running service. The CLI can be used for the following tasks: configuration You can upload, change and delete VCL files from the CLI. parameters You can inspect and change the various parameters Varnish has available through the CLI. The individual parameters are documented in the varnishd(1) man page. bans Bans are filters that are applied to keep Varnish from serving stale content. When you issue a ban Varnish will not serve any *banned* object from cache, but rather re-fetch it from its backend servers. process management You can stop and start the cache (child) process though the CLI. You can also retrieve the latest stack trace if the child process has crashed. If you invoke varnishd(1) with -T, -M or -d the CLI will be available. In debug mode (-d) the CLI will be in the foreground, with -T you can connect to it with varnishadm or telnet and with -M varnishd will connect back to a listening service *pushing* the CLI to that service. Please see :ref:`varnishd(1)` for details. Syntax ------ Commands are usually terminated with a newline. Long command can be entered using sh style *here documents*. The format of here-documents is:: << word here document word *word* can be any continuous string chosen to make sure it doesn't appear naturally in the following *here document*. When using the here document style of input there are no restrictions on length. When using newline-terminated commands maximum length is limited by the varnishd parameter *cli_buffer*. When commands are newline terminated they get *tokenized* before parsing so if you have significant spaces enclose your strings in double quotes. Within the quotes you can escape characters with \\. The \n, \r and \t get translated to newlines, carriage returns and tabs. Double quotes themselves can be escaped with a backslash. To enter characters in octals use the \\nnn syntax. Hexadecimals can be entered with the \\xnn syntax. Commands -------- help [] Show command/protocol help. ping [] Keep connection alive. auth Authenticate. quit Close connection. banner Print welcome banner. status Check status of Varnish cache process. start Start the Varnish cache process. stop Stop the Varnish cache process. vcl.load [auto|cold|warm] Compile and load the VCL file under the name provided. vcl.inline [auto|cold|warm] Compile and load the VCL data under the name provided. vcl.use Switch to the named configuration immediately. vcl.discard Unload the named configuration (when possible). vcl.list List all loaded configuration. vcl.show [-v] Display the source code for the specified configuration. vcl.state Force the state of the specified configuration. State is any of auto, warm or cold values. param.show [-l] [] Show parameters and their values. param.set Set parameter value. panic.show Return the last panic, if any. panic.clear [-z] Clear the last panic, if any. -z will clear related varnishstat counter(s). storage.list List storage devices. backend.list [-p] [] List backends. backend.set_health Set health status on the backends. State is any of auto, healthy or sick values. ban [&& ...] Mark obsolete all objects where all the conditions match. ban.list List the active bans. Backend Expression ------------------ A backend expression can be a backend name or a combination of backend name, IP address and port in "name(IP address:port)" format. All fields are optional. If no exact matching backend is found, partial matching will be attempted based on the provided name, IP address and port fields. Examples:: backend.list def* backend.set_health default sick backend.set_health def* healthy backend.set_health * auto Ban Expressions --------------- A ban expression consists of one or more conditions. A condition consists of a field, an operator, and an argument. Conditions can be ANDed together with "&&". A field can be any of the variables from VCL, for instance req.url, req.http.host or obj.http.set-cookie. Operators are "==" for direct comparison, "~" for a regular expression match, and ">" or "<" for size comparisons. Prepending an operator with "!" negates the expression. The argument could be a quoted string, a regexp, or an integer. Integers can have "KB", "MB", "GB" or "TB" appended for size related fields. .. _ref_vcl_temperature: VCL Temperature --------------- A VCL program goes through several states related to the different commands: it can be loaded, used, and later discarded. You can load several VCL programs and switch at any time from one to another. There is only one active VCL, but the previous active VCL will be maintained active until all its transactions are over. Over time, if you often refresh your VCL and keep the previous versions around, resource consumption will increase, you can't escape that. However, most of the time you want only one to pay the price only for the active VCL and keep older VCLs in case you'd need to rollback to a previous version. The VCL temperature allows you to minimize the footprint of inactive VCLs. Once a VCL becomes cold, Varnish will release all the resources that can be be later reacquired. You can manually set the temperature of a VCL or let varnish automatically handle it. Scripting --------- If you are going to write a script that talks CLI to varnishd, the include/cli.h contains the relevant magic numbers. One particular magic number to know, is that the line with the status 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. .. _ref_psk_auth: How -S/PSK Authentication Works ------------------------------- If the -S secret-file is given as argument to varnishd, all network CLI connections must authenticate, by proving they know the contents of that file. The file is read at the time the auth command is issued and the contents is not cached in varnishd, so it is possible to update the file on the fly. Use the unix file permissions to control access to the file. An authenticated session looks like this:: critter phk> telnet localhost 1234 Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 107 59 ixslvvxrgkjptxmcgnnsdxsvdmvfympg Authentication required. auth 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a 200 193 ----------------------------- Varnish HTTP accelerator CLI. ----------------------------- Type 'help' for command list. Type 'quit' to close CLI session. Type 'start' to launch worker process. The CLI status of 107 indicates that authentication is necessary. The first 32 characters of the response text is the challenge "ixsl...mpg". The challenge is randomly generated for each CLI connection, and changes each time a 107 is emitted. The most recently emitted challenge must be used for calculating the authenticator "455c...c89a". The authenticator is calculated by applying the SHA256 function to the following byte sequence: * Challenge string * Newline (0x0a) character. * Contents of the secret file * Challenge string * Newline (0x0a) character. and dumping the resulting digest in lower-case hex. In the above example, the secret file contained foo\n and thus:: critter phk> cat > _ ixslvvxrgkjptxmcgnnsdxsvdmvfympg foo ixslvvxrgkjptxmcgnnsdxsvdmvfympg ^D critter phk> hexdump -C _ 00000000 69 78 73 6c 76 76 78 72 67 6b 6a 70 74 78 6d 63 |ixslvvxrgkjptxmc| 00000010 67 6e 6e 73 64 78 73 76 64 6d 76 66 79 6d 70 67 |gnnsdxsvdmvfympg| 00000020 0a 66 6f 6f 0a 69 78 73 6c 76 76 78 72 67 6b 6a |.foo.ixslvvxrgkj| 00000030 70 74 78 6d 63 67 6e 6e 73 64 78 73 76 64 6d 76 |ptxmcgnnsdxsvdmv| 00000040 66 79 6d 70 67 0a |fympg.| 00000046 critter phk> sha256 _ SHA256 (_) = 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a critter phk> openssl dgst -sha256 < _ 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a The sourcefile lib/libvarnish/cli_auth.c contains a useful function which calculates the response, given an open filedescriptor to the secret file, and the challenge string. EXAMPLES ======== Simple example: All requests where req.url exactly matches the string /news are banned from the cache:: req.url == "/news" Example: Ban all documents where the serving host is "example.com" or "www.example.com", and where the Set-Cookie header received from the backend contains "USERID=1663":: req.http.host ~ "^(?i)(www\.)example.com$" && obj.http.set-cookie ~ "USERID=1663" AUTHORS ======= This manual page was originally written by Per Buer and later modified by Federico G. Schwindt, Dridi Boukelmoune, Lasse Karstensen and Poul-Henning Kamp. SEE ALSO ======== * :ref:`varnishadm(1)` * :ref:`varnishd(1)` * :ref:`vcl(7)` varnish-4.1.1/doc/sphinx/reference/states.rst0000644000201500234410000000235612652366721016175 00000000000000.. _reference-states: ========================= Varnish Processing States ========================= ------------ Introduction ------------ Varnish processing of client and backend requests is implemented as state machines. Whenever a state is entered, a C function is called, which in turn calls the appropriate Varnish core code functions to process the request or response at this stage. For most states, core code also calls into a state-specific function compiled from VCL, a VCL subroutine (see :ref:`vcl-built-in-subs` ). As a general guideline, core code aims to prepare objects accessible from VCL with good defaults for the most common cases before calling into the respective VCL subroutine. These can then be modified from VCL where necessary. The following graphs attempt to provide an overview over the processing states, their transitions and the most relevant functions in core code. They represent a compromise between usefulness for core/VMOD developers and administrators and are intended to serve as the reference basis for derivative work, such as more VCL-centric views. ----------- Client Side ----------- .. image:: ../../graphviz/cache_req_fsm.svg ------------ Backend Side ------------ .. image:: ../../graphviz/cache_fetch.svg varnish-4.1.1/doc/sphinx/reference/vmod_std.generated.rst0000644000201500234410000002170412652366762020451 00000000000000.. .. NB: This file is machine generated, DO NOT EDIT! .. .. Edit vmod.vcc and run make instead .. .. role:: ref(emphasis) .. _vmod_std(3): ======== vmod_std ======== ----------------------- Varnish Standard Module ----------------------- :Manual section: 3 SYNOPSIS ======== import std [from "path"] ; DESCRIPTION =========== `vmod_std` contains basic functions which are part and parcel of Varnish, but which for reasons of architecture fit better in a VMOD. One particular class of functions in vmod_std is the conversions functions which all have the form:: TYPE type(STRING, TYPE) These functions attempt to convert STRING to the TYPE, and if that fails, they return the second argument, which must have the given TYPE. CONTENTS ======== * :ref:`func_cache_req_body` * :ref:`func_collect` * :ref:`func_duration` * :ref:`func_fileread` * :ref:`func_healthy` * :ref:`func_integer` * :ref:`func_ip` * :ref:`func_log` * :ref:`func_port` * :ref:`func_querysort` * :ref:`func_random` * :ref:`func_real` * :ref:`func_real2integer` * :ref:`func_real2time` * :ref:`func_rollback` * :ref:`func_set_ip_tos` * :ref:`func_strstr` * :ref:`func_syslog` * :ref:`func_time` * :ref:`func_time2integer` * :ref:`func_time2real` * :ref:`func_timestamp` * :ref:`func_tolower` * :ref:`func_toupper` .. _func_toupper: STRING toupper(STRING_LIST) --------------------------- Prototype STRING toupper(STRING_LIST s) Description Converts the string *s* to uppercase. Example set beresp.http.scream = std.toupper("yes!"); .. _func_tolower: STRING tolower(STRING_LIST) --------------------------- Prototype STRING tolower(STRING_LIST s) Description Converts the string *s* to lowercase. Example set beresp.http.nice = std.tolower("VerY"); .. _func_set_ip_tos: VOID set_ip_tos(INT) -------------------- Prototype VOID set_ip_tos(INT tos) Description Sets the IP type-of-service (TOS) field for the current session to *tos*. Please note that the TOS field is not removed by the end of the request so probably want to set it on every request should you utilize it. Example | if (req.url ~ "^/slow/") { | std.set_ip_tos(0); | } .. _func_random: REAL random(REAL, REAL) ----------------------- Prototype REAL random(REAL lo, REAL hi) Description Returns a random real number between *lo* and *hi*. Example set beresp.http.random-number = std.random(1, 100); .. _func_log: VOID log(STRING_LIST) --------------------- Prototype VOID log(STRING_LIST s) Description Logs the string *s* to the shared memory log, using VSL tag *SLT_VCL_Log*. Example std.log("Something fishy is going on with the vhost " + req.http.host); .. _func_syslog: VOID syslog(INT, STRING_LIST) ----------------------------- Prototype VOID syslog(INT priority, STRING_LIST s) Description Logs the string *s* to syslog tagged with *priority*. *priority* is formed by ORing the facility and level values. See your system's syslog.h file for possible values. Example std.syslog(9, "Something is wrong"); This will send a message to syslog using LOG_USER | LOG_ALERT. .. _func_fileread: STRING fileread(PRIV_CALL, STRING) ---------------------------------- Prototype STRING fileread(PRIV_CALL, STRING) Description Reads a file and returns a string with the content. Please note that it is not recommended to send variables to this function the caching in the function doesn't take this into account. Also, files are not re-read. Example set beresp.http.served-by = std.fileread("/etc/hostname"); .. _func_collect: VOID collect(HEADER) -------------------- Prototype VOID collect(HEADER hdr) Description Collapses multiple *hdr* headers into one long header. Care should be taken when collapsing headers. In particular collapsing Set-Cookie will lead to unexpected results on the browser side. Example std.collect(req.http.cookie); .. _func_duration: DURATION duration(STRING, DURATION) ----------------------------------- Prototype DURATION duration(STRING s, DURATION fallback) Description Converts the string *s* to seconds. *s* must be quantified with ms (milliseconds), s (seconds), m (minutes), h (hours), d (days), w (weeks) or y (years) units. If conversion fails, *fallback* will be returned. Example set beresp.ttl = std.duration("1w", 3600s); .. _func_integer: INT integer(STRING, INT) ------------------------ Prototype INT integer(STRING s, INT fallback) Description Converts the string *s* to an integer. If conversion fails, *fallback* will be returned. Example | if (std.integer(req.http.foo, 0) > 5) { | ... | } .. _func_ip: IP ip(STRING, IP) ----------------- Prototype IP ip(STRING s, IP fallback) Description Converts the string *s* to the first IP number returned by the system library function getaddrinfo(3). If conversion fails, *fallback* will be returned. Example | if (std.ip(req.http.X-forwarded-for, "0.0.0.0") ~ my_acl) { | ... | } .. _func_real: REAL real(STRING, REAL) ----------------------- Prototype REAL real(STRING s, REAL fallback) Description Converts the string *s* to a real. If conversion fails, *fallback* will be returned. Example | if (std.real(req.http.foo, 0.0) > 5.5) { | ... | } .. _func_real2integer: INT real2integer(REAL, INT) --------------------------- Prototype INT real2integer(REAL r, INT fallback) Description Converts the real *r* to an integer. If conversion fails, *fallback* will be returned. Example set req.http.integer = std.real2integer(1140618699.00, 0); .. _func_real2time: TIME real2time(REAL, TIME) -------------------------- Prototype TIME real2time(REAL r, TIME fallback) Description Converts the real *r* to a time. If conversion fails, *fallback* will be returned. Example set req.http.time = std.real2time(1140618699.00, now); .. _func_time2integer: INT time2integer(TIME, INT) --------------------------- Prototype INT time2integer(TIME t, INT fallback) Description Converts the time *t* to a integer. If conversion fails, *fallback* will be returned. Example set req.http.int = std.time2integer(now, 0); .. _func_time2real: REAL time2real(TIME, REAL) -------------------------- Prototype REAL time2real(TIME t, REAL fallback) Description Converts the time *t* to a real. If conversion fails, *fallback* will be returned. Example set req.http.real = std.time2real(now, 1.0); .. _func_healthy: BOOL healthy(BACKEND) --------------------- Prototype BOOL healthy(BACKEND be) Description Returns `true` if the backend *be* is healthy. .. _func_port: INT port(IP) ------------ Prototype INT port(IP ip) Description Returns the port number of the IP address *ip*. .. _func_rollback: VOID rollback(HTTP) ------------------- Prototype VOID rollback(HTTP h) Description Restores the *h* HTTP headers to their original state. Example std.rollback(bereq); .. _func_timestamp: VOID timestamp(STRING) ---------------------- Prototype VOID timestamp(STRING s) Description Introduces a timestamp in the log with the current time, using the string *s* as the label. This is useful to time the execution of lengthy VCL procedures, and makes the timestamps inserted automatically by Varnish more accurate. Example std.timestamp("curl-request"); .. _func_querysort: STRING querysort(STRING) ------------------------ Prototype STRING querysort(STRING) Description Sorts the query string for cache normalization purposes. Example set req.url = std.querysort(req.url); .. _func_cache_req_body: VOID cache_req_body(BYTES) -------------------------- Prototype VOID cache_req_body(BYTES size) Description Cache the req.body if it is smaller than *size*. Caching the req.body makes it possible to retry pass operations (POST, PUT). Example std.cache_req_body(1KB); This will cache the req.body if its size is smaller than 1KB. .. _func_strstr: STRING strstr(STRING, STRING) ----------------------------- Prototype STRING strstr(STRING s1, STRING s2) Description Returns a string beginning at the first occurrence of the string *s2* in the string *s1*, or an empty string if *s2* is not found. Note that the comparison is case sensitive. Example | if (std.strstr(req.url, req.http.restrict)) { | ... | } This will check if the content of req.http.restrict occurs anywhere in req.url. .. _func_time: TIME time(STRING, TIME) ----------------------- Prototype TIME time(STRING s, TIME fallback) Description Converts the string *s* to a time. If conversion fails, *fallback* will be returned. Supported formats: | "Sun, 06 Nov 1994 08:49:37 GMT" | "Sunday, 06-Nov-94 08:49:37 GMT" | "Sun Nov 6 08:49:37 1994" | "1994-11-06T08:49:37" | "784111777.00" | "784111777" Example | if (std.time(resp.http.last-modified, now) < now - 1w) { | ... | } SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`vsl(7)` HISTORY ======= The Varnish standard module was released along with Varnish Cache 3.0. This manual page was written by Per Buer with help from Martin Blix Grydeland. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2010-2015 Varnish Software AS varnish-4.1.1/doc/sphinx/reference/varnish-counters.rst0000644000201500234410000000055012652366721020176 00000000000000.. _varnish-counters(7): ================ varnish-counters ================ --------------------------------- Varnish counter field definitions --------------------------------- :Manual section: 7 .. include:: ../include/counters.rst AUTHORS ======= This man page was written by Lasse Karstensen, using content from vsc2rst written by Tollef Fog Heen. varnish-4.1.1/doc/sphinx/glossary/0000755000201500234410000000000012652366721014117 500000000000000varnish-4.1.1/doc/sphinx/glossary/index.rst0000644000201500234410000000677512652366721015717 00000000000000 .. _glossary: Varnish Glossary ================ .. glossary:: :sorted: .. This file will be sorted automagically during formatting, so we keep the source in subject order to make sure we cover all bases. .. comment: "components of varnish --------------------------------" varnishd (NB: with 'd') This is the actual Varnish cache program. There is only one program, but when you run it, you will get *two* processes: The "master" and the "worker" (or "child"). master (process) One of the two processes in the varnishd program. The master process is a manager/nanny process which handles configuration, parameters, compilation of :term:VCL etc. but it does never get near the actual HTTP traffic. worker (process) The worker process is started and configured by the master process. This is the process that does all the work you actually want varnish to do. If the worker dies, the master will try start it again, to keep your website alive. backend The HTTP server varnishd is caching for. This can be any sort of device that handles HTTP requests, including, but not limited to: a webserver, a CMS, a load-balancer another varnishd, etc. client The program which sends varnishd an HTTP request, typically a browser, but do not forget to think about spiders, robots script-kiddies and criminals. varnishstat Program which presents varnish statistics counters. varnishlog Program which presents varnish transaction log in native format. varnishtop Program which gives real-time "top-X" list view of transaction log. varnishncsa Program which presents varnish transaction log in "NCSA" format. varnishhist Eye-candy program showing response time histogram in 1980s ASCII-art style. varnishtest Program to test varnishd's behaviour with, simulates backend and client according to test-scripts. .. comment: "components of traffic ---------------------------------" header An HTTP protocol header, like "Accept-Encoding:". request What the client sends to varnishd and varnishd sends to the backend. response What the backend returns to varnishd and varnishd returns to the client. When the response is stored in varnishd's cache, we call it an object. backend response The response specifically served from a backend to varnishd. The backend response may be manipulated in vcl_backend_response. body The bytes that make up the contents of the object, varnishd does not care if they are in HTML, XML, JPEG or even EBCDIC, to varnishd they are just bytes. object The (possibly) cached version of a backend response. varnishd receives a response from the backend and creates an object, from which it may deliver cached responses to clients. If the object is created as a result of a request which is passed, it will not be stored for caching. .. comment: "configuration of varnishd -----------------------------" VCL Varnish Configuration Language, a small specialized language for instructing Varnish how to behave. .. comment: "actions in VCL ----------------------------------------" hit An object Varnish delivers from cache. miss An object Varnish fetches from the backend before it is served to the client. The object may or may not be put in the cache, that depends. pass An object Varnish does not try to cache, but simply fetches from the backend and hands to the client. pipe Varnish just moves the bytes between client and backend, it does not try to understand what they mean. varnish-4.1.1/doc/sphinx/conf.py0000644000201500234410000001541712652366741013505 00000000000000# -*- coding: utf-8 -*- # # Varnish documentation build configuration file, created by # sphinx-quickstart on Tue Apr 20 13:02:15 2010. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.append(os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.todo'] # Add any paths that contain templates here, relative to this directory. templates_path = ['=templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Varnish Cache' copyright = u'2010-2014, 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 # built documents. # # The short X.Y version. version = '4.1.1' # The full version, including alpha/beta/rc tags. release = '4.1.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. #unused_docs = [] # List of directories, relative to source directory, that shouldn't be searched # for source files. exclude_patterns = ['build','include/*.rst','reference/vcl_var.rst'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # # topp background: #437EB2 # left column: #EEEEEE; # h3: #222222; # color: #222222; # a: #336590 html_theme_options = { "bgcolor" : "white", "relbarbgcolor" : "#437EB2", "relbartextcolor" : "white", "sidebarbgcolor" : "#EEEEEE", "sidebartextcolor" : "#222222", "sidebarlinkcolor" : "#336590", "textcolor" : "#222222", "linkcolor" : "#336590", # "codebgcolor" : "#EEEEEE", "codetextcolor" : "#222222", "headtextcolor" : "#222222", "headlinkcolor" : "#336590", } # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". html_title = "Varnish version 4.1.1 documentation" # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". #html_static_path = ['=static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. html_use_smartypants = False # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'Varnishdoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'Varnish.tex', u'Varnish Administrator documentation', u'Varnish Cache Project', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # Additional stuff for the LaTeX preamble. # latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True varnish-4.1.1/doc/sphinx/users-guide/0000755000201500234410000000000012652366721014510 500000000000000varnish-4.1.1/doc/sphinx/users-guide/vcl-grace.rst0000644000201500234410000000450312652366721017027 00000000000000.. _users-guide-handling_misbehaving_servers: Misbehaving servers ------------------- A key feature of Varnish is its ability to shield you from misbehaving web- and application servers. Grace mode ~~~~~~~~~~ When several clients are requesting the same page Varnish will send one request to the backend and place the others on hold while fetching one copy from the backend. In some products this is called request coalescing and Varnish does this automatically. If you are serving thousands of hits per second the queue of waiting requests can get huge. There are two potential problems - one is a thundering herd problem - suddenly releasing a thousand threads to serve content might send the load sky high. Secondly - nobody likes to wait. To deal with this we can instruct Varnish to keep the objects in cache beyond their TTL and to serve the waiting requests somewhat stale content. So, in order to serve stale content we must first have some content to serve. So to make Varnish keep all objects for 2 minutes beyond their TTL use the following VCL:: sub vcl_backend_response { set beresp.grace = 2m; } Now Varnish will be allowed to serve objects that are up to two minutes out of date. When it does it will also schedule a refresh of the object. This will happen asynchronously and the moment the new object is in it will replace the one we've already got. You can influence how this logic works by adding code in vcl_hit. The default looks like this:: 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, deliver it // Automatically triggers a background fetch return (deliver); } // fetch & deliver once we get the result return (fetch); } The grace logic is pretty obvious here. If you have enabled :ref:`users-guide-advanced_backend_servers-health` you can check if the backend is sick and only serve graced object then. Replace the second if-clause with something like this:: if (!std.healthy(req.backend_hint) && (obj.ttl + obj.grace > 0s)) { return (deliver); } else { return (fetch); } So, to sum up, grace mode solves two problems: * it serves stale content to avoid request pile-up. * it serves stale content if you allow it. varnish-4.1.1/doc/sphinx/users-guide/vcl-example-manipulating-headers.rst0000644000201500234410000000113112652366721023472 00000000000000 Manipulating request headers in VCL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lets say we want to remove the cookie for all objects in the `/images` directory of our web server:: sub vcl_recv { if (req.url ~ "^/images") { unset req.http.cookie; } } Now, when the request is handled to the backend server there will be no cookie header. The interesting line is the one with the if-statement. It matches the URL, taken from the request object, and matches it against the regular expression. Note the match operator. If it matches the Cookie: header of the request is unset (deleted). varnish-4.1.1/doc/sphinx/users-guide/troubleshooting.rst0000644000201500234410000001113112652366721020406 00000000000000.. _users_trouble: Troubleshooting Varnish ======================= Sometimes Varnish misbehaves or rather behaves the way you told it to behave but not necessarily the way you want it to behave. In order for you to understand whats going on there are a couple of places you can check. :ref:`varnishlog(1)`, `/var/log/syslog`, `/var/log/messages` are all good places where Varnish might leave clues of whats going on. This section will guide you through basic troubleshooting in Varnish. When Varnish won't start ------------------------ Sometimes Varnish wont start. There is a plethora of possible reasons why Varnish wont start on your machine. We've seen everything from wrong 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:: # varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1: 2000 -a 0.0.0.0:8080 -d Notice the '-d' parameter. It will give you some more information on what is going on. Let us see how Varnish will react when something else is listening on its port.:: # varnishd -n foo -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:8080 -d storage_malloc: max size 1024 MB. Using old SHMFILE Platform: Linux,2.6.32-21-generic,i686,-smalloc,-hcritbit 200 193 ----------------------------- Varnish Cache CLI. ----------------------------- Type 'help' for command list. Type 'quit' to close CLI session. Type 'start' to launch worker process. Now Varnish is running but only the master process is running, in debug mode the cache does not start. Now you're on the console. You can instruct the master process to start the cache by issuing "start".:: start bind(): Address already in use 300 22 Could not open sockets And here we have our problem. Something else is bound to the HTTP port of Varnish. If this doesn't help try ``strace`` or ``truss`` or come find us on IRC. Varnish is crashing - panics ---------------------------- When Varnish goes bust the child processes crashes. Most of the crashes are caught by one of the many consistency checks we have included in the Varnish source code. When Varnish hits one of these the caching process will crash itself in a controlled manner, leaving a nice stack trace with the mother process. You can inspect any panic messages by typing ``panic.show`` in the CLI.:: panic.show Last panic at: Tue, 15 Mar 2011 13:09:05 GMT Assert error in ESI_Deliver(), cache_esi_deliver.c line 354: Condition(i == Z_OK || i == Z_STREAM_END) not true. thread = (cache-worker) ident = Linux,2.6.32-28-generic,x86_64,-sfile,-smalloc,-hcritbit,epoll Backtrace: 0x42cbe8: pan_ic+b8 0x41f778: ESI_Deliver+438 0x42f838: RES_WriteObj+248 0x416a70: cnt_deliver+230 0x4178fd: CNT_Session+31d (..) The crash might be due to misconfiguration or a bug. If you suspect it is a bug you can use the output in a bug report, see the "Trouble Tickets" section in the Introduction chapter above. Varnish is crashing - segfaults ------------------------------- Sometimes a bug escapes the consistency checks and Varnish gets hit with a segmentation error. When this happens with the child process it is logged, the core is dumped and the child process starts up again. A core dumped is usually due to a bug in Varnish. However, in order to debug a segfault the developers need you to provide a fair bit of data. * Make sure you have Varnish installed with debugging symbols. * Make sure core dumps are allowed in the parent shell. (``ulimit -c unlimited``) Once you have the core you open it with `gdb` and issue the command ``bt`` to get a stack trace of the thread that caused the segfault. Varnish gives me Guru meditation -------------------------------- First find the relevant log entries in :ref:`varnishlog(1)`. That will probably give you a clue. Since :ref:`varnishlog(1)` logs a lot of data it might be hard to track the entries down. You can set :ref:`varnishlog(1)` to log all your 503 errors by issuing the following command:: $ varnishlog -q 'RespStatus == 503' -g request If the error happened just a short time ago the transaction might still be in the shared memory log segment. To get :ref:`varnishlog(1)` to process the whole shared memory log just add the '-d' parameter:: $ varnishlog -d -q 'RespStatus == 503' -g request Please see the :ref:`vsl-query(7)` and :ref:`varnishlog(1)` man pages for elaborations on further filtering capabilities and explanation of the various options. Varnish doesn't cache --------------------- See :ref:`users-guide-increasing_your_hitrate`. varnish-4.1.1/doc/sphinx/users-guide/vcl-inline-c.rst0000644000201500234410000000136212652366721017444 00000000000000 Using inline C to extend Varnish --------------------------------- (Here there be dragons. Big and mean ones.) You can use *inline C* to extend Varnish. Please note that you can seriously mess up Varnish this way. The C code runs within the Varnish Cache process so if your code generates a segfault the cache will crash. One of the first uses of inline C was logging to `syslog`.:: # The include statements must be outside the subroutines. C{ #include }C sub vcl_something { C{ syslog(LOG_INFO, "Something happened at VCL line XX."); }C } To use inline C you need to enable it with the ``vcc_allow_inline_c`` parameter. varnish-4.1.1/doc/sphinx/users-guide/esi.rst0000644000201500234410000000602312652366721015743 00000000000000.. _users-guide-esi: Content composition with Edge Side Includes ------------------------------------------- Varnish can create web pages by assembling different pages, called `fragments`, together into one page. These `fragments` can have individual cache policies. If you have a web site with a list showing the five most popular articles on your site, this list can probably be cached as a `fragment` and included in all the other pages. .. XXX:What other pages? benc Used properly this strategy can dramatically increase your hit rate and reduce the load on your servers. In Varnish we've only so far implemented a small subset of ESI. As of version 2.1 we have three ESI statements:: esi:include esi:remove Content substitution based on variables and cookies is not implemented but is on the roadmap. At least if you look at the roadmap from a certain angle. During a full moon. Varnish will not process ESI instructions in HTML comments. Example: esi:include ~~~~~~~~~~~~~~~~~~~~ Lets see an example how this could be used. This simple cgi script outputs the date:: #!/bin/sh echo 'Content-type: text/html' echo '' date "+%Y-%m-%d %H:%M" Now, lets have an HTML file that has an ESI include statement:: The time is: at this very moment. For ESI to work you need to activate ESI processing in VCL, like this:: sub vcl_backend_response { if (bereq.url == "/test.html") { set beresp.do_esi = true; // Do ESI processing set beresp.ttl = 24 h; // Sets the TTL on the HTML above } elseif (bereq.url == "/cgi-bin/date.cgi") { set beresp.ttl = 1m; // Sets a one minute TTL on // the included object } } Example: esi:remove and ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The `` and `` constructs can be used to present appropriate content whether or not ESI is available, for example you can include content when ESI is available or link to it when it is not. ESI processors will remove the start ("") when the page is processed, while still processing the contents. If the page is not processed, it will remain intact, becoming a HTML/XML comment tag. ESI processors will remove `` tags and all content contained in them, allowing you to only render the content when the page is not being ESI-processed. For example:: The license Doing ESI on JSON and other non-XML'ish content ----------------------------------------------- Please note that Varnish will peek at the included content. If it doesn't start with a "<" Varnish assumes you didn't really mean to include it and disregard it. You can alter this behaviour by setting the 'esi_syntax' parameter (see ref:`ref-varnishd`). varnish-4.1.1/doc/sphinx/users-guide/run_cli.rst0000644000201500234410000001216212652366721016617 00000000000000.. _run_cli: CLI - bossing Varnish around ============================ Once `varnishd` is started, you can control it using the command line interface. The easiest way to do this, is using `varnishadm` on the same machine as `varnishd` is running:: varnishadm help If you want to run `varnishadm` from a remote system, you can do it two ways. You can SSH into the `varnishd` computer and run `varnishadm`:: ssh $http_front_end varnishadm help But you can also configure `varnishd` to accept remote CLI connections (using the '-T' and '-S' arguments):: varnishd -T :6082 -S /etc/varnish_secret And then on the remote system run `varnishadm`:: varnishadm -T $http_front_end -S /etc/copy_of_varnish_secret help but as you can see, SSH is much more convenient. If you run `varnishadm` without arguments, it will read CLI commands from `stdin`, if you give it arguments, it will treat those as the single CLI command to execute. The CLI always returns a status code to tell how it went: '200' means OK, anything else means there were some kind of trouble. `varnishadm` will exit with status 1 and print the status code on standard error if it is not 200. What can you do with the CLI ---------------------------- The CLI gives you almost total control over `varnishd` some of the more important tasks you can perform are: * load/use/discard VCL programs * ban (invalidate) cache content * change parameters * start/stop worker process We will discuss each of these briefly below. Load, use and discard VCL programs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ All caching and policy decisions are made by VCL programs. You can have multiple VCL programs loaded, but one of them is designated the "active" VCL program, and this is where all new requests start out. To load new VCL program:: varnish> vcl.load some_name some_filename Loading will read the VCL program from the file, and compile it. If the compilation fails, you will get an error messages:: .../mask is not numeric. ('input' Line 4 Pos 17) "192.168.2.0/24x", ----------------#################- Running VCC-compiler failed, exit 1 VCL compilation failed If compilation succeeds, the VCL program is loaded, and you can now make it the active VCL, whenever you feel like it:: varnish> vcl.use some_name If you find out that was a really bad idea, you can switch back to the previous VCL program again:: varnish> vcl.use old_name The switch is instantaneous, all new requests will start using the VCL you activated right away. The requests currently being processed complete using whatever VCL they started with. It is good idea to design an emergency-VCL before you need it, and always have it loaded, so you can switch to it with a single vcl.use command. .. XXX:Should above have a clearer admonition like a NOTE:? benc Ban cache content ^^^^^^^^^^^^^^^^^ Varnish offers "purges" to remove things from cache, provided that you know exactly what they are. But sometimes it is useful to be able to throw things out of cache without having an exact list of what to throw out. Imagine for instance that the company logo changed and now you need Varnish to stop serving the old logo out of the cache:: varnish> ban req.url ~ "logo.*[.]png" should do that, and yes, that is a regular expression. We call this "banning" because the objects are still in the cache, but they are banned from delivery. Instead of checking each and every cached object right away, we test each object against the regular expression only if and when an HTTP request asks for it. Banning stuff is much cheaper than restarting Varnish to get rid of wronly cached content. .. In addition to handling such special occasions, banning can be used .. in many creative ways to keep the cache up to date, more about .. that in: (TODO: xref) Change parameters ^^^^^^^^^^^^^^^^^ Parameters can be set on the command line with the '-p' argument, but they can also be examined and changed on the fly from the CLI:: varnish> param.show prefer_ipv6 200 prefer_ipv6 off [bool] Default is off Prefer IPv6 address when connecting to backends which have both IPv4 and IPv6 addresses. varnish> param.set prefer_ipv6 true 200 In general it is not a good idea to modify parameters unless you have a good reason, such as performance tuning or security configuration. Most parameters will take effect instantly, or with a natural delay of some duration, .. XXX: Natural delay of some duration sounds vague. benc but a few of them requires you to restart the child process before they take effect. This is always noted in the description of the parameter. Starting and stopping the worker process ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In general you should just leave the worker process running, but if you need to stop and/or start it, the obvious commands work:: varnish> stop and:: varnish> start If you start `varnishd` with the '-d' (debugging) argument, you will always need to start the child process explicitly. Should the child process die, the master process will automatically restart it, but you can disable that with the 'auto_restart' parameter. varnish-4.1.1/doc/sphinx/users-guide/performance.rst0000644000201500234410000000207112652366721017463 00000000000000.. _users_performance: Varnish and Website Performance =============================== This section focuses on how to tune the performance of your Varnish server, and how to tune the performance of your website using Varnish. The section is split in three subsections. The first subsection deals with the various tools and functions of Varnish that you should be aware of. The next subsection focuses on the how to purge content out of your cache. Purging of content is essential in a performance context because it allows you to extend the *time-to-live* (TTL) of your cached objects. Having a long TTL allows Varnish to keep the content in cache longer, meaning Varnish will make fewer requests to your relativly slower backend. The final subsection deals with compression of web content. Varnish can gzip content when fetching it from the backend and then deliver it compressed. This will reduce the time it takes to download the content thereby increasing the performance of your website. .. toctree:: :maxdepth: 2 increasing-your-hitrate purging compression varnish-4.1.1/doc/sphinx/users-guide/storage-backends.rst0000644000201500234410000001173112652366721020401 00000000000000.. _guide-storage: Storage backends ---------------- Intro ~~~~~ Varnish has pluggable storage backends. It can store data in various backends which can have different performance characteristics. The default configuration is to use the malloc backend with a limited size. For a serious Varnish deployment you probably would want to adjust the storage settings. malloc ~~~~~~ syntax: malloc[,size] Malloc is a memory based backend. Each object will be allocated from memory. If your system runs low on memory swap will be used. Be aware that the size limitation only limits the actual storage and that the approximately 1k of memory per object, used for various internal structures, is included in the actual storage as well. .. XXX:This seems to contradict the last paragraph in "sizing-your-cache". benc The size parameter specifies the maximum amount of memory `varnishd` will allocate. The size is assumed to be in bytes, unless followed by one of the following suffixes: K, k The size is expressed in kibibytes. M, m The size is expressed in mebibytes. G, g The size is expressed in gibibytes. T, t The size is expressed in tebibytes. The default size is unlimited. malloc's performance is bound to memory speed so it is very fast. If the dataset is bigger than available memory performance will depend on the operating systems ability to page effectively. file ~~~~ syntax: file[,path[,size[,granularity]]] The file backend stores objects in memory backed by an unlinked file on disk with `mmap`. The 'path' parameter specifies either the path to the backing file or the path to a directory in which `varnishd` will create the backing file. The default is `/tmp`. The size parameter specifies the size of the backing file. The size is assumed to be in bytes, unless followed by one of the following suffixes: K, k The size is expressed in kibibytes. M, m The size is expressed in mebibytes. G, g The size is expressed in gibibytes. T, t The size is expressed in tebibytes. If 'path' points to an existing file and no size is specified, the size of the existing file will be used. If 'path' does not point to an existing file it is an error to not specify the size. If the backing file already exists, it will be truncated or expanded to the specified size. Note that if `varnishd` has to create or expand the file, it will not pre-allocate the added space, leading to fragmentation, which may adversely impact performance on rotating hard drives. Pre-creating the storage file using `dd(1)` will reduce fragmentation to a minimum. .. XXX:1? benc The 'granularity' parameter specifies the granularity of allocation. All allocations are rounded up to this size. The granularity is is assumed to be expressed in bytes, unless followed by one of the suffixes described for size. The default granularity is the VM page size. The size should be reduced if you have many small objects. File performance is typically limited to the write speed of the device, and depending on use, the seek time. persistent (experimental) ~~~~~~~~~~~~~~~~~~~~~~~~~ syntax: persistent,path,size {experimental} Persistent storage. Varnish will store objects in a file in a manner that will secure the survival of *most* of the objects in the event of a planned or unplanned shutdown of Varnish. The 'path' parameter specifies the path to the backing file. If the file doesn't exist Varnish will create it. The 'size' parameter specifies the size of the backing file. The size is expressed in bytes, unless followed by one of the following suffixes: K, k The size is expressed in kibibytes. M, m The size is expressed in mebibytes. G, g The size is expressed in gibibytes. T, t The size is expressed in tebibytes. Varnish will split the file into logical *silos* and write to the silos in the manner of a circular buffer. Only one silo will be kept open at any given point in time. Full silos are *sealed*. When Varnish starts after a shutdown it will discard the content of any silo that isn't sealed. Note that taking persistent silos offline and at the same time using bans can cause problems. This is due to the fact that bans added while the silo was offline will not be applied to the silo when it reenters the cache. Consequently enabling previously banned objects to reappear. Transient Storage ----------------- If you name any of your storage backend "Transient" it will be used for transient (short lived) objects. This includes the temporary objects created when returning a synthetic object. By default Varnish would use an unlimited malloc backend for this. .. XXX: Is this another paramater? In that case handled in the same manner as above? benc Varnish will consider an object short lived if the TTL is below the parameter 'shortlived'. .. XXX: I am generally missing samples of setting all of these parameters, maybe one sample per section or a couple of examples here with a brief explanation to also work as a summary? benc varnish-4.1.1/doc/sphinx/users-guide/index.rst0000644000201500234410000000316612652366721016277 00000000000000.. _users-guide-index: The Varnish Users Guide ======================= The Varnish documentation consists of three main documents: * :ref:`tutorial-index` explains the basics and gets you started with Varnish. * :ref:`users-guide-index` (this document), explains how Varnish works and how you can use it to improve your website. * :ref:`reference-index` contains hard facts and is useful for looking up specific questions. After :ref:`users_intro`, this Users Guide is organized in sections following the major interfaces to Varnish as a service: :ref:`users_running` is about getting Varnish configured, with respect to storage, sockets, security and how you can control and communicate with Varnish once it is running. :ref:`users_vcl` is about getting Varnish to handle the HTTP requests the way you want, what to cache, how to cache it, modifying HTTP headers etc. etc. :ref:`users_report` explains how you can monitor what Varnish does, from a transactional level to aggregating statistics. :ref:`users_performance` is about tuning your website with Varnish. :ref:`users_trouble` is for locating and fixing common issues with Varnish. .. toctree:: :maxdepth: 2 intro running vcl report performance esi troubleshooting .. customizing (which is a non ideal title) .. No longer used: configuration command_line VCL backend_servers logging sizing_your_cache statistics increasing_your_hitrate cookies vary hashing purging compression esi websockets devicedetection handling_misbehaving_servers advanced_topics troubleshooting varnish-4.1.1/doc/sphinx/users-guide/compression.rst0000644000201500234410000000760512652366721017533 00000000000000.. _users-guide-compression: Compression ----------- In Varnish 3.0 we introduced native support for compression, using gzip encoding. *Before* 3.0, Varnish would never compress objects. In Varnish 4.0 compression defaults to "on", meaning that it tries to be smart and do the sensible thing. If you don't want Varnish tampering with the encoding you can disable compression all together by setting the parameter `http_gzip_support` to false. Please see man :ref:`varnishd(1)` for details. Default behaviour ~~~~~~~~~~~~~~~~~ The default behaviour is active when the `http_gzip_support` parameter is set to "on" and neither `beresp.do_gzip` nor `beresp.do_gunzip` are used in VCL. Unless returning from `vcl_recv` with `pipe` or `pass`, Varnish modifies `req.http.Accept-Encoding`: if the client supports gzip `req.http.Accept-Encoding` is set to "gzip", otherwise the header is removed. Unless the request is a `pass`, Varnish sets `bereq.http.Accept-Encoding` to "gzip" before `vcl_backend_fetch` runs, so the header can be changed in VCL. If the server responds with gzip'ed content it will be stored in memory in its compressed form and `Accept-Encoding` will be added to the `Vary` header. To clients supporting gzip, compressed content is delivered unmodified. For clients not supporting gzip, compressed content gets decompressed on the fly while delivering it. The `Content-Encoding` response header gets removed and any `Etag` gets weakened (by prepending "W/"). For Vary Lookups, `Accept-Encoding` is ignored. Compressing content if backends don't ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can tell Varnish to compress content before storing it in cache in `vcl_backend_response` by setting `beresp.do_gzip` to "true", like this:: sub vcl_backend_response { if (beresp.http.content-type ~ "text") { set beresp.do_gzip = true; } } With `beresp.do_gzip` set to "true", Varnish will make the following changes to the headers of the resulting object before inserting it in the cache: * set `obj.http.Content-Encoding` to "gzip" * add "Accept-Encoding" to `obj.http.Vary`, unless already present * weaken any `Etag` (by prepending "W/") Generally, Varnish doesn't use much CPU so it might make more sense to have Varnish spend CPU cycles compressing content than doing it in your web- or application servers, which are more likely to be CPU-bound. Please make sure that you don't try to compress content that is uncompressable, like JPG, GIF and MP3 files. You'll only waste CPU cycles. Uncompressing content before entering the cache ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can also uncompress content before storing it in cache by setting `beresp.do_gunzip` to "true". One use case for this feature is to work around badly configured backends uselessly compressing already compressed content like JPG images (but fixing the misbehaving backend is always the better option). With `beresp.do_gunzip` set to "true", Varnish will make the following changes to the headers of the resulting object before inserting it in the cache: * remove `obj.http.Content-Encoding` * weaken any `Etag` (by prepending "W/") .. XXX pending closing #940: remove any "Accept-Encoding" from `obj.http.Vary` GZIP and ESI ~~~~~~~~~~~~ If you are using Edge Side Includes (ESI) you'll be happy to note that ESI and GZIP work together really well. Varnish will magically decompress the content to do the ESI-processing, then recompress it for efficient storage and delivery. Turning off gzip support ~~~~~~~~~~~~~~~~~~~~~~~~ When the `http_gzip_support` parameter is set to "off", Varnish does not do any of the header alterations documented above, handles `Vary: Accept-Encoding` like it would for any other `Vary` value and ignores `beresp.do_gzip` and `beresp.do_gunzip`. A random outburst ~~~~~~~~~~~~~~~~~ Poul-Henning Kamp has written :ref:`phk_gzip` which talks a bit more about how the implementation works. varnish-4.1.1/doc/sphinx/users-guide/devicedetection.rst0000644000201500234410000002160012652366721020317 00000000000000.. _users-guide-devicedetect: Device detection ~~~~~~~~~~~~~~~~ Device detection is figuring out what kind of content to serve to a client based on the User-Agent string supplied in a request. Use cases for this are for example to send size reduced files to mobile clients with small screens and on high latency networks, or to provide a streaming video codec that the client understands. There are a couple of typical strategies to use for this type of scenario: 1) Redirect to another URL. 2) Use a different backend for the special client. 3) Change the backend request so that the backend sends tailored content. To perhaps make the strategies easier to understand, we, in this context, assume that the `req.http.X-UA-Device` header is present and unique per client class. Setting this header can be as simple as:: sub vcl_recv { if (req.http.User-Agent ~ "(?i)iphone" { set req.http.X-UA-Device = "mobile-iphone"; } } There are different commercial and free offerings in doing grouping and identifying clients in further detail. For a basic and community based regular expression set, see https://github.com/varnishcache/varnish-devicedetect/. Serve the different content on the same URL ------------------------------------------- The tricks involved are: 1. Detect the client (pretty simple, just include `devicedetect.vcl` and call it). 2. Figure out how to signal the backend the client class. This includes for example setting a header, changing a header or even changing the backend request URL. 3. Modify any response from the backend to add missing 'Vary' headers, so Varnish' internal handling of this kicks in. 4. Modify output sent to the client so any caches outside our control don't serve the wrong content. All this needs to be done while still making sure that we only get one cached object per URL per device class. Example 1: Send HTTP header to backend '''''''''''''''''''''''''''''''''''''' The basic case is that Varnish adds the 'X-UA-Device' HTTP header on the backend requests, and the backend mentions in the response 'Vary' header that the content is dependant on this header. Everything works out of the box from Varnish' perspective. .. 071-example1-start VCL:: sub vcl_recv { # call some detection engine that set req.http.X-UA-Device } # req.http.X-UA-Device is copied by Varnish into bereq.http.X-UA-Device # so, this is a bit counterintuitive. The backend creates content based on # the normalized User-Agent, but we use Vary on X-UA-Device so Varnish will # use the same cached object for all U-As that map to the same X-UA-Device. # # If the backend does not mention in Vary that it has crafted special # content based on the User-Agent (==X-UA-Device), add it. # If your backend does set Vary: User-Agent, you may have to remove that here. sub vcl_backend_response { if (bereq.http.X-UA-Device) { if (!beresp.http.Vary) { # no Vary at all set beresp.http.Vary = "X-UA-Device"; } elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device"; } } # comment this out if you don't want the client to know your # classification set beresp.http.X-UA-Device = bereq.http.X-UA-Device; } # to keep any caches in the wild from serving wrong content to client #2 # behind them, we need to transform the Vary on the way out. sub vcl_deliver { if ((req.http.X-UA-Device) && (resp.http.Vary)) { set resp.http.Vary = regsub(resp.http.Vary, "X-UA-Device", "User-Agent"); } } .. 071-example1-end Example 2: Normalize the User-Agent string '''''''''''''''''''''''''''''''''''''''''' Another way of signalling the device type is to override or normalize the 'User-Agent' header sent to the backend. For example:: User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; nb-no; HTC Desire Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 becomes:: User-Agent: mobile-android when seen by the backend. This works if you don't need the original header for anything on the backend. A possible use for this is for CGI scripts where only a small set of predefined headers are (by default) available for the script. .. 072-example2-start VCL:: sub vcl_recv { # call some detection engine that set req.http.X-UA-Device } # override the header before it is sent to the backend sub vcl_miss { if (req.http.X-UA-Device) { set req.http.User-Agent = req.http.X-UA-Device; } } sub vcl_pass { if (req.http.X-UA-Device) { set req.http.User-Agent = req.http.X-UA-Device; } } # standard Vary handling code from previous examples. sub vcl_backend_response { if (bereq.http.X-UA-Device) { if (!beresp.http.Vary) { # no Vary at all set beresp.http.Vary = "X-UA-Device"; } elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device"; } } set beresp.http.X-UA-Device = bereq.http.X-UA-Device; } sub vcl_deliver { if ((req.http.X-UA-Device) && (resp.http.Vary)) { set resp.http.Vary = regsub(resp.http.Vary, "X-UA-Device", "User-Agent"); } } .. 072-example2-end Example 3: Add the device class as a GET query parameter '''''''''''''''''''''''''''''''''''''''''''''''''''''''' If everything else fails, you can add the device type as a GET argument. http://example.com/article/1234.html --> http://example.com/article/1234.html?devicetype=mobile-iphone The client itself does not see this classification, only the backend request is changed. .. 073-example3-start VCL:: sub vcl_recv { # call some detection engine that set req.http.X-UA-Device } sub append_ua { if ((req.http.X-UA-Device) && (req.method == "GET")) { # if there are existing GET arguments; if (req.url ~ "\?") { set req.http.X-get-devicetype = "&devicetype=" + req.http.X-UA-Device; } else { set req.http.X-get-devicetype = "?devicetype=" + req.http.X-UA-Device; } set req.url = req.url + req.http.X-get-devicetype; unset req.http.X-get-devicetype; } } # do this after vcl_hash, so all Vary-ants can be purged in one go. (avoid ban()ing) sub vcl_miss { call append_ua; } sub vcl_pass { call append_ua; } # Handle redirects, otherwise standard Vary handling code from previous # examples. sub vcl_backend_response { if (bereq.http.X-UA-Device) { if (!beresp.http.Vary) { # no Vary at all set beresp.http.Vary = "X-UA-Device"; } elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device"; } # if the backend returns a redirect (think missing trailing slash), # we will potentially show the extra address to the client. we # don't want that. if the backend reorders the get parameters, you # may need to be smarter here. (? and & ordering) if (beresp.status == 301 || beresp.status == 302 || beresp.status == 303) { set beresp.http.location = regsub(beresp.http.location, "[?&]devicetype=.*$", ""); } } set beresp.http.X-UA-Device = bereq.http.X-UA-Device; } sub vcl_deliver { if ((req.http.X-UA-Device) && (resp.http.Vary)) { set resp.http.Vary = regsub(resp.http.Vary, "X-UA-Device", "User-Agent"); } } .. 073-example3-end Different backend for mobile clients ------------------------------------ If you have a different backend that serves pages for mobile clients, or any special needs in VCL, you can use the 'X-UA-Device' header like this:: backend mobile { .host = "10.0.0.1"; .port = "80"; } sub vcl_recv { # call some detection engine if (req.http.X-UA-Device ~ "^mobile" || req.http.X-UA-device ~ "^tablet") { set req.backend_hint = mobile; } } sub vcl_hash { if (req.http.X-UA-Device) { hash_data(req.http.X-UA-Device); } } Redirecting mobile clients -------------------------- If you want to redirect mobile clients you can use the following snippet. .. 065-redir-mobile-start VCL:: sub vcl_recv { # call some detection engine if (req.http.X-UA-Device ~ "^mobile" || req.http.X-UA-device ~ "^tablet") { return(synth(750, "Moved Temporarily")); } } sub vcl_synth { if (obj.status == 750) { set obj.http.Location = "http://m.example.com" + req.url; set obj.status = 302; return(deliver); } } .. 065-redir-mobile-end varnish-4.1.1/doc/sphinx/users-guide/purging.rst0000644000201500234410000001300712652366721016636 00000000000000.. _users-guide-purging: Purging and banning ------------------- One of the most effective ways of increasing your hit ratio is to increase the time-to-live (ttl) of your objects. But, as you're aware of, in this twitterific day of age, serving content that is outdated is 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, lets look at HTTP purging. HTTP Purging ~~~~~~~~~~~~ A *purge* is what happens when you pick out an object from the cache and discard it along with its variants. Usually a purge is invoked through HTTP with the method `PURGE`. An HTTP purge is similar to an HTTP GET request, except that the *method* is `PURGE`. Actually you can call the method whatever you'd like, but most people refer to this as purging. Squid, for example, supports the same mechanism. In order to support purging in Varnish you need the following VCL in place:: acl purge { "localhost"; "192.168.55.0"/24; } sub vcl_recv { # allow PURGE from localhost and 192.168.55... if (req.method == "PURGE") { if (!client.ip ~ purge) { return(synth(405,"Not allowed.")); } return (purge); } } As you can see we have used a new action - return(purge). This ends execution of vcl_recv and jumps to vcl_hash. This is just like we handle a regular request. When vcl_hash calls return(lookup) varnish will purge the object and then call vcl_purge. Here you have the option of adding any particular actions you want Varnish to take once it has purge the object. So for example.com to invalidate their front page they would call out to Varnish like this:: PURGE / HTTP/1.0 Host: example.com And Varnish would then discard the front page. This will remove all variants as defined by Vary. Bans ~~~~ There is another way to invalidate content: Bans. You can think of bans as a sort of a filter on objects already in the cache. You ``ban`` certain content from being served from your cache. You can ban content based on any metadata we have. A ban will only work on objects already in the cache, it does not prevent new content from entering the cache or being served. Support for bans is built into Varnish and available in the CLI interface. To ban every png object belonging on example.com, issue the following command:: ban req.http.host == "example.com" && req.url ~ "\\.png$" 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*. Bans that only match against `obj.*` are also processed by a background worker threads called the `ban lurker`. The `ban lurker` will walk the heap and try to match objects and will evict the matching objects. How aggressive the `ban lurker` is can be controlled by the parameter 'ban_lurker_sleep'. The `ban lurker` can be disabled by setting 'ban_lurker_sleep' to 0. .. XXX: sample here? benc Bans that are older than the oldest objects in the cache are discarded without evaluation. If you have a lot of objects with long TTL, that are seldom accessed, you might accumulate a lot of bans. This might impact CPU usage and thereby performance. You can also add bans to Varnish via HTTP. Doing so requires a bit of VCL:: sub vcl_recv { if (req.method == "BAN") { # Same ACL check as above: if (!client.ip ~ purge) { return(synth(403, "Not allowed.")); } ban("req.http.host == " + req.http.host + " && req.url == " + req.url); # Throw a synthetic page so the # request won't go to the backend. return(synth(200, "Ban added")); } } This VCL stanza enables Varnish to handle a `HTTP BAN` method, adding a ban on the URL, including the host part. The `ban lurker` can help you keep the ban list at a manageable size, so we recommend that you avoid using `req.*` in your bans, as the request object is not available in the `ban lurker` thread. You can use the following template to write `ban lurker` friendly bans:: sub vcl_backend_response { set beresp.http.url = bereq.url; } sub vcl_deliver { unset resp.http.url; # Optional } sub vcl_recv { if (req.method == "PURGE") { if (client.ip !~ purge) { return(synth(403, "Not allowed")); } ban("obj.http.url ~ " + req.url); # Assumes req.url is a regex. This might be a bit too simple } } To inspect the current ban list, issue the ``ban.list`` command in the CLI. This will produce a status of all current bans:: 0xb75096d0 1318329475.377475 10 obj.http.url ~ test 0xb7509610 1318329470.785875 20G obj.http.url ~ test The ban list contains the ID of the ban, the timestamp when the ban entered the ban list. A count of the objects that has reached this point in the ban list, optionally postfixed with a 'G' for "Gone", if the ban is no longer valid. Finally, the ban expression is listed. The ban can be marked as "Gone" if it is a duplicate ban, but is still kept in the list for optimization purposes. 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 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 some other means. varnish-4.1.1/doc/sphinx/users-guide/vcl-variables.rst0000644000201500234410000000175312652366721017722 00000000000000 Request and response VCL objects ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. XXX: refactored headline. benc In VCL, there several important objects that you need to be aware of. These objects can be accessed and manipulated using VCL. *req* The request object. When Varnish has received the request the `req` object is created and populated. Most of the work you do in `vcl_recv` you do on or with the `req` object. *bereq* The backend request object. Varnish contructs this before sending it to the backend. It is based on the `req` object. .. XXX:in what way? benc *beresp* The backend response object. It contains the headers of the object coming from the backend. If you want to modify the response coming from the server you modify this object in `vcl_backend_response`. *resp* The HTTP response right before it is delivered to the client. It is typically modified in `vcl_deliver`. *obj* The object as it is stored in cache. Read only. .. XXX:What object? the current request? benc varnish-4.1.1/doc/sphinx/users-guide/operation-statistics.rst0000644000201500234410000000357212652366721021361 00000000000000.. _users-guide-statistics: Statistics ---------- Varnish comes with a couple of nifty and very useful statistics generating tools that generates statistics in real time by constantly updating and presenting a specific dataset by aggregating and analyzing logdata from the shared memory logs. .. XXX:Heavy rewrite above. benc varnishtop ~~~~~~~~~~ The :ref:`varnishtop(1)` utility reads the shared memory logs and presents a continuously updated list of the most commonly occurring log entries. With suitable filtering using the -I, -i, -X and -x options, it can be used to display a ranking of requested documents, clients, user agents, or any other information which is recorded in the log. ``varnishtop -i ReqURL`` will show you what URLs are being asked for by the client. ``varnishtop -i BereqURL`` will show you what your backend is being asked the most. ``varnishtop -I ReqHeader:Accept-Encoding`` will show the most popular Accept-Encoding header the client are sending you. varnishhist ~~~~~~~~~~~ The :ref:`varnishhist(1)` utility reads :ref:`varnishd(1)` shared memory logs and 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 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 ("#"). varnishstat ~~~~~~~~~~~ Varnish has lots of counters. We count misses, hits, information about the storage, threads created, deleted objects. Just about everything. :ref:`varnishstat(1)` will dump these counters. This is useful when tuning Varnish. There are programs that can poll :ref:`varnishstat(1)` 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. varnish-4.1.1/doc/sphinx/users-guide/params.rst0000644000201500234410000000210612652366721016444 00000000000000 Parameters ---------- Varnish Cache comes with a set of parameters that affects behaviour and performance. Most of these parameters can be set on the Varnish command line (through `varnishadm`) using the ``param.set`` keyword. Some parameters can, for security purposes be read only using the '-r' command line switch to `varnishd`. We don't recommend that you tweak parameters unless you're sure of what you're doing. We've worked hard to make the defaults sane and Varnish should be able to handle most workloads with the default settings. For a complete listing of all the parameters and a short descriptions type ``param.show`` in the CLI. To inspect a certain parameter and get a somewhat longer description on what it does and what the default is type ``param.show`` and the name of the parameter, like this:: varnish> param.show shortlived 200 shortlived 10.000000 [s] Default is 10.0 Objects created with TTL shorter than this are always put in transient storage. varnish-4.1.1/doc/sphinx/users-guide/vcl-hashing.rst0000644000201500234410000000315612652366721017372 00000000000000Hashing ------- Internally, when Varnish stores content in the cache it stores the object together with a hash key to find the object again. In the default setup this key is calculated based on the content of the *Host* header or the IP address of the server and the URL. Behold the `default vcl`:: sub vcl_hash { hash_data(req.url); if (req.http.host) { hash_data(req.http.host); } else { hash_data(server.ip); } return (lookup); } As you can see it first checks in `req.url` then `req.http.host` if it exists. It is worth pointing out that Varnish doesn't lowercase the hostname or the URL before hashing it so in theory having "Varnish.org/" and "varnish.org/" would result in different cache entries. Browsers however, tend to lowercase hostnames. You can change what goes into the hash. This way you can make Varnish serve up different content to different clients based on arbitrary criteria. Let's say you want to serve pages in different languages to your users based on where their IP address is located. You would need some Vmod to get a country code and then put it into the hash. It might look like this. In `vcl_recv`:: set req.http.X-Country-Code = geoip.lookup(client.ip); And then add a `vcl_hash`:: sub vcl_hash { hash_data(req.http.X-Country-Code); } As the default VCL will take care of adding the host and URL to the hash we don't have to do anything else. Be careful calling ``return (lookup)`` as this will abort the execution of the default VCL and Varnish can end up returning data based on more or less random inputs. varnish-4.1.1/doc/sphinx/users-guide/operation-logging.rst0000644000201500234410000000510512652366721020607 00000000000000.. _users-guide-logging: Logging in Varnish ------------------ One of the really nice features in Varnish is the way logging works. Instead of logging to a normal log file Varnish logs to a shared memory segment, called the VSL - the Varnish Shared Log. When the end of the segment is reached we start over, overwriting old data. This is much, much faster than logging to a file and it doesn't require disk space. Besides it gives you much, much more information when you need it. The flip side is that if you forget to have a program actually write the logs to disk they will be overwritten. `varnishlog` is one of the programs you can use to look at what Varnish is logging. `varnishlog` gives you the raw logs, everything that is written to the logs. There are other clients that can access the logs as well, we'll show you these later. In the terminal window you started Varnish now type ``varnishlog -g raw`` and press enter. You'll see lines like these scrolling slowly by.:: 0 CLI - Rd ping 0 CLI - Wr 200 19 PONG 1273698726 1.0 These is the Varnish master process checking up on the caching process to see that everything is OK. Now go to the browser and reload the page displaying your web app. .. XXX:Doesn't this require a setup of a running varnishd and a web application being cached? benc You'll see lines like these.:: 11 SessOpen c 127.0.0.1 58912 :8080 0.0.0.0 8080 1273698726.933590 14 11 ReqStart c 127.0.0.1 58912 11 ReqMethod c GET 11 ReqURL c / 11 ReqProtocol c HTTP/1.1 11 ReqHeader c Host: localhost:8080 11 ReqHeader c Connection: keep-alive The first column is an arbitrary number, it identifies the transaction. Lines with the same number are coming from the same transaction. The second column is the *tag* of the log message. All log entries are tagged with a tag indicating what sort of activity is being logged. The third column tell us whether this is is data coming from or going to the client ('c'), or the backend ('b'). The forth column is the data being logged. Now, you can filter quite a bit with `varnishlog`. The basic options we think you want to know are: '-b' 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' Same as '-b' but for client side traffic. '-g request' Group transactions by request. '-q query' Only list transactions matching this query. .. XXX:Maybe a couple of sample commands here? benc For more information on this topic please see :ref:`varnishlog(1)`. varnish-4.1.1/doc/sphinx/users-guide/sizing-your-cache.rst0000644000201500234410000000226312652366721020525 00000000000000 Sizing your cache ----------------- Deciding on cache size can be a tricky task. A few things to consider: * How big is your *hot* data set. For a portal or news site that would be the size of the front page with all the stuff on it, and the size of all the pages and objects linked from the first page. * How expensive is it to generate an object? Sometimes it makes sense to only cache images a little while or not to cache them at all if they are cheap to serve from the backend and you have a limited amount of memory. * Watch the `n_lru_nuked` counter with :ref:`varnishstat(1)` or some other tool. If you have a lot of LRU activity then your cache is evicting objects due to space constraints and you should consider increasing the size of the cache. 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 overhead of about 1KB per object. So, if you have lots of small objects in your cache the overhead might be significant. .. XXX:This seems to contradict the last paragraph in "storage-backends". benc varnish-4.1.1/doc/sphinx/users-guide/intro.rst0000644000201500234410000001123112652366721016313 00000000000000.. _users_intro: The Big Varnish Picture ======================= In this section we will cover answers to the questions: - What is in this package called "Varnish"? - what are all the different bits and pieces named? - Will you need a hex-wrench for assembly? The two main parts of Varnish are the two processes in the `varnishd` program. The first process is called "the manager", and its job is to talk to you, the administrator, and make the things you ask for happen. The second process is called "the worker" or just "the child" and this is the process which does all the actual work with your HTTP traffic. When you start `varnishd`, you start the manager process, and once it is done handling all the command line flags, it will start the child process for you. Should the child process die, the manager will start it again for you, automatically and right away. The main reason for this division of labor is security: The manager process will typically run with "root" permissions, in order to open TCP socket port 80, but it starts the child process with minimal permissions, as a defensive measure. The manager process is interactive, it offers a CLI -- Command Line 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 you need to change something very fundamental. The CLI can be safely accessed remotely, using a simple and flexible PSK -- Pre Shared Key, access control scheme, so it is easy to integrate Varnish into your operations and management infrastructure or tie it to your CMS. All this is covered in :ref:`users_running`. Things like, how the child process should deal with the HTTP requests, what to cache, which headers to remove etc, is all specified using a small programming language called VCL -- Varnish Configuration Language. The manager process will compile the VCL program and check it for errors, .. XXX:What does manager do after compile and error-check? Maybe a short description of further handling when no errors as well as when errors? benc but it is the child process which runs the VCL program, for each and every HTTP request which comes in. Because the VCL is compiled to C code, and the C code is compiled to machine instructions, even very complex VCL programs execute in a few microseconds, without impacting performance at all. And don't fret if you are not really a programmer, VCL is very simple to do simple things with:: sub vcl_recv { # Remove the cookie header to enable caching unset req.http.cookie; } The CLI interface allows you to compile and load new VCL programs at any time, and you can switch between the loaded VCL programs instantly, without restarting the child process and without missing a single HTTP request. VCL code can be extended using external modules, called VMODs or even by inline C-code if you are brave, so in terms of what Varnish can do for your HTTP traffic, there really is no limit. :ref:`users_vcl` describes VCL and what it can do in great detail. Varnish uses a segment of shared memory to report and log its activities and status. For each HTTP request, a number of very detailed records will be appended to the log memory segment. Other processes can subscribe to log-records, filter them, and format them, for instance as Apache/NCSA style log records. Another segment in shared memory is used for statistics counters, this allows real-time, down to microsecond resolution monitoring of cache hit-rate, resource usage and specific performance indicating metrics. Varnish comes with a number of tools which reports from shared memory, `varnishlog`, `varnishstats`, `varnishncsa` etc, and with an API library so you can write your own tools, should you need that. :ref:`users_report` explains how all that work. Presumably the reason for your interest in Varnish, is that you want your website to work better. There are many aspects of performance tuning a website, from relatively simple policy decisions about what to cache, to designing a geographically diverse multilevel CDNs using ESI and automatic failover. .. XXX:CDNs or CDN? benc :ref:`users_performance` will take you through the possibilities and facilities Varnish offers. Finally, Murphys Law must be referenced here: Things will go wrong, and more likely than not, they will do so at zero-zero-dark O'clock. Most likely during a hurricane, when your phone battery is flat and your wife had prepared a intimate evening to celebrate your anniversary. Yes, we've all been there, haven't we? When things go wrong :ref:`users_trouble` will hopefully be of some help. varnish-4.1.1/doc/sphinx/users-guide/report.rst0000644000201500234410000000046312652366721016500 00000000000000.. _users_report: Reporting and statistics ======================== This section covers how to find out what Varnish is doing, from the detailed per HTTP request blow-by-blow logrecords to the global summary statistics counters. .. toctree:: :maxdepth: 2 operation-logging operation-statistics varnish-4.1.1/doc/sphinx/users-guide/vcl-example-acls.rst0000644000201500234410000000103612652366721020317 00000000000000 ACLs ~~~~ You create a named access control list with the ``acl`` keyword. You can match the IP address of the client against an ACL with the match operator.:: # Who is allowed to purge.... acl local { "localhost"; "192.168.1.0"/24; /* and everyone on the local network */ ! "192.168.1.23"; /* except for the dialin router */ } sub vcl_recv { if (req.method == "PURGE") { if (client.ip ~ local) { return(purge); } else { return(synth(403, "Access denied.")); } } } varnish-4.1.1/doc/sphinx/users-guide/increasing-your-hitrate.rst0000644000201500234410000003407312652366721021745 00000000000000.. _users-guide-increasing_your_hitrate: Achieving a high hitrate ------------------------ Now that Varnish is up and running you can access your web application through Varnish. Unless your application is specifically written to work behind a web accelerator you'll probably need to do some changes to either the configuration or the application in order to get a high hitrate in Varnish. Varnish will not cache your data unless it's absolutely sure it is safe to do so. So, for you to understand how Varnish decides if and how to cache a page, we'll guide you through a couple of tools that you should find useful to understand what is happening in your Varnish setup. Note that you need a tool to see the HTTP headers that fly between Varnish and the backend. On the Varnish server, the easiest way to do this is to use :ref:`varnishlog(1)` and :ref:`varnishtop(1)` but sometimes a client-side tool makes sense. Here are the ones we commonly use. Tool: varnishtop ~~~~~~~~~~~~~~~~ You can use varnishtop to identify what URLs are hitting the backend the most. ``varnishtop -i BereqURL`` is an essential command, showing you the top requests Varnish is sending to the backend. You can see some other examples of :ref:`varnishtop(1)` usage in :ref:`users-guide-statistics`. Tool: varnishlog ~~~~~~~~~~~~~~~~ When you have identified an URL which is frequently sent to the backend you can use :ref:`varnishlog(1)` to have a look at the request. ``varnishlog -q 'ReqURL ~ "^/foo/bar"'`` will show you the requests coming from the client matching `/foo/bar`. For more information on how :ref:`varnishlog(1)` works please see :ref:`users-guide-logging` or then man page. For extended diagnostics headers, see https://www.varnish-cache.org/trac/wiki/VCLExampleHitMissHeader Tool: lwp-request ~~~~~~~~~~~~~~~~~ `lwp-request` is tool that is a part of The World-Wide Web library for Perl. It's a couple of really basic programs that can execute an HTTP request and show you the result. We mostly use the two programs, ``GET`` and ``HEAD``. vg.no was the first site to use Varnish and the people running Varnish there are quite clueful. So it's interesting to look at their HTTP Headers. Let's send a GET request for their home page:: $ GET -H 'Host: www.vg.no' -Used http://vg.no/ GET http://vg.no/ Host: www.vg.no User-Agent: lwp-request/5.834 libwww-perl/5.834 200 OK Cache-Control: must-revalidate Refresh: 600 Title: VG Nett - Forsiden - VG Nett X-Age: 463 X-Cache: HIT X-Rick-Would-Never: Let you down X-VG-Jobb: http://www.finn.no/finn/job/fulltime/result?keyword=vg+multimedia Merk:HeaderNinja X-VG-Korken: http://www.youtube.com/watch?v=Fcj8CnD5188 X-VG-WebCache: joanie X-VG-WebServer: leon OK. Lets look at what ``GET`` does. ``GET`` usually sends off HTTP 0.9 requests, which lack the 'Host' header. So we add a 'Host' header with the '-H' option. '-U' print request headers, '-s' prints response status, '-e' prints response headers and '-d' discards the actual content. We don't really care about the content, only the headers. As you can see, VG adds quite a bit of information in their headers. Some of the headers, like the 'X-Rick-Would-Never' are specific to vg.no and their somewhat odd sense of humour. Others, like the 'X-VG-Webcache' are for debugging purposes. So, to check whether a site sets cookies for a specific URL, just do:: GET -Used http://example.com/ |grep ^Set-Cookie .. XXX:Missing explanation and sample for HEAD here. benc Tool: Live HTTP Headers ~~~~~~~~~~~~~~~~~~~~~~~ There is also a plugin for Firefox called `Live HTTP Headers`. This plugin can show you what headers are being sent and received. `Live HTTP Headers` can be found at https://addons.mozilla.org/en-US/firefox/addon/3829/ or by googling "Live HTTP Headers". The role of HTTP Headers ~~~~~~~~~~~~~~~~~~~~~~~~ Along with each HTTP request and response comes a bunch of headers carrying metadata. Varnish will look at these headers to determine if it is appropriate to cache the contents and how long Varnish can keep the content cached. Please note that when Varnish considers these headers Varnish actually considers itself *part of* the actual webserver. The rationale being that both are under your control. The term *surrogate origin cache* is not really well defined by the IETF or RFC 2616 so the various ways Varnish works might differ from your expectations. Let's take a look at the important headers you should be aware of: .. _users-guide-cookies: Cookies ------- Varnish will, in the default configuration, not cache an object coming from the backend with a 'Set-Cookie' header present. Also, if the client sends a Cookie header, Varnish will bypass the cache and go directly to the backend. This can be overly conservative. A lot of sites use Google Analytics (GA) to analyze their traffic. GA sets a cookie to track you. This cookie is used by the client side javascript and is therefore of no interest to the server. Cookies from the client ~~~~~~~~~~~~~~~~~~~~~~~ For a lot of web applications it makes sense to completely disregard the cookies unless you are accessing a special part of the web site. This VCL snippet in `vcl_recv` will disregard cookies unless you are accessing `/admin/`:: if (!(req.url ~ "^/admin/")) { unset req.http.Cookie; } Quite simple. If, however, you need to do something more complicated, like removing one out of several cookies, things get difficult. Unfortunately Varnish doesn't have good tools for manipulating the Cookies. We have to use regular expressions to do the work. If you are familiar with regular expressions you'll understand whats going on. If you aren't we recommend that you either pick up a book on the subject, read through the *pcrepattern* man page, or read through one of many online guides. Lets use the Varnish Software (VS) web as an example here. Very simplified the setup VS uses can be described as a Drupal-based backend with a Varnish cache in front. VS uses some cookies for Google Analytics tracking and similar tools. The cookies are all set and used by Javascript. Varnish and Drupal doesn't need to see those cookies and since Varnish will cease caching of pages when the client sends cookies Varnish will discard these unnecessary cookies in VCL. In the following VCL we discard all cookies that start with an underscore:: # Remove has_js and Google Analytics __* cookies. set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(_[_a-z]+|has_js)=[^;]*", ""); # Remove a ";" prefix, if present. set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", ""); Lets look at an example where we remove everything except the cookies named "COOKIE1" and "COOKIE2" and you can marvel at the "beauty" of it:: sub vcl_recv { if (req.http.Cookie) { set req.http.Cookie = ";" + req.http.Cookie; set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";"); set req.http.Cookie = regsuball(req.http.Cookie, ";(COOKIE1|COOKIE2)=", "; \1="); set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", ""); set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", ""); if (req.http.Cookie == "") { unset req.http.Cookie; } } } A somewhat simpler example that can accomplish almost the same functionality can be found below. Instead of filtering out "other" cookies it instead picks out "the one" cookie that is needed, copies it to another header and then copies it back to the request, deleting the original cookie header. .. XXX:Verify correctness of request above! benc :: sub vcl_recv { # save the original cookie header so we can mangle it set req.http.X-Varnish-PHP_SID = req.http.Cookie; # using a capturing sub pattern, extract the continuous string of # alphanumerics that immediately follows "PHPSESSID=" set req.http.X-Varnish-PHP_SID = regsuball(req.http.X-Varnish-PHP_SID, ";? ?PHPSESSID=([a-zA-Z0-9]+)( |;| ;).*","\1"); set req.http.Cookie = req.X-Varnish-PHP_SID; unset req.X-Varnish-PHP_SID; } There are other scary examples of what can be done in VCL in the Varnish Cache Wiki. .. XXX:Missing link here. Cookies coming from the backend ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If your backend server sets a cookie using the 'Set-Cookie' header Varnish will not cache the page when using the default configuration. A `hit-for-pass` object (see :ref:`user-guide-vcl_actions`) is created. So, if the backend server acts silly and sets unwanted cookies just unset the 'Set-Cookie' header and all should be fine. Cache-Control ~~~~~~~~~~~~~ The 'Cache-Control' header instructs caches how to handle the content. Varnish cares about the *max-age* parameter and uses it to calculate the TTL for an object. So make sure you issue a 'Cache-Control' header with a max-age header. You can have a look at what Varnish Software's Drupal server issues:: $ GET -Used http://www.varnish-software.com/|grep ^Cache-Control Cache-Control: public, max-age=600 Age ~~~ Varnish adds an 'Age' header to indicate how long the object has been kept inside Varnish. You can grep out 'Age' from :ref:`varnishlog(1)` with ``varnishlog -I RespHeader:^Age``. Pragma ~~~~~~ An HTTP 1.0 server might send the header ``Pragma: nocache``. Varnish ignores this header. You could easily add support for this header in VCL. In `vcl_backend_response`:: if (beresp.http.Pragma ~ "nocache") { set beresp.uncacheable = true; set beresp.ttl = 120s; # how long not to cache this url. } Authorization ~~~~~~~~~~~~~ If Varnish sees an 'Authorization' header it will pass the request. If this is not what you want you can unset the header. Overriding the time-to-live (TTL) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Sometimes your backend will misbehave. It might, depending on your setup, be easier to override the TTL in Varnish then to fix your somewhat cumbersome backend. You need VCL to identify the objects you want and then you set the 'beresp.ttl' to whatever you want:: sub vcl_backend_response { if (bereq.url ~ "^/legacy_broken_cms/") { set beresp.ttl = 5d; } } This example will set the TTL to 5 days for the old legacy stuff on your site. Forcing caching for certain requests and certain responses ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Since you still might have this cumbersome backend that isn't very friendly to work with you might want to override more stuff in Varnish. We recommend that you rely as much as you can on the default caching rules. It is perfectly easy to force Varnish to lookup an object in the cache but it isn't really recommended. Normalizing your namespace ~~~~~~~~~~~~~~~~~~~~~~~~~~ Some sites are accessed via lots of hostnames. http://www.varnish-software.com/, http://varnish-software.com/ and http://varnishsoftware.com/ all point at the same site. Since Varnish doesn't know they are the same, Varnish will cache different versions of every page for every hostname. You can mitigate this in your web server configuration by setting up redirects or by using the following VCL:: if (req.http.host ~ "(?i)^(www.)?varnish-?software.com") { set req.http.host = "varnish-software.com"; } .. _users-guide-vary: HTTP Vary --------- *HTTP Vary is not a trivial concept. It is by far the most misunderstood HTTP header.* A lot of the response headers tell the client something about the HTTP object being delivered. Clients can request different variants of a HTTP object, based on their preference. Their preferences might cover stuff like encoding or language. When a client prefers UK English this is indicated through ``Accept-Language: en-uk``. Caches need to keep these different variants apart and this is done through the HTTP response header 'Vary'. When a backend server issues a ``Vary: Accept-Language`` it tells Varnish that its needs to cache a separate version for every different Accept-Language that is coming from the clients. If two clients say they accept the languages "en-us, en-uk" and "da, de" respectively, Varnish will cache and serve two different versions of the page if the backend indicated that Varnish needs to vary on the 'Accept-Language' header. Please note that the headers that 'Vary' refer to need to match *exactly* for there to be a match. So Varnish will keep two copies of a page if one of them was created for "en-us, en-uk" and the other for "en-us,en-uk". Just the lack of a whitespace will force Varnish to cache another version. To achieve a high hitrate whilst using Vary is there therefore crucial to normalize the headers the backends varies on. Remember, just a difference in casing can force different cache entries. The following VCL code will normalize the 'Accept-Language' header to either "en", "de" or "fr", in this order of precedence:: if (req.http.Accept-Language) { if (req.http.Accept-Language ~ "en") { set req.http.Accept-Language = "en"; } elsif (req.http.Accept-Language ~ "de") { set req.http.Accept-Language = "de"; } elsif (req.http.Accept-Language ~ "fr") { set req.http.Accept-Language = "fr"; } else { # unknown language. Remove the accept-language header and # use the backend default. unset req.http.Accept-Language } } Vary parse errors ~~~~~~~~~~~~~~~~~ Varnish will return a "503 internal server error" page when it fails to parse the 'Vary' header, or if any of the client headers listed in the Vary header exceeds the limit of 65k characters. An 'SLT_Error' log entry is added in these cases. Pitfall - Vary: User-Agent ~~~~~~~~~~~~~~~~~~~~~~~~~~ Some applications or application servers send ``Vary: User-Agent`` along with their content. This instructs Varnish to cache a separate copy for every variation of 'User-Agent' there is and there are plenty. Even a single patchlevel of the same browser will generate at least 10 different 'User-Agent' headers based just on what operating system they are running. So if you *really* need to vary based on 'User-Agent' be sure to normalize the header or your hit rate will suffer badly. Use the above code as a template. varnish-4.1.1/doc/sphinx/users-guide/vcl-example-websockets.rst0000644000201500234410000000050312652366721021544 00000000000000 Adding WebSockets support ------------------------- WebSockets is a technology for creating a bidirectional stream-based channel over HTTP. To run WebSockets through Varnish you need to pipe it as follows:: sub vcl_recv { if (req.http.upgrade ~ "(?i)websocket") { return (pipe); } } varnish-4.1.1/doc/sphinx/users-guide/vcl-actions.rst0000644000201500234410000000236412652366721017411 00000000000000.. _user-guide-vcl_actions: actions ~~~~~~~ The most common actions to return are these: .. XXX:Maybe a bit more explanation here what is an action and how it is returned? benc *pass* When you return pass the request and subsequent response will be passed to and from the backend server. It won't be cached. `pass` can be returned from `vcl_recv`. *hash* When you return hash from `vcl_recv` you tell Varnish to deliver content from cache even if the request othervise indicates that the request should be passed. *pipe* .. XXX:What is pipe? benc Pipe can be returned from `vcl_recv` as well. Pipe short circuits the client and the backend connections and Varnish will just sit there and shuffle bytes back and forth. Varnish will not look at the data being send back and forth - so your logs will be incomplete. *deliver* Deliver the object to the client. Usually returned from `vcl_backend_response`. *restart* Restart processing of the request. You can restart the processing of the whole transaction. Changes to the `req` object are retained. *retry* Retry the request against the backend. This can be returned from `vcl_backend_response` or `vcl_backend_error` if you don't like the response that the backend delivered. varnish-4.1.1/doc/sphinx/users-guide/vcl-backends.rst0000644000201500234410000001447612652366721017532 00000000000000.. _users-guide-backend_servers: Backend servers --------------- 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 backends. Start your favorite text editor and open the relevant VCL file. Somewhere in the top there will be a section that looks a bit like this.:: # backend default { # .host = "127.0.0.1"; # .port = "8080"; # } We remove the comment markings in this text stanza making the it look like.:: backend default { .host = "127.0.0.1"; .port = "8080"; } Now, this piece of configuration defines a backend in Varnish called *default*. When Varnish needs to get content from this backend it will connect to port 8080 on localhost (127.0.0.1). Varnish can have several backends defined you can even join several backends together into clusters of backends for load balancing purposes. Multiple backends ----------------- At some point you might need Varnish to cache content from several servers. You might want Varnish to map all the URL into one single host or not. There are lot of options. Lets say we need to introduce a Java application into out PHP web site. Lets say our Java application should handle URL beginning with `/java/`. We manage to get the thing up and running on port 8000. Now, lets have a look at the `default.vcl`.:: backend default { .host = "127.0.0.1"; .port = "8080"; } We add a new backend.:: backend java { .host = "127.0.0.1"; .port = "8000"; } Now we need tell Varnish where to send the difference URL. Lets look at `vcl_recv`.:: sub vcl_recv { if (req.url ~ "^/java/") { set req.backend_hint = java; } else { set req.backend_hint = default; } } 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.http.User-agent ~ /mobile/) ..`` should do the trick. Backends and virtual hosts in Varnish ------------------------------------- Varnish fully supports virtual hosts. They might however work in a somewhat counter-intuitive fashion since they are never declared explicitly. You set up the routing of incoming HTTP requests in `vcl_recv`. If you want this routing to be done on the basis of virtual hosts you just need to inspect `req.http.host`. You can have something like this:: sub vcl_recv { if (req.http.host ~ "foo.com") { set req.backend_hint = foo; } elsif (req.http.host ~ "bar.com") { set req.backend_hint = bar; } } Note that the first regular expressions will match "foo.com", "www.foo.com", "zoop.foo.com" and any other host ending in "foo.com". In this example this is intentional but you might want it to be a bit more tight, maybe relying on the ``==`` operator in stead, like this:: sub vcl_recv { if (req.http.host == "foo.com" || req.http.host == "www.foo.com") { set req.backend_hint = foo; } } .. _users-guide-advanced_backend_servers-directors: Directors --------- You can also group several backend into a group of backends. These groups are called directors. This will give you increased performance and resilience. You can define several backends and group them together in a director. This requires you to load a VMOD, a Varnish module, and then to call certain actions in `vcl_init`.:: import directors; # load the directors backend server1 { .host = "192.168.0.10"; } backend server2 { .host = "192.168.0.10"; } sub vcl_init { new bar = directors.round_robin(); bar.add_backend(server1); bar.add_backend(server2); } sub vcl_recv { # send all traffic to the bar director: set req.backend_hint = bar.backend(); } This director is a round-robin director. This means the director will distribute the incoming requests on a round-robin basis. There is also a *random* director which distributes requests in a, you guessed it, random fashion. If that is not enough, you can also write your own director (see :ref:`ref-writing-a-director`). But what if one of your servers goes down? Can Varnish direct all the requests to the healthy server? Sure it can. This is where the Health Checks come into play. .. _users-guide-advanced_backend_servers-health: Health checks ------------- Lets set up a director with two backends and health checks. First let us define the backends:: backend server1 { .host = "server1.example.com"; .probe = { .url = "/"; .timeout = 1s; .interval = 5s; .window = 5; .threshold = 3; } } backend server2 { .host = "server2.example.com"; .probe = { .url = "/"; .timeout = 1s; .interval = 5s; .window = 5; .threshold = 3; } } What is new here is the ``probe``. In this example Varnish will check the health of each backend every 5 seconds, timing out after 1 second. Each poll will send a GET request to /. If 3 out of the last 5 polls succeeded the backend is considered healthy, otherwise it will be marked as sick. Refer to the :ref:`reference-vcl_probes` section in the :ref:`vcl(7)` documentation for more information. Now we define the 'director':: import directors; sub vcl_init { new vdir = directors.round_robin(); vdir.add_backend(server1); vdir.add_backend(server2); } You use this `vdir` director as a backend_hint for requests, just like you would with a simple backend. Varnish will not send traffic to hosts that are marked as unhealthy. Varnish can also serve stale content if all the backends are down. See :ref:`users-guide-handling_misbehaving_servers` for more information on how to enable this. Please note that Varnish will keep health probes running for all loaded VCLs. Varnish will coalesce probes that seem identical - so be careful not to change the probe config if you do a lot of VCL loading. Unloading the VCL will discard the probes. For more information on how to do this please see ref:`reference-vcl-director`. varnish-4.1.1/doc/sphinx/users-guide/vcl.rst0000644000201500234410000000313012652366721015743 00000000000000 .. _users_vcl: VCL - Varnish Configuration Language ------------------------------------ This section covers how to tell Varnish how to handle your HTTP traffic, using the Varnish Configuration Language (VCL). Varnish has a great configuration system. Most other systems use configuration directives, where you basically turn on and off lots of switches. We have instead chosen to use a domain specific language called VCL for this. Every inbound request flows through Varnish and you can influence how the request is being handled by altering the VCL code. You can direct certain requests to particular backends, you can alter the requests and the responses or have Varnish take various actions depending on arbitrary properties of the request or the response. This makes Varnish an extremely powerful HTTP processor, not just for caching. Varnish translates VCL into binary code which is then executed when requests arrive. The performance impact of VCL is negligible. The VCL files are organized into subroutines. The different subroutines are executed at different times. One is executed when we get the request, another when files are fetched from the backend server. If you don't call an action in your subroutine and it reaches the end Varnish will execute some built-in VCL code. You will see this VCL code commented out in the file `builtin.vcl` that ships with Varnish Cache. .. _users-guide-vcl_fetch_actions: .. toctree:: :maxdepth: 1 vcl-syntax vcl-built-in-subs vcl-variables vcl-actions vcl-backends vcl-hashing vcl-grace vcl-inline-c vcl-examples devicedetection varnish-4.1.1/doc/sphinx/users-guide/vcl-syntax.rst0000644000201500234410000000530312652366721017273 00000000000000VCL Syntax ---------- VCL has inherited a lot from C and it reads much like simple C or Perl. Blocks are delimited by curly braces, statements end with semicolons, and comments may be written as in C, C++ or Perl according to your own preferences. Note that VCL doesn't contain any loops or jump statements. This section provides an outline of the more important parts of the syntax. For a full documentation of VCL syntax please see :ref:`vcl(7)` in the reference. Strings ~~~~~~~ Basic strings are enclosed in " ... ", and may not contain newlines. Backslash is not special, so for instance in `regsub()` you do not need to do the "count-the-backslashes" polka:: regsub("barf", "(b)(a)(r)(f)", "\4\3\2p") -> "frap" Long strings are enclosed in {" ... "}. They may contain any character including ", newline and other control characters except for the NUL (0x00) character. If you really want NUL characters in a string there is a VMOD that makes it possible to create such strings. .. _vcl_syntax_acl: Access control lists (ACLs) ~~~~~~~~~~~~~~~~~~~~~~~~~~~ An ACL declaration creates and initializes a named access control list which can later be used to match client addresses:: acl local { "localhost"; // myself "192.0.2.0"/24; // and everyone on the local network ! "192.0.2.23"; // except for the dialin router } If an ACL entry specifies a host name which Varnish is unable to resolve, it will match any address it is compared to. Consequently, if it is preceded by a negation mark, it will reject any address it is compared to, which may not be what you intended. If the entry is enclosed in parentheses, however, it will simply be ignored. To match an IP address against an ACL, simply use the match operator:: if (client.ip ~ local) { return (pipe); } Operators ~~~~~~~~~ The following operators are available in VCL. See the examples further down for, uhm, examples. = Assignment operator. == Comparison. ~ Match. Can either be used with regular expressions or ACLs. ! Negation. && Logical *and* || Logical *or* Subroutines ~~~~~~~~~~~ A subroutine is used to group code for legibility or reusability:: sub pipe_if_local { if (client.ip ~ local) { return (pipe); } } Subroutines in VCL do not take arguments, nor do they return values. To call a subroutine, use the call keyword followed by the subroutine's name:: call pipe_if_local; Varnish has quite a few built in subroutines that are called for each transaction as it flows through Varnish. These builtin subroutines are all named `vcl_*`. Your own subroutines cannot start their name with `vcl\_`. .. XXX:looks as bit funky as red text? benc varnish-4.1.1/doc/sphinx/users-guide/vcl-built-in-subs.rst0000644000201500234410000002572512652366721020454 00000000000000.. _vcl-built-in-subs: ==================== Built in subroutines ==================== Various built-in subroutines are called during processing of client- and backend requests as well as upon ``vcl.load`` and ``vcl.discard``. See :ref:`reference-states` for a defailed graphical overview of the states and how they relate to core code functions and VCL subroutines. ----------- client side ----------- .. _vcl_recv: vcl_recv ~~~~~~~~ Called at the beginning of a request, after the complete request has been received and parsed, after a `restart` or as the result of an ESI include. Its purpose is to decide whether or not to serve the request, possibly modify it and decide on how to process it further. A backend hint may be set as a default for the backend processing side. The `vcl_recv` subroutine may terminate with calling ``return()`` on one of the following keywords: ``hash`` Continue processing the object as a potential candidate for caching. Passes the control over to :ref:`vcl_hash`. ``pass`` Switch to pass mode. Control will eventually pass to :ref:`vcl_pass`. ``pipe`` Switch to pipe mode. Control will eventually pass to :ref:`vcl_pipe`. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. ``purge`` Purge the object and it's variants. Control passes through vcl_hash to vcl_purge. .. _vcl_pipe: vcl_pipe ~~~~~~~~ Called upon entering pipe mode. In this mode, the request is passed on to the backend, and any further data from both the client and backend is passed on unaltered until either end closes the connection. Basically, Varnish will degrade into a simple TCP proxy, shuffling bytes back and forth. For a connection in pipe mode, no other VCL subroutine will ever get called after `vcl_pipe`. The `vcl_pipe` subroutine may terminate with calling ``return()`` with one of the following keywords: ``pipe`` Proceed with pipe mode. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. .. _vcl_pass: vcl_pass ~~~~~~~~ Called upon entering pass mode. In this mode, the request is passed 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: ``fetch`` Proceed with pass mode - initiate a backend request. ``restart`` Restart the transaction. Increases the restart counter. If the number of restarts is higher than *max_restarts* Varnish emits a guru meditation error. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. .. _vcl_hit: vcl_hit ~~~~~~~ Called when a cache lookup is successful. The object being hit may be stale: It can have a zero or negative `ttl` with only `grace` or `keep` time left. The `vcl_hit` subroutine may terminate with calling ``return()`` with one of the following keywords: ``deliver`` Deliver the object. If it is stale, a background fetch to refresh it is triggered. ``miss`` Synchronously refresh the object from the backend despite the cache hit. Control will eventually pass to :ref:`vcl_miss`. ``pass`` Switch to pass mode. Control will eventually pass to :ref:`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 error. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. ``fetch`` (deprecated) same as ``miss``. Will get removed in a future version, triggers a VCL_Error log message. .. _vcl_miss: vcl_miss ~~~~~~~~ Called after a cache lookup if the requested document was not found in the cache or if :ref:`vcl_hit` returned ``fetch``. Its purpose is to decide whether or not to attempt to retrieve the document from the backend. A backend hint may be set as a default for the backend processing side. The `vcl_miss` subroutine may terminate with calling ``return()`` with one of the following keywords: ``fetch`` Retrieve the requested object from the backend. Control will eventually pass to `vcl_backend_fetch`. ``pass`` Switch to pass mode. Control will eventually pass to :ref:`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 error. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. .. XXX: #1603 hit should not go to miss .. _vcl_hash: vcl_hash ~~~~~~~~ Called after `vcl_recv` to create a hash value for the request. This is used as a key to look up the object in Varnish. The `vcl_hash` subroutine may only terminate with calling ``return(lookup)``: ``lookup`` Look up the object in cache. Control passes to :ref:`vcl_purge` when coming from a ``purge`` return in `vcl_recv`. Otherwise control passes to :ref:`vcl_hit`, :ref:`vcl_miss` or :ref:`vcl_pass` if the cache lookup result was a hit, a miss or hit on a hit-for-pass object (object with ``obj.uncacheable == true``), respectively. .. _vcl_purge: vcl_purge ~~~~~~~~~ Called after the purge has been executed and all its variants have been evited. The `vcl_purge` subroutine may terminate with calling ``return()`` with one of the following keywords: ``restart`` Restart the transaction. Increases the restart counter. If the number of restarts is higher than *max_restarts* Varnish emits a guru meditation error. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. .. _vcl_deliver: vcl_deliver ~~~~~~~~~~~ Called before any object except a `vcl_synth` result is delivered to the client. The `vcl_deliver` subroutine may terminate with calling ``return()`` with one of the following keywords: ``deliver`` 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 error. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. .. _vcl_synth: vcl_synth ~~~~~~~~~ Called to deliver a synthetic object. A synthetic object is generated in VCL, not fetched from the backend. Its body may be contructed using the ``synthetic()`` function. A `vcl_synth` defined object never enters the cache, contrary to a :ref:`vcl_backend_error` defined object, which may end up in cache. The subroutine may terminate with calling ``return()`` with one of the following keywords: ``deliver`` Directly deliver the object defined by `vcl_synth` to the client without calling `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 error. ------------ Backend Side ------------ .. _vcl_backend_fetch: vcl_backend_fetch ~~~~~~~~~~~~~~~~~ Called before sending the backend request. In this subroutine you typically alter the request before it gets to the backend. The `vcl_backend_fetch` subroutine may terminate with calling ``return()`` with one of the following keywords: ``fetch`` Fetch the object from the backend. ``abandon`` Abandon the backend request. Unless the backend request was a background fetch, control is passed to :ref:`vcl_synth` on the client side with ``resp.status`` preset to 503. .. _vcl_backend_response: vcl_backend_response ~~~~~~~~~~~~~~~~~~~~ Called after the response headers have been successfully retrieved from the backend. For a 304 response, varnish core code amends ``beresp`` before calling `vcl_backend_response`: * If the gzip status changed, ``Content-Encoding`` is unset and any ``Etag`` is weakened * Any headers not present in the 304 response are copied from the existing cache object. ``Content-Length`` is copied if present in the existing cache object and discarded otherwise. * The status gets set to 200. `beresp.was_304` marks that this conditional response processing has happened. Note: Backend conditional requests are independend of client conditional requests, so clients may receive 304 responses no matter if a backend request was conditional. The `vcl_backend_response` subroutine may terminate with calling ``return()`` with one of the following keywords: ``deliver`` For a 304 response, create an updated cache object. Otherwise, fetch the object body from the backend and initiate delivery to any waiting client requests, possibly in parallel (streaming). ``abandon`` Abandon the backend request. Unless the backend request was a background fetch, control is passed to :ref:`vcl_synth` on the client side with ``resp.status`` preset to 503. ``retry`` Retry the backend transaction. Increases the `retries` counter. If the number of retries is higher than *max_retries*, control will be passed to :ref:`vcl_backend_error`. .. _vcl_backend_error: vcl_backend_error ~~~~~~~~~~~~~~~~~ This subroutine is called if we fail the backend fetch or if *max_retries* has been exceeded. A synthetic object is generated in VCL, whose body may be contructed using the ``synthetic()`` function. The `vcl_backend_error` subroutine may terminate with calling ``return()`` with one of the following keywords: ``deliver`` Deliver and possibly cache the object defined in `vcl_backend_error` **as if it was fetched from the backend**, also referred to as a "backend synth". ``retry`` Retry the backend transaction. Increases the `retries` counter. If the number of retries is higher than *max_retries*, :ref:`vcl_synth` on the client side is called with ``resp.status`` preset to 503. ---------------------- vcl.load / vcl.discard ---------------------- .. _vcl_init: vcl_init ~~~~~~~~ Called when VCL is loaded, before any requests pass through it. Typically used to initialize VMODs. The `vcl_init` subroutine may terminate with calling ``return()`` with one of the following keywords: ``ok`` Normal return, VCL continues loading. ``fail`` Abort loading of this VCL. .. _vcl_fini: vcl_fini ~~~~~~~~ Called when VCL is discarded only after all requests have exited the VCL. Typically used to clean up VMODs. The `vcl_fini` subroutine may terminate with calling ``return()`` with one of the following keywords: ``ok`` Normal return, VCL will be discarded. varnish-4.1.1/doc/sphinx/users-guide/vcl-example-manipulating-responses.rst0000644000201500234410000000066612652366721024114 00000000000000 Altering the backend response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here we override the TTL of a object coming from the backend if it matches certain criteria:: sub vcl_backend_response { if (bereq.url ~ "\.(png|gif|jpg)$") { unset beresp.http.set-cookie; set beresp.ttl = 1h; } } We also remove any Set-Cookie headers in order to avoid a `hit-for-pass` object to be created. See :ref:`user-guide-vcl_actions`. varnish-4.1.1/doc/sphinx/users-guide/run_security.rst0000644000201500234410000001724412652366721017725 00000000000000.. _run_security: Security first ============== If you are the only person involved in running Varnish, or if all the people involved are trusted to the same degree, you can skip this chapter. We have protected Varnish as well as we can from anything which can come in through an HTTP socket. If parts of your web infrastructure are outsourced or otherwise partitioned along administrative lines, you need to think about security. Varnish provides four levels of authority, roughly related to how and where control comes into Varnish: * The command line arguments, * The CLI interface, * VCL programs, and * HTTP requests. Command line arguments ---------------------- The top level security decisions is decided and defined when starting Varnish in the form of command line arguments, we use this strategy in order to make them invulnerable to subsequent manipulation. The important decisions to make are: #. Who should have access to the Command Line Interface? #. Which parameters can they change? #. Will inline-C code be allowed? #. If/how VMODs will be restricted? #. How child processes will be jailed? CLI interface access ^^^^^^^^^^^^^^^^^^^^ The command line interface can be accessed in three ways. `varnishd` can be told to listen and offer CLI connections on a TCP socket. You can bind the socket to pretty much anything the kernel will accept:: -T 127.0.0.1:631 -T localhost:9999 -T 192.168.1.1:34 -T '[fe80::1]:8082' The default is ``-T localhost:0`` which will pick a random port number, which `varnishadm(8)` can learn from the shared memory. By using a "localhost" address, you restrict CLI access to the local machine. You can also bind the CLI port to an IP address reachable across the net, and let other machines connect directly. This gives you no secrecy, i.e. the CLI commands will go across the network as ASCII text with no encryption, but the -S/PSK authentication requires the remote end to know the shared secret. Alternatively you can bind the CLI port to a 'localhost' address, and give remote users access via a secure connection to the local machine, using ssh/VPN or similar. If you use `ssh` you can restrict which commands each user can execute to just `varnishadm`, or even use a wrapper scripts around `varnishadm` to 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. .. XXX:Maybe a sample command here with a brief explanation? benc The connection in this case is also without encryption, but the remote end must still authenticate using -S/PSK. Finally, if you run varnishd with the '-d' option, you get a CLI command on stdin/stdout, but since you started the process, it would be hard to prevent you getting CLI access, wouldn't it ? CLI interface authentication ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ By default the CLI interface is protected with a simple, yet powerful "Pre Shared Key" authentication method, which do not provide secrecy (ie: The CLI commands and responses are not encrypted). The way -S/PSK works is really simple: During startup a file is created with a random content and the file is only accessible to the user who started `varnishd` (or the superuser). To authenticate and use a CLI connection, you need to know the contents of that file, in order to answer the cryptographic challenge `varnishd` issues, see :ref:`ref_psk_auth`. `varnishadm` uses all of this to restrict access, it will only function, provided it can read the secret file. If you want to allow other users, local or remote, to be able to access CLI connections, you must create your own secret file and make it possible for (only!) these users to read it. A good way to create the secret file is:: dd if=/dev/random of=/etc/varnish_secret count=1 When you start `varnishd`, you specify the filename with '-S', and it goes without saying that the `varnishd` master process needs to be able to read the file too. You can change the contents of the secret file while `varnishd` runs, it is read every time a CLI connection is authenticated. On the local system, `varnishadm` can retrieve the filename from shared memory, but on remote systems, you need to give `varnishadm` a copy of the secret file, with the -S argument. If you want to disable -S/PSK authentication, specify '-S' with an empty argument to varnishd:: varnishd [...] -S "" [...] Parameters ^^^^^^^^^^ Parameters can be set from the command line, and made "read-only" (using '-r') so they cannot subsequently be modified from the CLI interface. Pretty much any parameter can be used to totally mess up your HTTP service, but a few can do more damage than others: :ref:`ref_param_cc_command` Execute arbitrary programs :ref:`ref_param_vcc_allow_inline_c` Allow inline C in VCL, which would any C code from VCL to be executed by Varnish. Furthermore you may want to look at and lock down: :ref:`ref_param_syslog_cli_traffic` Log all CLI commands to `syslog(8)`, so you know what goes on. :ref:`ref_param_vcc_unsafe_path` Restrict VCL/VMODS to :ref:`ref_param_vcl_dir` and :ref:`ref_param_vmod_dir` :ref:`ref_param_vmod_dir` The directory where Varnish will will look for modules. This could potentially be used to load rouge modules into Varnish. The CLI interface ----------------- The CLI interface in Varnish is very powerful, if you have access to the CLI interface, you can do almost anything to the Varnish process. As described above, some of the damage can be limited by restricting certain parameters, but that will only protect the local filesystem, and operating system, it will not protect your HTTP service. We do not currently have a way to restrict specific CLI commands to specific CLI connections. One way to get such an effect is to "wrap" all CLI access in pre-approved scripts which use `varnishadm(1)` to submit the sanitized CLI commands, and restrict a remote user to only those scripts, for instance using sshd(8)'s configuration. VCL programs ------------ There are two "dangerous" mechanisms available in VCL code: VMODs and inline-C. Both of these mechanisms allow execution of arbitrary code and will thus allow a person to get access to the machine, with the privileges of the child process. If `varnishd` is started as root/superuser, we sandbox the child process, using whatever facilities are available on the operating system, but if `varnishd` is not started as root/superuser, this is not possible. No, don't ask me why you have to be superuser to lower the privilege of a child process... Inline-C is disabled by default starting with Varnish version 4, so unless you enable it, you don't have to worry about it. The parameters mentioned above can restrict the loading of VMODs to only be loaded from a designated directory, restricting VCL wranglers to a pre-approved subset of VMODs. If you do that, we are confident that your local system cannot be compromised from VCL code. HTTP requests ------------- We have gone to great lengths to make Varnish resistant to anything coming in through the socket where HTTP requests are received, and you should, generally speaking, not need to protect it any further. The caveat is that since VCL is a programming language which lets you decide exactly what to do with HTTP requests, you can also decide to do stupid and potentially dangerous things with them, including opening yourself up to various kinds of attacks and subversive activities. 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 :ref:`vcl_syntax_acl`. varnish-4.1.1/doc/sphinx/users-guide/vcl-examples.rst0000644000201500234410000000040612652366721017562 00000000000000 VCL Examples ------------ These are a short collection of examples that showcase some of the capabilities of the VCL language. .. toctree:: vcl-example-manipulating-headers vcl-example-manipulating-responses vcl-example-acls vcl-example-websockets varnish-4.1.1/doc/sphinx/users-guide/command-line.rst0000644000201500234410000000554012652366721017531 00000000000000.. _users-guide-command-line: Important command line arguments -------------------------------- There a two command line arguments you have to set when starting Varnish, these are: * what TCP port to serve HTTP from, and * where the backend server can be contacted. If you have installed Varnish through using a provided operating system bound package, you will find the startup options here: * Debian, Ubuntu: `/etc/default/varnish` * Red Hat, Centos: `/etc/sysconfig/varnish` * FreeBSD: `/etc/rc.conf` (See also: /usr/local/etc/rc.d/varnishd) '-a' *listen_address* ^^^^^^^^^^^^^^^^^^^^^ The '-a' argument defines what address Varnish should listen to, and service HTTP requests from. 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 to open and service as many of them as possible, but if none of them can be opened, `varnishd` will not start. Here are some examples:: -a :80 -a localhost:80 -a 192.168.1.100:8080 -a '[fe80::1]:80' -a '0.0.0.0:8080,[::]:8081' .. XXX:brief explanation of some of the more complex examples perhaps? benc If your webserver runs on the same machine, you will have to move it to another port number first. '-f' *VCL-file* or '-b' *backend* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Varnish needs to know where to find the HTTP server it is caching for. You can either specify it with the '-b' argument, or you can put it in your own VCL file, specified with the '-f' argument. Using '-b' is a quick way to get started:: -b localhost:81 -b thatotherserver.example.com:80 -b 192.168.1.2:80 Notice that if you specify a name, it can at most resolve to one IPv4 *and* one IPv6 address. If you go with '-f', you can start with a VCL file containing just:: backend default { .host = "localhost:81"; } which is exactly what '-b' does. .. XXX:What happens if I start with -b and then have the backend defined in my VCL? benc In both cases the built-in VCL code is appended. Other options ^^^^^^^^^^^^^ Varnish comes with an abundance of useful command line arguments. We recommend that you study them but not necessary use them all, but to get started, the above will be sufficient. By default Varnish will use 100 megabytes of malloc(3) storage for caching objects, if you want to cache more than that, you should look at the '-s' argument. .. XXX: 3? benc If you run a really big site, you may want to tune the number of worker threads and other parameters with the '-p' argument, but we generally advice not to do that unless you need to. Before you go into production, you may also want to revisit the chapter :ref:`run_security` to see if you need to partition administrative privileges. For a complete list of the command line parameters please see :ref:`ref-varnishd-options`. varnish-4.1.1/doc/sphinx/users-guide/running.rst0000644000201500234410000000070012652366721016637 00000000000000.. _users_running: Starting and running Varnish ============================ This section covers starting, running, and stopping Varnish, command line flags and options, and communicating with the running Varnish processes, configuring storage and sockets and, and about securing and protecting Varnish against attacks. .. toctree:: :maxdepth: 2 run_security command-line run_cli storage-backends params sizing-your-cache varnish-4.1.1/doc/sphinx/whats-new/0000755000201500234410000000000012652366721014171 500000000000000varnish-4.1.1/doc/sphinx/whats-new/index.rst0000644000201500234410000000107412652366721015754 00000000000000.. _whats-new-index: %%%%%%%%%%%%%%%%%%%%%%%%%% What's new in Varnish 4.1 %%%%%%%%%%%%%%%%%%%%%%%%%% This section describes the changes that have been made for Varnish 4.1. The first subsection describes overarching changes that have gone into Varnish 4.0, while the second subsection describes changes you need to make to your current configuration if you come from Varnish 3.x. The text also considers changes in behaviour that you need to be aware of and take into consideration when upgrading. .. toctree:: :maxdepth: 2 changes upgrading upgrade-4.0 varnish-4.1.1/doc/sphinx/whats-new/upgrading.rst0000644000201500234410000000365612652366721016635 00000000000000.. _whatsnew_upgrade41: %%%%%%%%%%%%%%%%%%%%%%%% Upgrading to Varnish 4.1 %%%%%%%%%%%%%%%%%%%%%%%% Changes to VCL ============== Data type conversion functions now take a fallback ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Data type conversion functions in the std vmod now takes an additional argument *fallback*, which is returned if the conversion does not succeed. Version statement is kept ~~~~~~~~~~~~~~~~~~~~~~~~~ The VCL syntax has not chanced significantly, and as such the Varnish 4.0 version marker is kept for Varnish 4.1. One of the initial lines in a Varnish 4.1 VCL should read:: vcl 4.0; Remote address accessors ~~~~~~~~~~~~~~~~~~~~~~~~ New in 4.1 is the `local.ip` and `remote.ip` representing the (local) TCP connection endpoints. With PROXY listeners the `server.ip` and `client.ip` are set from the PROXY preamble. On normal HTTP listeners the behaviour is unchanged. Management interface ==================== The management interface enabled with ``-M`` previously supported the telnet protocol. Support for telnet control sequences have been retired. Replacement clients like netcat or (preferred) ``varnishadm`` should be used instead. Runtime users and groups ======================== With the new jail support, an additional runtime user (`vcache`) should be used for the Varnish worker child process. Additionally, the ``varnishlog``, ``varnishncsa`` and other Varnish shared log utilities must now be run in a context with `varnish` group membership. Changes to parameters ===================== `vcl_cooldown` is new, and decides how long time a VCL is kept warm after being replaced as the active VCL. The following parameters have been retired: * `group` (security revamp) * `group_cc` (security revamp) * `listen_address` (security revamp) * `pool_vbc` * `timeout_req` - merged with `timeout_idle`. * `user` (security revamp) Minor changes of default values on `workspace_session` and `vsl_mask`. varnish-4.1.1/doc/sphinx/whats-new/upgrade-4.0.rst0000644000201500234410000001567612652366721016610 00000000000000.. _whatsnew_upgrading: %%%%%%%%%%%%%%%%%%%%%%%% Upgrading to Varnish 4.0 %%%%%%%%%%%%%%%%%%%%%%%% Changes to VCL ============== The backend fetch parts of VCL have changed in Varnish 4. We've tried to compile a list of changes needed to upgrade here. 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:: vcl 4.0; req.request is now req.method ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To align better with RFC naming, `req.request` has been renamed to `req.method`. vcl_fetch is now vcl_backend_response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Directors have been moved to the vmod_directors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To make directors (backend selection logic) easier to extend, the directors are now defined in loadable VMODs. Setting a backend for future fetches in `vcl_recv` is now done as follows:: sub vcl_init { new cluster1 = directors.round_robin(); cluster1.add_backend(b1, 1.0); cluster1.add_backend(b2, 1.0); } sub vcl_recv { set req.backend_hint = cluster1.backend(); } Note the extra `.backend()` needed after the director name. Use the hash director as a client director ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Since the client director was already a special case of the hash director, it has been removed, and you should use the hash director directly:: sub vcl_init { new h = directors.hash(); h.add_backend(b1, 1); h.add_backend(b2, 1); } sub vcl_recv { set req.backend_hint = h.backend(client.identity); } vcl_error is now vcl_backend_error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To make a distinction between internally generated errors and VCL synthetic responses, `vcl_backend_error` will be called when varnish encounters an error when trying to fetch an object. error() is now synth() ~~~~~~~~~~~~~~~~~~~~~~ And you must explicitly return it:: return (synth(999, "Response")); Synthetic responses in vcl_synth ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Setting headers on synthetic response bodies made in vcl_synth are now done on resp.http instead of obj.http. The synthetic keyword is now a function:: if (resp.status == 799) { set resp.status = 200; set resp.http.Content-Type = "text/plain; charset=utf-8"; synthetic("You are " + client.ip); return (deliver); } obj in vcl_error replaced by beresp in vcl_backend_error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To better represent a the context in which it is called, you should now use `beresp.*` vcl_backend_error, where you used to use `obj.*` in `vcl_error`. hit_for_pass objects are created using beresp.uncacheable ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Example:: sub vcl_backend_response { if (beresp.http.X-No-Cache) { set beresp.uncacheable = true; set beresp.ttl = 120s; return (deliver); } } req.* not available in vcl_backend_response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ req.* used to be available in `vcl_fetch`, but after the split of functionality, you only have 'bereq.*' in `vcl_backend_response`. vcl_* reserved ~~~~~~~~~~~~~~ Any custom-made subs cannot be named 'vcl_*' anymore. This namespace is reserved for builtin subs. req.backend.healthy replaced by std.healthy(req.backend_hint) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Remember to import the std module if you're not doing so already. client.port, and server.port replaced by respectively std.port(client.ip) and std.port(server.ip) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `client.ip` and `server.ip` are now proper data types, which renders as an IP address by default. You need to use the `std.port()` function to get the port number. Invalidation with purge ~~~~~~~~~~~~~~~~~~~~~~~ Cache invalidation with purges is now done via `return(purge)` from `vcl_recv`. The `purge;` keyword has been retired. obj is now read-only ~~~~~~~~~~~~~~~~~~~~ `obj` is now read-only. `obj.last_use` has been retired. Some return values have been replaced ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Apart from the new `synth` return value described above, the following has changed: - `vcl_recv` must now return `hash` instead of `lookup` - `vcl_hash` must now return `lookup` instead of `hash` - `vcl_pass` must now return `fetch` instead of `pass` Backend restarts are now retry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In 3.0 it was possible to do `return(restart)` after noticing that the backend response was wrong, to change to a different backend. This is now called `return(retry)`, and jumps back up to `vcl_backend_fetch`. This only influences the backend fetch thread, client-side handling is not affected. default/builtin VCL changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The VCL code that is appended to user-configured VCL automatically is now called the builtin VCL. (previously default.vcl) The builtin VCL now honors Cache-Control: no-cache (and friends) to indicate uncacheable content from the backend. The `remove` keyword is gone ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Replaced by `unset`. X-Forwarded-For is now set before vcl_recv ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In many cases, people unintentionally removed X-Forwarded-For when implementing their own vcl_recv. Therefore it has been moved to before vcl_recv, so if you don't want an IP added to it, you should remove it in vcl_recv. Changes to existing parameters ============================== session_linger ~~~~~~~~~~~~~~ `session_linger` has been renamed to `timeout_linger` and it is in seconds now (previously was milliseconds). sess_timeout ~~~~~~~~~~~~ `sess_timeout` has been renamed to `timeout_idle`. sess_workspace ~~~~~~~~~~~~~~ In 3.0 it was often necessary to increase `sess_workspace` if a lot of VMODs, complex header operations or ESI were in use. This is no longer necessary, because ESI scratch space happens elsewhere in 4.0. If you are using a lot of VMODs, you may need to increase either `workspace_backend` and `workspace_client` based on where your VMOD is doing its work. thread_pool_purge_delay ~~~~~~~~~~~~~~~~~~~~~~~ `thread_pool_purge_delay` has been renamed to `thread_pool_destroy_delay` and it is in seconds now (previously was milliseconds). thread_pool_add_delay and thread_pool_fail_delay ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ They are in seconds now (previously were milliseconds). New parameters since 3.0 ======================== vcc_allow_inline_c ~~~~~~~~~~~~~~~~~~ You can now completely disable inline C in your VCL, and it is disabled by default. Other changes ============= New log filtering ~~~~~~~~~~~~~~~~~ The logging framework has a new filtering language, which means that the -m switch has been replaced with a new -q switch. See :ref:`vsl-query(7)` for more information about the new query language. varnish-4.1.1/doc/sphinx/whats-new/changes.rst0000644000201500234410000001245412652366721016261 00000000000000.. _whatsnew_changes: Changes in Varnish 4.1 ====================== Varnish 4.1 is the continuation of the new streaming architecture seen in Varnish 4.0. Proactive security features =========================== New in 4.1 is support for different kinds of privilege separation methods, collectively described as jails. On most systems, the Varnish parent process will now drop effective privileges to normal user mode when not doing operations needing special access. The Varnish worker child should now be run as a separate `vcache` user. ``varnishlog``, ``varnishncsa`` and other Varnish shared log utilities now must be run in a context with `varnish` group membership. Warm and cold VCL configurations ================================ Traditionally Varnish have had the concept of active and inactive loaded VCLs. Any loaded VCL lead to state being kept, and a separate set of health checks (if configured) were being run against the backends. To avoid the extra state and backend polling, a loaded VCL is now either warm or cold. Runtime state (incl. backend counters) and health checks are not present for cold VCLs. A warm VCL will automatically be set to cold after `vcl_cooldown` seconds. Output from `vcl.list`:: varnish> vcl.list 200 available auto/warm 0 boot available auto/warm 0 62f5275f-a937-4df9-9fbb-c12336bdfdb8 A single VCL's state can be changed with the `vcl.state` call in ``varnishadm``:: vcl.state Force the state of the specified configuration. State is any of auto, warm or cold values. Example:: varnish> vcl.state 62f5275f-a937-4df9-9fbb-c12336bdfdb8 cold 200 varnish> vcl.list 200 available auto/warm 0 boot available auto/cold 0 62f5275f-a937-4df9-9fbb-c12336bdfdb8 VMOD writers should read up on the new vcl_event system to release unnecessary state when a VCL is transitioned to cold (see :ref:`ref-vmod-event-functions`). PROXY protocol support ====================== Socket support for PROXY protocol connections has been added. PROXY defines a short preamble on the TCP connection where (usually) a SSL/TLS terminating proxy can signal the real client address. The ``-a`` startup argument syntax has been expanded to allow for this:: $ varnishd -f /etc/varnish/default.vcl -a :6081 -a 127.0.0.1:6086,PROXY Both PROXY1 and PROXY2 protocols are supported on the resulting listening socket. For connections coming in over a PROXY socket, ``client.ip`` and ``server.ip`` will contain the addresses given to Varnish in the PROXY header/preamble (the "real" IPs). The new VCL variables ``remote.ip`` and ``local.ip`` contains the local TCP connection endpoints. On non-PROXY connections these will be identical to ``client.ip`` and ``server.ip``. An expected pattern following this is `if (std.port(local.ip) == 80) { }` in ``vcl_recv`` to see if traffic came in over the HTTP listening socket (so a client redirect to HTTPS can be served). VMOD backends ============= Before Varnish 4.1, backends could only be declared in native VCL. Varnish 4.0 moved directors from VCL to VMODs, and VMODs can now also create backends. It is possible to both create the same backends than VCL but dynamically, or create backends that don't necessarily speak HTTP/1 over TCP to fetch resources. More details in the :ref:`ref-writing-a-director` documentation. Backend connection timeout ========================== Backend connections will now be closed by Varnish after `backend_idle_timeout` seconds of inactivity. Previously they were kept around forever and the backend servers would close the connection without Varnish noticing it. On the next traffic spike needing these extra backend connections, the request would fail, perhaps multiple times, before a working backend connection was found/created. Protocol support ================ Support for HTTP/0.9 on the client side has been retired. More modules available ====================== Varnish has an ecosystem for third-party modules (vmods). New since the last release, these are worth knowing about: libvmod-saintmode: Saint mode ("inferred health probes from traffic") was taken out of Varnish core in 4.0, and is now back as a separate vmod. This is useful for detecting failing backends before the health probes pick it up. libvmod-xkey: Secondary hash keys for cache objects, based on the hashtwo vmod written by Varnish Software. Allows for arbitrary grouping of objects to be purged in one go, avoiding use of ban invalidation. Also known as Cache Keys or Surrogate Key support. libvmod-rtstatus: Real time statistics dashboard. Passing data between ESI requests ================================= A new `req_top` identifier is available in VCL, which is a reference to `req` in the top-level ESI request. This is useful to pass data back and forth between the main ESI request and any ESI sub-requests it leads to. Other noteworthy small changes ============================== * Varnish will now use the ``stale-while-revalidate`` defined in RFC5861 to set object grace time. * -smalloc storage is now recommended over -sfile on Linux systems. * New VCL variable ``beresp.was_304`` has been introduced in ``vcl_backend_response``. Will be set to ``true`` if the response from the backend was a positive result of a conditional fetch (``304 Not Modified``). varnish-4.1.1/doc/sphinx/installation/0000755000201500234410000000000012652366721014755 500000000000000varnish-4.1.1/doc/sphinx/installation/platformnotes.rst0000644000201500234410000000452512652366721020332 00000000000000 Platform specific notes ------------------------ On some platforms it is necessary to adjust the operating system before running Varnish on it. The systems and steps known to us are described in this section. Transparent hugepages on Redhat Enterprise Linux 6 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On RHEL6 Transparent Hugepage kernel support is enabled by default. This is known to cause sporadic crashes of Varnish. It is recommended to disable transparent hugepages on affected systems. This can be done with ``echo "never" > /sys/kernel/mm/redhat_transparent_hugepage/enabled`` (runtime) and changes to `/etc/sysctl.conf` (persisted.) On Debian/Ubuntu systems running 3.2 kernels the default value is "madvise" and does not need to be changed. OpenVZ ~~~~~~ It is possible, but not recommended for high performance, to run Varnish on virtualised hardware. Reduced disk and network -performance will reduce the performance a bit so make sure your system has good IO performance. If you are running on 64bit OpenVZ (or Parallels VPS), you must reduce the maximum stack size before starting Varnish. The default allocates too much memory per thread, which will make Varnish fail as soon as the number of threads (traffic) increases. Reduce the maximum stack size by adding ``ulimit -s 256`` before starting Varnish in the init script. TCP keep-alive configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On some Solaris, FreeBSD and OS X systems, Varnish is not able to set the TCP keep-alive values per socket, and therefore the *tcp_keepalive_* Varnish runtime parameters are not available. On these platforms it can be beneficial to tune the system wide values for these in order to more reliably detect remote close for sessions spending long time on waitinglists. This will help free up resources faster. Systems that does not support TCP keep-alive values per socket include: - Solaris releases prior to version 11 - FreeBSD releases prior to version 9.1 - OS X releases prior to Mountain Lion On platforms with the necessary socket options the defaults are set to: - `tcp_keepalive_time` = 600 seconds - `tcp_keepalive_probes` = 5 - `tcp_keepalive_intvl` = 5 seconds Note that Varnish will only apply these run-time parameters so long as they are less than the system default value. .. XXX:Maybe a sample-command of using/setting/changing these values? benc varnish-4.1.1/doc/sphinx/installation/help.rst0000644000201500234410000001014612652366721016361 00000000000000%%%%%%%%%%%% Getting help %%%%%%%%%%%% Getting hold of the gang behind Varnish is pretty straight forward, we try to help out as much as time permits and have tried to streamline this process as much as possible. But before you grab hold of us, spend a moment composing your thoughts and formulate your question. From our perspective there is nothing as pointless as simply telling us "Varnish does not work for me" with no further information. This does not give us any relevant information to use when trying to figure out whats wrong. And before you even do that, do a couple of searches to see if your question is already answered, if it has been, you will get your answer much faster that way. IRC Channel =========== The most immediate way to get hold of us is to join our IRC channel: `#varnish on server irc.linpro.no` The main timezone of the channel is Europe work hours. If you can explain your problem in a few clear sentences, without too much copy&paste, IRC is a good way to try to get help. If you do need to paste log files, VCL and so on, please use a pastebin_ service. If the channel is all quiet, try again some time later, we do have lives, families and jobs to deal with also. You are more than welcome to just hang out, and while we don't mind the occasional intrusion from the real world into our flow, we try and keep it mostly on topic, and please don't paste random links unless they are *really* spectacular and intelligent. Mailing Lists ============= Subscribing or unsubscribing to our mailing lists is handled through mailman_. If you are going to use Varnish, subscribing to our `varnish-announce` mailing list is a very good idea. The typical pattern is that people spend some time getting Varnish running, and then more or less forget about it. Therefore the announce list is a good way to be reminded about new releases, bugs or potential (security) vulnerabilities. The `varnish-misc` mailing list is for general banter, questions, suggestions, ideas and so on. If you are new to Varnish it may pay off to subscribe to it, simply to have an ear to the telegraph-pole and potentially learn some smart tricks. This is also a good place to ask for help with more complex issues, that may require file-chunks, references to files and/or long explanations. Make sure to pick a good subject line, and if the subject of the thread changes, please change the subject to match, some of us deal with hundreds of emails per day, after spam-filters, and we need all the help we can get to pick the interesting ones. The `varnish-dev` mailing list is used by the developers and is usually quite focused on source-code and such. Everybody on the `-dev` list is also on `-misc`, so cross-posting only serves to annoy those people. We also maintain a community wiki_ for Varnish, there you will find information on planned events, meetings, current backlog, trouble tickets , and links to resources and documentation. .. XXX: we should introduce the wiki (if we care about it) before .. we start referring to it (below). Make a wiki chapter? Trouble Tickets =============== Please do not open a trouble ticket, unless you have spotted an actual bug in Varnish. Ask on IRC first if you are in doubt. The reason for this policy, is to avoid bugs being drowned in a pile of other `issues`, feature suggestions for future releases, and double postings of calls for help from people who forgot to check back on already opened Tickets. .. XXX: Not sure what you want with the last sentence above. benc We instead track suggestions and feature ideas in our `"Future_Feature" wiki page`_, and through user support via email and IRC. Commercial Support ================== The following companies offer commercial Varnish support, and are listed here for your convenience. If you want your company listed here, drop an email to phk@FreeBSD.org. Varnish Software sales@varnish-software.com UPLEX info@uplex.de .. _mailman: https://www.varnish-cache.org/lists/mailman/listinfo .. _pastebin: https://gist.github.com/ .. _"Future_Feature" wiki page: https://www.varnish-cache.org/trac/wiki/Future_Feature .. _wiki: https://www.varnish-cache.org/trac varnish-4.1.1/doc/sphinx/installation/bugs.rst0000644000201500234410000001366212652366721016377 00000000000000%%%%%%%%%%%%%% Reporting bugs %%%%%%%%%%%%%% Varnish can be a tricky beast to debug, having potentially thousands of threads crowding into a few data structures makes for *interesting* core dumps. Actually, let me rephrase that without irony: You tire of the "no, not thread 438 either, lets look at 439 then..." routine really fast. So if you run into a bug, it is important that you spend a little bit of time collecting the right information, to help us fix the bug. The most valuable information you can give us, is **always** how to trigger and reproduce the problem. If you can tell us that, we rarely need anything else to solve it.The caveat being, that we do not have a way to simulate high levels of real-life web-traffic, so telling us to "have 10.000 clients hit at once" does not really allow us to reproduce. To report a bug please follow the suggested procedure described in the "Trouble Tickets" section of the documentation (above). Roughly we categorize bugs in to three kinds of bugs (described below) with Varnish. The information we need to debug them depends on what kind of bug we are facing. Varnish crashes =============== Plain and simple: **boom** Varnish is split over two processes, the manager and the child. The child does all the work, and the manager hangs around to resurrect it if it crashes. Therefore, the first thing to do if you see a Varnish crash, is to examine your syslogs to see if it has happened before. (One site is rumoured to have had Varnish restarting every 10 minutes and *still* provide better service than their CMS system.) When it crashes, which is highly unlikely to begin with, Varnish will spew out a crash dump that looks something like:: Child (32619) died signal=6 (core dumped) Child (32619) Panic message: Assert error in ccf_panic(), cache_cli.c line 153: Condition(!strcmp("", "You asked for it")) not true. errno = 9 (Bad file descriptor) thread = (cache-main) ident = FreeBSD,9.0-CURRENT,amd64,-sfile,-hcritbit,kqueue Backtrace: 0x42bce1: pan_ic+171 0x4196af: ccf_panic+4f 0x8006b3ef2: _end+80013339a 0x8006b4307: _end+8001337af 0x8006b8b76: _end+80013801e 0x8006b8d84: _end+80013822c 0x8006b51c1: _end+800134669 0x4193f6: CLI_Run+86 0x429f8b: child_main+14b 0x43ef68: start_child+3f8 [...] If you can get that information to us, we are usually able to see exactly where things went haywire, and that speeds up bugfixing a lot. There will be a lot more information in the crash dump besides this, and before sending it all to us, you should obscure any sensitive/secret data/cookies/passwords/ip# etc. Please make sure to keep context when you do so, ie: do not change all the IP# to "X.X.X.X", but change each IP# to something unique, otherwise we are likely to be more confused than informed. The most important line is the "Panic Message", which comes in two general forms: "Missing errorhandling code in ..." This is a situation where we can conceive Varnish ending up, which we have not (yet) written the padded-box error handling code for. The most likely cause here, is that you need a larger workspace for HTTP headers and Cookies. Please try that before reporting a bug. "Assert error in ..." This is something bad that should never happen, and a bug report is almost certainly in order. As always, if in doubt ask us on IRC before opening the ticket. .. (TODO: in the ws-size note above, mention which params to tweak) In your syslog it may all be joined into one single line, but if you can reproduce the crash, do so while running :ref:`varnishd(1)` manually: ``varnishd -d |& tee /tmp/_catch_bug`` That will get you the entire panic message into a file. (Remember to type ``start`` to launch the worker process, that is not automatic when ``-d`` is used.) Varnish goes on vacation ======================== This kind of bug is nasty to debug, because usually people tend to kill the process and send us an email saying "Varnish hung, I restarted it" which gives us only about 1.01 bit of usable debug information to work with. What we need here is all the information you can squeeze out of your operating system **before** you kill the Varnish process. One of the most valuable bits of information, is if all Varnish' threads are waiting for something or if one of them is spinning furiously on some futile condition. Commands like ``top -H`` or ``ps -Haxlw`` or ``ps -efH`` should be able to figure that out. .. XXX:Maybe a short description of what valuable information the various commands above generates? /benc If one or more threads are spinning, use ``strace`` or ``ktrace`` or ``truss`` (or whatever else your OS provides) to get a trace of which system calls the Varnish process issues. Be aware that this may generate a lot of very repetitive data, usually one second worth of data is more than enough. Also, run :ref:`varnishlog(1)` for a second, and collect the output for us, and if :ref:`varnishstat(1)` shows any activity, capture that also. When you have done this, kill the Varnish *child* process, and let the *master* process restart it. Remember to tell us if that does or does not work. If it does not, kill all Varnish processes, and start from scratch. If that does not work either, tell us, that means that we have wedged your kernel. Varnish does something wrong ============================ These are the easy bugs: usually all we need from you is the relevant transactions recorded with :ref:`varnishlog(1)` and your explanation of what is wrong about what Varnish does. Be aware, that often Varnish does exactly what you asked it to, rather than what you intended it to do. If it sounds like a bug that would have tripped up everybody else, take a moment to read through your VCL and see if it really does what you think it does. You can also try setting the ``vcl_trace`` parameter, that will generate log records with like and character number for each statement executed in your VCL program. .. XXX:Example of the command perhaps? benc varnish-4.1.1/doc/sphinx/installation/index.rst0000644000201500234410000000066112652366721016541 00000000000000.. _install-index: Varnish Installation ==================== This section covers installation prerequisites, a step-by-step installation procedure, how and where to get help, and how to report bugs. It also contains a set of platform specific notes to aid you when installing Varnish on certain platforms. .. XXX: rewrite the last paragraph. .. toctree:: prerequisites.rst install.rst help.rst bugs.rst platformnotes.rst varnish-4.1.1/doc/sphinx/installation/install.rst0000644000201500234410000001136612652366721017104 00000000000000.. _install-doc: Installing Varnish ================== .. no section heading here. With open source software, you can choose to install binary packages or compile it yourself from source code. To install a package or compile from source is a matter of personal taste. If you don't know which method to choose, we recommend that you read this whole section and then choose the method you feel most comfortable with. Source or packages? ------------------- Installing Varnish on most relevant operating systems can usually be done with with the specific systems package manager, typical examples being: FreeBSD ------- Binary package: ``pkg_add -r varnish`` From source: ``cd /usr/ports/varnish && make install clean`` Red Hat / CentOS ---------------- We try to keep the latest version available as prebuilt RPMs (el5 and el6) on `repo.varnish-cache.org `_. See the online `Red Hat installation instructions `_ for more information. Varnish is included in the `EPEL `_ repository, however due to incompatible syntax changes in newer versions of Varnish, only older versions are available. We therefore recommend that you install the latest version directly from our repository, as described above. Debian/Ubuntu ------------- Varnish is distributed with both Debian and Ubuntu. In order to get Varnish up and running type ``sudo apt-get install varnish``. Please note that this might not be the latest version of Varnish. If you need a later version of Varnish, please follow the online installation instructions for `Debian `_ or `Ubuntu `_. Compiling Varnish from source ============================= If there are no binary packages available for your system, or if you want to compile Varnish from source for other reasons, follow these steps: Download the appropriate release tarball, which you can find on http://repo.varnish-cache.org/source/ . Alternatively, if you want to hack on Varnish, you should clone our git repository by doing. ``git clone git://git.varnish-cache.org/varnish-cache`` Build dependencies on Debian / Ubuntu -------------------------------------- In order to build Varnish from source you need a number of packages installed. On a Debian or Ubuntu system these are: .. grep-dctrl -n -sBuild-Depends -r ^ ../../../../varnish-cache-debian/control | tr -d '\n' | awk -F,\ '{ for (i = 0; ++i <= NF;) { sub (/ .*/, "", $i); print "* `" $i "`"; }}' | egrep -v '(debhelper)' * `automake` * `autotools-dev` * `libedit-dev` * `libjemalloc-dev` * `libncurses-dev` * `libpcre3-dev` * `libtool` * `pkg-config` * `python-docutils` * `python-sphinx` * `graphviz` Build dependencies on Red Hat / CentOS -------------------------------------- To build Varnish on a Red Hat or CentOS system you need the following packages installed: .. gawk '/^BuildRequires/ {print "* `" $2 "`"}' ../../../redhat/varnish.spec | sort | uniq | egrep -v '(systemd)' * `autoconf` * `automake` * `jemalloc-devel` * `libedit-devel` * `libtool` * `ncurses-devel` * `pcre-devel` * `pkgconfig` * `python-docutils` * `python-sphinx` * `graphviz` Compiling Varnish ----------------- The configuration will need the dependencies above satisfied. Once that is taken care of:: cd varnish-cache sh autogen.sh sh configure make The `configure` script takes some arguments, but more likely than not you can forget about that for now, almost everything in Varnish can be tweaked with run time parameters. Before you install, you may want to run the test suite, make a cup of tea while it runs, it usually takes a couple of minutes:: make check Don't worry if one or two tests fail, some of the tests are a bit too timing sensitive (Please tell us which so we can fix them.) but if a lot of them fails, and in particular if the `b00000.vtc` test fails, something is horribly wrong, and you will get nowhere without figuring out what. Installing ---------- And finally, the true test of a brave heart: ``sudo make install`` Varnish will now be installed in ``/usr/local``. The ``varnishd`` binary is in `/usr/local/sbin/varnishd`. To make sure that the necessary links and caches of the most recent shared libraries are found, run ``sudo ldconfig``. Next steps ========== After successful installation you are ready to proceed to the :ref:`tutorial-index`. This tutorial is written for installations from binary packages. In practice, it means that some configurations are not in place for installations from source code. For example, instead of calling ``service varnish start``, you start the varnish daemon manually by typing:: varnishd -a :6081 -T localhost:6082 -b localhost:8080 varnish-4.1.1/doc/sphinx/installation/prerequisites.rst0000644000201500234410000000110512652366721020330 00000000000000Prerequisites ============= In order for you to install Varnish you must have the following: * A recent, preferably server grade, computer. * A fairly modern and 64 bit version of either - Linux - FreeBSD, or - Solaris (x86 only). * Root access. Varnish can be installed on other UNIX systems as well, but it is not extensively or systematically tested by us on other systems than the above. Varnish is, from time to time, said to work on: * 32 bit versions of the before-mentioned systems, * OS X, * NetBSD, * OpenBSD, and * Windows with Cygwin. varnish-4.1.1/doc/sphinx/tutorial/0000755000201500234410000000000012652366721014117 500000000000000varnish-4.1.1/doc/sphinx/tutorial/starting_varnish.rst0000644000201500234410000000462412652366721020164 00000000000000.. _tutorial-starting_varnish: Starting Varnish ---------------- This tutorial will assume that you are running Varnish on Ubuntu, Debian, Red Hat Enterprise Linux or CentOS. Those of you running on other platforms might have to do some mental translation exercises in order to follow this. Since you're on a "weird" platform you're probably used to it. :-) Make sure you have Varnish successfully installed (following one of the procedures described in "Installing Varnish" above. When properly installed you start Varnish with ``service varnish start``. This will start Varnish if it isn't already running. .. XXX:What does it do if it is already running? benc Now you have Varnish running. Let us make sure that it works properly. Use your browser to go to http://127.0.0.1:6081/ (Replace the IP address with the IP for the machine that runs Varnish) The default configuration will try to forward requests to a web application running on the same machine as Varnish was installed on. Varnish expects the web application to be exposed over http on port 8080. If there is no web application being served up on that location Varnish will issue an error. Varnish Cache is very conservative about telling the world what is wrong so whenever something is amiss it will issue the same generic "Error 503 Service Unavailable". You might have a web application running on some other port or some other machine. Let's edit the configuration and make it point to something that actually works. Fire up your favorite editor and edit `/etc/varnish/default.vcl`. Most of it is commented out but there is some text that is not. It will probably look like this:: vcl 4.0; backend default { .host = "127.0.0.1"; .port = "8080"; } We'll change it and make it point to something that works. Hopefully http://www.varnish-cache.org/ is up. Let's use that. Replace the text with:: vcl 4.0; backend default { .host = "www.varnish-cache.org"; .port = "80"; } Now issue ``service varnish reload`` to make Varnish reload it's configuration. If that succeeded visit http://127.0.0.1:6081/ in your browser and you should see some directory listing. It works! The reason you're not seeing the Varnish official website is because your client isn't sending the appropriate `Host` header in the request and it ends up showing a listing of the default webfolder on the machine usually serving up http://www.varnish-cache.org/ . varnish-4.1.1/doc/sphinx/tutorial/backend_servers.rst0000644000201500234410000000277612652366721017745 00000000000000.. _tutorial-backend_servers: Backend servers --------------- Varnish has a concept of `backend` or origin servers. A backend server is the server providing the content Varnish will accelerate via the cache. Our first task is to tell Varnish where it can find its content. Start 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`. If you've been following the tutorial there is probably a section of the configuration that looks like this:: vcl 4.0; backend default { .host = "www.varnish-cache.org"; .port = "80"; } This means we set up a backend in Varnish that fetches content from 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 server. We've already bound Varnish to the public port 80 on the server so now we need to tie it to the origin. For this example, let's pretend the origin server is running on localhost, port 8080.:: vcl 4.0; backend default { .host = "127.0.0.1"; .port = "8080"; } Varnish can have several backends defined and can even join several backends together into clusters of backends for load balancing purposes, having Varnish pick one backend based on different algorithms. Next, let's have a look at some of what makes Varnish unique and what you can do with it. varnish-4.1.1/doc/sphinx/tutorial/now_what.rst0000644000201500234410000000047012652366721016420 00000000000000 ========= Now what? ========= You've read through the tutorial. You should have Varnish up and running. You should know about the logs and you should have a rough idea of what VCL is. Next, you might want to have a look at :ref:`users-guide-index`, where we go through the features of Varnish in more detail. varnish-4.1.1/doc/sphinx/tutorial/index.rst0000644000201500234410000000111412652366721015675 00000000000000.. _tutorial-index: The Varnish Tutorial ==================== This section covers the Varnish basics in a tutorial form. It will cover what Varnish is and how it works. It also covers how to get Varnish up and running. After this section you probably would want to continue with the users guide (:ref:`users-guide-index`). If you're reading this on the web note the "Next topic" and "Previous topic" links on the right side of each page. .. toctree:: :maxdepth: 1 introduction starting_varnish putting_varnish_on_port_80 backend_servers peculiarities.rst now_what varnish-4.1.1/doc/sphinx/tutorial/putting_varnish_on_port_80.rst0000644000201500234410000000221412652366721022063 00000000000000 Put Varnish on port 80 ---------------------- Until now we've been running with Varnish on a high port which is great for testing purposes. Let's now put Varnish on the default HTTP port 80. First we stop varnish: ``service varnish stop`` Now we need to edit the configuration file that starts Varnish. Debian/Ubuntu ~~~~~~~~~~~~~ On Debian/Ubuntu this is `/etc/default/varnish`. In the file you'll find some text that looks like this:: DAEMON_OPTS="-a :6081 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -s malloc,256m" Change it to:: DAEMON_OPTS="-a :80 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -s malloc,256m" Red Hat Enterprise Linux / CentOS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On Red Hat/CentOS you can find a similar configuration file in `/etc/sysconfig/varnish`. Restarting Varnish again ------------------------ Once the change is done, restart Varnish: ``service varnish start``. Now everyone accessing your site will be accessing through Varnish. varnish-4.1.1/doc/sphinx/tutorial/introduction.rst0000644000201500234410000000674212652366721017323 00000000000000.. _tutorial-intro: The fundamentals of web proxy caching with Varnish -------------------------------------------------- Varnish is a caching HTTP reverse proxy. It receives requests from clients and tries to answer them from the cache. If Varnish cannot answer the request from the cache it will forward the request to the backend, fetch the response, store it in the cache and deliver it to the client. When Varnish has a cached response ready it is typically delivered in a matter of microseconds, two orders of magnitude faster than your typical backend server, so you want to make sure to have Varnish answer as many of the requests as possible directly from the cache. Varnish decides whether it can store the content or not based on the response it gets back from the backend. The backend can instruct Varnish to cache the content with the HTTP response header `Cache-Control`. There are a few conditions where Varnish will not cache, the most common one being the use of cookies. Since cookies indicates a client-specific web object, Varnish will by default not cache it. This behaviour as most of Varnish functionality can be changed using policies written in the Varnish Configuration Language (VCL). See :ref:`users-guide-index` for more information on how to do that. Performance ~~~~~~~~~~~ Varnish has a modern architecture and is written with performance in mind. It is usually bound by the speed of the network, effectively turning performance into a non-issue. You get to focus on how your web applications work and you can allow yourself, to some degree, to care less about performance and scalability. .. XXX:Not totally sure what the last sentence above means. benc Flexibility ~~~~~~~~~~~ One of the key features of Varnish Cache, in addition to its performance, is the flexibility of its configuration language, VCL. VCL enables you to write policies on how incoming requests should be handled. In such a policy you can decide what content you want to serve, from where you want to get the content and how the request or response should be altered. Supported platforms -------------------- Varnish is written to run on modern versions of Linux and FreeBSD and the best experience is had on those platforms. Thanks to our contributors it also runs on NetBSD, OpenBSD, OS X and various Solaris-descendants like Oracle Solaris, OmniOS and SmartOS. About the Varnish development process ------------------------------------- Varnish is a community driven project. The development is overseen by the Varnish Governing Board which currently consists of Poul-Henning Kamp (Architect), Rogier Mulhuijzen (Fastly) and Lasse Karstensen (Varnish Software). Please see https://www.varnish-cache.org/trac/wiki/Contributing as a starting point if you would like to contribute to Varnish. Getting in touch ---------------- You can get in touch with us through many channels. For real time chat you can reach us on IRC through the server irc.linpro.net on the #varnish and #varnish-hacking channels. There are two mailing lists available: one for user questions and one for development discussions. See https://www.varnish-cache.org/lists for information and signup. There is also a web forum on the same site. Now that you have a vague idea on what Varnish Cache is, let's see if we can get it up and running. .. XXX:The above three paragraphs are repetitive this is already handled in previous chapters. The only new information is Governing Board which could be moved to the introduction and the paragraphs scrapped. benc varnish-4.1.1/doc/sphinx/tutorial/peculiarities.rst0000644000201500234410000000302712652366721017435 00000000000000 Peculiarities ------------- There are a couple of things that are different with Varnish Cache, as opposed to other programs. One thing you've already seen - VCL. In this section we provide a very quick tour of other peculiarities you need to know about to get the most out of Varnish. Configuration ~~~~~~~~~~~~~ The Varnish Configuration is written in VCL. When Varnish is ran this configuration is transformed into C code and then fed into a C compiler, loaded and executed. .. XXX:Ran sounds strange above, maybe "is running" "is started" "executes"? benc So, as opposed to switching various settings on or off, you write polices on how the incoming traffic should be handled. varnishadm ~~~~~~~~~~ Varnish Cache has an admin console. You can connect it it through the :ref:`varnishadm(1)` command. In order to connect the user needs to be able to read `/etc/varnish/secret` in order to authenticate. Once you've started the console you can do quite a few operations on Varnish, like stopping and starting the cache process, load VCL, adjust the built in load balancer and invalidate cached content. It has a built in command "help" which will give you some hints on what it does. .. XXX:sample of the command here. benc varnishlog ~~~~~~~~~~ Varnish does not log to disk. Instead it logs to a chunk of memory. It is actually streaming the logs. At any time you'll be able to connect to the stream and see what is going on. Varnish logs quite a bit of information. You can have a look at the logstream with the command :ref:`varnishlog(1)`. varnish-4.1.1/doc/Makefile.in0000644000201500234410000004467012652366726012750 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ # # RST2ANY_FLAGS = --halt=2 EXTRA_DIST = changes.rst changes.html # build graphviz before sphinx, so sphinx docs can use svg output SUBDIRS = graphviz sphinx all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ ctags ctags-recursive distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am changes.html: changes.rst @HAVE_RST2HTML_TRUE@ ${RST2HTML} ${RST2ANY_FLAGS} $? $@ @HAVE_RST2HTML_FALSE@ @echo "========================================" @HAVE_RST2HTML_FALSE@ @echo "You need rst2html installed to make dist" @HAVE_RST2HTML_FALSE@ @echo "========================================" @HAVE_RST2HTML_FALSE@ @false # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/doc/changes.html0000644000201500234410000040423012652366762013171 00000000000000

Varnish Cache 4.1.1 (2016-01-28)

  • No code changes since 4.1.1-beta2.

Varnish Cache 4.1.1-beta2 (2016-01-22)

  • Improvements to VCL temperature handling added. This opens for reliably deny warming a cooling VCL from a VMOD.

Bugs fixed

  • 1802 - Segfault after VCL change
  • 1825 - Cannot Start Varnish After Just Restarting The Service
  • 1842 - Handle missing waiting list gracefully.
  • 1845 - Handle whitespace after floats in test fields

Varnish Cache 4.1.1-beta1 (2016-01-15)

Changes since 4.1.0:

  • Format of "ban.list" has changed slightly.
  • [varnishncsa] -w is now required when running deamonized.
  • [varnishncsa] Log format can now be read from file.
  • Port fields extracted from PROXY1 header now work as expected.
  • New VCL state "busy" introduced (mostly for vmod writers).
  • Last traces of varnishreplay removed.
  • If-Modified-Since is now ignored if we have If-None-Match.
  • Zero Content-Length is no longer sent on 304 responses.
  • vcl_dir and vmod_dir now accept a colon separated list of directories.
  • Nested includes starting with "./" are relative to the including VCL file now.

Bugs fixed

  • 1763 - Restart epoll_wait on EINTR error
  • 1788 - ObjIter has terrible performance profile when busyobj != NULL
  • 1798 - Varnish requests painfully slow with large files
  • 1816 - Use a weak comparison function for If-None-Match
  • 1818 - Allow grace-hits on hit-for-pass objects, [..]
  • 1821 - Always slim private & pass objects after delivery.
  • 1823 - Rush the objheader if there is a waiting list when it is deref'ed.
  • 1826 - Ignore 0 Content-Lengths in 204 responses

Varnish Cache 4.1.0 (2015-09-30)

Changes since 4.1.0-beta1:

  • Documentation updates.
  • Stabilization fixes on testcase p00005.vtc.
  • Avoid compiler warning in zlib.
  • Bug 1792: Avoid using fallocate() with -sfile on non-EXT4.

Varnish Cache 4.1.0-beta1 (2015-09-11)

Changes since 4.1.0-tp1:

  • Redhat packaging files are now separate from the normal tree.
  • Client workspace overflow should now result in a 500 response instead of panic.
  • [varnishstat] -w option has been retired.
  • libvarnishapi release number is increased.
  • Body bytes sent on ESI subrequests with gzip are now counted correctly.
  • [vmod-std] Data type conversion functions now take additional fallback argument.

Bugs fixed

  • 1777 - Disable speculative Range handling on streaming transactions.
  • 1778 - [varnishstat] Cast to integer to prevent negative values messing the statistics
  • 1781 - Propagate gzip CRC upwards from nested ESI includes.
  • 1783 - Align code with RFC7230 section 3.3.3 which allows POST without a body.

Varnish Cache 4.1.0-tp1 (2015-07-08)

Changes between 4.0 and 4.1 are numerous. Please read the upgrade section in the documentation for a general overview.

Changes from 4.0.3-rc3 to 4.0.3 (2015-02-17)

  • No changes.

Changes from 4.0.3-rc2 to 4.0.3-rc3 (2015-02-11)

  • Superseded objects are now expired immediately.

Bugs fixed

  • 1462 - Use first/last log entry in varnishncsa.
  • 1539 - Avoid panic when expiry thread modifies a candidate object.
  • 1637 - Fail the fetch processing if the vep callback failed.
  • 1665 - Be more accurate when computing client RX_TIMEOUT.
  • 1672 - Do not panic on unsolicited 304 response to non-200 bereq.

Changes from 4.0.3-rc1 to 4.0.3-rc2 (2015-01-28)

Changes since 4.0.3-rc1:

  • Assorted documentation updates.

Bugs fixed

  • 1479 - Fix out-of-tree builds.
  • 1566 - Escape VCL string question marks.
  • 1616 - Correct header file placement.
  • 1620 - Fail miss properly if out of backend threads. (Also 1621)
  • 1628 - Avoid dereferencing null in VBO_DerefBusyObj().
  • 1629 - Ditch rest of waiting list on failure to reschedule.
  • 1660 - Don't attempt range delivery on a synth response

Changes from 4.0.2 to 4.0.3-rc1 (2015-01-15)

Changes since 4.0.2:

  • Support older autoconf (< 2.63b) (el5)
  • A lot of minor documentation fixes.
  • bereq.uncacheable is now read-only.
  • obj.uncacheable is now readable in vcl_deliver.
  • [varnishadm] Prefer exact matches for backend.set_healthy. Bug 1349.
  • Hard-coded -sfile default size is removed.
  • [packaging] EL6 packages are once again built with -O2.
  • [parameter] fetch_chunksize default is reduced to 16KB. (from 128KB)
  • Added std.time() which converts strings to VCL_TIME.
  • [packaging] packages now Provide strictABI (gitref) and ABI (VRT major/minor) for VMOD use.

Bugs fixed

  • 1378 - Properly escape non-printable characters in varnishncsa.
  • 1596 - Delay HSH_Complete() until the storage sanity functions has finished.
  • 1506 - Keep Content-Length from backend if we can.
  • 1602 - Fix a cornercase related to empty pass objects.
  • 1607 - Don't leak reqs on failure to revive from waitinglist.
  • 1610 - Update forgotten varnishlog example to 4.0 syntax.
  • 1612 - Fix a cornercase related to empty pass objects.
  • 1623 - Fix varnishhist -d segfault.
  • 1636 - Outdated paragraph in Vary: documentation
  • 1638 - Fix panic when retrying a failed backend fetch.
  • 1639 - Restore the default SIGSEGV handler during pan_ic
  • 1647 - Relax an assertion for the IMS update candidate object.
  • 1648 - Avoid partial IMS updates to replace old object.
  • 1650 - Collapse multiple X-Forwarded-For headers

Changes from 4.0.2-rc1 to 4.0.2 (2014-10-08)

New since 4.0.2-rc1:

  • [varnishlog] -k argument is back. (exit after n records)
  • [varnishadm] vcl.show is now listed in help.

Changes from 4.0.1 to 4.0.2-rc1 (2014-09-23)

New since 4.0.1:

  • [libvmod-std] New function strstr() for matching substrings.
  • server.(hostname|identity) is now available in all VCL functions.
  • VCL variable type BYTES was added.
  • workspace_client default is now 9k.
  • [varnishstat] Update interval can now be subsecond.
  • Document that reloading VCL does not reload a VMOD.
  • Guru meditation page is now valid HTML5.
  • [varnishstat] hitrate calculation is back.
  • New parameter group_cc adds a GID to the grouplist of VCL compiler sandbox.
  • Parameter shm_reclen is now an alias for vsl_reclen.
  • Workspace overflows are now handled with a 500 client response.
  • VCL variable type added: HTTP, representing a HTTP header set.
  • It is now possible to return(synth) from vcl_deliver.
  • [varnishadm] vcl.show now has a -v option that output the complete set of VCL and included VCL files.
  • RHEL7 packaging (systemd) was added.
  • [libvmod-std] querysort() fixed parameter limit has been lifted.
  • Fix small memory leak in ESI parser.
  • Fix unreported race/assert in V1D_Deliver().

Bugs fixed

  • 1553 - Fully reset workspace (incl. Vary state) before reusing it.
  • 1551 - Handle workspace exhaustion during purge.
  • 1591 - Group entries correctly in varnishtop.
  • 1592 - Bail out on workspace exhaustion in VRT_IP_string.
  • 1538 - Relax VMOD ABI check for release branches.
  • 1584 - Don't log garbage/non-HTTP requests. [varnishncsa]
  • 1407 - Don't rename VSM file until child has started.
  • 1466 - Don't leak request structs on restart after waitinglist.
  • 1580 - Output warning if started without -b and -f. [varnishd]
  • 1583 - Abort on fatal sandbox errors on Solaris. (Related: 1572)
  • 1585 - Handle fatal sandbox errors.
  • 1572 - Exit codes have been cleaned up.
  • 1569 - Order of symbols should not influence compilation result.
  • 1579 - Clean up type inference in VCL.
  • 1578 - Don't count Age twice when computing new object TTL.
  • 1574 - std.syslog() logged empty strings.
  • 1555 - autoconf editline/readline build issue.
  • 1568 - Skip NULL arguments when hashing.
  • 1567 - Compile on systems without SO_SNDTIMEO/SO_RCVTIMEO.
  • 1512 - Changes to bereq are lost between v_b_r and v_b_f.
  • 1563 - Increase varnishtest read timeout.
  • 1561 - Never call a VDP with zero length unless done.
  • 1562 - Fail correctly when rereading a failed client request body.
  • 1521 - VCL compilation fails on OSX x86_64.
  • 1547 - Panic when increasing shm_reclen.
  • 1503 - Document return(retry).
  • 1581 - Don't log duplicate Begin records to shmlog.
  • 1588 - Correct timestamps on pipelined requests.
  • 1575 - Use all director backends when looking for a healthy one.
  • 1577 - Read the full request body if shunted to synth.
  • 1532 - Use correct VCL representation of reals.
  • 1531 - Work around libedit bug in varnishadm.

Changes from 4.0.0 to 4.0.1 (2014-06-24)

New since 4.0.0:

  • New functions in vmod_std: real2time, time2integer, time2real, real.
  • Chunked requests are now supported. (pass)
  • Add std.querysort() that sorts GET query arguments. (from libvmod-boltsort)
  • Varnish will no longer reply with "200 Not Modified".
  • Backend IMS is now only attempted when last status was 200.
  • Packaging now uses find-provides instead of find-requires. [redhat]
  • Two new counters: n_purges and n_obj_purged.
  • Core size can now be set from /etc/sysconfig/varnish [redhat]
  • Via header set is now RFC compliant.
  • Removed "purge" keyword in VCL. Use return(purge) instead.
  • fallback director is now documented.
  • %D format flag in varnishncsa is now truncated to an integer value.
  • persistent storage backend is now deprecated. https://www.varnish-cache.org/docs/trunk/phk/persistent.html
  • Added format flags %I (total bytes received) and %O (total bytes sent) for varnishncsa.
  • python-docutils >= 0.6 is now required.
  • Support year (y) as a duration in VCL.
  • VMOD ABI requirements are relaxed, a VMOD no longer have to be run on the same git revision as it was compiled for. Replaced by a major/minor ABI counter.

Bugs fixed

  • 1269 - Use correct byte counters in varnishncsa when piping a request.
  • 1524 - Chunked requests should be pipe-able.
  • 1530 - Expire old object on successful IMS fetch.
  • 1475 - time-to-first-byte in varnishncsa was potentially dishonest.
  • 1480 - Porting guide for 4.0 is incomplete.
  • 1482 - Inherit group memberships of -u specified user.
  • 1473 - Fail correctly in configure when rst2man is not found.
  • 1486 - Truncate negative Age values to zero.
  • 1488 - Don't panic on high request rates.
  • 1489 - req.esi should only be available in client threads.
  • 1490 - Fix thread leak when reducing number of threads.
  • 1491 - Reorder backend connection close procedure to help test cases.
  • 1498 - Prefix translated VCL names to avoid name clashes.
  • 1499 - Don't leak an objcore when HSH_Lookup returns expired object.
  • 1493 - vcl_purge can return synth or restart.
  • 1476 - Cope with systems having sys/endian.h and endian.h.
  • 1496 - varnishadm should be consistent in argv ordering.
  • 1494 - Don't panic on VCL-initiated retry after a backend 500 error.
  • 1139 - Also reset keep (for IMS) time when purging.
  • 1478 - Avoid panic when delivering an object that expires during delivery.
  • 1504 - ACLs can be unreferenced with vcc_err_unref=off set.
  • 1501 - Handle that a director couldn't pick a backend.
  • 1495 - Reduce WRK_SumStat contention.
  • 1510 - Complain on symbol reuse in VCL.
  • 1514 - Document storage.NAME.free_space and .used_space [docs]
  • 1518 - Suppress body on 304 response when using ESI.
  • 1519 - Round-robin director does not support weight. [docs]

Changes from 4.0.0 beta1 to 4.0.0 (2014-04-10)

New since 4.0.0-beta1:

  • improved varnishstat documentation.
  • In VCL, req.backend_hint is available in vcl_hit
  • ncurses is now a dependency.

Bugs fixed

  • 1469 - Fix build error on PPC
  • 1468 - Set ttl=0 on failed objects
  • 1462 - Handle duplicate ReqURL in varnishncsa.
  • 1467 - Fix missing clearing of oc->busyobj on HSH_Fail.

Changes from 4.0.0 TP2 to 4.0.0 beta1 (2014-03-27)

New since TP2:

  • Previous always-appended code called default.vcl is now called builtin.vcl. The new example.vcl is recommended as a starting point for new users.
  • vcl_error is now called vcl_synth, and does not any more mandate closing the client connection.
  • New VCL function vcl_backend_error, where you can change the 503 prepared if all your backends are failing. This can then be cached as a regular object.
  • Keyword "remove" in VCL is replaced by "unset".
  • new timestamp and accounting records in varnishlog.
  • std.timestamp() is introduced.
  • stored objects are now read only, meaning obj.hits now counts per objecthead instead. obj.lastuse saw little use and has been removed.
  • builtin VCL now does return(pipe) for chunked POST and PUT requests.
  • python-docutils and rst2man are now build requirements.
  • cli_timeout is now 60 seconds to avoid slaughtering the child process in times of high IO load/scheduling latency.
  • return(purge) from vcl_recv is now valid.
  • return(hash) is now the default return action from vcl_recv.
  • req.backend is now req.backend_hint. beresp.storage is beresp.storage_hint.

Bugs fixed

  • 1460 - tools now use the new timestamp format.
  • 1450 - varnishstat -l segmentation fault.
  • 1320 - Work around Content-Length: 0 and Content-Encoding: gzip gracefully.
  • 1458 - Panic on busy object.
  • 1417 - Handle return(abandon) in vcl_backend_response.
  • 1455 - vcl_pipe now sets Connection: close by default on backend requests.
  • 1454 - X-Forwarded-For is now done in C, before vcl_recv is run.
  • 1436 - Better explanation when missing an import in VCL.
  • 1440 - Serve ESI-includes from a different backend.
  • 1441 - Incorrect grouping when logging ESI subrequests.
  • 1434 - std.duration can now do ms/milliseconds.
  • 1419 - Don't put objcores on the ban list until they go non-BUSY.
  • 1405 - Ban lurker does not always evict all objects.

Changes from 4.0.0 TP1 to 4.0.0 TP2 (2014-01-23)

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.
  • 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.

Changes from 3.0.7-rc1 to 3.0.7 (2015-03-23)

  • No changes.

Changes from 3.0.6 to 3.0.7-rc1 (2015-03-18)

  • Requests with multiple Content-Length headers will now fail.
  • Stop recognizing a single CR (r) as a HTTP line separator. This opened up a possible cache poisioning attack in stacked installations where sslterminator/varnish/backend had different CR handling.
  • Improved error detection on master-child process communication, leading to faster recovery (child restart) if communication loses sync.
  • Fix a corner-case where Content-Length was wrong for HTTP 1.0 clients, when using gzip and streaming. Bug 1627.
  • More robust handling of hop-by-hop headers.
  • [packaging] Coherent Redhat pidfile in init script. Bug 1690.
  • Avoid memory leak when adding bans.

Changes from 3.0.6rc1 to 3.0.6 (2014-10-16)

  • Minor changes to documentation.
  • [varnishadm] Add termcap workaround for libedit. Bug 1531.

Changes from 3.0.5 to 3.0.6rc1 (2014-06-24)

  • Document storage.<name>.* VCL variables. Bug 1514.
  • Fix memory alignment panic when http_max_hdr is not a multiple of 4. Bug 1327.
  • Avoid negative ReqEnd timestamps with ESI. Bug 1297.
  • %D format for varnishncsa is now an integer (as documented)
  • Fix compile errors with clang.
  • Clear objectcore flags earlier in ban lurker to avoid spinning thread. Bug 1470.
  • Patch embedded jemalloc to avoid segfault. Bug 1448.
  • Allow backend names to start with if, include or else. Bug 1439.
  • Stop handling gzip after gzip body end. Bug 1086.
  • Document %D and %T for varnishncsa.

Changes from 3.0.5 rc 1 to 3.0.5 (2013-12-02)

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

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.

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

varnishadm

  • Handle input from stdin properly. Bug #1314

Changes from 3.0.4 rc 1 to 3.0.4 (2013-06-14)

varnishd

  • Set the waiter pipe as non-blocking and record overflows. Bug #1285
  • Fix up a bug in the ACL compile code that could lead to false negatives. CVE-2013-4090. Bug #1312
  • Return an error if the client sends multiple Host headers.

Changes from 3.0.3 to 3.0.4 rc 1

varnishd

  • Fix error handling when uncompressing fetched objects for ESI processing. Bug #1184
  • Be clearer about which timeout was reached in logs.
  • Correctly decrement n_waitinglist counter. Bug #1261
  • Turn off Nagle/set TCP_NODELAY.
  • Avoid panic on malformed Vary headers. Bug #1275
  • Increase the maximum length of backend names. Bug #1224
  • Add support for banning on http.status. Bug #1076
  • Make hit-for-pass correctly prefer the transient storage.

varnishlog

  • If -m, but neither -b or -c is given, assume both. This filters out a lot of noise when -m is used to filter. Bug #1071

varnishadm

  • Improve tab completion and require libedit/readline to build.

varnishtop

  • Reopen log file if Varnish is restarted.

varnishncsa

  • Handle file descriptors above 64k (by ignoring them). Prevents a crash in some cases with corrupted shared memory logs.
  • Add %D and %T support for more timing information.

Other

  • Documentation updates.
  • Fixes for OSX
  • Disable PCRE JIT-er, since it's broken in some PCRE versions, at least on i386.
  • Make libvarnish prefer exact hits when looking for VSL tags.

Changes from 3.0.2 to 3.0.3 (2012-08-20)

varnishd

  • Fix a race on the n_sess counter. This race made varnish do excessive session workspace allocations. Bug #897.
  • Fix some crashes in the gzip code when it runs out of memory. Bug #1037. Bug #1043. Bug #1044.
  • Fix a bug where the regular expression parser could end up in an infinite loop. Bug #1047.
  • Fix a memory leak in the regex code.
  • DNS director now uses port 80 by default if not specified.
  • Introduce idle_send_timeout and increase default value for send_timeout to 600s. This allows a long send timeout for slow clients while still being able to disconnect idle clients.
  • Fix an issue where <esi:remove> did not remove HTML comments. Bug #1092.
  • Fix a crash when passing with streaming on.
  • Fix a crash in the idle session timeout code.
  • Fix an issue where the poll waiter did not timeout clients if all clients were idle. Bug #1023.
  • Log regex errors instead of crashing.
  • Introduce pcre_match_limit, and pcre_match_limit_recursion parameters.
  • Add CLI commands to manually control health state of a backend.
  • Fix an issue where the s_bodybytes counter is not updated correctly on gunzipped delivery.
  • Fix a crash when we couldn't allocate memory for a fetched object. Bug #1100.
  • Fix an issue where objects could end up in the transient store with a long TTL, when memory could not be allocated for them in the requested store. Bug #1140.
  • Activate req.hash_ignore_busy when req.hash_always_miss is activated. Bug #1073.
  • Reject invalid tcp port numbers for listen address. Bug #1035.
  • Enable JIT for better performing regular expressions. Bug #1080.
  • Return VCL errors in exit code when using -C. Bug #1069.
  • Stricter validation of acl syntax, to avoid a crash with 5-octet IPv4 addresses. Bug #1126.
  • Fix a crash when first argument to regsub was null. Bug #1125.
  • Fix a case where varnish delivered corrupt gzip content when using ESI. Bug #1109.
  • Fix a case where varnish didn't remove the old Date header and served it alongside the varnish-generated Date header. Bug #1104.
  • Make saint mode work, for the case where we have no object with that hash. Bug #1091.
  • Don't save the object body on hit-for-pass objects.
  • n_ban_gone counter added to count the number of "gone" bans.
  • Ban lurker rewritten to properly sleep when no bans are present, and otherwise to process the list at the configured speed.
  • Fix a case where varnish delivered wrong content for an uncompressed page with compressed ESI child. Bug #1029.
  • Fix an issue where varnish runs out of thread workspace when processing many ESI includes on an object. Bug #1038.
  • Fix a crash when streaming was enabled for an empty body.
  • Better error reporting for some fetch errors.
  • Small performance optimizations.

varnishncsa

  • Support for tn in varnishncsa format strings.
  • Add new format: %{VCL_Log:foo}x which output key:value from std.log() in VCL.
  • Add user-defined date formatting, using %{format}t.

varnishtest

  • resp.body is now available for inspection.
  • Make it possible to test for the absence of an HTTP header. Bug #1062.
  • Log the full panic message instead of shortening it to 512 characters.

varnishstat

  • Add json output (-j).

Other

  • Documentation updates.
  • Bump minimum number of threads to 50 in RPM packages.
  • RPM packaging updates.
  • Fix some compilation warnings on Solaris.
  • Fix some build issues on Open/Net/DragonFly-BSD.
  • Fix build on FreeBSD 10-current.
  • Fix libedit detection on *BSD OSes. Bug #1003.

Changes from 3.0.2 rc 1 to 3.0.2 (2011-10-26)

varnishd

  • Make the size of the synthetic object workspace equal to http_resp_size and add workaround to avoid a crash when setting too long response strings for synthetic objects.
  • Ensure the ban lurker always sleeps the advertised 1 second when it does not have anything to do.
  • Remove error from vcl_deliver. Previously this would assert while it will now give a syntax error.

varnishncsa

  • Add default values for some fields when logging incomplete records and document the default values.

Other

  • Documentation updates
  • Some Solaris portability updates.

Changes from 3.0.1 to 3.0.2 rc 1 (2011-10-06)

varnishd

  • Only log the first 20 bytes of extra headers to prevent overflows.
  • Fix crasher bug which sometimes happened if responses are queued and the backend sends us Vary. Bug #994.
  • Log correct size of compressed when uncompressing them for clients that do not support compression. Bug #996.
  • Only send Range responses if we are going to send a body. Bug #1007.
  • When varnishd creates a storage file, also unlink it to avoid leaking disk space over time. Bug #1008.
  • The default size of the -s file parameter has been changed to 100MB instead of 50% of the available disk space.
  • The limit on the number of objects we remove from the cache to make room for a new one was mistakenly lowered to 10 in 3.0.1. This has been raised back to 50. Bug #1012.
  • http_req_size and http_resp_size have been increased to 8192 bytes. This better matches what other HTTPds have. Bug #1016.

VCL

  • Allow relational comparisons of floating point types.
  • Make it possible for vmods to fail loading and so cause the VCL loading to fail.

varnishncsa

  • Fixed crash when client was sending illegal HTTP headers.
  • %{Varnish:handling} in format strings was broken, this has been fixed.

Other

  • Documentation updates
  • Some Solaris portability updates.

Changes from 3.0.1 rc 1 to 3.0.1 (2011-08-30)

varnishd

  • Fix crash in streaming code.
  • Add fallback director, as a variant of the round-robin director.
  • The parameter http_req_size has been reduced on 32 bit machines.

VCL

  • Disallow error in the vcl_init and vcl_fini VCL functions.

varnishncsa

  • Fixed crash when using -X.
  • Fix error when the time to first byte was in the format string.

Other

  • Documentation updates

Changes from 3.0.0 to 3.0.1 rc 1 (2011-08-24)

varnishd

  • Avoid sending an empty end-chunk when sending bodyless responsed.
  • http_resp_hdr_len and http_req_hdr_len were set to too low values leading to clients receiving HTTP 400 Bad Request errors. The limit has been increased and the error code is now HTTP 413 Request entity too large.
  • Objects with grace or keep set were mistakenly considered as candidates for the transient storage. They now have their grace and keep limited to limit the memory usage of the transient stevedore.
  • If a request was restarted from vcl_miss or vcl_pass it would crash. This has been fixed. Bug #965.
  • Only the first few clients waiting for an object from the backend would be woken up when object arrived and this lead to some clients getting stuck for a long time. This has now been fixed. Bug #963.
  • The hash and client directors would mistakenly retry fetching an object from the same backend unless health probes were enabled. This has been fixed and it will now retry a different backend.

VCL

  • Request specific variables such as client.* and server.* are now correctly marked as not available in vcl_init and vcl_fini.
  • The VCL compiler would fault if two IP comparisons were done on the same line. This now works correctly. Bug #948.

varnishncsa

  • Add support for logging arbitrary request and response headers.
  • Fix crashes if hitmiss and handling have not yet been set.
  • Avoid printing partial log lines if there is an error in a format string.
  • Report user specified format string errors better.

varnishlog

  • varnishlog -r now works correctly again and no longer opens the shared log file of the running Varnish.

Other

  • Various documentation updates.
  • Minor compilation fixes for newer compilers.
  • A bug in the ESI entity replacement parser has been fixed. Bug #961.
  • The ABI of vmods are now checked. This will require a rebuild of all vmods against the new version of Varnish.

Changes from 3.0 beta 2 to 3.0.0 (2011-06-16)

varnishd

  • Avoid sending an empty end-chunk when sending bodyless responsed.

VCL

  • The synthetic keyword has now been properly marked as only available in vcl_deliver. Bug #936.

varnishadm

  • Fix crash if the secret file was unreadable. Bug #935.
  • Always exit if varnishadm can't connect to the backend for any reason.

Changes from 3.0 beta 1 to 3.0 beta 2

varnishd

  • thread_pool_min and thread_pool_max now each refer to the number of threads per pool, rather than being inconsistent as they were before.
  • 307 Temporary redirect is now considered cacheable. Bug #908.
  • The stats command has been removed from the CLI interface. With the new counters, it would mean implementing more and more of varnishstat in the master CLI process and the CLI is single-threaded so we do not want to do this work there in the first place. Use varnishstat instead.

VCL

  • VCL now treats null arguments (unset headers for instance) as empty strings. Bug #913.
  • VCL now has vcl_init and vcl_fini functions that are called when a given VCL has been loaded and unloaded.
  • There is no longer any interpolation of the right hand side in bans where the ban is a single string. This was confusing and you now have to make sure bits are inside or outside string context as appropriate.
  • Varnish is now stricter in enforcing no duplication of probes, backends and ACLs.

varnishncsa

  • varnishncsa now ignores piped requests, since we have no way of knowing their return status.

VMODs

  • The std module now has proper documentation, including a manual page

Changes from 2.1.5 to 3.0 beta 1

Upcoming changes

  • The interpretation of bans will change slightly between 3.0 beta 1 and 3.0 release. Currently, doing ban("req.url == req.url") will cause the right hand req.url to be interpreted in the context of the request creating the ban. This will change so you will have to do ban("req.url == " + req.url) instead. This syntax already works and is recommended.

varnishd

  • Add streaming on pass and miss. This is controlled by the beresp.do_stream boolean. This includes support for compression/uncompression.
  • Add support for ESI and gzip.
  • Handle objects larger than 2G.
  • HTTP Range support is now enabled by default
  • The ban lurker is enabled by default
  • if there is a backend or director with the name default, use that as the default backend, otherwise use the first one listed.
  • Add many more stats counters. Amongst those, add per storage backend stats and per-backend statistics.
  • Syslog the platform we are running on
  • The -l (shared memory log file) argument has been changed, please see the varnishd manual for the new syntax.
  • The -S and -T arguments are now stored in the shmlog
  • Fix off-by-one error when exactly filling up the workspace. Bug #693.
  • Make it possible to name storage backends. The names have to be unique.
  • Update usage output to match the code. Bug #683
  • Add per-backend health information to shared memory log.
  • Always recreate the shared memory log on startup.
  • Add a vcl_dir parameter. This is used to resolve relative path names for vcl.load and include in .vcl files.
  • Make it possible to specify -T :0. This causes varnishd to look for a free port automatically. The port is written in the shared memory log so varnishadm can find it.
  • Classify locks into kinds and collect stats for each kind, recording the data in the shared memory log.
  • Auto-detect necessary flags for pthread support and VCC_CC flags. This should make Varnish somewhat happier on Solaris. Bug #663
  • The overflow_max parameter has been renamed to queue_max.
  • If setting a parameter fails, report which parameter failed as this is not obvious during startup.
  • Add a parameter named shortlived. Objects whose TTL is less than the parameter go into transient (malloc) storage.
  • Reduce the default thread_add_delay to 2ms.
  • The max_esi_includes parameter has been renamed to max_esi_depth.
  • Hash string components are now logged by default.
  • The default connect timeout parameter has been increased to 0.7 seconds.
  • The err_ttl parameter has been removed and is replaced by a setting in default.vcl.
  • The default send_timeout parameter has been reduced to 1 minute.
  • The default ban_lurker sleep has been set to 10ms.
  • When an object is banned, make sure to set its grace to 0 as well.
  • Add panic.show and panic.clear CLI commands.
  • The default http_resp_hdr_len and http_req_hdr_len has been increased to 2048 bytes.
  • If vcl_fetch results in restart or error, close the backend connection rather than fetching the object.
  • If allocating storage for an object, try reducing the chunk size before evicting objects to make room. Bug #880
  • Add restart from vcl_deliver. Bug #411
  • Fix an off-by-up-to-one-minus-epsilon bug where if an object from the backend did not have a last-modified header we would send out a 304 response which did include a Last-Modified header set to when we received the object. However, we would compare the timestamp to the fractional second we got the object, meaning any request with the exact timestamp would get a 200 response rather than the correct 304.
  • Fix a race condition in the ban lurker where a serving thread and the lurker would both look at an object at the same time, leading to Varnish crashing.
  • If a backend sends a Content-Length header and we are streaming and we are not uncompressing it, send the Content-Length header on, allowing browsers to diplay a progress bar.
  • All storage must be at least 1M large. This is to prevent administrator errors when specifying the size of storage where the admin might have forgotten to specify units.

Tools

common

  • Add an -m $tag:$regex parameter, used for selecting some transactions. The parameter can be repeated, in which case it is logically and-ed together.

varnishadm

  • varnishadm will now pick up the -S and -T arguments from the shared memory log, meaning just running it without any arguments will connect to the running varnish. Bug #875
  • varnishadm now accepts an -n argument to specify the location of the shared memory log file
  • add libedit support

varnishstat

  • reopen shared memory log if the varnishd process is restarted.
  • Improve support for selecting some, but not all fields using the -f argument. Please see the documentation for further details on the use of -f.
  • display per-backend health information

varnishncsa

  • Report error if called with -i and -I as they do not make any sense for varnishncsa.
  • Add custom log formats, specified with -F. Most of the Apache log formats are supported, as well as some Varnish-specific ones. See the documentation for further information. Bug #712 and bug #485

varnishtest

  • add -l and -L switches which leave /tmp/vtc.* behind on error and unconditionally respectively.
  • add -j parameter to run tests in parallell and use this by default.

varnishtop

  • add -p $period parameter. The units in varnishtop were previously undefined, they are now in requests/period. The default period is 60 seconds.

varnishlog

  • group requests by default. This can be turned off by using -O
  • the -o parameter is now a no-op and is ignored.

VMODs

  • Add a std vmod which includes a random function, log, syslog, fileread, collect,

VCL

  • Change string concatenation to be done using + rather than implicitly.
  • Stop using %xx escapes in VCL strings.
  • Change req.hash += value to hash_data(value)
  • Variables in VCL now have distinct read/write access
  • bereq.connect_timeout is now available in vcl_pipe.
  • Make it possible to declare probes outside of a director. Please see the documentation on how to do this.
  • The VCL compiler has been reworked greatly, expanding its abilities with regards to what kinds of expressions it understands.
  • Add beresp.backend.name, beresp.backend.ip and beresp.backend.port variables. They are only available from vcl_fetch and are read only. Bug #481
  • The default VCL now calls pass for any objects where beresp.http.Vary == "*". Bug #787
  • The log keyword has been moved to the std vmod.
  • It is now possible to choose which storage backend to be used
  • Add variables storage.$name.free_space, storage.$name.used_space and storage.$name.happy
  • The variable req.can_gzip tells us whether the client accepts gzipped objects or not.
  • purge is now called ban, since that is what it really is and has always been.
  • req.esi_level is now available. Bug #782
  • esi handling is now controlled by the beresp.do_esi boolean rather than the esi function.
  • beresp.do_gzip and beresp.do_gunzip now control whether an uncompressed object should be compressed and a compressed object should be uncompressed in the cache.
  • make it possible to control compression level using the gzip_level parameter.
  • obj.cacheable and beresp.cacheable have been removed. Cacheability is now solely through the beresp.ttl and beresp.grace variables.
  • setting the obj.ttl or beresp.ttl to zero now also sets the corresponding grace to zero. If you want a non-zero grace, set grace after setting the TTL.
  • return(pass) in vcl_fetch has been renamed to return(hit_for_pass) to make it clear that pass in vcl_fetch and vcl_recv are different beasts.
  • Add actual purge support. Doing purge will remove an object and all its variants.

Libraries

  • libvarnishapi has been overhauled and the API has been broken. Please see git commit logs and the support tools to understand what's been changed.
  • Add functions to walk over all the available counters. This is needed because some of the counter names might only be available at runtime.
  • Limit the amount of time varnishapi waits for a shared memory log to appear before returning an error.
  • All libraries but libvarnishapi have been moved to a private directory as they are not for public consumption and have no ABI/API guarantees.

Other

  • Python is now required to build
  • Varnish Cache is now consistently named Varnish Cache.
  • The compilation process now looks for kqueue on NetBSD
  • Make it possible to use a system jemalloc rather than the bundled version.
  • The documentation has been improved all over and should now be in much better shape than before

Changes from 2.1.4 to 2.1.5 (2011-01-25)

varnishd

  • On pass from vcl_recv, we did not remove the backends Content-Length header before adding our own. This could cause confusion for browsers and has been fixed.
  • Make pass with content-length work again. An issue with regards to 304, Content-Length and pass has been resolved.
  • An issue relating to passed requests with If-Modified-Since headers has been fixed. Varnish did not recognize that the 304-response did not have a body.
  • A potential lock-inversion with the ban lurker thread has been resolved.
  • Several build-dependency issues relating to rst2man have been fixed. Varnish should now build from source without rst2man if you are using tar-balls.
  • Ensure Varnish reads the expected last CRLF after chunked data from the backend. This allows re-use of the connection.
  • Remove a GNU Make-ism during make dist to make BSD happier.
  • Document the log, set, unset, return and restart statements in the VCL documentation.
  • Fix an embarrassingly old bug where Varnish would run out of workspace when requests come in fast over a single connection, typically during synthetic benchmarks.
  • Varnish will now allow If-Modified-Since requests to objects without a Last-Modified-header, and instead use the time the object was cached instead.
  • Do not filter out Content-Range headers in pass.
  • Require -d, -b, -f, -S or -T when starting varnishd. In human terms, this means that it is legal to start varnishd without a Vcl or backend, but only if you have a CLI channel of some kind.
  • Don't suppress Cache-Control headers in pass responses.
  • Merge multi-line Cache-Control and Vary header fields. Until now, no browsers have needed this, but Chromium seems to find it necessary to spread its Cache-Control across two lines, and we get to deal with it.
  • Make new-purge not touch busy objects. This fixes a potential crash when calling VRT_purge.
  • If there are everal grace-able objects, pick the least expired one.
  • Fix an issue with varnishadm -T :6082 shorthand.
  • Add bourn-shell like "here" documents on the CLI. Typical usage: vcl.inline vcl_new << 42 backend foo {...} sub vcl_recv {...} 42
  • Add CLI version to the CLI-banner, starting with version 1.0 to mark here-documents.
  • Fix a problem with the expiry thread slacking off during high load.

varnishtest

  • Remove no longer existing -L option.

Changes from 2.1.3 to 2.1.4

varnishd

  • An embarrasing typo in the new binary heap layout caused inflated obj/objcore/objhdr counts and could cause odd problems when the LRU expunge mechanism was invoked. This has been fixed.
  • We now have updated documentation in the reStructuredText format. Manual pages and reference documentation are both built from this.
  • We now include a DNS director which uses DNS for choosing which backend to route requests to. Please see the documentation for more details.
  • If you restarted a request, the HTTP header X-Forwarded-For would be updated multiple times. This has been fixed.
  • If a VCL contained a % sign, and the vcl.show CLI command was used, varnishd would crash. This has been fixed.
  • When doing a pass operation, we would remove the Content-Length, Age and Proxy-Auth headers. We are no longer doing this.
  • now has a string representation, making it easier to construct Expires headers in VCL.
  • In a high traffic environment, we would sometimes reuse a file descriptor before flushing the logs from a worker thread to the shared log buffer. This would cause confusion in some of the tools. This has been fixed by explicitly flushing the log when a backend connection is closed.
  • If the communication between the management and the child process gets out of sync, we have no way to recover. Previously, varnishd would be confused, but we now just kill the child and restart it.
  • If the backend closes the connection on us just as we sent a request to it, we retry the request. This should solve some interoperability problems with Apache and the mpm-itk multi processing module.
  • varnishd now only provides help output the current CLI session is authenticated for.
  • If the backend does not tell us which length indication it is using, we now assume the resource ends EOF at.
  • The client director now has a variable client.identity which is used to choose which backend should receive a given request.
  • The Solaris port waiter has been updated, and other portability fixes for Solaris.
  • There was a corner case in the close-down processing of pipes, this has now been fixed.
  • Previously, if we stopped polling a backend which was sick, it never got marked as healthy. This has now been changed.
  • It is now possible to specify ports as part of the .host field in VCL.
  • The synthetic counters were not locked properly, and so the sms_ counters could underflow. This has now been fixed.
  • The value of obj.status as a string in vcl_error would not be correct in all cases. This has been fixed.
  • Varnish would try to trim storage segments completely filled when using the malloc stevedore and the object was received chunked encoding. This has been fixed.
  • If a buggy backend sends us a Vary header with two colons, we would previously abort. We now rather fix this up and ignore the extra colon.
  • req.hash_always_miss and req.hash_ignore_busy has been added, to make preloading or periodically refreshing content work better.

varnishncsa

  • varnishncsa would in some cases be confused by ESI requests and output invalid lines. This has now been fixed.

varnishlog

  • varnishlog now allows -o and -u together.

varnishtop

  • varnishtop would crash on 32 bit architectures. This has been fixed.

libvarnishapi

  • Regex inclusion and exclusion had problems with matching particular parts of the string being matched. This has been fixed.

Changes from 2.1.2 to 2.1.3

varnishd

  • Improve scalability of critbit.
  • The critbit hash algorithm has now been tightened to make sure the tree is in a consistent state at all points, and the time we wait for an object to cool off after it is eligible for garbage collection has been tweaked.
  • Add log command to VCL. This emits a VCL_log entry into the shared memory log.
  • Only emit Length and ReqEnd log entries if we actually have an XID. This should get rid of some empty log lines in varnishncsa.
  • Destroy directors in a predictable fashion, namely reverse of creation order.
  • Fix bug when ESI elements spanned storage elements causing a panic.
  • In some cases, the VCL compiler would panic instead of giving sensible messages. This has now been fixed.
  • Correct an off-by-one error when the requested range exceeds the size of an object.
  • Handle requests for the end of an object correctly.
  • Allow tabulator characters in the third field of the first line of HTTP requests
  • On Solaris, if the remote end sends us an RST, all system calls related to that socket will return EINVAL. We now handle this better.

libvarnishapi

  • The -X parameter didn't work correctly. This has been fixed.

Changes from 2.1.1 to 2.1.2

varnishd

  • When adding Range support for 2.1.1, we accidentally introduced a bug which would append garbage to objects larger than the chunk size, by default 128k. Browsers would do the right thing due to Content-Length, but some load balancers would get very confused.

Changes from 2.1.1 to 2.1.1

varnishd

  • The changelog in 2.1.0 included syntax errors, causing the generated changelog to be empty.
  • The help text for default_grace was wrongly formatted and included a syntax error. This has now been fixed.
  • varnishd now closes the file descriptor used to read the management secret file (from the -S parameter).
  • The child would previously try to close every valid file descriptor, something which could cause problems if the file descriptor ulimit was set too high. We now keep track of all the file descriptors we open and only close up to that number.
  • ESI was partially broken in 2.1.0 due to a bug in the rollback of session workspace. This has been fixed.
  • Reject the authcommand rather than crash if there is no -S parameter given.
  • Align pointers in allocated objects. This will in theory make Varnish a tiny bit faster at the expense of slightly more memory usage.
  • Ensure the master process process id is updated in the shared memory log file after we go into the background.
  • HEAD requests would be converted to GET requests too early, which affected pass and pipe. This has been fixed.
  • Update the documentation to point out that the TTL is no longer taken into account to decide whether an object is cacheable or not.
  • Add support for completely obliterating an object and all variants of it. Currently, this has to be done using inline C.
  • Add experimental support for the Range header. This has to be enabled using the parameter http_range_support.
  • The critbit hasher could get into a deadlock and had a race condition. Both those have now been fixed.

varnishsizes -----------~

  • varnishsizes, which is like varnishhist, but for the length of objects, has been added..

Changes from 2.0.6 to 2.1.0

varnishd

  • Persistent storage is now experimentally supported using the persistent stevedore. It has the same command line arguments as the file stevedore.

  • obj.* is now called beresp.* in vcl_fetch, and obj.* is now read-only.

  • The regular expression engine is now PCRE instead of POSIX regular expressions.

  • req.* is now available in vcl_deliver.

  • Add saint mode where we can attempt to grace an object if we don't like the backend response for some reason.

    Related, add saintmode_threshold which is the threshold for the number of objects to be added to the trouble list before the backend is considered sick.

  • Add a new hashing method called critbit. This autoscales and should work better on large object workloads than the classic hash. Critbit has been made the default hash algorithm.

  • When closing connections, we experimented with sending RST to free up load balancers and free up threads more quickly. This caused some problems with NAT routers and so has been reverted for now.

  • Add thread that checks objects against ban list in order to prevent ban list from growing forever. Note that this needs purges to be written so they don't depend on req.*. Enabled by setting ban_lurker_sleep to a nonzero value.

  • The shared memory log file format was limited to maximum 64k simultaneous connections. This is now a 32 bit field which removes this limitation.

  • Remove obj_workspace, this is now sized automatically.

  • Rename acceptors to waiters

  • vcl_prefetch has been removed. It was never fully implemented.

  • Add support for authenticating CLI connections.

  • Add hash director that chooses which backend to use depending on req.hash.

  • Add client director that chooses which backend to use depending on the client's IP address. Note that this ignores the X-Forwarded-For header.

  • varnishd now displays a banner by default when you connect to the CLI.

  • Increase performance somewhat by moving statistics gathering into a per-worker structure that is regularly flushed to the global stats.

  • Make sure we store the header and body of object together. This may in some cases improve performance and is needed for persistence.

  • Remove client-side address accounting. It was never used for anything and presented a performance problem.

  • Add a timestamp to bans, so you can know how old they are.

  • Quite a few people got confused over the warning about not being able to lock the shared memory log into RAM, so stop warning about that.

  • Change the default CLI timeout to 10 seconds.

  • We previously forced all inserts into the cache to be GET requests. This has been changed to allow POST as well in order to be able to implement purge-on-POST semantics.

  • The CLI command stats now only lists non-zero values.

  • The CLI command stats now only lists non-zero values.

  • Use daemon(3) from libcompat on Darwin.

  • Remove vcl_discard as it causes too much complexity and never actually worked particularly well.

  • Remove vcl_timeout as it causes too much complexity and never actually worked particularly well.

  • Update the documentation so it refers to sess_workspace, not http_workspace.

  • Document the -i switch to varnishd as well as the server.identity and server.hostname VCL variables.

  • purge.hash is now deprecated and no longer shown in help listings.

  • When processing ESI, replace the five mandatory XML entities when we encounter them.

  • Add string representations of time and relative time.

  • Add locking for n_vbe_conn to make it stop underflowing.

  • When ESI-processing content, check for illegal XML character entities.

  • Varnish can now connect its CLI to a remote instance when starting up, rather than just being connected to.

  • It is no longer needed to specify the maximum number of HTTP headers to allow from backends. This is now a run-time parameter.

  • The X-Forwarded-For header is now generated by vcl_recv rather than the C code.

  • It is now possible to not send all CLI traffic to syslog.

  • It is now possible to not send all CLI traffic to syslog.

  • In the case of varnish crashing, it now outputs a identifying string with the OS, OS revision, architecture and storage parameters together with the backtrace.

  • Use exponential backoff when we run out of file descriptors or sessions.

  • Allow setting backend timeouts to zero.

  • Count uptime in the shared memory log.

  • Try to detect the case of two running varnishes with the same shmlog and storage by writing the master and child process ids to the shmlog and refusing to start if they are still running.

  • Make sure to use EOF mode when serving ESI content to HTTP/1.0 clients.

  • Make sure we close the connection if it either sends Connection: close or it is a HTTP/1.0 backend that does not send Connection: keep-alive.

  • Increase the default session workspace to 64k on 64-bit systems.

  • Make the epoll waiter use level triggering, not edge triggering as edge triggering caused problems on very busy servers.

  • Handle unforeseen client disconnections better on Solaris.

  • Make session lingering apply to new sessions, not just reused sessions.

varnishstat

  • Make use of the new uptime field in the shared memory log rather than synthesizing it from the start time.

varnishlog

  • Exit at the end of the file when started with -d.

varnishadm

  • varnishadm can now have a timeout when trying to connect to the running varnishd.
  • varnishadm now knows how to respond to the secret from a secured varnishd

Changes from 2.0.5 to 2.0.6

varnishd

  • 2.0.5 had an off-by-one error in the ESI handling causing includes to fail a large part of the time. This has now been fixed.
  • Try harder to not confuse backends when sending them backend probes. We half-closed the connection, something some backends thought meant we had dropped the connection. Stop doing so, and add the capability for specifying the expected response code.
  • In 2.0.5, session lingering was turned on. This caused statistics to not be counted often enough in some cases. This has now been fixed.
  • Avoid triggering an assert if the other end closes the connection while we are lingering and waiting for another request from them.
  • When generating backtraces, prefer the built-in backtrace function if such exists. This fixes a problem compiling 2.0.5 on Solaris.
  • Make it possible to specify the per-thread stack size. This might be useful on 32 bit systems with their limited address space.
  • Document the -C option to varnishd.

Changes from 2.0.4 to 2.0.5

varnishd

  • Handle object workspace overruns better.
  • Allow turning off ESI processing per request by using set req.esi = off.
  • Tell the kernel that we expect to use the mmap-ed file in a random fashion. On Linux, this turns off/down readahead and increases performance.
  • Make it possible to change the maximum number of HTTP headers we allow by passing --with-max-header-fields=NUM rather than changing the code.
  • Implement support for HTTP continuation lines.
  • Change how connections are closed and only use SO_LINGER for orderly connection closure. This should hopefully make worker threads less prone to hangups on network problems.
  • Handle multi-element purges correctly. Previously we ended up with parse errors when this was done from VCL.
  • Handle illegal responses from the backend better by serving a 503 page rather than panic-ing.
  • When we run into an assertion that is not true, Varnish would previously dump a little bit of information about itself. Extend that information with a backtrace. Note that this relies on the varnish binary being unstripped.
  • Add a session_max parameter that limits the maximum number of sessions we keep open before we start dropping new connections summarily.
  • Try to consume less memory when doing ESI processing by properly rolling back used workspace after processing an object. This should make it possible to turn sess_workspace quite a bit for users with ESI-heavy pages.
  • Turn on session_linger by default. Tests have shown that session_linger helps a fair bit with performance.
  • Rewrite the epoll acceptor for better performance. This should lead to both higher processing rates and maximum number of connections on Linux.
  • Add If-None-Match support, this gives significant bandwidth savings for users with compliant browsers.
  • RFC2616 specifies that ETag, Content-Location, Expires, Cache-Control and Vary should be emitted when delivering a response with the 304 response code.
  • Various fixes which makes Varnish compile and work on AIX.
  • Turn on TCP_DEFER_ACCEPT on Linux. This should make us less suspecible to denial of service attacks as well as give us slightly better performance.
  • Add an .initial property to the backend probe specification. This is the number of good probes we pretend to have seen. The default is one less than .threshold, which means the first probe will decide if we consider the backend healthy.
  • Make it possible to compare strings against other string-like objects, not just plain strings. This allows you to compare two headers, for instance.
  • When support for restart in vcl_error was added, there was no check to prevent infinte recursion. This has now been fixed.
  • Turn on purge_dups by default. This should make us consume less memory when there are many bans for the same pattern added.
  • Add a new log tag called FetchError which tries to explain why we could not fetch an object from the backend.
  • Change the default srcaddr_ttl to 0. It is not used by anything and has been removed in the development version. This will increase performance somewhat.

varnishtop

  • varnishtop did not handle variable-length log fields correctly. This is now fixed.
  • varnishtop previously did not print the name of the tag, which made it very hard to understand. We now print out the tag name.

Changes from 2.0.3 to 2.0.4

varnishd

  • Make Varnish more portable by pulling in fixes for Solaris and NetBSD.
  • Correct description of -a in the manual page.
  • Ensure we are compiling in C99 mode.
  • If error was called with a null reason, we would crash on Solaris. Make sure this no longer happens.
  • Varnish used to crash if you asked it to use a non-existent waiter. This has now been fixed.
  • Add documentation to the default VCL explaining that using Connection: close in vcl_close is generally a good idea.
  • Add minimal facility for dealing with TELNET option negotiation by returning WONT to DO and DONT requests.
  • If the backend is unhealthy, use a graced object if one is available.
  • Make server.hostname and server.identity available to VCL. The latter can be set with the -i parameter to varnishd.
  • Make restart available from vcl_error.
  • Previously, only the TTL of an object was considered in whether it would be marked as cacheable. This has been changed to take the grace into consideration as well.
  • Previously, if an included ESI fragment had a zero size, we would send out a zero-sized chunk which signifies end-of-transmission. We now ignore zero-sized chunks.
  • We accidentally slept for far too long when we reached the maximum number of open file descriptors. This has been corrected and accept_fd_holdoff now works correctly.
  • Previously, when ESI processing, we did not look at the full length, but stopped at the first NULL byte. We no longer do that, enabling ESI processing of binary data.

varnishtest

  • Make sure system "..." returns successfully to ensure test failures do not go unnoticed.
  • Make it possible to send NULL bytes through the testing framework.

Changes from 2.0.2 to 2.0.3

varnishd

  • Handle If-Modified-Since and ESI sub-objects better, fixing a problem where we sometimes neglected to insert included objects.
  • restart in vcl_hit is now supported.
  • Setting the TTL of an object to 0 seconds would sometimes cause it to be delivered for up to one second - epsilon. This has been corrected and we should now never deliver those objects to other clients.
  • The malloc storage backend now prints the maximum storage size, just like the file backend.
  • Various small documentation bugs have been fixed.
  • Varnish did not set a default interval for backend probes, causing it to poll the backend continuously. This has been corrected.
  • Allow "true" and "false" when setting boolean parameters, in addition to on/off, enable/disable and yes/no.
  • Default to always talking HTTP 1.1 with the backend.
  • Varnish did not make sure the file it was loading was a regular file. This could cause Varnish to crash if it was asked to load a directory or other non-regular file. We now check that the file is a regular file before loading it.
  • The binary heap used for expiry processing had scalability problems. Work around this by using stripes of a fixed size, which should make this scale better, particularly when starting up and having lots of objects.
  • When we imported the jemalloc library into the Varnish tree, it did not compile without warnings. This has now been fixed.
  • Varnish took a very long time to detect that the backend did not respond. To remedy this, we now have read timeouts in addition to the connect timeout. Both the first_byte_timeout and the between_bytes_timeout defaults to 60 seconds. The connect timeout is no longer in milliseconds, but rather in seconds.
  • Previously, the VCL to C conversion as well as the invocation of the C compiler was done in the management process. This is now done in a separate sub-process. This prevents any bugs in the VCL compiler from affecting the management process.
  • Chunked encoding headers were counted in the statistics for header bytes. They no longer are.
  • ESI processed objects were not counted in the statistics for body bytes. They now are.
  • It is now possible to adjust the maximum record length of log entries in the shmlog by tuning the shm_reclen parameter.
  • The management parameters listed in the CLI were not sorted, which made it hard to find the parameter you were looking for. They are now sorted, which should make this easier.
  • Add a new hashing type, "critbit", which uses a lock-less tree based lookup algorithm. This is experimental and should not be enabled in production environments without proper testing.
  • The session workspace had a default size of 8k. It is now 16k, which should make VCLs where many headers are processed less prone to panics.
  • We have seen that people seem to be confused as to which actions in the different VCL functions return and which ones don't. Add a new syntax return(action) to make this more explicit. The old syntax is still supported.
  • Varnish would return an error if any of the management IPs listed in the -T parameter could not be listened to. We now only return an error if none of them can be listened to.
  • In the case of the backend or client giving us too many parameters, we used to just ignore the overflowing headers. This is problematic if you end up ignoreing Content-Length, Transfer-Encoding and similar headers. We now give out a 400 error to the client if it sends us too many and 503 if we get too many from the backend.
  • We used panic if we got a too large chunked header. This behaviour has been changed into just failing the transaction.
  • Varnish now supports an extended purge method where it is possible to do purge req.http.host ~ "web1.com" && req.url ~ "\.png" and similar. See the documentation for details.
  • Under heavy load, Varnish would sometimes crash when trying to update the per-request statistics. This has now been fixed.
  • It is now possible to not save the hash string in the session and object workspace. This will save a lot of memory on sites with many small objects. Disabling the purge_hash parameter also disables the purge.hash facility.
  • Varnish now supports !~ as a "no match" regular expression matcher.
  • In some cases, you could get serialised access to "pass" objects. We now make it default to the default_ttl value; this can be overridden in vcl_fetch.
  • Varnish did not check the syntax of regsub calls properly. More checking has been added.
  • If the client closed the connection while Varnish was processing ESI elements, Varnish would crash while trying to write the object to the client. We now check if the client has closed the connection.
  • The ESI parser had a bug where it would crash if an XML comment would span storage segments. This has been fixed.

VCL Manual page --------------~

  • The documentation on how capturing parentheses work was wrong. This has been corrected.
  • Grace has now been documented.

varnishreplay

  • varnishreplay did not work correctly on Linux, due to a too small stack. This has now been fixed.

Changes from 2.0.1 to 2.0.2

varnishd

  • In high-load situations, when using ESI, varnishd would sometimes mishandle objects and crash. This has been worked around.

varnishreplay

  • varnishreplay did not work correctly on Linux, due to a too small stack. This has now been fixed.

Changes from 2.0 to 2.0.1

varnishd

  • When receiving a garbled HTTP request, varnishd would sometimes crash. This has been fixed.
  • There was an off-by-one error in the ACL compilation. Now fixed.

Red Hat spec file ----------------~

  • A typo in the spec file made the .rpm file names wrong.

Changes from 1.1.2 to 2.0

varnishd

  • Only look for sendfile on platforms where we know how to use it, which is FreeBSD for now.
  • Make it possible to adjust the shared memory log size and bump the size from 8MB to 80MB.
  • Fix up the handling of request bodies to better match what RFC2616 mandates. This makes PUT, DELETE, OPTIONS and TRACE work in addition to POST.
  • Change how backends are defined, to a constant structural defintion style. See https://www.varnish-cache.org/wiki/VclSyntaxChanges for the details.
  • Add directors, which wrap backends. Currently, there's a random director and a round-robin director.
  • Add "grace", which is for how long and object will be served, even after it has expired. To use this, both the object's and the request's grace parameter need to be set.
  • Manual pages have been updated for new VCL syntax and varnishd options.
  • Man pages and other docs have been updated.
  • The shared memory log file is now locked in memory, so it should not be paged out to disk.
  • We now handle Vary correctly, as well as Expect.
  • ESI include support is implemented.
  • Make it possible to limit how much memory the malloc uses.
  • Solaris is now supported.
  • There is now a regsuball function, which works like regsub except it replaces all occurrences of the regex, not just the first.
  • Backend and director declarations can have a .connect_timeout parameter, which tells us how long to wait for a successful connection.
  • It is now possible to select the acceptor to use by changing the acceptor parameter.
  • Backends can have probes associated with them, which can be checked with req.backend.health in VCL as well as being handled by directors which do load-balancing.
  • Support larger-than-2GB files also on 32 bit hosts. Please note that this does not mean we can support caches bigger than 2GB, it just means logfiles and similar can be bigger.
  • In some cases, we would remove the wrong header when we were stripping Content-Transfer-Encoding headers from a request. This has been fixed.
  • Backends can have a .max_connections associated with them.
  • On Linux, we need to set the dumpable bit on the child if we want core dumps. Make sure it's set.
  • Doing purge.hash() with an empty string would cause us to dump core. Fixed so we don't do that any more.
  • We ran into a problem with glibc's malloc on Linux where it seemed like it failed to ever give memory back to the OS, causing the system to swap. We have now switched to jemalloc which appears not to have this problem.
  • max_restarts was never checked, so we always ended up running out of workspace. Now, vcl_error is called when we reach max_restarts.

varnishtest

  • varnishtest is a tool to do correctness tests of varnishd. The test suite is run by using make check.

varnishtop

  • We now set the field widths dynamically based on the size of the terminal and the name of the longest field.

varnishstat

  • varnishstat -1 now displays the uptime too.

varnishncsa

  • varnishncsa now does fflush after each write. This makes tail -f work correctly, as well as avoiding broken lines in the log file.
  • It is possible to get varnishncsa to output the X-Forwarded-For instead of the client IP by passing -f to it.

Build system -----------~

  • Various sanity checks have been added to configure, it now complains about no ncurses or if SO_RCVTIMEO or SO_SNDTIMEO are non-functional. It also aborts if there's no working acceptor mechanism
  • The C compiler invocation is decided by the configure script and can now be overridden by passing VCC_CC when running configure.

Changes from 1.1.1 to 1.1.2

varnishd

  • When switching to a new VCL configuration, a race condition exists which may cause Varnish to reference a backend which no longer exists (see ticket #144). This race condition has not been entirely eliminated, but it should occur less frequently.
  • When dropping a TCP session before any requests were processed, an assertion would be triggered due to an uninitialized timestamp (see ticket #132). The timestamp is now correctly initialized.
  • Varnish will now correctly generate a Date: header for every response instead of copying the one it got from the backend (see ticket #157).
  • Comparisons in VCL which involve a non-existent string (usually a header which is not present in the request or object being processed) would cause a NULL pointer dereference; now the comparison will simply fail.
  • A bug in the VCL compiler which would cause a double-free when processing include directives has been fixed.
  • A resource leak in the worker thread management code has been fixed.
  • When connecting to a backend, Varnish will usually get the address from a cache. When the cache is refreshed, existing connections may end up with a reference to an address structure which no longer exists, resulting in a crash. This race condition has been somewhat mitigated, but not entirely eliminated (see ticket #144.)
  • Varnish will now pass the correct protocol version in pipe mode: the backend will get what the client sent, and vice versa.
  • The core of the pipe mode code has been rewritten to increase robustness and eliminate spurious error messages when either end closes the connection in a manner Varnish did not anticipate.
  • A memory leak in the backend code has been plugged.
  • When using the kqueue acceptor, if a client shuts down the request side of the connection (as many clients do after sending their final request), it was possible for the acceptor code to receive the EOF event and recycle the session while the last request was still being serviced, resulting in a assertion failure and a crash when the worker thread later tried to delete the session. This should no longer happen (see ticket #162.)
  • A mismatch between the recorded length of a cached object and the amount of data actually present in cache for that object can occasionally occur (see ticket #167.) This has been partially fixed, but may still occur for error pages generated by Varnish when a problem arises while retrieving an object from the backend.
  • Some socket-related system calls may return unexpected error codes when operating on a TCP connection that has been shut down at the other end. These error codes would previously cause assertion failures, but are now recognized as harmless conditions.

varnishhist

  • Pressing 0 though 9 while varnishhist is running will change the refresh interval to the corresponding power of two, in seconds.

varnishncsa

  • The varnishncsa tool can now daemonize and write a PID file like varnishlog, using the same command-line options. It will also reopen its output upon receipt of a SIGHUP if invoked with -w.

varnishstat

  • Pressing 0 though 9 while varnishstat is running will change the refresh interval to the corresponding power of two, in seconds.

Build system -----------~

  • Varnish's <queue.h> has been modified to avoid conflicts with <sys/queue.h> on platforms where the latter is included indirectly through system headers.
  • Several steps have been taken towards Solaris support, but this is not yet complete.
  • When configure was run without an explicit prefix, Varnish's idea of the default state directory would be garbage and a state directory would have to be specified manually with -n. This has been corrected.

Changes from 1.1 to 1.1.1

varnishd

  • The code required to allow VCL to read obj.status, which had accidentally been left out, has now been added.
  • Varnish will now always include a Connection: header in its reply to the client, to avoid possible misunderstandings.
  • A bug that triggered an assertion failure when generating synthetic error documents has been corrected.
  • A new VCL function, purge_url, provides the same functionality as the url.purge management command.
  • Previously, Varnish assumed that the response body should be sent only if the request method was GET. This was a problem for custom request methods (such as PURGE), so the logic has been changed to always send the response body except in the specific case of a HEAD request.
  • Changes to run-time parameters are now correctly propagated to the child process.
  • Due to the way run-time parameters are initialized at startup, varnishd previously required the nobody user and the nogroup group to exist even if a different user and group were specified on the command line. This has been corrected.
  • Under certain conditions, the VCL compiler would carry on after a syntax error instead of exiting after reporting the error. This has been corrected.
  • The manner in which the hash string is assembled has been modified to reduce memory usage and memory-to-memory copying.
  • Before calling vcl_miss, Varnish assembles a tentative request object for the backend request which will usually follow. This object would be leaked if vcl_miss returned anything else than fetch. This has been corrected.
  • The code necessary to handle an error return from vcl_fetch and vcl_deliver had inadvertantly been left out. This has been corrected.
  • Varnish no longer prints a spurious "child died" message (the result of reaping the compiler process) after compiling a new VCL configuration.
  • Under some circumstances, due to an error in the workspace management code, Varnish would lose the "tail" of a request, i.e. the part of the request that has been received from the client but not yet processed. The most obvious symptom of this was that POST requests would work with some browsers but not others, depending on details of the browser's HTTP implementation. This has been corrected.
  • On some platforms, due to incorrect assumptions in the CLI code, the management process would crash while processing commands received over the management port. This has been corrected.

Build system -----------~

  • The top-level Makefile will now honor $DESTDIR when creating the state directory.
  • The Debian and RedHat packages are now split into three (main / lib / devel) as is customary.
  • A number of compile-time and run-time portability issues have been addressed.
  • The autogen.sh script had workarounds for problems with the GNU autotools on FreeBSD; these are no longer needed and have been removed.
  • The libcompat library has been renamed to libvarnishcompat and is now dynamic rather than static. This simplifies the build process and resolves an issue with the Mac OS X linker.

Changes from 1.0.4 to 1.1

varnishd

  • Readability of the C source code generated from VCL code has been improved.
  • Equality (==) and inequality (!=) operators have been implemented for IP addresses (which previously could only be compared using ACLs).
  • The address of the listening socket on which the client connection was received is now available to VCL as the server.ip variable.
  • Each object's hash key is now computed based on a string which is available to VCL as req.hash. A VCL hook named vcl_hash has been added to allow VCL scripts to control hash generation (for instance, whether or not to include the value of the Host: header in the hash).
  • The setup code for listening sockets has been modified to detect and handle situations where a host name resolves to multiple IP addresses. It will now attempt to bind to each IP address separately, and report a failure only if none of them worked.
  • Network or protocol errors that occur while retrieving an object from a backend server now result in a synthetic error page being inserted into the cache with a 30-second TTL. This should help avoid driving an overburdened backend server into the ground by repeatedly requesting the same object.
  • The child process will now drop root privileges immediately upon startup. The user and group to use are specified with the user and group run-time parameters, which default to nobody and nogroup, respectively. Other changes have been made in an effort to increase the isolation between parent and child, and reduce the impact of a compromise of the child process.
  • Objects which are received from the backend with a Vary: header are now stored separately according to the values of the headers specified in Vary:. This allows Varnish to correctly cache e.g. compressed and uncompressed versions of the same object.
  • Each Varnish instance now has a name, which by default is the host name of the machine it runs on, but can be any string that would be valid as a relative or absolute directory name. It is used to construct the name of a directory in which the server state as well as all temporary files are stored. This makes it possible to run multiple Varnish instances on the same machine without conflict.
  • When invoked with the -C option, varnishd will now not just translate the VCL code to C, but also compile the C code and attempt to load the resulting shared object.
  • Attempts by VCL code to reference a variable outside its scope or to assign a value to a read-only variable will now result in compile-time rather than run-time errors.
  • The new command-line option -F will make varnishd run in the foreground, without enabling debugging.
  • New VCL variables have been introduced to allow inspection and manipulation of the request sent to the backend (bereq.request, bereq.url, bereq.proto and bereq.http) and the response to the client (resp.proto, resp.status, resp.response and resp.http).
  • Statistics from the storage code (including the amount of data and free space in the cache) are now available to varnishstat and other statistics-gathering tools.
  • Objects are now kept on an LRU list which is kept loosely up-to-date (to within a few seconds). When cache runs out, the objects at the tail end of the LRU list are discarded one by one until there is enough space for the freshly requested object(s). A VCL hook, vcl_discard, is allowed to inspect each object and determine its fate by returning either keep or discard.
  • A new VCL hook, vcl_deliver, provides a chance to adjust the response before it is sent to the client.
  • A new management command, vcl.show, displays the VCL source code of any loaded configuration.
  • A new VCL variable, now, provides VCL scripts with the current time in seconds since the epoch.
  • A new VCL variable, obj.lastuse, reflects the time in seconds since the object in question was last used.
  • VCL scripts can now add an HTTP header (or modify the value of an existing one) by assigning a value to the corresponding variable, and strip an HTTP header by using the remove keyword.
  • VCL scripts can now modify the HTTP status code of cached objects (obj.status) and responses (resp.status)
  • Numeric and other non-textual variables in VCL can now be assigned to textual variables; they will be converted as needed.
  • VCL scripts can now apply regular expression substitutions to textual variables using the regsub function.
  • A new management command, status, returns the state of the child.
  • Varnish will now build and run on Mac OS X.

varnishadm

  • This is a new utility which sends a single command to a Varnish server's management port and prints the result to stdout, greatly simplifying the use of the management port from scripts.

varnishhist

  • The user interface has been greatly improved; the histogram will be automatically rescaled and redrawn when the window size changes, and it is updated regularly rather than at a rate dependent on the amount of log data gathered. In addition, the name of the Varnish instance being watched is displayed in the upper right corner.

varnishncsa

  • In addition to client traffic, varnishncsa can now also process log data from backend traffic.
  • A bug that would cause varnishncsa to segfault when it encountered an empty HTTP header in the log file has been fixed.

varnishreplay

  • This new utility will attempt to recreate the HTTP traffic which resulted in the raw Varnish log data which it is fed.

varnishstat

  • Don't print lifetime averages when it doesn't make any sense, for instance, there is no point in dividing the amount in bytes of free cache space by the lifetime in seconds of the varnishd process.
  • The user interface has been greatly improved; varnishstat will no longer print more than fits in the terminal, and will respond correctly to window resize events. The output produced in one-shot mode has been modified to include symbolic names for each entry. In addition, the name of the Varnish instance being watched is displayed in the upper right corner in curses mode.

varnishtop

  • The user interface has been greatly improved; varnishtop will now respond correctly to window resize events, and one-shot mode (-1) actually works. In addition, the name of the Varnish instance being watched is displayed in the upper right corner in curses mode.

Changes from 1.0.3 to 1.0.4

varnishd

  • The request workflow has been redesigned to simplify request processing and eliminate code duplication. All codepaths which need to speak HTTP now share a single implementation of the protocol. Some new VCL hooks have been added, though they aren't much use yet. The only real user-visible change should be that Varnish now handles persistent backend connections correctly (see ticket #56).

  • Support for multiple listen addresses has been added.

  • An "include" facility has been added to VCL, allowing VCL code to pull in code fragments from multiple files.

  • Multiple definitions of the same VCL function are now concatenated into one in the order in which they appear in the source. This simplifies the mechanism for falling back to the built-in default for cases which aren't handled in custom code, and facilitates modularization.

  • The code used to format management command arguments before passing them on to the child process would underestimate the amount of space needed to hold each argument once quotes and special characters were properly escaped, resulting in a buffer overflow. This has been corrected.

  • The VCL compiler has been overhauled. Several memory leaks have been plugged, and error detection and reporting has been improved throughout. Parts of the compiler have been refactored to simplify future extension of the language.

  • A bug in the VCL compiler which resulted in incorrect parsing of the decrement (-=) operator has been fixed.

  • A new -C command-line option has been added which causes varnishd to compile the VCL code (either from a file specified with -f or the built-in default), print the resulting C code and exit.

  • When processing a backend response using chunked encoding, if a chunk header crosses a read buffer boundary, read additional bytes from the backend connection until the chunk header is complete.

  • A new ping_interval run-time parameter controls how often the management process checks that the worker process is alive.

  • A bug which would cause the worker process to dereference a NULL pointer and crash if the backend did not respond has been fixed.

  • In some cases, such as when they are used by AJAX applications to circumvent Internet Explorer's over-eager disk cache, it may be desirable to cache POST requests. However, the code path responsible for delivering objects from cache would only transmit the response body when replying to a GET request. This has been extended to also apply to POST.

    This should be revisited at a later date to allow VCL code to control whether the body is delivered.

  • Varnish now respects Cache-control: s-maxage, and prefers it to Cache-control: max-age if both are present.

    This should be revisited at a later date to allow VCL code to control which headers are used and how they are interpreted.

  • When loading a new VCL script, the management process will now load the compiled object to verify that it links correctly before instructing the worker process to load it.

  • A new -P command-line options has been added which causes varnishd to create a PID file.

  • The sendfile_threshold run-time parameter's default value has been set to infinity after a variety of sendfile()-related bugs were discovered on several platforms.

varnishlog

  • When grouping log entries by request, varnishlog attempts to collapse the log entry for a call to a VCL function with the log entry for the corresponding return from VCL. When two VCL calls were made in succession, varnishlog would incorrectly omit the newline between the two calls (see ticket #95).
  • New -D and -P command-line options have been added to daemonize and create a pidfile, respectively.
  • The flag that is raised upon reception of a SIGHUP has been marked volatile so it will not be optimized away by the compiler.

varnishncsa

  • The formatting callback has been largely rewritten for clarity, robustness and efficiency.

    If a request included a Host: header, construct and output an absolute URL. This makes varnishncsa output from servers which handle multiple virtual hosts far more useful.

  • The flag that is raised upon reception of a SIGHUP has been marked volatile so it will not be optimized away by the compiler.

Documentation

  • The documentation, especially the VCL documentation, has been greatly extended and improved.

Build system

  • The name and location of the curses or ncurses library is now correctly detected by the configure script instead of being hardcoded into affected Makefiles. This allows Varnish to build correctly on a wider range of platforms.
  • Compatibility shims for clock_gettime() are now correctly applied where needed, allowing Varnish to build on MacOS X.
  • The autogen.sh script will now correctly detect and warn about automake versions which are known not to work correctly.
varnish-4.1.1/doc/changes.rst0000644000201500234410000031503512652366721013034 00000000000000================================ Varnish Cache 4.1.1 (2016-01-28) ================================ * No code changes since 4.1.1-beta2. ====================================== Varnish Cache 4.1.1-beta2 (2016-01-22) ====================================== * Improvements to VCL temperature handling added. This opens for reliably deny warming a cooling VCL from a VMOD. Bugs fixed ---------- * 1802_ - Segfault after VCL change * 1825_ - Cannot Start Varnish After Just Restarting The Service * 1842_ - Handle missing waiting list gracefully. * 1845_ - Handle whitespace after floats in test fields .. _1802: https://www.varnish-cache.org/trac/ticket/1802 .. _1825: https://www.varnish-cache.org/trac/ticket/1825 .. _1842: https://www.varnish-cache.org/trac/ticket/1842 .. _1845: https://www.varnish-cache.org/trac/ticket/1845 ====================================== Varnish Cache 4.1.1-beta1 (2016-01-15) ====================================== Changes since 4.1.0: - Format of "ban.list" has changed slightly. - [varnishncsa] -w is now required when running deamonized. - [varnishncsa] Log format can now be read from file. - Port fields extracted from PROXY1 header now work as expected. - New VCL state "busy" introduced (mostly for vmod writers). - Last traces of varnishreplay removed. - If-Modified-Since is now ignored if we have If-None-Match. - Zero Content-Length is no longer sent on 304 responses. - vcl_dir and vmod_dir now accept a colon separated list of directories. - Nested includes starting with "./" are relative to the including VCL file now. Bugs fixed ---------- - 1763_ - Restart epoll_wait on EINTR error - 1788_ - ObjIter has terrible performance profile when busyobj != NULL - 1798_ - Varnish requests painfully slow with large files - 1816_ - Use a weak comparison function for If-None-Match - 1818_ - Allow grace-hits on hit-for-pass objects, [..] - 1821_ - Always slim private & pass objects after delivery. - 1823_ - Rush the objheader if there is a waiting list when it is deref'ed. - 1826_ - Ignore 0 Content-Lengths in 204 responses .. _1763: https://www.varnish-cache.org/trac/ticket/1763 .. _1788: https://www.varnish-cache.org/trac/ticket/1788 .. _1798: https://www.varnish-cache.org/trac/ticket/1798 .. _1816: https://www.varnish-cache.org/trac/ticket/1816 .. _1818: https://www.varnish-cache.org/trac/ticket/1818 .. _1821: https://www.varnish-cache.org/trac/ticket/1821 .. _1823: https://www.varnish-cache.org/trac/ticket/1823 .. _1826: https://www.varnish-cache.org/trac/ticket/1826 ================================ Varnish Cache 4.1.0 (2015-09-30) ================================ Changes since 4.1.0-beta1: - Documentation updates. - Stabilization fixes on testcase p00005.vtc. - Avoid compiler warning in zlib. - Bug 1792_: Avoid using fallocate() with -sfile on non-EXT4. .. _1792: https://www.varnish-cache.org/trac/ticket/1792 ====================================== Varnish Cache 4.1.0-beta1 (2015-09-11) ====================================== Changes since 4.1.0-tp1: - Redhat packaging files are now separate from the normal tree. - Client workspace overflow should now result in a 500 response instead of panic. - [varnishstat] -w option has been retired. - libvarnishapi release number is increased. - Body bytes sent on ESI subrequests with gzip are now counted correctly. - [vmod-std] Data type conversion functions now take additional fallback argument. Bugs fixed ---------- - 1777_ - Disable speculative Range handling on streaming transactions. - 1778_ - [varnishstat] Cast to integer to prevent negative values messing the statistics - 1781_ - Propagate gzip CRC upwards from nested ESI includes. - 1783_ - Align code with RFC7230 section 3.3.3 which allows POST without a body. .. _1777: https://www.varnish-cache.org/trac/ticket/1777 .. _1778: https://www.varnish-cache.org/trac/ticket/1778 .. _1781: https://www.varnish-cache.org/trac/ticket/1781 .. _1783: https://www.varnish-cache.org/trac/ticket/1783 ==================================== Varnish Cache 4.1.0-tp1 (2015-07-08) ==================================== Changes between 4.0 and 4.1 are numerous. Please read the upgrade section in the documentation for a general overview. ============================================ Changes from 4.0.3-rc3 to 4.0.3 (2015-02-17) ============================================ * No changes. ================================================ Changes from 4.0.3-rc2 to 4.0.3-rc3 (2015-02-11) ================================================ - Superseded objects are now expired immediately. Bugs fixed ---------- - 1462_ - Use first/last log entry in varnishncsa. - 1539_ - Avoid panic when expiry thread modifies a candidate object. - 1637_ - Fail the fetch processing if the vep callback failed. - 1665_ - Be more accurate when computing client RX_TIMEOUT. - 1672_ - Do not panic on unsolicited 304 response to non-200 bereq. .. _1462: https://www.varnish-cache.org/trac/ticket/1462 .. _1539: https://www.varnish-cache.org/trac/ticket/1539 .. _1637: https://www.varnish-cache.org/trac/ticket/1637 .. _1665: https://www.varnish-cache.org/trac/ticket/1665 .. _1672: https://www.varnish-cache.org/trac/ticket/1672 ================================================ Changes from 4.0.3-rc1 to 4.0.3-rc2 (2015-01-28) ================================================ Changes since 4.0.3-rc1: - Assorted documentation updates. Bugs fixed ---------- - 1479_ - Fix out-of-tree builds. - 1566_ - Escape VCL string question marks. - 1616_ - Correct header file placement. - 1620_ - Fail miss properly if out of backend threads. (Also 1621_) - 1628_ - Avoid dereferencing null in VBO_DerefBusyObj(). - 1629_ - Ditch rest of waiting list on failure to reschedule. - 1660_ - Don't attempt range delivery on a synth response .. _1479: https://www.varnish-cache.org/trac/ticket/1479 .. _1566: https://www.varnish-cache.org/trac/ticket/1578 .. _1616: https://www.varnish-cache.org/trac/ticket/1616 .. _1620: https://www.varnish-cache.org/trac/ticket/1620 .. _1621: https://www.varnish-cache.org/trac/ticket/1621 .. _1628: https://www.varnish-cache.org/trac/ticket/1628 .. _1629: https://www.varnish-cache.org/trac/ticket/1629 .. _1660: https://www.varnish-cache.org/trac/ticket/1660 ============================================ Changes from 4.0.2 to 4.0.3-rc1 (2015-01-15) ============================================ Changes since 4.0.2: - Support older autoconf (< 2.63b) (el5) - A lot of minor documentation fixes. - bereq.uncacheable is now read-only. - obj.uncacheable is now readable in vcl_deliver. - [varnishadm] Prefer exact matches for backend.set_healthy. Bug 1349_. - Hard-coded -sfile default size is removed. - [packaging] EL6 packages are once again built with -O2. - [parameter] fetch_chunksize default is reduced to 16KB. (from 128KB) - Added std.time() which converts strings to VCL_TIME. - [packaging] packages now Provide strictABI (gitref) and ABI (VRT major/minor) for VMOD use. Bugs fixed ---------- * 1378_ - Properly escape non-printable characters in varnishncsa. * 1596_ - Delay HSH_Complete() until the storage sanity functions has finished. * 1506_ - Keep Content-Length from backend if we can. * 1602_ - Fix a cornercase related to empty pass objects. * 1607_ - Don't leak reqs on failure to revive from waitinglist. * 1610_ - Update forgotten varnishlog example to 4.0 syntax. * 1612_ - Fix a cornercase related to empty pass objects. * 1623_ - Fix varnishhist -d segfault. * 1636_ - Outdated paragraph in Vary: documentation * 1638_ - Fix panic when retrying a failed backend fetch. * 1639_ - Restore the default SIGSEGV handler during pan_ic * 1647_ - Relax an assertion for the IMS update candidate object. * 1648_ - Avoid partial IMS updates to replace old object. * 1650_ - Collapse multiple X-Forwarded-For headers .. _1349: https://www.varnish-cache.org/trac/ticket/1349 .. _1378: https://www.varnish-cache.org/trac/ticket/1378 .. _1596: https://www.varnish-cache.org/trac/ticket/1596 .. _1506: https://www.varnish-cache.org/trac/ticket/1506 .. _1602: https://www.varnish-cache.org/trac/ticket/1602 .. _1607: https://www.varnish-cache.org/trac/ticket/1607 .. _1610: https://www.varnish-cache.org/trac/ticket/1610 .. _1612: https://www.varnish-cache.org/trac/ticket/1612 .. _1623: https://www.varnish-cache.org/trac/ticket/1623 .. _1636: https://www.varnish-cache.org/trac/ticket/1636 .. _1638: https://www.varnish-cache.org/trac/ticket/1638 .. _1639: https://www.varnish-cache.org/trac/ticket/1639 .. _1647: https://www.varnish-cache.org/trac/ticket/1647 .. _1648: https://www.varnish-cache.org/trac/ticket/1648 .. _1650: https://www.varnish-cache.org/trac/ticket/1650 ============================================ Changes from 4.0.2-rc1 to 4.0.2 (2014-10-08) ============================================ New since 4.0.2-rc1: - [varnishlog] -k argument is back. (exit after n records) - [varnishadm] vcl.show is now listed in help. ============================================ Changes from 4.0.1 to 4.0.2-rc1 (2014-09-23) ============================================ New since 4.0.1: - [libvmod-std] New function strstr() for matching substrings. - server.(hostname|identity) is now available in all VCL functions. - VCL variable type BYTES was added. - `workspace_client` default is now 9k. - [varnishstat] Update interval can now be subsecond. - Document that reloading VCL does not reload a VMOD. - Guru meditation page is now valid HTML5. - [varnishstat] hitrate calculation is back. - New parameter `group_cc` adds a GID to the grouplist of VCL compiler sandbox. - Parameter shm_reclen is now an alias for vsl_reclen. - Workspace overflows are now handled with a 500 client response. - VCL variable type added: HTTP, representing a HTTP header set. - It is now possible to return(synth) from vcl_deliver. - [varnishadm] vcl.show now has a -v option that output the complete set of VCL and included VCL files. - RHEL7 packaging (systemd) was added. - [libvmod-std] querysort() fixed parameter limit has been lifted. - Fix small memory leak in ESI parser. - Fix unreported race/assert in V1D_Deliver(). Bugs fixed ---------- * 1553_ - Fully reset workspace (incl. Vary state) before reusing it. * 1551_ - Handle workspace exhaustion during purge. * 1591_ - Group entries correctly in varnishtop. * 1592_ - Bail out on workspace exhaustion in VRT_IP_string. * 1538_ - Relax VMOD ABI check for release branches. * 1584_ - Don't log garbage/non-HTTP requests. [varnishncsa] * 1407_ - Don't rename VSM file until child has started. * 1466_ - Don't leak request structs on restart after waitinglist. * 1580_ - Output warning if started without -b and -f. [varnishd] * 1583_ - Abort on fatal sandbox errors on Solaris. (Related: 1572_) * 1585_ - Handle fatal sandbox errors. * 1572_ - Exit codes have been cleaned up. * 1569_ - Order of symbols should not influence compilation result. * 1579_ - Clean up type inference in VCL. * 1578_ - Don't count Age twice when computing new object TTL. * 1574_ - std.syslog() logged empty strings. * 1555_ - autoconf editline/readline build issue. * 1568_ - Skip NULL arguments when hashing. * 1567_ - Compile on systems without SO_SNDTIMEO/SO_RCVTIMEO. * 1512_ - Changes to bereq are lost between v_b_r and v_b_f. * 1563_ - Increase varnishtest read timeout. * 1561_ - Never call a VDP with zero length unless done. * 1562_ - Fail correctly when rereading a failed client request body. * 1521_ - VCL compilation fails on OSX x86_64. * 1547_ - Panic when increasing shm_reclen. * 1503_ - Document return(retry). * 1581_ - Don't log duplicate Begin records to shmlog. * 1588_ - Correct timestamps on pipelined requests. * 1575_ - Use all director backends when looking for a healthy one. * 1577_ - Read the full request body if shunted to synth. * 1532_ - Use correct VCL representation of reals. * 1531_ - Work around libedit bug in varnishadm. .. _1553: https://www.varnish-cache.org/trac/ticket/1553 .. _1551: https://www.varnish-cache.org/trac/ticket/1551 .. _1591: https://www.varnish-cache.org/trac/ticket/1591 .. _1592: https://www.varnish-cache.org/trac/ticket/1592 .. _1538: https://www.varnish-cache.org/trac/ticket/1538 .. _1584: https://www.varnish-cache.org/trac/ticket/1584 .. _1407: https://www.varnish-cache.org/trac/ticket/1407 .. _1466: https://www.varnish-cache.org/trac/ticket/1466 .. _1580: https://www.varnish-cache.org/trac/ticket/1580 .. _1583: https://www.varnish-cache.org/trac/ticket/1583 .. _1585: https://www.varnish-cache.org/trac/ticket/1585 .. _1572: https://www.varnish-cache.org/trac/ticket/1572 .. _1569: https://www.varnish-cache.org/trac/ticket/1569 .. _1579: https://www.varnish-cache.org/trac/ticket/1579 .. _1578: https://www.varnish-cache.org/trac/ticket/1578 .. _1574: https://www.varnish-cache.org/trac/ticket/1574 .. _1555: https://www.varnish-cache.org/trac/ticket/1555 .. _1568: https://www.varnish-cache.org/trac/ticket/1568 .. _1567: https://www.varnish-cache.org/trac/ticket/1567 .. _1512: https://www.varnish-cache.org/trac/ticket/1512 .. _1563: https://www.varnish-cache.org/trac/ticket/1563 .. _1561: https://www.varnish-cache.org/trac/ticket/1561 .. _1562: https://www.varnish-cache.org/trac/ticket/1562 .. _1521: https://www.varnish-cache.org/trac/ticket/1521 .. _1547: https://www.varnish-cache.org/trac/ticket/1547 .. _1503: https://www.varnish-cache.org/trac/ticket/1503 .. _1581: https://www.varnish-cache.org/trac/ticket/1581 .. _1588: https://www.varnish-cache.org/trac/ticket/1588 .. _1575: https://www.varnish-cache.org/trac/ticket/1575 .. _1577: https://www.varnish-cache.org/trac/ticket/1577 .. _1532: https://www.varnish-cache.org/trac/ticket/1532 .. _1531: https://www.varnish-cache.org/trac/ticket/1531 ======================================== Changes from 4.0.0 to 4.0.1 (2014-06-24) ======================================== New since 4.0.0: - New functions in vmod_std: real2time, time2integer, time2real, real. - Chunked requests are now supported. (pass) - Add std.querysort() that sorts GET query arguments. (from libvmod-boltsort) - Varnish will no longer reply with "200 Not Modified". - Backend IMS is now only attempted when last status was 200. - Packaging now uses find-provides instead of find-requires. [redhat] - Two new counters: n_purges and n_obj_purged. - Core size can now be set from /etc/sysconfig/varnish [redhat] - Via header set is now RFC compliant. - Removed "purge" keyword in VCL. Use return(purge) instead. - fallback director is now documented. - %D format flag in varnishncsa is now truncated to an integer value. - persistent storage backend is now deprecated. https://www.varnish-cache.org/docs/trunk/phk/persistent.html - Added format flags %I (total bytes received) and %O (total bytes sent) for varnishncsa. - python-docutils >= 0.6 is now required. - Support year (y) as a duration in VCL. - VMOD ABI requirements are relaxed, a VMOD no longer have to be run on the same git revision as it was compiled for. Replaced by a major/minor ABI counter. Bugs fixed ---------- * 1269_ - Use correct byte counters in varnishncsa when piping a request. * 1524_ - Chunked requests should be pipe-able. * 1530_ - Expire old object on successful IMS fetch. * 1475_ - time-to-first-byte in varnishncsa was potentially dishonest. * 1480_ - Porting guide for 4.0 is incomplete. * 1482_ - Inherit group memberships of -u specified user. * 1473_ - Fail correctly in configure when rst2man is not found. * 1486_ - Truncate negative Age values to zero. * 1488_ - Don't panic on high request rates. * 1489_ - req.esi should only be available in client threads. * 1490_ - Fix thread leak when reducing number of threads. * 1491_ - Reorder backend connection close procedure to help test cases. * 1498_ - Prefix translated VCL names to avoid name clashes. * 1499_ - Don't leak an objcore when HSH_Lookup returns expired object. * 1493_ - vcl_purge can return synth or restart. * 1476_ - Cope with systems having sys/endian.h and endian.h. * 1496_ - varnishadm should be consistent in argv ordering. * 1494_ - Don't panic on VCL-initiated retry after a backend 500 error. * 1139_ - Also reset keep (for IMS) time when purging. * 1478_ - Avoid panic when delivering an object that expires during delivery. * 1504_ - ACLs can be unreferenced with vcc_err_unref=off set. * 1501_ - Handle that a director couldn't pick a backend. * 1495_ - Reduce WRK_SumStat contention. * 1510_ - Complain on symbol reuse in VCL. * 1514_ - Document storage.NAME.free_space and .used_space [docs] * 1518_ - Suppress body on 304 response when using ESI. * 1519_ - Round-robin director does not support weight. [docs] .. _1269: https://www.varnish-cache.org/trac/ticket/1269 .. _1524: https://www.varnish-cache.org/trac/ticket/1524 .. _1530: https://www.varnish-cache.org/trac/ticket/1530 .. _1475: https://www.varnish-cache.org/trac/ticket/1475 .. _1480: https://www.varnish-cache.org/trac/ticket/1480 .. _1482: https://www.varnish-cache.org/trac/ticket/1482 .. _1473: https://www.varnish-cache.org/trac/ticket/1473 .. _1486: https://www.varnish-cache.org/trac/ticket/1486 .. _1488: https://www.varnish-cache.org/trac/ticket/1488 .. _1489: https://www.varnish-cache.org/trac/ticket/1489 .. _1490: https://www.varnish-cache.org/trac/ticket/1490 .. _1491: https://www.varnish-cache.org/trac/ticket/1491 .. _1498: https://www.varnish-cache.org/trac/ticket/1498 .. _1499: https://www.varnish-cache.org/trac/ticket/1499 .. _1493: https://www.varnish-cache.org/trac/ticket/1493 .. _1476: https://www.varnish-cache.org/trac/ticket/1476 .. _1496: https://www.varnish-cache.org/trac/ticket/1496 .. _1494: https://www.varnish-cache.org/trac/ticket/1494 .. _1139: https://www.varnish-cache.org/trac/ticket/1139 .. _1478: https://www.varnish-cache.org/trac/ticket/1478 .. _1504: https://www.varnish-cache.org/trac/ticket/1504 .. _1501: https://www.varnish-cache.org/trac/ticket/1501 .. _1495: https://www.varnish-cache.org/trac/ticket/1495 .. _1510: https://www.varnish-cache.org/trac/ticket/1510 .. _1518: https://www.varnish-cache.org/trac/ticket/1518 .. _1519: https://www.varnish-cache.org/trac/ticket/1519 ============================================== Changes from 4.0.0 beta1 to 4.0.0 (2014-04-10) ============================================== New since 4.0.0-beta1: - improved varnishstat documentation. - In VCL, req.backend_hint is available in vcl_hit - ncurses is now a dependency. Bugs fixed ---------- * 1469_ - Fix build error on PPC * 1468_ - Set ttl=0 on failed objects * 1462_ - Handle duplicate ReqURL in varnishncsa. * 1467_ - Fix missing clearing of oc->busyobj on HSH_Fail. .. _1469: https://www.varnish-cache.org/trac/ticket/1469 .. _1468: https://www.varnish-cache.org/trac/ticket/1468 .. _1462: https://www.varnish-cache.org/trac/ticket/1462 .. _1467: https://www.varnish-cache.org/trac/ticket/1467 ================================================== Changes from 4.0.0 TP2 to 4.0.0 beta1 (2014-03-27) ================================================== New since TP2: - Previous always-appended code called default.vcl is now called builtin.vcl. The new example.vcl is recommended as a starting point for new users. - vcl_error is now called vcl_synth, and does not any more mandate closing the client connection. - New VCL function vcl_backend_error, where you can change the 503 prepared if all your backends are failing. This can then be cached as a regular object. - Keyword "remove" in VCL is replaced by "unset". - new timestamp and accounting records in varnishlog. - std.timestamp() is introduced. - stored objects are now read only, meaning obj.hits now counts per objecthead instead. obj.lastuse saw little use and has been removed. - builtin VCL now does return(pipe) for chunked POST and PUT requests. - python-docutils and rst2man are now build requirements. - cli_timeout is now 60 seconds to avoid slaughtering the child process in times of high IO load/scheduling latency. - return(purge) from vcl_recv is now valid. - return(hash) is now the default return action from vcl_recv. - req.backend is now req.backend_hint. beresp.storage is beresp.storage_hint. Bugs fixed ---------- * 1460_ - tools now use the new timestamp format. * 1450_ - varnishstat -l segmentation fault. * 1320_ - Work around Content-Length: 0 and Content-Encoding: gzip gracefully. * 1458_ - Panic on busy object. * 1417_ - Handle return(abandon) in vcl_backend_response. * 1455_ - vcl_pipe now sets Connection: close by default on backend requests. * 1454_ - X-Forwarded-For is now done in C, before vcl_recv is run. * 1436_ - Better explanation when missing an import in VCL. * 1440_ - Serve ESI-includes from a different backend. * 1441_ - Incorrect grouping when logging ESI subrequests. * 1434_ - std.duration can now do ms/milliseconds. * 1419_ - Don't put objcores on the ban list until they go non-BUSY. * 1405_ - Ban lurker does not always evict all objects. .. _1460: https://www.varnish-cache.org/trac/ticket/1460 .. _1450: https://www.varnish-cache.org/trac/ticket/1450 .. _1320: https://www.varnish-cache.org/trac/ticket/1320 .. _1458: https://www.varnish-cache.org/trac/ticket/1458 .. _1417: https://www.varnish-cache.org/trac/ticket/1417 .. _1455: https://www.varnish-cache.org/trac/ticket/1455 .. _1454: https://www.varnish-cache.org/trac/ticket/1454 .. _1436: https://www.varnish-cache.org/trac/ticket/1436 .. _1440: https://www.varnish-cache.org/trac/ticket/1440 .. _1441: https://www.varnish-cache.org/trac/ticket/1441 .. _1434: https://www.varnish-cache.org/trac/ticket/1434 .. _1419: https://www.varnish-cache.org/trac/ticket/1419 .. _1405: https://www.varnish-cache.org/trac/ticket/1405 ================================================ Changes from 4.0.0 TP1 to 4.0.0 TP2 (2014-01-23) ================================================ 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. * 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.7-rc1 to 3.0.7 (2015-03-23) ============================================ - No changes. ============================================ Changes from 3.0.6 to 3.0.7-rc1 (2015-03-18) ============================================ - Requests with multiple Content-Length headers will now fail. - Stop recognizing a single CR (\r) as a HTTP line separator. This opened up a possible cache poisioning attack in stacked installations where sslterminator/varnish/backend had different CR handling. - Improved error detection on master-child process communication, leading to faster recovery (child restart) if communication loses sync. - Fix a corner-case where Content-Length was wrong for HTTP 1.0 clients, when using gzip and streaming. Bug 1627_. - More robust handling of hop-by-hop headers. - [packaging] Coherent Redhat pidfile in init script. Bug 1690_. - Avoid memory leak when adding bans. .. _1627: http://varnish-cache.org/trac/ticket/1627 .. _1690: http://varnish-cache.org/trac/ticket/1690 =========================================== Changes from 3.0.6rc1 to 3.0.6 (2014-10-16) =========================================== - Minor changes to documentation. - [varnishadm] Add termcap workaround for libedit. Bug 1531_. =========================================== Changes from 3.0.5 to 3.0.6rc1 (2014-06-24) =========================================== - Document storage..* VCL variables. Bug 1514_. - Fix memory alignment panic when http_max_hdr is not a multiple of 4. Bug 1327_. - Avoid negative ReqEnd timestamps with ESI. Bug 1297_. - %D format for varnishncsa is now an integer (as documented) - Fix compile errors with clang. - Clear objectcore flags earlier in ban lurker to avoid spinning thread. Bug 1470_. - Patch embedded jemalloc to avoid segfault. Bug 1448_. - Allow backend names to start with if, include or else. Bug 1439_. - Stop handling gzip after gzip body end. Bug 1086_. - Document %D and %T for varnishncsa. .. _1514: https://www.varnish-cache.org/trac/ticket/1514 .. _1327: https://www.varnish-cache.org/trac/ticket/1327 .. _1297: https://www.varnish-cache.org/trac/ticket/1297 .. _1470: https://www.varnish-cache.org/trac/ticket/1470 .. _1448: https://www.varnish-cache.org/trac/ticket/1448 .. _1439: https://www.varnish-cache.org/trac/ticket/1439 .. _1086: https://www.varnish-cache.org/trac/ticket/1086 ============================================= Changes from 3.0.5 rc 1 to 3.0.5 (2013-12-02) ============================================= 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: https://www.varnish-cache.org/trac/ticket/1376 ================================ 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: https://www.varnish-cache.org/trac/ticket/1287 .. _bug #1272: https://www.varnish-cache.org/trac/ticket/1272 .. _bug #1367: https://www.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: https://www.varnish-cache.org/trac/ticket/1325 varnishadm ---------- - Handle input from stdin properly. `Bug #1314` .. _bug #1314: https://www.varnish-cache.org/trac/ticket/1314 ============================================= Changes from 3.0.4 rc 1 to 3.0.4 (2013-06-14) ============================================= varnishd -------- - Set the waiter pipe as non-blocking and record overflows. `Bug #1285` - Fix up a bug in the ACL compile code that could lead to false negatives. CVE-2013-4090. `Bug #1312` - Return an error if the client sends multiple Host headers. .. _bug #1285: https://www.varnish-cache.org/trac/ticket/1285 .. _bug #1312: https://www.varnish-cache.org/trac/ticket/1312 ================================ Changes from 3.0.3 to 3.0.4 rc 1 ================================ varnishd -------- - Fix error handling when uncompressing fetched objects for ESI processing. `Bug #1184` - Be clearer about which timeout was reached in logs. - Correctly decrement n_waitinglist counter. `Bug #1261` - Turn off Nagle/set TCP_NODELAY. - Avoid panic on malformed Vary headers. `Bug #1275` - Increase the maximum length of backend names. `Bug #1224` - Add support for banning on http.status. `Bug #1076` - Make hit-for-pass correctly prefer the transient storage. .. _bug #1076: https://www.varnish-cache.org/trac/ticket/1076 .. _bug #1184: https://www.varnish-cache.org/trac/ticket/1184 .. _bug #1224: https://www.varnish-cache.org/trac/ticket/1224 .. _bug #1261: https://www.varnish-cache.org/trac/ticket/1261 .. _bug #1275: https://www.varnish-cache.org/trac/ticket/1275 varnishlog ---------- - If -m, but neither -b or -c is given, assume both. This filters out a lot of noise when -m is used to filter. `Bug #1071` .. _bug #1071: https://www.varnish-cache.org/trac/ticket/1071 varnishadm ---------- - Improve tab completion and require libedit/readline to build. varnishtop ---------- - Reopen log file if Varnish is restarted. varnishncsa ----------- - Handle file descriptors above 64k (by ignoring them). Prevents a crash in some cases with corrupted shared memory logs. - Add %D and %T support for more timing information. Other ----- - Documentation updates. - Fixes for OSX - Disable PCRE JIT-er, since it's broken in some PCRE versions, at least on i386. - Make libvarnish prefer exact hits when looking for VSL tags. ======================================== Changes from 3.0.2 to 3.0.3 (2012-08-20) ======================================== varnishd -------- - Fix a race on the n_sess counter. This race made varnish do excessive session workspace allocations. `Bug #897`_. - Fix some crashes in the gzip code when it runs out of memory. `Bug #1037`_. `Bug #1043`_. `Bug #1044`_. - Fix a bug where the regular expression parser could end up in an infinite loop. `Bug #1047`_. - Fix a memory leak in the regex code. - DNS director now uses port 80 by default if not specified. - Introduce `idle_send_timeout` and increase default value for `send_timeout` to 600s. This allows a long send timeout for slow clients while still being able to disconnect idle clients. - Fix an issue where did not remove HTML comments. `Bug #1092`_. - Fix a crash when passing with streaming on. - Fix a crash in the idle session timeout code. - Fix an issue where the poll waiter did not timeout clients if all clients were idle. `Bug #1023`_. - Log regex errors instead of crashing. - Introduce `pcre_match_limit`, and `pcre_match_limit_recursion` parameters. - Add CLI commands to manually control health state of a backend. - Fix an issue where the s_bodybytes counter is not updated correctly on gunzipped delivery. - Fix a crash when we couldn't allocate memory for a fetched object. `Bug #1100`_. - Fix an issue where objects could end up in the transient store with a long TTL, when memory could not be allocated for them in the requested store. `Bug #1140`_. - Activate req.hash_ignore_busy when req.hash_always_miss is activated. `Bug #1073`_. - Reject invalid tcp port numbers for listen address. `Bug #1035`_. - Enable JIT for better performing regular expressions. `Bug #1080`_. - Return VCL errors in exit code when using -C. `Bug #1069`_. - Stricter validation of acl syntax, to avoid a crash with 5-octet IPv4 addresses. `Bug #1126`_. - Fix a crash when first argument to regsub was null. `Bug #1125`_. - Fix a case where varnish delivered corrupt gzip content when using ESI. `Bug #1109`_. - Fix a case where varnish didn't remove the old Date header and served it alongside the varnish-generated Date header. `Bug #1104`_. - Make saint mode work, for the case where we have no object with that hash. `Bug #1091`_. - Don't save the object body on hit-for-pass objects. - n_ban_gone counter added to count the number of "gone" bans. - Ban lurker rewritten to properly sleep when no bans are present, and otherwise to process the list at the configured speed. - Fix a case where varnish delivered wrong content for an uncompressed page with compressed ESI child. `Bug #1029`_. - Fix an issue where varnish runs out of thread workspace when processing many ESI includes on an object. `Bug #1038`_. - Fix a crash when streaming was enabled for an empty body. - Better error reporting for some fetch errors. - Small performance optimizations. .. _bug #897: https://www.varnish-cache.org/trac/ticket/897 .. _bug #1023: https://www.varnish-cache.org/trac/ticket/1023 .. _bug #1029: https://www.varnish-cache.org/trac/ticket/1029 .. _bug #1023: https://www.varnish-cache.org/trac/ticket/1023 .. _bug #1035: https://www.varnish-cache.org/trac/ticket/1035 .. _bug #1037: https://www.varnish-cache.org/trac/ticket/1037 .. _bug #1038: https://www.varnish-cache.org/trac/ticket/1038 .. _bug #1043: https://www.varnish-cache.org/trac/ticket/1043 .. _bug #1044: https://www.varnish-cache.org/trac/ticket/1044 .. _bug #1047: https://www.varnish-cache.org/trac/ticket/1047 .. _bug #1069: https://www.varnish-cache.org/trac/ticket/1069 .. _bug #1073: https://www.varnish-cache.org/trac/ticket/1073 .. _bug #1080: https://www.varnish-cache.org/trac/ticket/1080 .. _bug #1091: https://www.varnish-cache.org/trac/ticket/1091 .. _bug #1092: https://www.varnish-cache.org/trac/ticket/1092 .. _bug #1100: https://www.varnish-cache.org/trac/ticket/1100 .. _bug #1104: https://www.varnish-cache.org/trac/ticket/1104 .. _bug #1109: https://www.varnish-cache.org/trac/ticket/1109 .. _bug #1125: https://www.varnish-cache.org/trac/ticket/1125 .. _bug #1126: https://www.varnish-cache.org/trac/ticket/1126 .. _bug #1140: https://www.varnish-cache.org/trac/ticket/1140 varnishncsa ----------- - Support for \t\n in varnishncsa format strings. - Add new format: %{VCL_Log:foo}x which output key:value from std.log() in VCL. - Add user-defined date formatting, using %{format}t. varnishtest ----------- - resp.body is now available for inspection. - Make it possible to test for the absence of an HTTP header. `Bug #1062`_. - Log the full panic message instead of shortening it to 512 characters. .. _bug #1062: https://www.varnish-cache.org/trac/ticket/1062 varnishstat ----------- - Add json output (-j). Other ----- - Documentation updates. - Bump minimum number of threads to 50 in RPM packages. - RPM packaging updates. - Fix some compilation warnings on Solaris. - Fix some build issues on Open/Net/DragonFly-BSD. - Fix build on FreeBSD 10-current. - Fix libedit detection on \*BSD OSes. `Bug #1003`_. .. _bug #1003: https://www.varnish-cache.org/trac/ticket/1003 ============================================= Changes from 3.0.2 rc 1 to 3.0.2 (2011-10-26) ============================================= varnishd -------- - Make the size of the synthetic object workspace equal to `http_resp_size` and add workaround to avoid a crash when setting too long response strings for synthetic objects. - Ensure the ban lurker always sleeps the advertised 1 second when it does not have anything to do. - Remove error from `vcl_deliver`. Previously this would assert while it will now give a syntax error. varnishncsa ----------- - Add default values for some fields when logging incomplete records and document the default values. Other ----- - Documentation updates - Some Solaris portability updates. ============================================= Changes from 3.0.1 to 3.0.2 rc 1 (2011-10-06) ============================================= varnishd -------- - Only log the first 20 bytes of extra headers to prevent overflows. - Fix crasher bug which sometimes happened if responses are queued and the backend sends us Vary. `Bug #994`_. - Log correct size of compressed when uncompressing them for clients that do not support compression. `Bug #996`_. - Only send Range responses if we are going to send a body. `Bug #1007`_. - When varnishd creates a storage file, also unlink it to avoid leaking disk space over time. `Bug #1008`_. - The default size of the `-s file` parameter has been changed to 100MB instead of 50% of the available disk space. - The limit on the number of objects we remove from the cache to make room for a new one was mistakenly lowered to 10 in 3.0.1. This has been raised back to 50. `Bug #1012`_. - `http_req_size` and `http_resp_size` have been increased to 8192 bytes. This better matches what other HTTPds have. `Bug #1016`_. .. _bug #994: https://www.varnish-cache.org/trac/ticket/994 .. _bug #992: https://www.varnish-cache.org/trac/ticket/992 .. _bug #996: https://www.varnish-cache.org/trac/ticket/996 .. _bug #1007: https://www.varnish-cache.org/trac/ticket/1007 .. _bug #1008: https://www.varnish-cache.org/trac/ticket/1008 .. _bug #1012: https://www.varnish-cache.org/trac/ticket/1012 .. _bug #1016: https://www.varnish-cache.org/trac/ticket/1016 VCL --- - Allow relational comparisons of floating point types. - Make it possible for vmods to fail loading and so cause the VCL loading to fail. varnishncsa ----------- - Fixed crash when client was sending illegal HTTP headers. - `%{Varnish:handling}` in format strings was broken, this has been fixed. Other ----- - Documentation updates - Some Solaris portability updates. ============================================= Changes from 3.0.1 rc 1 to 3.0.1 (2011-08-30) ============================================= varnishd -------- - Fix crash in streaming code. - Add `fallback` director, as a variant of the `round-robin` director. - The parameter `http_req_size` has been reduced on 32 bit machines. VCL --- - Disallow error in the `vcl_init` and `vcl_fini` VCL functions. varnishncsa ----------- - Fixed crash when using `-X`. - Fix error when the time to first byte was in the format string. Other ----- - Documentation updates ============================================= Changes from 3.0.0 to 3.0.1 rc 1 (2011-08-24) ============================================= varnishd -------- - Avoid sending an empty end-chunk when sending bodyless responsed. - `http_resp_hdr_len` and `http_req_hdr_len` were set to too low values leading to clients receiving `HTTP 400 Bad Request` errors. The limit has been increased and the error code is now `HTTP 413 Request entity too large`. - Objects with grace or keep set were mistakenly considered as candidates for the transient storage. They now have their grace and keep limited to limit the memory usage of the transient stevedore. - If a request was restarted from `vcl_miss` or `vcl_pass` it would crash. This has been fixed. `Bug #965`_. - Only the first few clients waiting for an object from the backend would be woken up when object arrived and this lead to some clients getting stuck for a long time. This has now been fixed. `Bug #963`_. - The `hash` and `client` directors would mistakenly retry fetching an object from the same backend unless health probes were enabled. This has been fixed and it will now retry a different backend. .. _bug #965: https://www.varnish-cache.org/trac/ticket/965 .. _bug #963: https://www.varnish-cache.org/trac/ticket/963 VCL --- - Request specific variables such as `client.*` and `server.*` are now correctly marked as not available in `vcl_init` and `vcl_fini`. - The VCL compiler would fault if two IP comparisons were done on the same line. This now works correctly. `Bug #948`_. .. _bug #948: https://www.varnish-cache.org/trac/ticket/948 varnishncsa ----------- - Add support for logging arbitrary request and response headers. - Fix crashes if `hitmiss` and `handling` have not yet been set. - Avoid printing partial log lines if there is an error in a format string. - Report user specified format string errors better. varnishlog ---------- - `varnishlog -r` now works correctly again and no longer opens the shared log file of the running Varnish. Other ----- - Various documentation updates. - Minor compilation fixes for newer compilers. - A bug in the ESI entity replacement parser has been fixed. `Bug #961`_. - The ABI of vmods are now checked. This will require a rebuild of all vmods against the new version of Varnish. .. _bug #961: https://www.varnish-cache.org/trac/ticket/961 ============================================= Changes from 3.0 beta 2 to 3.0.0 (2011-06-16) ============================================= varnishd -------- - Avoid sending an empty end-chunk when sending bodyless responsed. VCL --- - The `synthetic` keyword has now been properly marked as only available in `vcl_deliver`. `Bug #936`_. .. _bug #936: https://www.varnish-cache.org/trac/ticket/936 varnishadm ---------- - Fix crash if the secret file was unreadable. `Bug #935`_. - Always exit if `varnishadm` can't connect to the backend for any reason. .. _bug #935: https://www.varnish-cache.org/trac/ticket/935 ===================================== Changes from 3.0 beta 1 to 3.0 beta 2 ===================================== varnishd -------- - thread_pool_min and thread_pool_max now each refer to the number of threads per pool, rather than being inconsistent as they were before. - 307 Temporary redirect is now considered cacheable. `Bug #908`_. - The `stats` command has been removed from the CLI interface. With the new counters, it would mean implementing more and more of varnishstat in the master CLI process and the CLI is single-threaded so we do not want to do this work there in the first place. Use varnishstat instead. .. _bug #908: https://www.varnish-cache.org/trac/ticket/908 VCL --- - VCL now treats null arguments (unset headers for instance) as empty strings. `Bug #913`_. - VCL now has vcl_init and vcl_fini functions that are called when a given VCL has been loaded and unloaded. - There is no longer any interpolation of the right hand side in bans where the ban is a single string. This was confusing and you now have to make sure bits are inside or outside string context as appropriate. - Varnish is now stricter in enforcing no duplication of probes, backends and ACLs. .. _bug #913: https://www.varnish-cache.org/trac/ticket/913 varnishncsa ----------- - varnishncsa now ignores piped requests, since we have no way of knowing their return status. VMODs ----- - The std module now has proper documentation, including a manual page ================================ Changes from 2.1.5 to 3.0 beta 1 ================================ Upcoming changes ---------------- - The interpretation of bans will change slightly between 3.0 beta 1 and 3.0 release. Currently, doing ``ban("req.url == req.url")`` will cause the right hand req.url to be interpreted in the context of the request creating the ban. This will change so you will have to do ``ban("req.url == " + req.url)`` instead. This syntax already works and is recommended. varnishd -------- - Add streaming on ``pass`` and ``miss``. This is controlled by the ``beresp.do_stream`` boolean. This includes support for compression/uncompression. - Add support for ESI and gzip. - Handle objects larger than 2G. - HTTP Range support is now enabled by default - The ban lurker is enabled by default - if there is a backend or director with the name ``default``, use that as the default backend, otherwise use the first one listed. - Add many more stats counters. Amongst those, add per storage backend stats and per-backend statistics. - Syslog the platform we are running on - The ``-l`` (shared memory log file) argument has been changed, please see the varnishd manual for the new syntax. - The ``-S`` and ``-T`` arguments are now stored in the shmlog - Fix off-by-one error when exactly filling up the workspace. `Bug #693`_. - Make it possible to name storage backends. The names have to be unique. - Update usage output to match the code. `Bug #683`_ - Add per-backend health information to shared memory log. - Always recreate the shared memory log on startup. - Add a ``vcl_dir`` parameter. This is used to resolve relative path names for ``vcl.load`` and ``include`` in .vcl files. - Make it possible to specify ``-T :0``. This causes varnishd to look for a free port automatically. The port is written in the shared memory log so varnishadm can find it. - Classify locks into kinds and collect stats for each kind, recording the data in the shared memory log. - Auto-detect necessary flags for pthread support and ``VCC_CC`` flags. This should make Varnish somewhat happier on Solaris. `Bug #663`_ - The ``overflow_max`` parameter has been renamed to ``queue_max``. - If setting a parameter fails, report which parameter failed as this is not obvious during startup. - Add a parameter named ``shortlived``. Objects whose TTL is less than the parameter go into transient (malloc) storage. - Reduce the default ``thread_add_delay`` to 2ms. - The ``max_esi_includes`` parameter has been renamed to ``max_esi_depth``. - Hash string components are now logged by default. - The default connect timeout parameter has been increased to 0.7 seconds. - The ``err_ttl`` parameter has been removed and is replaced by a setting in default.vcl. - The default ``send_timeout`` parameter has been reduced to 1 minute. - The default ``ban_lurker`` sleep has been set to 10ms. - When an object is banned, make sure to set its grace to 0 as well. - Add ``panic.show`` and ``panic.clear`` CLI commands. - The default ``http_resp_hdr_len`` and ``http_req_hdr_len`` has been increased to 2048 bytes. - If ``vcl_fetch`` results in ``restart`` or ``error``, close the backend connection rather than fetching the object. - If allocating storage for an object, try reducing the chunk size before evicting objects to make room. `Bug #880`_ - Add ``restart`` from ``vcl_deliver``. `Bug #411`_ - Fix an off-by-up-to-one-minus-epsilon bug where if an object from the backend did not have a last-modified header we would send out a 304 response which did include a ``Last-Modified`` header set to when we received the object. However, we would compare the timestamp to the fractional second we got the object, meaning any request with the exact timestamp would get a ``200`` response rather than the correct ``304``. - Fix a race condition in the ban lurker where a serving thread and the lurker would both look at an object at the same time, leading to Varnish crashing. - If a backend sends a ``Content-Length`` header and we are streaming and we are not uncompressing it, send the ``Content-Length`` header on, allowing browsers to diplay a progress bar. - All storage must be at least 1M large. This is to prevent administrator errors when specifying the size of storage where the admin might have forgotten to specify units. .. _bug #693: https://www.varnish-cache.org/trac/ticket/693 .. _bug #683: https://www.varnish-cache.org/trac/ticket/683 .. _bug #663: https://www.varnish-cache.org/trac/ticket/663 .. _bug #880: https://www.varnish-cache.org/trac/ticket/880 .. _bug #411: https://www.varnish-cache.org/trac/ticket/411 .. _bug #693: https://www.varnish-cache.org/trac/ticket/693 Tools ----- common ****** - Add an ``-m $tag:$regex`` parameter, used for selecting some transactions. The parameter can be repeated, in which case it is logically and-ed together. varnishadm ********** - varnishadm will now pick up the -S and -T arguments from the shared memory log, meaning just running it without any arguments will connect to the running varnish. `Bug #875`_ - varnishadm now accepts an -n argument to specify the location of the shared memory log file - add libedit support .. _bug #875: https://www.varnish-cache.org/trac/ticket/875 varnishstat *********** - reopen shared memory log if the varnishd process is restarted. - Improve support for selecting some, but not all fields using the ``-f`` argument. Please see the documentation for further details on the use of ``-f``. - display per-backend health information varnishncsa *********** - Report error if called with ``-i`` and ``-I`` as they do not make any sense for varnishncsa. - Add custom log formats, specified with ``-F``. Most of the Apache log formats are supported, as well as some Varnish-specific ones. See the documentation for further information. `Bug #712`_ and `bug #485`_ .. _bug #712: https://www.varnish-cache.org/trac/ticket/712 .. _bug #485: https://www.varnish-cache.org/trac/ticket/485 varnishtest *********** - add ``-l`` and ``-L`` switches which leave ``/tmp/vtc.*`` behind on error and unconditionally respectively. - add ``-j`` parameter to run tests in parallell and use this by default. varnishtop ********** - add ``-p $period`` parameter. The units in varnishtop were previously undefined, they are now in requests/period. The default period is 60 seconds. varnishlog ********** - group requests by default. This can be turned off by using ``-O`` - the ``-o`` parameter is now a no-op and is ignored. VMODs ----- - Add a std vmod which includes a random function, log, syslog, fileread, collect, VCL --- - Change string concatenation to be done using ``+`` rather than implicitly. - Stop using ``%xx`` escapes in VCL strings. - Change ``req.hash += value`` to ``hash_data(value)`` - Variables in VCL now have distinct read/write access - ``bereq.connect_timeout`` is now available in ``vcl_pipe``. - Make it possible to declare probes outside of a director. Please see the documentation on how to do this. - The VCL compiler has been reworked greatly, expanding its abilities with regards to what kinds of expressions it understands. - Add ``beresp.backend.name``, ``beresp.backend.ip`` and ``beresp.backend.port`` variables. They are only available from ``vcl_fetch`` and are read only. `Bug #481`_ - The default VCL now calls pass for any objects where ``beresp.http.Vary == "*"``. `Bug #787`_ - The ``log`` keyword has been moved to the ``std`` vmod. - It is now possible to choose which storage backend to be used - Add variables ``storage.$name.free_space``, ``storage.$name.used_space`` and ``storage.$name.happy`` - The variable ``req.can_gzip`` tells us whether the client accepts gzipped objects or not. - ``purge`` is now called ``ban``, since that is what it really is and has always been. - ``req.esi_level`` is now available. `Bug #782`_ - esi handling is now controlled by the ``beresp.do_esi`` boolean rather than the ``esi`` function. - ``beresp.do_gzip`` and ``beresp.do_gunzip`` now control whether an uncompressed object should be compressed and a compressed object should be uncompressed in the cache. - make it possible to control compression level using the ``gzip_level`` parameter. - ``obj.cacheable`` and ``beresp.cacheable`` have been removed. Cacheability is now solely through the ``beresp.ttl`` and ``beresp.grace`` variables. - setting the ``obj.ttl`` or ``beresp.ttl`` to zero now also sets the corresponding grace to zero. If you want a non-zero grace, set grace after setting the TTL. - ``return(pass)`` in ``vcl_fetch`` has been renamed to ``return(hit_for_pass)`` to make it clear that pass in ``vcl_fetch`` and ``vcl_recv`` are different beasts. - Add actual purge support. Doing ``purge`` will remove an object and all its variants. .. _bug #481: https://www.varnish-cache.org/trac/ticket/481 .. _bug #787: https://www.varnish-cache.org/trac/ticket/787 .. _bug #782: https://www.varnish-cache.org/trac/ticket/782 Libraries --------- - ``libvarnishapi`` has been overhauled and the API has been broken. Please see git commit logs and the support tools to understand what's been changed. - Add functions to walk over all the available counters. This is needed because some of the counter names might only be available at runtime. - Limit the amount of time varnishapi waits for a shared memory log to appear before returning an error. - All libraries but ``libvarnishapi`` have been moved to a private directory as they are not for public consumption and have no ABI/API guarantees. Other ----- - Python is now required to build - Varnish Cache is now consistently named Varnish Cache. - The compilation process now looks for kqueue on NetBSD - Make it possible to use a system jemalloc rather than the bundled version. - The documentation has been improved all over and should now be in much better shape than before ======================================== Changes from 2.1.4 to 2.1.5 (2011-01-25) ======================================== varnishd -------- - On pass from vcl\_recv, we did not remove the backends Content-Length header before adding our own. This could cause confusion for browsers and has been fixed. - Make pass with content-length work again. An issue with regards to 304, Content-Length and pass has been resolved. - An issue relating to passed requests with If-Modified-Since headers has been fixed. Varnish did not recognize that the 304-response did not have a body. - A potential lock-inversion with the ban lurker thread has been resolved. - Several build-dependency issues relating to rst2man have been fixed. Varnish should now build from source without rst2man if you are using tar-balls. - Ensure Varnish reads the expected last CRLF after chunked data from the backend. This allows re-use of the connection. - Remove a GNU Make-ism during make dist to make BSD happier. - Document the log, set, unset, return and restart statements in the VCL documentation. - Fix an embarrassingly old bug where Varnish would run out of workspace when requests come in fast over a single connection, typically during synthetic benchmarks. - Varnish will now allow If-Modified-Since requests to objects without a Last-Modified-header, and instead use the time the object was cached instead. - Do not filter out Content-Range headers in pass. - Require -d, -b, -f, -S or -T when starting varnishd. In human terms, this means that it is legal to start varnishd without a Vcl or backend, but only if you have a CLI channel of some kind. - Don't suppress Cache-Control headers in pass responses. - Merge multi-line Cache-Control and Vary header fields. Until now, no browsers have needed this, but Chromium seems to find it necessary to spread its Cache-Control across two lines, and we get to deal with it. - Make new-purge not touch busy objects. This fixes a potential crash when calling VRT\_purge. - If there are everal grace-able objects, pick the least expired one. - Fix an issue with varnishadm -T :6082 shorthand. - Add bourn-shell like "here" documents on the CLI. Typical usage: vcl.inline vcl\_new << 42 backend foo {...} sub vcl\_recv {...} 42 - Add CLI version to the CLI-banner, starting with version 1.0 to mark here-documents. - Fix a problem with the expiry thread slacking off during high load. varnishtest ----------- - Remove no longer existing -L option. =========================== Changes from 2.1.3 to 2.1.4 =========================== varnishd -------- - An embarrasing typo in the new binary heap layout caused inflated obj/objcore/objhdr counts and could cause odd problems when the LRU expunge mechanism was invoked. This has been fixed. - We now have updated documentation in the reStructuredText format. Manual pages and reference documentation are both built from this. - We now include a DNS director which uses DNS for choosing which backend to route requests to. Please see the documentation for more details. - If you restarted a request, the HTTP header X-Forwarded-For would be updated multiple times. This has been fixed. - If a VCL contained a % sign, and the vcl.show CLI command was used, varnishd would crash. This has been fixed. - When doing a pass operation, we would remove the Content-Length, Age and Proxy-Auth headers. We are no longer doing this. - now has a string representation, making it easier to construct Expires headers in VCL. - In a high traffic environment, we would sometimes reuse a file descriptor before flushing the logs from a worker thread to the shared log buffer. This would cause confusion in some of the tools. This has been fixed by explicitly flushing the log when a backend connection is closed. - If the communication between the management and the child process gets out of sync, we have no way to recover. Previously, varnishd would be confused, but we now just kill the child and restart it. - If the backend closes the connection on us just as we sent a request to it, we retry the request. This should solve some interoperability problems with Apache and the mpm-itk multi processing module. - varnishd now only provides help output the current CLI session is authenticated for. - If the backend does not tell us which length indication it is using, we now assume the resource ends EOF at. - The client director now has a variable client.identity which is used to choose which backend should receive a given request. - The Solaris port waiter has been updated, and other portability fixes for Solaris. - There was a corner case in the close-down processing of pipes, this has now been fixed. - Previously, if we stopped polling a backend which was sick, it never got marked as healthy. This has now been changed. - It is now possible to specify ports as part of the .host field in VCL. - The synthetic counters were not locked properly, and so the sms\_ counters could underflow. This has now been fixed. - The value of obj.status as a string in vcl\_error would not be correct in all cases. This has been fixed. - Varnish would try to trim storage segments completely filled when using the malloc stevedore and the object was received chunked encoding. This has been fixed. - If a buggy backend sends us a Vary header with two colons, we would previously abort. We now rather fix this up and ignore the extra colon. - req.hash\_always\_miss and req.hash\_ignore\_busy has been added, to make preloading or periodically refreshing content work better. varnishncsa ----------- - varnishncsa would in some cases be confused by ESI requests and output invalid lines. This has now been fixed. varnishlog ---------- - varnishlog now allows -o and -u together. varnishtop ---------- - varnishtop would crash on 32 bit architectures. This has been fixed. libvarnishapi ------------- - Regex inclusion and exclusion had problems with matching particular parts of the string being matched. This has been fixed. =========================== Changes from 2.1.2 to 2.1.3 =========================== varnishd -------- - Improve scalability of critbit. - The critbit hash algorithm has now been tightened to make sure the tree is in a consistent state at all points, and the time we wait for an object to cool off after it is eligible for garbage collection has been tweaked. - Add log command to VCL. This emits a VCL\_log entry into the shared memory log. - Only emit Length and ReqEnd log entries if we actually have an XID. This should get rid of some empty log lines in varnishncsa. - Destroy directors in a predictable fashion, namely reverse of creation order. - Fix bug when ESI elements spanned storage elements causing a panic. - In some cases, the VCL compiler would panic instead of giving sensible messages. This has now been fixed. - Correct an off-by-one error when the requested range exceeds the size of an object. - Handle requests for the end of an object correctly. - Allow tabulator characters in the third field of the first line of HTTP requests - On Solaris, if the remote end sends us an RST, all system calls related to that socket will return EINVAL. We now handle this better. libvarnishapi ------------- - The -X parameter didn't work correctly. This has been fixed. =========================== Changes from 2.1.1 to 2.1.2 =========================== varnishd -------- - When adding Range support for 2.1.1, we accidentally introduced a bug which would append garbage to objects larger than the chunk size, by default 128k. Browsers would do the right thing due to Content-Length, but some load balancers would get very confused. =========================== Changes from 2.1.1 to 2.1.1 =========================== varnishd -------- - The changelog in 2.1.0 included syntax errors, causing the generated changelog to be empty. - The help text for default\_grace was wrongly formatted and included a syntax error. This has now been fixed. - varnishd now closes the file descriptor used to read the management secret file (from the -S parameter). - The child would previously try to close every valid file descriptor, something which could cause problems if the file descriptor ulimit was set too high. We now keep track of all the file descriptors we open and only close up to that number. - ESI was partially broken in 2.1.0 due to a bug in the rollback of session workspace. This has been fixed. - Reject the authcommand rather than crash if there is no -S parameter given. - Align pointers in allocated objects. This will in theory make Varnish a tiny bit faster at the expense of slightly more memory usage. - Ensure the master process process id is updated in the shared memory log file after we go into the background. - HEAD requests would be converted to GET requests too early, which affected pass and pipe. This has been fixed. - Update the documentation to point out that the TTL is no longer taken into account to decide whether an object is cacheable or not. - Add support for completely obliterating an object and all variants of it. Currently, this has to be done using inline C. - Add experimental support for the Range header. This has to be enabled using the parameter http\_range\_support. - The critbit hasher could get into a deadlock and had a race condition. Both those have now been fixed. varnishsizes -----------~ - varnishsizes, which is like varnishhist, but for the length of objects, has been added.. =========================== Changes from 2.0.6 to 2.1.0 =========================== varnishd -------- - Persistent storage is now experimentally supported using the persistent stevedore. It has the same command line arguments as the file stevedore. - obj.\* is now called beresp.\* in vcl\_fetch, and obj.\* is now read-only. - The regular expression engine is now PCRE instead of POSIX regular expressions. - req.\* is now available in vcl\_deliver. - Add saint mode where we can attempt to grace an object if we don't like the backend response for some reason. Related, add saintmode\_threshold which is the threshold for the number of objects to be added to the trouble list before the backend is considered sick. - Add a new hashing method called critbit. This autoscales and should work better on large object workloads than the classic hash. Critbit has been made the default hash algorithm. - When closing connections, we experimented with sending RST to free up load balancers and free up threads more quickly. This caused some problems with NAT routers and so has been reverted for now. - Add thread that checks objects against ban list in order to prevent ban list from growing forever. Note that this needs purges to be written so they don't depend on req.\*. Enabled by setting ban\_lurker\_sleep to a nonzero value. - The shared memory log file format was limited to maximum 64k simultaneous connections. This is now a 32 bit field which removes this limitation. - Remove obj\_workspace, this is now sized automatically. - Rename acceptors to waiters - vcl\_prefetch has been removed. It was never fully implemented. - Add support for authenticating CLI connections. - Add hash director that chooses which backend to use depending on req.hash. - Add client director that chooses which backend to use depending on the client's IP address. Note that this ignores the X-Forwarded-For header. - varnishd now displays a banner by default when you connect to the CLI. - Increase performance somewhat by moving statistics gathering into a per-worker structure that is regularly flushed to the global stats. - Make sure we store the header and body of object together. This may in some cases improve performance and is needed for persistence. - Remove client-side address accounting. It was never used for anything and presented a performance problem. - Add a timestamp to bans, so you can know how old they are. - Quite a few people got confused over the warning about not being able to lock the shared memory log into RAM, so stop warning about that. - Change the default CLI timeout to 10 seconds. - We previously forced all inserts into the cache to be GET requests. This has been changed to allow POST as well in order to be able to implement purge-on-POST semantics. - The CLI command stats now only lists non-zero values. - The CLI command stats now only lists non-zero values. - Use daemon(3) from libcompat on Darwin. - Remove vcl\_discard as it causes too much complexity and never actually worked particularly well. - Remove vcl\_timeout as it causes too much complexity and never actually worked particularly well. - Update the documentation so it refers to sess\_workspace, not http\_workspace. - Document the -i switch to varnishd as well as the server.identity and server.hostname VCL variables. - purge.hash is now deprecated and no longer shown in help listings. - When processing ESI, replace the five mandatory XML entities when we encounter them. - Add string representations of time and relative time. - Add locking for n\_vbe\_conn to make it stop underflowing. - When ESI-processing content, check for illegal XML character entities. - Varnish can now connect its CLI to a remote instance when starting up, rather than just being connected to. - It is no longer needed to specify the maximum number of HTTP headers to allow from backends. This is now a run-time parameter. - The X-Forwarded-For header is now generated by vcl\_recv rather than the C code. - It is now possible to not send all CLI traffic to syslog. - It is now possible to not send all CLI traffic to syslog. - In the case of varnish crashing, it now outputs a identifying string with the OS, OS revision, architecture and storage parameters together with the backtrace. - Use exponential backoff when we run out of file descriptors or sessions. - Allow setting backend timeouts to zero. - Count uptime in the shared memory log. - Try to detect the case of two running varnishes with the same shmlog and storage by writing the master and child process ids to the shmlog and refusing to start if they are still running. - Make sure to use EOF mode when serving ESI content to HTTP/1.0 clients. - Make sure we close the connection if it either sends Connection: close or it is a HTTP/1.0 backend that does not send Connection: keep-alive. - Increase the default session workspace to 64k on 64-bit systems. - Make the epoll waiter use level triggering, not edge triggering as edge triggering caused problems on very busy servers. - Handle unforeseen client disconnections better on Solaris. - Make session lingering apply to new sessions, not just reused sessions. varnishstat ----------- - Make use of the new uptime field in the shared memory log rather than synthesizing it from the start time. varnishlog ---------- - Exit at the end of the file when started with -d. varnishadm ---------- - varnishadm can now have a timeout when trying to connect to the running varnishd. - varnishadm now knows how to respond to the secret from a secured varnishd =========================== Changes from 2.0.5 to 2.0.6 =========================== varnishd -------- - 2.0.5 had an off-by-one error in the ESI handling causing includes to fail a large part of the time. This has now been fixed. - Try harder to not confuse backends when sending them backend probes. We half-closed the connection, something some backends thought meant we had dropped the connection. Stop doing so, and add the capability for specifying the expected response code. - In 2.0.5, session lingering was turned on. This caused statistics to not be counted often enough in some cases. This has now been fixed. - Avoid triggering an assert if the other end closes the connection while we are lingering and waiting for another request from them. - When generating backtraces, prefer the built-in backtrace function if such exists. This fixes a problem compiling 2.0.5 on Solaris. - Make it possible to specify the per-thread stack size. This might be useful on 32 bit systems with their limited address space. - Document the -C option to varnishd. =========================== Changes from 2.0.4 to 2.0.5 =========================== varnishd -------- - Handle object workspace overruns better. - Allow turning off ESI processing per request by using set req.esi = off. - Tell the kernel that we expect to use the mmap-ed file in a random fashion. On Linux, this turns off/down readahead and increases performance. - Make it possible to change the maximum number of HTTP headers we allow by passing --with-max-header-fields=NUM rather than changing the code. - Implement support for HTTP continuation lines. - Change how connections are closed and only use SO\_LINGER for orderly connection closure. This should hopefully make worker threads less prone to hangups on network problems. - Handle multi-element purges correctly. Previously we ended up with parse errors when this was done from VCL. - Handle illegal responses from the backend better by serving a 503 page rather than panic-ing. - When we run into an assertion that is not true, Varnish would previously dump a little bit of information about itself. Extend that information with a backtrace. Note that this relies on the varnish binary being unstripped. - Add a session\_max parameter that limits the maximum number of sessions we keep open before we start dropping new connections summarily. - Try to consume less memory when doing ESI processing by properly rolling back used workspace after processing an object. This should make it possible to turn sess\_workspace quite a bit for users with ESI-heavy pages. - Turn on session\_linger by default. Tests have shown that session\_linger helps a fair bit with performance. - Rewrite the epoll acceptor for better performance. This should lead to both higher processing rates and maximum number of connections on Linux. - Add If-None-Match support, this gives significant bandwidth savings for users with compliant browsers. - RFC2616 specifies that ETag, Content-Location, Expires, Cache-Control and Vary should be emitted when delivering a response with the 304 response code. - Various fixes which makes Varnish compile and work on AIX. - Turn on TCP\_DEFER\_ACCEPT on Linux. This should make us less suspecible to denial of service attacks as well as give us slightly better performance. - Add an .initial property to the backend probe specification. This is the number of good probes we pretend to have seen. The default is one less than .threshold, which means the first probe will decide if we consider the backend healthy. - Make it possible to compare strings against other string-like objects, not just plain strings. This allows you to compare two headers, for instance. - When support for restart in vcl\_error was added, there was no check to prevent infinte recursion. This has now been fixed. - Turn on purge\_dups by default. This should make us consume less memory when there are many bans for the same pattern added. - Add a new log tag called FetchError which tries to explain why we could not fetch an object from the backend. - Change the default srcaddr\_ttl to 0. It is not used by anything and has been removed in the development version. This will increase performance somewhat. varnishtop ---------- - varnishtop did not handle variable-length log fields correctly. This is now fixed. - varnishtop previously did not print the name of the tag, which made it very hard to understand. We now print out the tag name. =========================== Changes from 2.0.3 to 2.0.4 =========================== varnishd -------- - Make Varnish more portable by pulling in fixes for Solaris and NetBSD. - Correct description of -a in the manual page. - Ensure we are compiling in C99 mode. - If error was called with a null reason, we would crash on Solaris. Make sure this no longer happens. - Varnish used to crash if you asked it to use a non-existent waiter. This has now been fixed. - Add documentation to the default VCL explaining that using Connection: close in vcl\_close is generally a good idea. - Add minimal facility for dealing with TELNET option negotiation by returning WONT to DO and DONT requests. - If the backend is unhealthy, use a graced object if one is available. - Make server.hostname and server.identity available to VCL. The latter can be set with the -i parameter to varnishd. - Make restart available from vcl\_error. - Previously, only the TTL of an object was considered in whether it would be marked as cacheable. This has been changed to take the grace into consideration as well. - Previously, if an included ESI fragment had a zero size, we would send out a zero-sized chunk which signifies end-of-transmission. We now ignore zero-sized chunks. - We accidentally slept for far too long when we reached the maximum number of open file descriptors. This has been corrected and accept\_fd\_holdoff now works correctly. - Previously, when ESI processing, we did not look at the full length, but stopped at the first NULL byte. We no longer do that, enabling ESI processing of binary data. varnishtest ----------- - Make sure system "..." returns successfully to ensure test failures do not go unnoticed. - Make it possible to send NULL bytes through the testing framework. =========================== Changes from 2.0.2 to 2.0.3 =========================== varnishd -------- - Handle If-Modified-Since and ESI sub-objects better, fixing a problem where we sometimes neglected to insert included objects. - restart in vcl\_hit is now supported. - Setting the TTL of an object to 0 seconds would sometimes cause it to be delivered for up to one second - epsilon. This has been corrected and we should now never deliver those objects to other clients. - The malloc storage backend now prints the maximum storage size, just like the file backend. - Various small documentation bugs have been fixed. - Varnish did not set a default interval for backend probes, causing it to poll the backend continuously. This has been corrected. - Allow "true" and "false" when setting boolean parameters, in addition to on/off, enable/disable and yes/no. - Default to always talking HTTP 1.1 with the backend. - Varnish did not make sure the file it was loading was a regular file. This could cause Varnish to crash if it was asked to load a directory or other non-regular file. We now check that the file is a regular file before loading it. - The binary heap used for expiry processing had scalability problems. Work around this by using stripes of a fixed size, which should make this scale better, particularly when starting up and having lots of objects. - When we imported the jemalloc library into the Varnish tree, it did not compile without warnings. This has now been fixed. - Varnish took a very long time to detect that the backend did not respond. To remedy this, we now have read timeouts in addition to the connect timeout. Both the first\_byte\_timeout and the between\_bytes\_timeout defaults to 60 seconds. The connect timeout is no longer in milliseconds, but rather in seconds. - Previously, the VCL to C conversion as well as the invocation of the C compiler was done in the management process. This is now done in a separate sub-process. This prevents any bugs in the VCL compiler from affecting the management process. - Chunked encoding headers were counted in the statistics for header bytes. They no longer are. - ESI processed objects were not counted in the statistics for body bytes. They now are. - It is now possible to adjust the maximum record length of log entries in the shmlog by tuning the shm\_reclen parameter. - The management parameters listed in the CLI were not sorted, which made it hard to find the parameter you were looking for. They are now sorted, which should make this easier. - Add a new hashing type, "critbit", which uses a lock-less tree based lookup algorithm. This is experimental and should not be enabled in production environments without proper testing. - The session workspace had a default size of 8k. It is now 16k, which should make VCLs where many headers are processed less prone to panics. - We have seen that people seem to be confused as to which actions in the different VCL functions return and which ones don't. Add a new syntax return(action) to make this more explicit. The old syntax is still supported. - Varnish would return an error if any of the management IPs listed in the -T parameter could not be listened to. We now only return an error if none of them can be listened to. - In the case of the backend or client giving us too many parameters, we used to just ignore the overflowing headers. This is problematic if you end up ignoreing Content-Length, Transfer-Encoding and similar headers. We now give out a 400 error to the client if it sends us too many and 503 if we get too many from the backend. - We used panic if we got a too large chunked header. This behaviour has been changed into just failing the transaction. - Varnish now supports an extended purge method where it is possible to do purge req.http.host ~ "web1.com" && req.url ~ "\\.png" and similar. See the documentation for details. - Under heavy load, Varnish would sometimes crash when trying to update the per-request statistics. This has now been fixed. - It is now possible to not save the hash string in the session and object workspace. This will save a lot of memory on sites with many small objects. Disabling the purge\_hash parameter also disables the purge.hash facility. - Varnish now supports !~ as a "no match" regular expression matcher. - In some cases, you could get serialised access to "pass" objects. We now make it default to the default\_ttl value; this can be overridden in vcl\_fetch. - Varnish did not check the syntax of regsub calls properly. More checking has been added. - If the client closed the connection while Varnish was processing ESI elements, Varnish would crash while trying to write the object to the client. We now check if the client has closed the connection. - The ESI parser had a bug where it would crash if an XML comment would span storage segments. This has been fixed. VCL Manual page --------------~ - The documentation on how capturing parentheses work was wrong. This has been corrected. - Grace has now been documented. varnishreplay ------------- - varnishreplay did not work correctly on Linux, due to a too small stack. This has now been fixed. =========================== Changes from 2.0.1 to 2.0.2 =========================== varnishd -------- - In high-load situations, when using ESI, varnishd would sometimes mishandle objects and crash. This has been worked around. varnishreplay ------------- - varnishreplay did not work correctly on Linux, due to a too small stack. This has now been fixed. ========================= Changes from 2.0 to 2.0.1 ========================= varnishd -------- - When receiving a garbled HTTP request, varnishd would sometimes crash. This has been fixed. - There was an off-by-one error in the ACL compilation. Now fixed. Red Hat spec file ----------------~ - A typo in the spec file made the .rpm file names wrong. ========================= Changes from 1.1.2 to 2.0 ========================= varnishd -------- - Only look for sendfile on platforms where we know how to use it, which is FreeBSD for now. - Make it possible to adjust the shared memory log size and bump the size from 8MB to 80MB. - Fix up the handling of request bodies to better match what RFC2616 mandates. This makes PUT, DELETE, OPTIONS and TRACE work in addition to POST. - Change how backends are defined, to a constant structural defintion style. See https://www.varnish-cache.org/wiki/VclSyntaxChanges for the details. - Add directors, which wrap backends. Currently, there's a random director and a round-robin director. - Add "grace", which is for how long and object will be served, even after it has expired. To use this, both the object's and the request's grace parameter need to be set. - Manual pages have been updated for new VCL syntax and varnishd options. - Man pages and other docs have been updated. - The shared memory log file is now locked in memory, so it should not be paged out to disk. - We now handle Vary correctly, as well as Expect. - ESI include support is implemented. - Make it possible to limit how much memory the malloc uses. - Solaris is now supported. - There is now a regsuball function, which works like regsub except it replaces all occurrences of the regex, not just the first. - Backend and director declarations can have a .connect\_timeout parameter, which tells us how long to wait for a successful connection. - It is now possible to select the acceptor to use by changing the acceptor parameter. - Backends can have probes associated with them, which can be checked with req.backend.health in VCL as well as being handled by directors which do load-balancing. - Support larger-than-2GB files also on 32 bit hosts. Please note that this does not mean we can support caches bigger than 2GB, it just means logfiles and similar can be bigger. - In some cases, we would remove the wrong header when we were stripping Content-Transfer-Encoding headers from a request. This has been fixed. - Backends can have a .max\_connections associated with them. - On Linux, we need to set the dumpable bit on the child if we want core dumps. Make sure it's set. - Doing purge.hash() with an empty string would cause us to dump core. Fixed so we don't do that any more. - We ran into a problem with glibc's malloc on Linux where it seemed like it failed to ever give memory back to the OS, causing the system to swap. We have now switched to jemalloc which appears not to have this problem. - max\_restarts was never checked, so we always ended up running out of workspace. Now, vcl\_error is called when we reach max\_restarts. varnishtest ----------- - varnishtest is a tool to do correctness tests of varnishd. The test suite is run by using make check. varnishtop ---------- - We now set the field widths dynamically based on the size of the terminal and the name of the longest field. varnishstat ----------- - varnishstat -1 now displays the uptime too. varnishncsa ----------- - varnishncsa now does fflush after each write. This makes tail -f work correctly, as well as avoiding broken lines in the log file. - It is possible to get varnishncsa to output the X-Forwarded-For instead of the client IP by passing -f to it. Build system -----------~ - Various sanity checks have been added to configure, it now complains about no ncurses or if SO\_RCVTIMEO or SO\_SNDTIMEO are non-functional. It also aborts if there's no working acceptor mechanism - The C compiler invocation is decided by the configure script and can now be overridden by passing VCC\_CC when running configure. =========================== Changes from 1.1.1 to 1.1.2 =========================== varnishd -------- - When switching to a new VCL configuration, a race condition exists which may cause Varnish to reference a backend which no longer exists (see `ticket #144 `_). This race condition has not been entirely eliminated, but it should occur less frequently. - When dropping a TCP session before any requests were processed, an assertion would be triggered due to an uninitialized timestamp (see `ticket #132 `_). The timestamp is now correctly initialized. - Varnish will now correctly generate a Date: header for every response instead of copying the one it got from the backend (see `ticket #157 `_). - Comparisons in VCL which involve a non-existent string (usually a header which is not present in the request or object being processed) would cause a NULL pointer dereference; now the comparison will simply fail. - A bug in the VCL compiler which would cause a double-free when processing include directives has been fixed. - A resource leak in the worker thread management code has been fixed. - When connecting to a backend, Varnish will usually get the address from a cache. When the cache is refreshed, existing connections may end up with a reference to an address structure which no longer exists, resulting in a crash. This race condition has been somewhat mitigated, but not entirely eliminated (see `ticket #144 `_.) - Varnish will now pass the correct protocol version in pipe mode: the backend will get what the client sent, and vice versa. - The core of the pipe mode code has been rewritten to increase robustness and eliminate spurious error messages when either end closes the connection in a manner Varnish did not anticipate. - A memory leak in the backend code has been plugged. - When using the kqueue acceptor, if a client shuts down the request side of the connection (as many clients do after sending their final request), it was possible for the acceptor code to receive the EOF event and recycle the session while the last request was still being serviced, resulting in a assertion failure and a crash when the worker thread later tried to delete the session. This should no longer happen (see `ticket #162 `_.) - A mismatch between the recorded length of a cached object and the amount of data actually present in cache for that object can occasionally occur (see `ticket #167 `_.) This has been partially fixed, but may still occur for error pages generated by Varnish when a problem arises while retrieving an object from the backend. - Some socket-related system calls may return unexpected error codes when operating on a TCP connection that has been shut down at the other end. These error codes would previously cause assertion failures, but are now recognized as harmless conditions. varnishhist ----------- - Pressing 0 though 9 while varnishhist is running will change the refresh interval to the corresponding power of two, in seconds. varnishncsa ----------- - The varnishncsa tool can now daemonize and write a PID file like varnishlog, using the same command-line options. It will also reopen its output upon receipt of a SIGHUP if invoked with -w. varnishstat ----------- - Pressing 0 though 9 while varnishstat is running will change the refresh interval to the corresponding power of two, in seconds. Build system -----------~ - Varnish's has been modified to avoid conflicts with on platforms where the latter is included indirectly through system headers. - Several steps have been taken towards Solaris support, but this is not yet complete. - When configure was run without an explicit prefix, Varnish's idea of the default state directory would be garbage and a state directory would have to be specified manually with -n. This has been corrected. ========================= Changes from 1.1 to 1.1.1 ========================= varnishd -------- - The code required to allow VCL to read obj.status, which had accidentally been left out, has now been added. - Varnish will now always include a Connection: header in its reply to the client, to avoid possible misunderstandings. - A bug that triggered an assertion failure when generating synthetic error documents has been corrected. - A new VCL function, purge\_url, provides the same functionality as the url.purge management command. - Previously, Varnish assumed that the response body should be sent only if the request method was GET. This was a problem for custom request methods (such as PURGE), so the logic has been changed to always send the response body except in the specific case of a HEAD request. - Changes to run-time parameters are now correctly propagated to the child process. - Due to the way run-time parameters are initialized at startup, varnishd previously required the nobody user and the nogroup group to exist even if a different user and group were specified on the command line. This has been corrected. - Under certain conditions, the VCL compiler would carry on after a syntax error instead of exiting after reporting the error. This has been corrected. - The manner in which the hash string is assembled has been modified to reduce memory usage and memory-to-memory copying. - Before calling vcl\_miss, Varnish assembles a tentative request object for the backend request which will usually follow. This object would be leaked if vcl\_miss returned anything else than fetch. This has been corrected. - The code necessary to handle an error return from vcl\_fetch and vcl\_deliver had inadvertantly been left out. This has been corrected. - Varnish no longer prints a spurious "child died" message (the result of reaping the compiler process) after compiling a new VCL configuration. - Under some circumstances, due to an error in the workspace management code, Varnish would lose the "tail" of a request, i.e. the part of the request that has been received from the client but not yet processed. The most obvious symptom of this was that POST requests would work with some browsers but not others, depending on details of the browser's HTTP implementation. This has been corrected. - On some platforms, due to incorrect assumptions in the CLI code, the management process would crash while processing commands received over the management port. This has been corrected. Build system -----------~ - The top-level Makefile will now honor $DESTDIR when creating the state directory. - The Debian and RedHat packages are now split into three (main / lib / devel) as is customary. - A number of compile-time and run-time portability issues have been addressed. - The autogen.sh script had workarounds for problems with the GNU autotools on FreeBSD; these are no longer needed and have been removed. - The libcompat library has been renamed to libvarnishcompat and is now dynamic rather than static. This simplifies the build process and resolves an issue with the Mac OS X linker. ========================= Changes from 1.0.4 to 1.1 ========================= varnishd -------- - Readability of the C source code generated from VCL code has been improved. - Equality (==) and inequality (!=) operators have been implemented for IP addresses (which previously could only be compared using ACLs). - The address of the listening socket on which the client connection was received is now available to VCL as the server.ip variable. - Each object's hash key is now computed based on a string which is available to VCL as req.hash. A VCL hook named vcl\_hash has been added to allow VCL scripts to control hash generation (for instance, whether or not to include the value of the Host: header in the hash). - The setup code for listening sockets has been modified to detect and handle situations where a host name resolves to multiple IP addresses. It will now attempt to bind to each IP address separately, and report a failure only if none of them worked. - Network or protocol errors that occur while retrieving an object from a backend server now result in a synthetic error page being inserted into the cache with a 30-second TTL. This should help avoid driving an overburdened backend server into the ground by repeatedly requesting the same object. - The child process will now drop root privileges immediately upon startup. The user and group to use are specified with the user and group run-time parameters, which default to nobody and nogroup, respectively. Other changes have been made in an effort to increase the isolation between parent and child, and reduce the impact of a compromise of the child process. - Objects which are received from the backend with a Vary: header are now stored separately according to the values of the headers specified in Vary:. This allows Varnish to correctly cache e.g. compressed and uncompressed versions of the same object. - Each Varnish instance now has a name, which by default is the host name of the machine it runs on, but can be any string that would be valid as a relative or absolute directory name. It is used to construct the name of a directory in which the server state as well as all temporary files are stored. This makes it possible to run multiple Varnish instances on the same machine without conflict. - When invoked with the -C option, varnishd will now not just translate the VCL code to C, but also compile the C code and attempt to load the resulting shared object. - Attempts by VCL code to reference a variable outside its scope or to assign a value to a read-only variable will now result in compile-time rather than run-time errors. - The new command-line option -F will make varnishd run in the foreground, without enabling debugging. - New VCL variables have been introduced to allow inspection and manipulation of the request sent to the backend (bereq.request, bereq.url, bereq.proto and bereq.http) and the response to the client (resp.proto, resp.status, resp.response and resp.http). - Statistics from the storage code (including the amount of data and free space in the cache) are now available to varnishstat and other statistics-gathering tools. - Objects are now kept on an LRU list which is kept loosely up-to-date (to within a few seconds). When cache runs out, the objects at the tail end of the LRU list are discarded one by one until there is enough space for the freshly requested object(s). A VCL hook, vcl\_discard, is allowed to inspect each object and determine its fate by returning either keep or discard. - A new VCL hook, vcl\_deliver, provides a chance to adjust the response before it is sent to the client. - A new management command, vcl.show, displays the VCL source code of any loaded configuration. - A new VCL variable, now, provides VCL scripts with the current time in seconds since the epoch. - A new VCL variable, obj.lastuse, reflects the time in seconds since the object in question was last used. - VCL scripts can now add an HTTP header (or modify the value of an existing one) by assigning a value to the corresponding variable, and strip an HTTP header by using the remove keyword. - VCL scripts can now modify the HTTP status code of cached objects (obj.status) and responses (resp.status) - Numeric and other non-textual variables in VCL can now be assigned to textual variables; they will be converted as needed. - VCL scripts can now apply regular expression substitutions to textual variables using the regsub function. - A new management command, status, returns the state of the child. - Varnish will now build and run on Mac OS X. varnishadm ---------- - This is a new utility which sends a single command to a Varnish server's management port and prints the result to stdout, greatly simplifying the use of the management port from scripts. varnishhist ----------- - The user interface has been greatly improved; the histogram will be automatically rescaled and redrawn when the window size changes, and it is updated regularly rather than at a rate dependent on the amount of log data gathered. In addition, the name of the Varnish instance being watched is displayed in the upper right corner. varnishncsa ----------- - In addition to client traffic, varnishncsa can now also process log data from backend traffic. - A bug that would cause varnishncsa to segfault when it encountered an empty HTTP header in the log file has been fixed. varnishreplay ------------- - This new utility will attempt to recreate the HTTP traffic which resulted in the raw Varnish log data which it is fed. varnishstat ----------- - Don't print lifetime averages when it doesn't make any sense, for instance, there is no point in dividing the amount in bytes of free cache space by the lifetime in seconds of the varnishd process. - The user interface has been greatly improved; varnishstat will no longer print more than fits in the terminal, and will respond correctly to window resize events. The output produced in one-shot mode has been modified to include symbolic names for each entry. In addition, the name of the Varnish instance being watched is displayed in the upper right corner in curses mode. varnishtop ---------- - The user interface has been greatly improved; varnishtop will now respond correctly to window resize events, and one-shot mode (-1) actually works. In addition, the name of the Varnish instance being watched is displayed in the upper right corner in curses mode. =========================== Changes from 1.0.3 to 1.0.4 =========================== varnishd -------- - The request workflow has been redesigned to simplify request processing and eliminate code duplication. All codepaths which need to speak HTTP now share a single implementation of the protocol. Some new VCL hooks have been added, though they aren't much use yet. The only real user-visible change should be that Varnish now handles persistent backend connections correctly (see `ticket #56 `_). - Support for multiple listen addresses has been added. - An "include" facility has been added to VCL, allowing VCL code to pull in code fragments from multiple files. - Multiple definitions of the same VCL function are now concatenated into one in the order in which they appear in the source. This simplifies the mechanism for falling back to the built-in default for cases which aren't handled in custom code, and facilitates modularization. - The code used to format management command arguments before passing them on to the child process would underestimate the amount of space needed to hold each argument once quotes and special characters were properly escaped, resulting in a buffer overflow. This has been corrected. - The VCL compiler has been overhauled. Several memory leaks have been plugged, and error detection and reporting has been improved throughout. Parts of the compiler have been refactored to simplify future extension of the language. - A bug in the VCL compiler which resulted in incorrect parsing of the decrement (-=) operator has been fixed. - A new -C command-line option has been added which causes varnishd to compile the VCL code (either from a file specified with -f or the built-in default), print the resulting C code and exit. - When processing a backend response using chunked encoding, if a chunk header crosses a read buffer boundary, read additional bytes from the backend connection until the chunk header is complete. - A new ping\_interval run-time parameter controls how often the management process checks that the worker process is alive. - A bug which would cause the worker process to dereference a NULL pointer and crash if the backend did not respond has been fixed. - In some cases, such as when they are used by AJAX applications to circumvent Internet Explorer's over-eager disk cache, it may be desirable to cache POST requests. However, the code path responsible for delivering objects from cache would only transmit the response body when replying to a GET request. This has been extended to also apply to POST. This should be revisited at a later date to allow VCL code to control whether the body is delivered. - Varnish now respects Cache-control: s-maxage, and prefers it to Cache-control: max-age if both are present. This should be revisited at a later date to allow VCL code to control which headers are used and how they are interpreted. - When loading a new VCL script, the management process will now load the compiled object to verify that it links correctly before instructing the worker process to load it. - A new -P command-line options has been added which causes varnishd to create a PID file. - The sendfile\_threshold run-time parameter's default value has been set to infinity after a variety of sendfile()-related bugs were discovered on several platforms. varnishlog ---------- - When grouping log entries by request, varnishlog attempts to collapse the log entry for a call to a VCL function with the log entry for the corresponding return from VCL. When two VCL calls were made in succession, varnishlog would incorrectly omit the newline between the two calls (see `ticket #95 `_). - New -D and -P command-line options have been added to daemonize and create a pidfile, respectively. - The flag that is raised upon reception of a SIGHUP has been marked volatile so it will not be optimized away by the compiler. varnishncsa ----------- - The formatting callback has been largely rewritten for clarity, robustness and efficiency. If a request included a Host: header, construct and output an absolute URL. This makes varnishncsa output from servers which handle multiple virtual hosts far more useful. - The flag that is raised upon reception of a SIGHUP has been marked volatile so it will not be optimized away by the compiler. Documentation ------------- - The documentation, especially the VCL documentation, has been greatly extended and improved. Build system ------------ - The name and location of the curses or ncurses library is now correctly detected by the configure script instead of being hardcoded into affected Makefiles. This allows Varnish to build correctly on a wider range of platforms. - Compatibility shims for clock\_gettime() are now correctly applied where needed, allowing Varnish to build on MacOS X. - The autogen.sh script will now correctly detect and warn about automake versions which are known not to work correctly. varnish-4.1.1/doc/html/0000755000201500234410000000000012652366773011716 500000000000000varnish-4.1.1/doc/html/index.html0000644000201500234410000001644612652366773013646 00000000000000 Varnish Administrator Documentation — Varnish version 4.1.1 documentation

Varnish Administrator Documentation¶

Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. Varnish Cache is really, really fast. It typically speeds up delivery with a factor of 300 - 1000x, depending on your architecture.

To get started with Varnish-Cache we recommend that you read the installation guide Varnish Installation. Once you have Varnish up and running we recommend that you go through our tutorial - The Varnish Tutorial, and finally the The Varnish Users Guide.

If you need to find out how to use a specific Varnish tool, the The Varnish Reference Manual contains detailed documentation over the tools. Changes from previous versions are located in the What's new in Varnish 4.1 chapter. In closing, we have Poul-Hennings random outbursts, a collection of blog posts from Poul-Henning Kamp related to Varnish and HTTP.

Conventions used in this manual include:

service varnish restart
A command you can run, or a shortkey you can press. Used either in the terminal or after starting one of the tools.
/usr/local/, varnishadm, sess_timeout
A utility, Varnish configurable parameter or path.
https://www.varnish-cache.org/
A hyperlink.

Longer listings like example command output and VCL look like this:

$ /opt/varnish/sbin/varnishd -V
varnishd (varnish-trunk revision 199de9b)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2015 Varnish Software AS

Indices and tables¶

Table Of Contents

Next topic

Varnish Installation

This Page

varnish-4.1.1/doc/html/searchindex.js0000644000201500234410000026404112652366773014500 00000000000000Search.setIndex({objects:{},terms:{stock:92,obious:34,entropi:54,s_pass:59,waslock:19,demand:[87,3,34,78,60],all:[24,1,77,65,25,71,52,53,3,43,26,16,6,28,58,29,30,51,78,80,81,7,9,83,36,37,10,60,66,19,39,62,68,74,63,87,15,42,54,44,59,17,64,46,89,47,34,86,91,49,92,23,70],four:[52,1,92],secondli:37,prefix:[64,14,74,66,19,60],sleep:[59,92,68,19,60],vcl_acl:52,oldest:[86,63,36,62],hate:[92,68],min_pool:60,forget:[64,80,54,27,58,83,17,39],hcb:59,kqueue:65,accur:47,"const":[64,78,58],vdi_getip_f:78,spew:65,sorri:49,logdata:56,edward:92,swap:29,under:[86,64,62,51,25,71,52,3,74,63,87,26,47,34,42,78,91,60,66,61,30],sha256:[54,30],worth:[58,34,21,42,65,92,38],everi:[1,74,62,71,63,44,65,14,18,47,81,80,34,86,36,54,91,10,89,66,92],risk:54,hdr:[26,47],vastli:[3,42],"void":[64,78,19,58,47,61],hardwar:[87,22,43,73],ptxmcgnnsdxsvdmv:30,govern:[87,2],appar:19,vast:64,school:[82,12,25],prize:23,showcas:67,upload:30,string_list:[64,61,47],vector:60,session_max:60,geoip:38,initialis:91,x86_64:9,properti:18,quilt:77,"10m":26,geekiest:49,direct:[51,18,91,44,30,92,60],histor:23,enjoi:80,consequ:[91,29,70],second:[71,53,65,14,21,77,59,73,82,83,37,10,62,63,85,42,43,44,60,64,74,47,48,20,86,91,22],street:34,aggreg:[87,84,56],backend_unhealthi:59,ill:[87,42],even:[0,1,51,53,3,54,25,78,7,81,82,10,17,66,19,39,90,87,42,43,44,60,64,22,68,34,49,92],aim:[32,51],hide:14,backend1:[61,51],sess_fail:59,neg:6,madvis:73,lookback:80,fetch_maxchunks:60,launch:[92,9,65,30],strictli:26,child_main:65,"new":[52,53,3,21,77,59,30,31,79,81,82,36,37,10,61,39,62,87,44,60,64,68,89,19,48,20,91,92],net:[1,2,87],ever:[64,68,34,6,77,49,12],metadata:[53,87,66,36],ongo:[91,64],elimin:[60,54],centric:32,nanni:17,noreturn:19,never:[64,65,43,60,16,34,6,73,44,22,66,19,17],accus:49,here:[51,72,3,65,57,58,30,7,9,36,37,10,66,39,41,43,44,64,46,48,34,92,23],herd:[59,37],wanton:[88,68],china:68,debugg:60,cache_hit:59,path:[31,51,26,47,29,22,61,60],invad:92,interpret:[3,60],acceptor:60,dry:[59,77],forum:2,announc:[87,92,39],anymor:[48,68],jail:[1,21,79,60],robin:[44,61,78],precis:77,loop:[91,92,19,70],permit:[60,39],vcl_backend_respons:[0,24,57,3,7,26,16,6,48,50,21,36,37,91,66,17],aka:91,c89a:30,werror:60,portabl:[58,19,43],ebcdic:17,eur1:34,newspap:34,storage_malloc:9,brought:[34,19],unix:[64,78,52,43,11,30,19,60],moral:34,printf:19,vrt_backend_field:78,total:[87,1,25,51,71,52,82,89,34,77,59,92],unit:[52,64,60,47],highli:[34,22,65],plot:[68,23],s_req_bodybyt:59,describ:[87,1,65,52,73,64,85,35,48,20,21,27,10,91,29,66],would:[1,2,51,53,3,54,16,21,58,29,61,80,81,82,36,12,19,40,87,42,43,44,64,22,65,66,68,38,34,91,49,92],found:[64,78,52,56,34,60,47,6,82,21,27,59,22,66,30],ddthh:14,lwp:[66,4],leaki:34,init:[64,73],concret:19,call:[24,52,3,43,18,21,27,70,65,61,78,32,7,82,83,36,37,10,60,66,19,39,41,54,44,17,87,64,88,68,89,38,48,6,91,22,92,23],telegraph:39,passport:34,spike:[87,21],lru_cand:52,old_nam:89,type:[24,71,52,53,3,14,16,27,65,30,78,79,80,8,7,9,83,41,15,60,64,74,47,48,91],tell:[0,90,49,65,83,80,3,43,89,60,16,35,18,27,54,44,22,66,19,39],"0x4178fd":9,vmod_foo:64,snowden:92,lru_fail:52,paperwork:34,autogen:27,relax:[64,12],relat:[31,1,52,64,74,6,54,30],award:23,hurt:[60,58],grief:34,phone:10,warm:[64,78,79,87,20,21,30,60],adult:34,hole:[92,25],hold:[64,23,37,60,92,19,39],overrun:74,must:[80,1,77,78,79,52,72,37,64,47,48,82,21,73,91,10,11,60,66,61,30],shoot:52,accid:[92,23],join:[44,90,65,39],room:[59,68],err:59,restor:[91,47],"0x3336351d":78,setup:[66,38],work:[24,50,1,77,2,51,52,53,3,65,16,21,58,30,88,32,80,7,35,82,83,36,37,10,11,60,66,19,39,40,84,41,15,42,43,44,17,87,64,49,68,89,48,34,91,22,92,23],roof:34,wors:[87,19],glossari:[31,17],sess_closed_err:59,erl:[62,71,14,63,86,60],sbin:[31,27],hansen:[88,23],root:[10,1,11,60],overrid:[4,36,7,57,66,60],climat:92,give:[1,51,53,5,65,59,9,83,84,17,19,39,86,44,60,64,22,89,34,42,49,92],txreq:26,indic:[0,31,64,2,51,53,3,60,48,34,83,59,91,10,22,66,30],vrt_backend_prob:64,http_range_support:60,unavail:35,want:[50,1,2,51,40,52,53,3,16,27,28,58,29,47,30,61,78,80,90,7,9,83,36,84,10,66,19,39,13,68,87,42,54,44,17,64,88,46,89,38,48,34,91,49,92,70],vmod_std:[91,8,64,47],viceminist:12,attract:82,somekei:54,recov:42,end:[24,1,52,65,14,18,6,70,77,35,83,36,38,62,63,42,54,44,60,58,87,74,47,34,86,91],manipul:[50,1,78,67,28,66,61,17],turn:[64,2,78,32,68,87,16,18,36,4,22,61],polic:[5,77],stone:19,revisit:[92,88,46],how:[24,1,77,2,51,71,52,3,43,4,18,6,76,65,59,89,30,31,78,79,80,33,81,7,9,36,37,10,60,66,19,40,84,87,54,44,16,17,64,88,68,5,61,34,91,22,23],hot:[81,87],confin:80,"128b":60,answer:[1,2,25,80,34,54,10,22,39],widespread:[82,19],perspect:[7,39],connect_timeout:[91,60],updat:[86,64,62,71,52,63,14,26,56,8,6,80,59,60,30],dialect:43,recogn:87,lai:92,mess:[72,1,51],chines:12,after:[52,26,6,27,59,29,31,79,7,84,19,39,40,44,60,87,68,48,34,21,91,49],superus:1,diagram:25,befor:[50,51,71,68,3,65,14,16,21,27,73,59,30,32,7,36,11,60,19,39,62,74,63,87,86,43,4,17,64,46,89,38,48,6,91,49],wrong:[87,65,33,68,47,35,48,7,9,27,59,10,92,19,39],beauti:66,cli_req:25,law:[10,34,12,92,51],parallel:[6,26,73],averag:[52,63,14,77],rhel6:73,handl:[2,71,52,16,18,6,28,65,59,30,7,36,84,10,17,66,19,39,74,15,44,60,5,48,34,91,22,92],attempt:[1,62,71,32,63,3,14,87,86,47,52,34,6,43,91,59,60,30],third:[64,82,21,83,34],opaqu:64,gottcha:41,is_stream:91,think:[1,51,65,77,25,88,80,7,82,83,36,17,12,19,54,42,43,44,60,87,22,68,34,49,92,23],insuffer:43,wink:34,maintain:[34,39,92,64,30],environ:[26,58],max_restart:[6,60],incorpor:87,enter:[32,16,6,83,36,4,30],no_coredump:60,ethernet:[49,43],first:[1,51,71,52,72,3,77,55,4,75,65,30,61,48,34,81,82,9,83,36,37,10,12,19,39,90,84,63,87,86,54,44,60,64,49,66,46,74,47,38,20,91,22,92,23],order:[1,2,71,52,3,54,14,5,27,57,73,78,35,7,9,36,37,10,11,17,66,61,87,42,43,60,64,65,91,23],vfp:52,origin:[63,90,26,47,7,91,44,66,23,30],tcp_keepalive_tim:[60,73],feedback:[41,60],objhead:[52,60,54],over:[14,6,65,30,31,78,32,80,35,82,83,45,61,63,85,42,60,87,64,68,89,19,34,21,91,23],fall:[34,68],becaus:[65,51,53,77,4,58,59,78,80,35,82,10,19,54,42,43,60,87,22,89,48,34,49,92,23],jpeg:[3,17],g_alloc:59,privileg:[1,21,46,60],affect:[53,3,73,68,15,48,54],omnio:[2,58],federico:[85,30],flexibl:[10,34,2,23],vari:[3,16,7,36,84,4,66],digest:[54,61,30],makefil:[64,43],streamlin:39,cli:[1,25,52,53,84,55,89,15,85,8,9,83,36,80,10,60,30],fit:[78,68,47,59,22,19],cld:25,fix:[77,84,51,65,16,34,42,27,54,66],crew:34,better:[87,51,92,65,60,16,48,34,42,58,10,22,12,19,47],offic:34,req_top:[91,21],rx_bad:59,persist:[52,3,55,42,73,29,88,59,60],hidden:51,easier:[87,48,7,77,22,66],descend:2,them:[24,1,2,51,71,53,3,54,27,58,25,78,80,81,7,10,12,19,68,41,42,43,44,60,87,64,88,65,66,46,89,61,34,91,22,23],gnu99:60,woken:[59,25],thei:[1,77,25,53,43,14,21,70,73,59,30,51,78,88,32,80,81,83,36,10,60,12,19,39,41,42,54,44,17,58,87,64,22,66,68,89,47,48,34,6,91,49,92],proce:[91,6,27],priv_cal:[64,47],safe:[64,53,34,42,10,66,19],"break":[53,87,51,58],band:43,bang:58,promis:[42,19,54],interrupt:30,yourself:[27,1,2,25],bank:34,rumour:65,choic:[60,58],tendenc:92,"40b":60,"0xb7509610":36,s_pipe:59,arrow:[88,23,25],each:[1,71,52,53,65,14,26,74,70,59,29,30,80,10,66,61,40,63,87,54,44,60,64,68,89,34,91,22],debug:[64,52,89,23,9,65,59,60,66,19,30],went:[59,89,92,19,65],side:[24,40,64,51,48,32,68,87,16,6,8,34,21,83,84,91,22,66,47],mean:[24,51,53,16,27,65,59,78,80,90,82,36,72,17,19,74,87,54,44,4,60,64,68,89,48,34,88],doddl:77,pdflatex:82,reqstart:[52,83],req_stat:60,unreport:74,interop:87,list:[24,1,2,53,14,56,21,70,59,30,31,80,33,69,35,82,9,83,36,60,66,19,39,74,63,15,86,17,64,46,89,61,48,34,91,22],exactli:[1,65,46,89,54,22,66,19,30],kerbero:87,spider:17,taught:[23,19],forgot:[51,39],logo:89,dawn:51,commiss:87,"24x":89,respreason:52,network:[87,1,2,52,7,69,70,73,91,30],goe:[1,65,53,33,34,9,42,58,44,38,30],crucial:66,content:[0,24,1,2,25,71,52,53,3,4,5,6,59,29,30,31,61,7,36,37,60,66,19,84,85,74,54,44,16,17,87,64,38,89,47,48,90,91],rewrit:[82,60],adjust:[29,5,73],adapt:[34,68],reader:[53,74],got:[59,34,68,19,37],backend_req:59,size:[51,71,52,53,73,55,26,77,29,30,81,7,9,36,84,19,62,87,54,59,60,64,47],forth:[21,80,83,6,68],outburst:[31,16,88,19,4],cli_auth:30,barrier:[88,25],worthwhil:87,gzipbodi:26,nightmar:[22,92],situat:[87,34,65,23,60],free:[64,51,7,23,34,73,91,59,88,19,60],standard:[87,51,89,47,8,7,91,49,19,60],small:[24,87,58,54,68,20,7,81,34,21,29,91,10,60,59,23,17],fret:10,spdy:[87,88,51],perform:[87,2,84,51,29,44,58,89,15,4,52,18,74,36,73,10,22,60],speedi:51,sunshin:92,libedit:27,varnishcach:7,angl:24,haywir:65,openssl:[34,22,92,30],filter:[87,71,52,63,60,56,48,9,83,36,10,30,66,39],soekri:77,vcl_backend_fetch:[48,6,16],ish:[24,80,77,84,60],iso:[58,19,43],isn:[92,68,35,42,29,66],iphon:7,regress:[23,26,58],subtl:[34,78],loud:34,spersist:42,rang:[91,59,34,60],httpgarbag:52,grade:11,independ:[87,82,78,51],wast:[22,60,19,51,16],rank:[8,34,77,63,56],restrict:[87,1,47,82,30],hook:64,instruct:[24,2,3,9,27,37,10,66,17],alreadi:[90,64,49,78,51,3,77,87,60,16,35,48,5,9,36,37,91,29,22,59,39],vug6:51,messag:[87,64,52,53,89,47,6,34,9,83,42,65,91,88,60],wasn:68,ditch:42,fantast:19,primari:64,hood:78,traction:87,xid:91,rewritten:[3,63],top:[87,1,62,25,14,64,56,21,65,91,44,66,17],sometim:[87,52,89,81,34,9,77,66],fiction:51,sdeprecated_persist:42,master:[1,52,89,9,83,65,17,60],too:[1,77,78,54,68,64,60,34,42,27,36,73,59,22,92,19,39],lognam:71,critter:[87,30],john:[25,77],listen:[9,1,79,52,46,21,60,30],danish:34,murder:77,consol:[5,9],namespac:[48,66,4],signup:2,clueful:66,took:[34,74],waster:87,tee:65,only_root:60,compressor:87,somewhat:[64,78,15,37,44,66],conserv:[35,66,60],wchar:60,technic:[25,58],was_304:[21,91,6],losthdr:59,past:[87,51,77,34,43,39],silli:[43,66,19,54],target:64,keyword:[15,48,69,6,70,91,66,19],provid:[1,25,53,3,5,70,65,59,30,78,32,7,9,61,42,44,60,64,46,89,90,92],expr:74,tree:[64,26,54,91,22,60],zero:[64,62,51,71,53,3,14,85,86,74,6,63,10,49,60],shower:34,matter:[87,2,78,53,43,34,61,82,6,27,54,19],bca3633d52607f38a107cb5297fd66e5:54,silly:19,frankli:82,"5mm":77,minut:[24,65,47,27,37,91,59,19],expected_respons:91,provis:78,mini:43,fashion:[91,44,61],websocket:[87,67,45],abov:[24,1,92,3,65,46,64,26,16,35,48,9,27,36,54,11,60,66,30],vdi_healthy_f:78,ran:[59,5,92,34],modern:[11,2],mind:[59,64,2,87,39],localnetwork:91,spent:[52,53,34,77],raw:[83,86,63,74,77],pessimist:58,manner:[29,9,60],wmiss:60,concent:58,seem:[87,51,82,44,88,23],incompat:[27,19,43],seek:29,minu:[22,68],ponder:23,recreat:60,wpointer:60,latter:[64,78],client:[0,50,2,51,71,52,3,26,56,21,70,65,59,79,32,35,8,7,83,36,37,17,66,38,63,87,86,4,60,64,74,61,16,48,69,6,91],evalu:[52,36],transmit:[52,59,60],vrt_magic_string_end:64,simplifi:[64,66],crippl:19,plenti:[34,66,60],though:[78,74,34,42,77,92,23,30],vmodtool:64,"0x4196af":65,glob:[63,86,14,74],object:[0,24,2,25,52,68,3,4,56,18,21,28,59,29,30,51,78,32,81,7,36,37,60,66,19,84,15,42,54,16,17,61,64,50,46,89,38,48,6,91,57],what:[1,77,2,51,40,53,3,43,55,56,5,27,70,76,58,90,31,78,88,80,34,35,7,9,83,36,84,10,60,12,19,39,13,68,74,41,15,42,54,44,17,87,64,49,65,66,46,89,38,20,91,22,92],supress:49,n_waitinglist:59,regular:[64,62,71,53,74,63,89,60,7,70,82,86,36,58,91,44,30,66,28],letter:19,bsd:43,objstatu:52,contain:[24,31,64,52,14,3,33,46,74,60,47,70,50,21,36,84,91,22,19,30],tradit:60,wish:[34,92],excus:92,don:[0,1,51,4,18,21,27,78,7,10,66,19,39,87,15,42,54,16,60,64,12,68,74,38,48,90,49,92],vcl_fetch:48,doc:[91,82,60],alarm:68,camp:87,flow:[87,18,70,39],doe:[25,52,53,3,65,16,5,73,29,78,79,33,7,82,9,36,37,10,60,66,19,39,84,87,15,54,59,17,64,22,46,74,34,88,91,49,92],declar:[64,78,80,21,70,91,44,61],annoi:[19,39],wildcard:80,diag:59,gzip_stack_buff:60,enclos:[91,60,70,30],unchang:[3,79],section:[71,52,65,14,26,4,18,27,70,76,73,59,30,33,90,9,84,10,61,40,62,55,74,63,85,86,44,60,64,5,47,20,91],came:[64,52,34,21,43,12,23],treati:51,othervis:0,objecthead:59,pope:49,opposit:54,varnish_secret:[1,89],probe:[64,78,52,80,8,21,44,91,59,60],"_noreturn":19,syntax:[79,80,3,85,74,18,21,27,70,84,91,29,60,30],pipe_timeout:60,advisori:54,directli:[1,2,78,48,34,6,27,54,91,66],radio:49,pkg:27,vsm_free:59,radic:82,protocol:[87,78,71,52,17,79,60,20,21,91,49,92,19,30],priv:[64,78],involv:[1,34,51,7],despit:[34,6],dridi:30,layout:53,acquir:64,field2:14,menu:82,explain:[3,84,43,54,10,39],configur:[1,2,52,53,55,16,18,21,27,73,29,89,30,31,80,33,90,75,35,8,84,10,60,66,43,44,17,5,48,20,91,22],apach:[8,34,71,10],stanza:[44,36],bust:9,busi:[91,59,36,77],phpsessid:66,painfulli:[87,42],gzip_buff:60,http1pipe:78,"0x42bce1":65,thread_pool_purge_delai:48,steel:19,nasti:65,stop:[87,52,55,34,75,89,5,59,44,60,30],compli:[92,78],next:[13,64,92,40,53,33,68,41,4,87,80,34,21,27,58,49,90,19],obscur:[65,43],cryptographi:92,report:[77,65,84,78,52,3,33,14,74,26,34,9,76,58,10,49,60],txresp:26,transpir:[19,43],earn:87,bar:[64,54,26,59,44,66,19],ietf:[87,66,51],patch:[77,58],fals:[91,64,74,41,16],reload:[35,83,78,60],bad:[77,68,89,34,36,65,59,92,19,60],"sm\u00f8rgrav":[62,71,14,63,86,60],ban:[52,84,89,4,7,21,36,42,59,91,29,60,30],told:[1,9,92,58],respond:[34,92,16],blew:34,victim:77,pummel:80,wstrict:60,cache_esi_deliv:9,roadmap:24,"0x40":60,nul:[91,64,70],full:[24,64,49,51,70,29,91,10,22,60],mandatori:[91,60,74,58],result:[52,53,3,14,16,21,58,30,37,17,66,38,85,64,41,43,60,87,74,47,34,6,92],respons:[0,50,1,2,25,71,52,16,18,21,57,59,30,32,7,84,17,66,87,42,4,60,64,67,74,48,6,91],fail:[86,7,64,62,51,71,52,63,14,89,26,47,6,82,21,27,73,91,59,66,60],themselv:[54,43,30],foss:92,vcc_allow_inline_c:[72,48,1,60],impur:34,subject:[87,91,59,17,66,39],awar:[50,4,81,20,36,65,29,66,60],said:[11,92,34,51,77],hopefulli:[35,10,3,77],databas:[64,42],vcl_event_load:64,arcana:54,figur:[65,68,7,34,27,43,12,39],outstand:[59,86,71],finger:34,drawn:60,awai:[87,71,53,89,86,54,10,22,92],irc:[2,33,34,9,65,39],approach:[80,87,41],attribut:91,depriv:92,accord:[78,77,70,54,19,17],triplet:80,extend:[71,72,84,4,48,18,77,10,66,61],mandat:[87,43],boss:[34,55,89,84],extens:[87,64,11,23],workaround:64,wear:42,extent:[53,87],toler:58,advertis:87,kitchen:68,setsockopt:60,protect:[64,1,55,82],expos:[35,92,78],fault:60,howev:[64,78,92,87,9,27,70,54,91,44,66,38,30],misguid:87,against:[0,25,55,89,74,70,69,21,28,42,91,59,60,92,36],futil:65,countri:[92,38],varnishstat:[62,71,63,65,14,26,56,81,8,86,60,76,59,10,30,17],fileformat:82,compromis:[32,92,1,68,25],host_head:91,"16k":60,foobar:[3,64],trunk:[31,68],gopher:87,"16b":60,cnt_deliv:9,shortcut:[80,87,60],infirm:34,wider:87,diff:82,guid:[13,2,40,31,9,84,66],assum:[24,87,25,3,74,35,7,36,43,29,22],goodby:22,speak:[31,1,21,78],question:[87,64,2,80,41,34,84,91,10,39],priv_top:64,trapdoor:51,coredump:60,divers:[10,43],three:[24,87,1,51,25,53,84,14,64,4,34,36,65,60],been:[25,53,14,75,6,59,79,34,10,66,19,39,90,41,85,42,60,87,12,48,20,21,91,92,23],accumul:[59,36,25,60],trigger:[6,65,37],unsubscrib:39,dlopen:[64,60],interest:[87,62,51,92,65,34,82,28,58,10,88,66,39],subscrib:[25,78,53,82,10,39],c12336bdfdb8:21,vcl_deliv:[50,64,7,6,36,91],tini:[34,92],threw:34,http_req:25,life:[58,87,51,78,65,68,77],regul:92,spit:54,dismiss:80,worker:[9,64,77,79,52,53,65,46,89,60,21,36,59,10,17,92,30],"25g":60,telnet:[87,82,49,79,30],anywher:[87,22,47],vcc_err_unref:60,implict:60,craft:7,tollef:59,cli_buff:[60,30],child:[9,1,25,79,52,53,65,89,60,21,59,10,22,30,17],event_funct:64,spin:65,overtak:74,emploi:87,ugli:[42,19],ident:[80,9,87,53,65,14,85,48,21,54,91,44,59,60],aix:[58,43],prefer_ipv6:[89,60],servic:[31,1,49,78,25,84,46,47,35,75,27,65,39,30],zlib:22,commerci:[7,33,39],can:[0,24,1,77,2,74,25,71,52,68,3,43,55,26,4,56,5,21,27,61,73,29,89,30,31,51,78,32,80,69,75,81,82,9,83,36,37,10,11,60,12,38,72,39,90,62,14,85,84,63,41,15,7,42,54,44,16,59,17,58,87,64,65,66,50,46,18,86,19,48,34,6,91,22,92,23,70],employ:34,calcul:[66,38,34,54,12,19,30],devicedetect:7,neat:[53,68,19],dashboard:21,aid:33,vagu:2,alloc_seq:53,spawn:64,opt:[31,64,60],seven:51,fe80:[1,46],bans_lurker_content:59,c_req:59,complaint:34,elicit:51,conf:[46,73],randri:59,tediou:43,"0x43ef68":65,thread_pool_stack:60,sever:[50,87,77,90,34,37,44,66,30],grown:19,vclrel:60,"80m":60,child_pan:59,http_max_hdr:60,suggest:[65,77,39],make:[1,77,2,25,52,53,3,58,4,56,18,27,70,73,59,47,30,81,51,78,34,35,82,9,37,10,60,12,38,39,90,74,41,15,7,42,54,44,16,17,87,64,65,66,68,89,19,48,20,91,22,92,23],transpar:[33,73],bikesh:[34,51],amount:[87,3,74,81,29,60],complex:[87,48,34,10,22,92,39],split:[29,48,65,4],vmod_dir:[1,60],complet:[86,62,52,63,46,89,15,48,6,91,59,22,66,60],bans_obj_kil:59,raid:12,nil:[60,58],smf:59,nake:41,lustr:51,hang:[65,39],deflect:[34,87],hand:[77,41,34,42,43,60,19,17],fairli:11,rais:42,portal:81,evit:6,studi:46,tune:[3,84,46,89,56,73,10,4,60],kid:[92,34,22,68,87],lockless:[60,54],kept:[86,62,79,63,26,81,34,21,36,29,66,60],scenario:[80,7,74],thu:[87,1,36,51,30],itself:[86,62,71,52,63,74,26,47,7,9,42,91,66,61,60],inherit:[91,70,25],eur700k:34,vcc_unsafe_path:[1,60],contact:[34,46],cooloff:60,thi:[0,24,1,2,74,25,71,52,53,3,43,55,26,4,56,5,21,27,61,76,73,29,47,90,30,86,31,51,78,32,80,33,20,75,35,82,9,83,36,37,10,60,66,38,72,39,40,62,14,84,63,85,15,7,42,54,44,16,59,17,58,87,64,49,68,65,50,46,18,89,19,48,34,6,91,22,92,70],mother:[34,9],gzip:[88,51,52,3,26,16,6,77,91,59,4,60],programm:[10,82,19],everyth:[64,3,87,56,7,9,27,58,83,22,66],legisl:87,left:[64,62,25,74,14,87,56,82,6,91,59],agon:34,identifi:[87,53,7,21,83,80,66,19],sz_actual:59,just:[1,77,51,53,54,56,18,58,25,78,80,7,9,36,10,17,12,61,39,68,87,43,44,60,64,66,46,89,19,34,49,92],sigusr1:[86,71],bandwidth:[3,87],via:[1,48,90,36,66,39],backend_hint:[48,7,37,91,44,61],human:[34,92],yet:[1,34,65,59,22,92,19],languag:[64,1,2,84,48,67,41,26,19,8,18,74,71,43,91,10,60,66,38,17],previous:[29,21,79,48],easi:[10,66,19,25,65],elm:19,had:[64,2,80,65,92,87,74,34,21,42,59,10,12,19],builtin:[48,18,70,60],must_reload:60,my_acl:47,spread:34,esi_chop:60,board:2,prison:92,els:[58,64,65,92,3,54,89,26,7,69,9,37,91,44,22,66,38],save:[87,51,3,91,66,60],explanatori:19,transit:[21,32,64,6,60],elt:34,n_objectcor:59,sanit:1,applic:[31,2,71,14,16,35,86,37,44,66],mayb:[44,34,51],preserv:87,sanitari:68,objreason:52,donat:34,ktrace:65,vrt_ctx:64,background:[37,64,6,23,36],elabor:9,dreamt:22,lck:59,apart:[48,66,68],measur:[10,63,60],daemon:[71,14,8,86,27,60],specif:[1,2,71,73,26,56,18,27,58,31,78,32,80,33,84,10,17,66,19,42,43,60,64,74,91],arbitrari:[1,18,21,83,44,38],nudg:34,manual:[71,52,14,26,27,65,59,30,31,8,84,10,61,62,63,85,86,60,64,74,47,91],pool_sess:60,graviti:19,zoop:44,remind:39,confid:1,night:92,hung:65,uppercas:[19,47],el6:27,unnecessari:[3,21,66],el5:27,underli:78,www:[24,31,64,2,87,35,90,91,44,66,30],right:[50,40,58,77,65,51,68,43,14,34,89,87,82,54,10,64,92,23],old:[87,64,92,71,52,53,68,89,86,23,9,83,36,42,80,59,66,19,60],deal:[87,53,60,4,80,34,42,37,10,22,39],negat:[91,70,30],interv:[91,44,64,14,60],crown:43,somehow:80,dead:25,intern:[78,74,26,48,7,59,29,66,38,60],varnishd:[24,1,71,52,53,14,26,56,21,27,65,29,30,31,80,8,9,10,17,62,74,63,85,15,86,16,60,46,89,47,91],i686:9,heritag:87,bore:19,successfulli:[35,59,6,19],transmiss:[52,59],txt:82,cooper:[62,71,63,26,86,91,60],vcl_hash:[48,7,6,36,54,91,38],bottom:[82,14],establish:[53,85,59],fpic:60,generer:52,massiv:19,multipli:41,fog:[59,51],condit:[9,2,51,3,74,6,21,65,91,60,30],wunus:60,localhost:[90,1,78,83,46,75,85,70,69,27,36,91,44,60,30],core:[9,32,6,21,65,59,22,23,60],plu:[22,92],sensibl:[64,77,3,43,16,58,19],uncompress:[3,16,60,4],oracl:[2,58],burn:22,unreason:80,sc_tx_pipe:59,post:[31,47,23,39],chapter:[31,1,9,46,60],sshd:1,obj:[50,16,48,7,6,36,37,91,59,60,30],troubl:[9,87,25,52,33,89,42,65,39],smalloc:[21,9],unfortun:[42,66,19],commit:[80,87,51],bans_lurker_test:59,produc:[64,71,52,3,87,82,36,43,59,60],match:[57,62,71,63,14,74,60,28,80,69,86,83,36,54,91,44,70,30,66,39],net5501:77,dilemma:34,civil:92,tackl:34,"float":[64,74],encod:[87,52,3,60,26,16,6,91,56,66,17],bound:[64,2,62,63,46,86,16,90,9,29],verbiag:19,down:[1,78,51,68,14,9,70,42,44,91,10,66,92],vcl_log:[52,71],resili:44,nuke_limit:60,wrap:[1,82,19],opportun:[92,12],stall:53,storag:[64,52,46,3,84,55,87,15,16,81,53,21,60,42,54,91,29,56,59,30],sc_req_clos:59,often:[64,25,51,65,48,54,91,30,60],somedict:54,accordingli:64,git:[68,27,77],crowd:[34,65],suffici:46,boutiqu:64,transform:[5,7,77],happi:[64,16,34,77,91,59],avail:[24,1,2,71,53,73,14,26,21,27,70,58,29,30,34,7,36,62,63,87,42,59,60,64,74,48,20,86,91],gif:[57,51,16],reli:[44,66,58],editor:[35,44,82,90,77],fraction:[34,74],hit_for_pass:48,overhead:[52,81,60],constantli:56,tcpdump:92,clockskew:60,fork:[25,60],head:[87,62,71,63,86,91,59,66,60],amateur:19,slip:23,form:[40,1,53,47,16,65,49],offer:[87,1,89,7,10,39,19,60],forc:[62,51,52,80,3,63,86,4,21,36,91,60,66,92,30],recommend:[31,1,46,15,47,21,27,36,73,49,66,61,60],refcount:[52,51],hitrat:[9,66,84,4],n_purg:59,linpro:[91,2,26,39],hear:51,idle_send_timeout:60,heap:36,icmp:87,"true":[24,9,64,78,3,74,41,26,16,6,48,89,21,27,36,65,91,47,66],analyst:87,mymod:64,reset:[91,3,60],absent:[86,63],mtx:59,suspect:[9,51],toolchest:51,bugfix:65,vcl_init:[91,44,6,61,48],maximum:[62,80,3,63,86,73,91,29,60,19,30],until:[64,78,51,71,80,58,41,60,75,6,36,54,49,92,19,30],strace:[9,65],ncurs:27,fundament:[40,87,2,80,10,23],autoconf:27,retir:[80,48,21,79],c_byte:[53,59],nnn:30,classif:[7,78],later:[86,64,71,52,43,63,85,60,34,42,27,70,54,91,59,30,83,19,39],openbsd:[92,11,2,58],sight:22,semicolon:70,classic:[42,60],httpbi:87,http2cfi:87,futur:[64,51,68,87,48,6,91,39,23,60],textbook:51,sale:39,postscript:92,exist:[51,71,53,41,7,48,20,6,43,91,29,22,38,60],obj_sticki:60,request:[0,50,1,2,74,51,71,52,3,55,26,4,56,18,21,28,76,59,30,78,32,35,8,7,9,83,36,37,10,60,66,62,84,63,87,86,44,16,17,64,67,46,89,47,48,20,6,91],vcl_event_us:64,ship:18,check:[25,71,52,53,14,74,18,21,27,59,30,9,83,36,37,10,66,38,39,62,84,63,41,86,43,44,60,64,89,47,34,23],shit:77,sticki:61,assembl:[24,10,19],encrypt:1,when:[0,24,1,2,74,25,71,52,53,3,14,26,4,56,18,21,28,65,29,47,30,51,78,80,33,20,35,8,89,9,83,36,37,10,60,66,38,39,62,68,84,63,7,42,43,44,16,17,61,64,49,50,46,5,86,19,48,34,6,91,22,92,23],actor:[92,25],cache_miss:59,role:[87,66,78,25,4],proxygarbag:52,test:[24,64,77,52,3,58,89,26,75,8,34,74,27,36,43,59,11,60,23,17],tie:[10,90],presum:[10,19],unlimit:[29,9],wcast:60,intend:[32,91,70,65],benefici:73,devot:34,felt:[34,87],fell:[19,25],intent:[44,58],notic:[9,64,53,46,87,48,21,77,23],consid:[87,64,78,51,71,68,20,81,34,44,91,29,66,60],exp_inbox:52,warn:[62,52,63,86,42,91,59,19],receiv:[50,1,2,71,52,3,64,60,86,6,91,59,17,66,61,30],faster:[2,53,83,73,60,39],furthermor:[1,54],logstream:5,sighup:[86,71],"0x0a":30,carriag:30,exce:[66,74,78,60],ignor:[71,52,3,16,70,91,66,60],distro:58,time:[24,1,77,2,51,71,52,53,3,43,14,26,4,18,21,27,73,29,30,78,79,80,9,36,10,11,60,12,19,39,74,63,41,42,54,44,56,59,17,58,87,64,49,65,66,68,5,47,34,6,91,22,92,23],push:[53,87,54,51,30],serious:[72,51,58],backward:19,wshadow:60,stick:[49,51],vmod_set_ip_to:64,concept:[87,78,53,77,90,21,42,54,44,66],cli_timeout:60,snif:43,whoever:19,skip:[1,3],global:[91,64,76,60],focus:[91,87,39,4],invent:19,haxlw:65,shellscript:43,signific:[81,92,30],tx_error:59,netbsd:[11,2,58],millisecond:[91,48,60,47],varnish:[0,1,2,3,4,5,21,7,8,9,10,11,66,13,14,15,16,17,18,19,20,6,22,23,24,25,26,27,70,29,30,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,58,59,60,61,62,63,64,65,68,71,72,73,89,75,76,77,78,79,80,81,82,83,84,85,86,87,88,74,90,91,92],middl:[87,92,77],depend:[31,33,18,7,82,74,27,65,91,29,60,66,17],graph:[32,62,56],exp_rearm:52,flash:[87,42],readabl:[91,82,64,58],"_that_":25,rel:[64,53,41,34,10,60],default_ttl:60,certainli:[64,58,34,65,92,19],vec:3,downtim:42,addon:66,oversight:64,sourc:[51,26,56,27,58,30,33,34,82,9,17,19,39,42,43,60,64,22,90,91,88,92],string:[64,61,62,71,52,3,74,63,41,60,47,7,86,70,54,91,49,66,19,30],"3am":25,vdir:[44,61],daemon_opt:75,spate:54,revalid:[21,66],varnishncsa:[86,62,71,52,53,79,14,26,8,21,63,10,60,17],lru:[52,59,81,60],cook:68,word:[87,82,42,19,30],n900:58,exact:[34,60,89,30],cool:[64,25,78,53,42,59],exp_when:52,foo:[64,66,74,85,26,47,9,54,91,44,59,19,30],hour:[91,34,47,39],administr:[31,1,25,32,46,10,12,60],level:[87,1,84,52,92,3,65,14,82,47,34,21,42,58,91,59,74,60],did:[88,51,25,3,58,68,74,23,34,42,43,59,49,19],die:[10,89,51],gui:51,overarch:20,shortcom:[87,19],ccf_panic:65,mystat:64,cooki:[24,64,2,84,92,65,87,4,57,74,28,54,10,47,66,61,30],sedimentari:87,round:[51,78,44,29,92,61,60],prevent:[87,1,80,64,34,36,92,19,60],brave:[10,27],slower:[54,4],peek:[24,82],trend:77,cache_cli:65,sign:[87,25,60],cost:[34,49,12,87,60],gzipe:3,unprotect:25,port:[1,52,75,21,27,30,80,35,7,9,10,40,85,44,60,87,46,47,48,90,91,49,23],pipeacct:52,insuffi:60,cecili:85,filler:19,repli:[91,12,85,60],"64bit":73,anywai:[53,34,49,80],current:[87,1,2,78,51,89,14,20,47,48,34,36,65,91,22,92,19,39],sinc:[1,2,51,52,53,3,21,78,80,34,35,9,66,19,90,42,54,44,60,64,12,68,74,48,20,91,23],rfc5952:49,rephras:65,s_pipe_hdrbyt:59,appeal:34,boost:34,deriv:[32,34],compos:[51,39],gener:[1,77,65,25,52,72,54,14,56,6,58,30,81,78,32,35,9,66,19,39,41,42,43,16,60,87,64,46,89,48],revamp:79,timeout_req:79,satisfi:[34,60,27,74,58],kamp:[31,87,2,62,71,52,63,26,16,86,91,60,30],address:[1,52,53,21,70,30,79,80,35,7,9,38,63,85,60,87,46,89,47,48,69,91,49],along:[87,64,14,1,47,36,77,66,23],wait:[87,64,62,25,51,71,63,65,14,85,86,6,37,91,59,92,60],box:[7,87,65],buck:58,rx_timeout:59,insan:[22,92],fenc:22,"4084b":60,errorhandl:65,group_cc:79,queue:[59,60,37],range_short:59,"199de9b":31,behav:[9,43,17],dusti:80,extrem:[18,34,23],weird:[35,41,51,58],transact:[0,87,62,51,71,52,86,84,63,74,26,6,9,83,70,65,59,17,30],commonli:[66,63,61,56],ourselv:58,semant:[91,14,78],love:[64,34,68,19,58],repositori:[68,27,26],humour:66,extra:[48,7,21,42,59,92],tweak:[3,27,51,15],modul:[1,25,48,64,47,8,20,21,42,44,91,10,61,60],prefer:[87,79,80,89,70,54,11,66,60],getbodi:78,marker:[91,64,87,79],instal:[31,64,33,46,35,90,9,27,11,60],smallish:54,mobil:[44,7,87],"0x42f838":9,transplant:34,regex:[91,86,63,36],priv2:78,memori:[1,25,71,52,53,16,5,73,29,81,8,9,83,10,62,63,85,86,54,56,59,60,64,74,47,91],subvert:25,franca:82,visit:35,todai:[42,68,51],subvers:1,everybodi:[65,23,39],live:[64,66,58,68,34,4,82,42,36,43,91,29,60,59,39],handler:60,"417a":49,criteria:[87,74,38,57],paramet:[24,1,25,52,53,3,65,55,16,27,73,29,30,31,79,7,9,36,72,17,66,84,85,15,59,60,46,89,48,20,91],scope:78,angri:19,bill:[92,78],reorder:7,twitterif:36,fridai:34,afford:54,peopl:[1,77,65,92,51,80,58,68,87,48,34,42,36,54,49,66,19,39],priv_:64,finit:51,clue:9,suckag:[49,88],drown:39,prototyp:[87,64,47,34,61,60],examin:[87,53,3,89,65,91,60],exp_expir:52,effort:[87,51,34,42,58,22,19],easiest:[66,89],fly:[87,89,16,60,66,30],graphic:[82,6],car:34,prepar:[32,10,91],pretend:90,focu:[34,2],cat:[51,30],descriptor:[52,59,64,65,60],hardest:64,http1:60,whatev:[87,1,51,53,64,89,36,65,66,60],purpos:[90,78,41,15,47,75,6,36,44,66,60],rx_junk:59,materi:[34,19],problemat:87,heart:27,favourit:51,vfpacct:[52,60],stream:[51,52,3,7,6,5,21,91,45],busy_sleep:59,predict:[74,51,54],slightli:[53,3],chip:42,critiz:92,wnest:60,backslash:[74,14,70,30],agent:[71,63,74,56,7,91,44,4,66],topic:[40,34,49,83,39],heard:[34,23,58],critic:[34,92,87],abort:[22,6,38,60],"14b":65,hash_always_miss:[91,36],recycl:[59,54],agenc:92,simul:[65,26,17],occur:[64,56,63,47],alwai:[87,64,65,78,25,71,3,58,68,89,26,16,34,74,15,54,91,60,19,30],sundai:[92,47],multipl:[64,53,84,46,89,86,47,91,18,21,14,80,63,44,60],oslo:[92,77],get:[1,77,2,74,25,71,53,3,43,14,16,18,6,27,61,58,89,30,31,51,78,80,33,90,7,9,83,36,37,60,66,19,39,40,62,68,84,63,87,15,42,54,44,17,64,49,65,46,5,38,48,34,86,91,22,92,23],ping:[60,83,30],uptim:[59,14],write:[2,51,71,29,53,26,5,21,58,59,30,25,78,80,8,82,83,36,10,12,19,42,43,44,60,64,34,86,22,92],anyon:58,fourth:82,swore:34,fetch_bodi:52,map:[64,51,53,7,44,12],product:[37,46,34,82,58,60],ban_lurker_sleep:[36,60],vcl_event:21,huge:[22,19,37],max:[62,52,9,59,66,60],clone:27,timedout:19,spot:[87,82,19,25,39],usabl:[80,19,65],intrus:[58,39],membership:[21,79],scratch:[48,87,78,51,65],mad:43,mai:[1,71,65,14,6,27,70,58,29,78,88,7,17,19,39,63,41,86,54,60,64,22,46,48,34,91,49,23],shuffl:6,suck:82,data:[77,51,52,53,65,6,59,29,30,25,78,79,81,8,9,83,66,19,41,86,54,44,60,64,74,38,48,20,21,91,22],grow:[22,23,60],accessori:58,repo:27,stress:[34,19],autotool:27,practic:[87,25,3,82,19,34,27,23],mgr:25,disabigu:80,secur:[87,1,88,84,25,79,46,54,55,20,15,89,34,21,29,10,60,92,39],ideolog:34,mangl:66,inform:[2,71,52,14,56,5,27,65,59,80,9,83,66,39,62,63,86,54,44,60,87,48,91],"switch":[64,80,60,5,15,89,48,18,6,10,30,82],wrt54g:58,combin:[8,71,74,30],block:[52,14,74,9,70,91,92,60],anoth:[25,3,54,18,30,80,7,36,10,17,66,19,87,43,60,64,46,34,91,49,92,23],vrt_backend_handl:78,talk:[64,51,80,16,82,91,10,49,92,30],shield:37,virtualis:73,graphviz:27,brain:34,vtailq_insert_befor:19,ttl:[24,57,52,60,26,4,48,6,15,37,91,29,47,66,36],clock_skew:60,cold:[20,21,64,78,30],still:[24,87,1,77,65,74,51,92,43,89,7,34,9,36,42,54,66],pointer:[64,52,80,74,8,19,60],dynam:[8,21,78,53],entiti:64,divis:10,vtc:[27,26],group:[87,78,62,71,79,63,7,86,74,20,21,83,70,91,44,49,19,60],monitor:[10,56,74,84,53],polici:[24,87,2,80,89,91,10,39],torn:68,norwai:[82,34],unambiti:19,instantli:[10,64,89,80],platform:[58,40,2,33,35,82,9,73,88,60],rogier:2,curli:[91,70],mail:[59,33,2,39],g_byte:59,main:[87,84,51,65,21,59,10,39],limbo:42,do_gzip:[91,3,16],non:[24,64,2,84,71,58,85,74,82,21,42,43,91,92,60],synopsi:[62,71,63,14,85,26,47,86,61,60],ban_lurker_batch:60,set_health:30,losthead:52,smarter:[82,7],supersed:59,objprotocol:52,initi:[87,1,62,51,71,52,63,79,14,64,86,74,6,70,42,78,91,59,92,61,60],nation:34,underneath:87,safari:7,half:[64,82,92,34,60],nov:47,now:[24,77,2,51,40,3,43,14,75,21,27,28,58,79,80,90,35,82,9,83,37,66,19,13,41,42,54,44,87,64,22,68,89,47,48,34,91,49],negoti:92,nor:[87,64,16,70,91,19,60],introduct:[32,8,9],wont:[34,9],wagon:43,term:[87,54,34,58,10,17,66,60],workload:15,polish:51,name:[71,52,53,14,26,70,29,30,78,80,10,66,62,63,85,15,86,54,60,87,64,46,74,48,69,91,92],realist:[68,54],opera:19,config:[44,27,60],drop:[59,34,21,60,39],crypto:[87,22,92],separ:[64,25,46,63,87,86,74,21,22,66,60],pcrepattern:66,careless:49,between_bytes_timeout:[91,60],polit:[92,25],reqstatu:74,backendclos:52,failov:10,domain:[91,87,18,78,25],replac:[87,51,79,37,35,48,43,91,59,49,92,60],individu:[24,64,52,74,30,60],compon:[64,42,74,25],continu:[40,62,63,14,26,56,6,34,21,60,66,19,30],ensur:[10,3],vcl_trace:[52,65,60],"0x8006b51c1":65,unlock:59,sponsor:[34,42],year:[23,87,51,68,34,47,82,77,91,92,19],operand:74,happen:[51,72,3,65,6,77,25,82,9,36,37,10,66,61,62,63,87,86,60,64,68,74,48,34,92],disturbingli:77,"80013822c":65,shown:[34,64],accomplish:66,libjemalloc:27,space:[64,14,74,60,81,48,34,42,83,59,91,29,49,30],repetoir:41,pamphlet:34,storage_fil:60,stupid:[80,1,25],pagedown:14,rational:66,internet:[34,49,92,25],ironi:[77,65],bla:51,correct:19,stat:[80,53,14,60],unresurrect:59,varnishlog:[86,62,71,52,63,65,14,26,4,21,8,5,9,83,79,59,10,60,66,17],monster:19,state:[64,78,32,80,47,6,8,21,42,91,60,30],migrat:80,million:[92,77],libpcre3:27,theori:[3,38,54],carl:49,org:[31,64,2,90,87,26,56,35,82,27,77,91,60,66,38,39],"byte":[64,71,52,3,87,60,47,91,6,54,17,29,22,59,30],rfc1884:49,vcc_if:64,care:[64,2,78,58,47,34,27,54,44,49,66,38,17],reusabl:[91,70,78],funki:68,couldn:59,badli:[34,66,87,16],waiter:60,insert:[52,3,47,91,59,16],synchron:[6,60],modest:34,honest:[34,51],motion:51,thing:[1,51,3,65,16,5,77,25,80,81,10,66,19,87,43,44,60,64,68,89,34,22,92],place:[64,37,68,9,27,36,54,49,39],router:[91,87,69,70],ture:23,principl:[92,12,74],imposs:51,frequent:[66,63],berespbodi:52,oper:[1,25,52,53,65,5,21,27,28,73,29,30,78,10,66,41,85,42,43,44,59,60,46,74,47,48,69,91,70],redhat:[33,73],carri:[81,22,66,23,25],onc:[71,14,75,27,65,59,30,31,78,80,9,36,37,10,61,62,84,63,5,42,64,68,89,86],arrai:[42,54],housekeep:64,wedg:65,reopen:[86,71],fetcher:60,fast:[31,51,80,65,42,54,29,60],waitinglist:[52,59,60,73],oppos:5,ring:74,open:[1,51,52,53,58,27,65,29,30,80,90,9,10,39,64,44,87,46,74,34,91,88],predefin:7,yourselv:78,given:[86,87,64,61,63,85,14,41,26,47,21,80,29,60,23,30],sheet:22,silent:[53,59],teenag:77,mailman:39,autocrap:[88,43],caught:[59,9,23],sessclos:52,vmod_director:[91,8,61,78,48],necessarili:[21,9],cassett:49,white:74,conveni:[64,89,39],get_lock_befor:19,friend:[48,34],arith:60,cope:51,copi:[1,74,78,3,54,64,43,7,34,6,37,91,60,66,39],undoubtedli:23,specifi:[86,1,62,71,14,46,64,26,85,81,91,21,70,42,29,63,10,60,19,30],qual:60,"short":[9,67,15,21,29,60],vcl_backend_error:[0,48,6,91,52],packet:[87,92,19],mostli:[53,60,66,39],vcl_event_discard:64,quad:60,grunt:12,than:[1,77,2,25,71,53,3,65,16,21,27,73,29,51,78,80,82,83,36,10,11,19,39,68,74,41,15,85,42,43,60,87,49,46,89,86,47,34,6,22,92],png:[3,89,36,57],royal:82,serv:[35,87,81,2,61,71,32,46,89,47,6,7,21,36,39,37,44,17,66,38,30],wide:[87,66,73],sess_workspac:48,tx_pipe:59,slt_vcl_log:47,posix:[19,43],balanc:[87,90,5,54,91,44,22,61,17],were:[87,64,92,85,89,19,48,34,21,43,59,88,12,23],posit:[52,87,21,19,74],yesteryear:87,surrog:[21,66],browser:[3,47,35,82,83,66,38,17],pre:[10,1,29],lowest:41,sai:[1,51,25,92,3,65,87,19,34,28,54,44,49,66,38],cnt_session:9,nicer:19,vcl_string:64,bans_obj:59,argument:[1,52,53,55,6,27,70,65,30,78,79,7,84,19,14,85,43,60,64,46,89,47,21,91],slap:53,ant:7,relativli:4,"20g":36,deliv:[0,50,87,77,2,52,3,58,7,60,16,48,34,6,36,37,91,59,4,66,17],exclud:[86,63,71],saw:[92,34,12,19],worst:[52,34,43],reqacct:52,engin:[91,7,22,60],squar:[77,92,60],advic:46,vdi_gethdrs_f:78,berequrl:[52,66,56],destroi:[59,68,19,60],rtstatu:21,note:[24,72,3,16,6,27,70,73,29,33,66,61,40,87,44,60,64,12,89,47,48,91,28],schmocument:82,"_end":65,take:[77,51,53,58,4,18,27,70,65,29,47,78,79,34,82,36,10,66,19,87,60,64,89,38,20,91,22,92],noth:[80,68,34,39,61,60],channel:[45,33,2,25,39],begin:[65,62,52,43,63,74,86,47,6,54,91,44,19,60],sure:[2,51,53,3,73,16,27,58,30,25,80,35,7,9,17,66,39,87,15,44,60,64,65,68,48,34,23],importantli:54,trace:[52,68,9,65,92,30],normal:[79,52,3,41,7,4,6,34,21,83,77,59,47,66],buffer:[74,26,59,29,49,60],schwindt:[85,30],price:30,knowingli:34,compress:[84,52,3,77,16,54,91,4,60],paid:34,server1:44,exclus:14,setppriv:60,abus:87,copy_of_varnish_secret:89,homepag:77,gunzip:[52,59,3,26,60],latex:82,renam:[48,64,42,53],correctli:87,pcre_match_limit_recurs:60,dream:22,esi_syntax:24,drive:[29,34],"0x4193f6":65,varnishtest:[8,60,23,26,17],runtim:[64,62,79,14,20,21,73,59,60],pattern:[87,80,21,43,66,39],eur10:34,preambl:[21,79],hungri:92,patchlevel:66,translat:[35,91,18,49,30],epel:27,backendreus:52,s_pipe_out:59,show:[24,51,52,65,14,26,56,77,30,82,35,7,9,83,17,66,62,74,85,15,43,60,89,92],shm_record:59,cheap:[81,60],merit:53,subprocess:60,concurr:59,permiss:[10,9,30],hack:[27,87,2],threshold:[52,44,91,60],corner:[87,62,25,56],boom:65,fifth:82,ground:51,xml:[24,60,14,84,17],onli:[24,50,1,77,25,71,52,53,3,65,14,26,16,21,27,73,29,30,51,78,80,7,81,82,9,83,36,37,11,60,66,19,39,62,74,63,85,15,42,43,59,17,87,64,49,89,86,48,34,6,91,22],slow:[60,68,47],ratio:36,stair:68,esi_ignore_http:60,dick:87,activ:[24,87,1,65,79,80,3,58,64,16,81,89,21,83,43,10,60,59,30],get_lock_tim:19,wood:77,rexec:87,analyz:[66,56],summertim:51,analyt:66,analys:[87,12],offici:[35,42],n_vampireobject:59,overwritten:[86,83,74,71],n_vcl:59,proxy2:21,nearli:34,variou:[9,1,2,25,66,3,18,4,87,5,6,29,60,12,92,30],proxy1:21,stomp:53,secondari:21,ssm:[26,60],ssl:[22,21,92,88],cannot:[87,1,2,51,25,3,74,64,19,48,82,70,54,59,22,23],ssh:[87,1,25,53,89,85,49],ssd:42,getip:78,geo:87,bans_ad:59,requir:[1,71,89,60,74,48,86,83,36,54,91,44,30,92,39],truli:[80,87],reveal:34,seldom:36,dramat:24,yield:64,berespprotocol:52,sidewai:12,priviledg:25,draft:[87,19],through:[1,2,52,53,3,14,18,6,70,65,59,30,31,75,9,36,10,60,66,19,39,13,15,54,45,46,5,22],vcl_backend_:64,where:[1,2,51,52,53,65,14,74,18,21,58,90,30,32,80,33,7,82,9,12,19,13,68,63,87,43,44,60,64,66,46,89,38,48,34,22,92],vision:87,summari:[85,76,77],wiki:[66,82,2,87,39],kernel:[1,53,65,73,59,22,60],aquaeduct:19,surgeri:68,workspace_backend:[48,64,60],shm_reclen:60,jailopt:60,seal:29,testcas:60,sport:87,wonder:[68,34,77,12,54],detect:[73,43,7,18,21,84],review:34,transnat:92,enumer:87,label:[52,87,47],behind:[87,51,7,58,66,39],between:[25,52,3,14,21,78,32,80,34,83,10,17,66,19,62,63,85,86,60,64,47,48,20,91,92],"import":[50,1,51,65,55,70,77,47,25,80,84,66,19,41,44,60,64,46,89,61,48,91,22,23],engang:34,tcp_keepalive_:73,across:[1,92,87],threads_creat:59,assumpt:51,hcb_insert:59,postfix:36,parent:[9,52,34,21,92,60],screen:[7,62],n_gzip:59,style:[10,30,17],cycl:[78,14,16,59,22,60],jobb:66,sessopen:[52,83],come:[50,1,46,77,4,6,57,65,9,83,10,66,19,63,87,15,42,54,44,56,64,68,74,86,20,21,49,92,23],tue:9,beliv:[34,92],sketchi:87,unrel:74,exp_receiv:59,trader:92,nifti:56,quiet:[58,26,39],contract:34,emit:[64,52,6,30,23,60],audienc:34,tutori:[13,40,31,35,90,27,84],"80013339a":65,sockaddr:49,mani:[2,71,52,53,26,58,29,9,10,66,19,62,63,85,86,46,54,59,60,87,64,68,74,48,34,91,22,92],clf:71,evict:[52,59,81,36],acceler:[31,8,90,44,30,66,60],displai:[62,71,52,63,14,56,8,86,83,30,60],fan:51,overview:[32,52,6,74],inspir:34,period:[62,53,63,74,14,91,60],pole:39,featur:[13,87,2,78,80,77,20,16,34,21,83,42,37,60,19,39],colon:[49,74,60],toupper:[64,47],typic:[50,31,2,78,3,54,7,6,27,29,10,39,17],karstensen:[2,14,85,91,59,30],poll:[80,56,21,91,44,19],damag:[1,49],libvarnish:30,sess:[52,51],"0x8006b8b76":65,resort:60,stretch:41,rebuild:68,fritzvold:85,mark:[62,52,53,77,63,86,56,70,6,36,59,91,44,60,30],resphead:[52,66],varnish_nam:14,listen_address:[46,55,79],addit:[64,2,79,80,87,91,19,60],surplu:[59,34],hitpass:52,avian:82,reschedul:59,reaction:51,thousand:[65,37],resolut:[10,34],drawer:49,child_exit:59,doesn:[24,74,87,78,47,84,82,16,19,34,9,83,70,42,43,29,22,66,38,30],workspac:[64,65,60],"1xx":59,those:[1,92,2,51,68,74,14,64,89,35,80,34,42,58,22,66,19,39],"case":[1,51,52,3,54,16,58,30,78,32,7,82,66,19,43,60,64,46,74,47,48,34,91],myself:[91,34,70,25],guidelin:32,"50k":60,ungzip:3,tinderbox:58,"40gbit":87,trick:[25,7,44,49,19,39],cast:91,invok:[36,30],libvmod:21,outcom:87,familiar:66,sess_clos:59,reenter:29,invoc:43,margin:[87,22,25],advantag:[42,78],stdout:[1,14,85,60],metric:10,remove_backend:61,canon:[22,78],undercut:34,worri:[1,51,34,42,27,77,49,92],cluster:[78,90,8,34,42,44],bias:34,pthread:[19,60],reqmethod:[52,83],telescop:34,ascii:[86,1,49,25,17],kettl:42,add_backend:[91,44,61,48],develop:[86,40,87,2,62,71,32,77,63,26,34,9,42,58,91,60,92,19,39],contriv:64,author:[87,1,25,51,14,85,4,59,60,66,30],respstatu:[52,9],tour:5,same:[1,2,51,71,52,53,3,26,74,6,58,29,25,78,80,35,7,83,36,37,66,61,62,63,85,86,54,60,87,64,46,89,47,21,91,49,92],trip:[51,65],future_featur:39,epoch:[52,91,64],html:[24,51,3,77,7,82,54,17],pad:65,sentenc:39,pai:[92,34,39,77,30],document:[51,71,52,65,26,56,6,70,58,30,31,82,84,61,39,62,63,87,86,44,16,60,64,74,47,34,21,91],medit:[9,6,84],vmod_tolow:64,week:[91,34,77,68,47],exhaust:52,finish:[52,77,85,78,60],backend_recycl:59,webserv:[51,46,77,49,66,17],see:[24,1,2,25,71,52,68,3,14,26,16,18,6,27,57,65,59,47,30,51,78,32,7,35,89,9,83,36,66,19,39,62,74,63,85,86,44,60,61,87,64,49,46,5,38,48,34,21,91,22,92,70],rxresp:26,assist:12,driver:25,ness:3,weed:87,director:[64,78,8,48,18,21,84,91,44,61],capabl:[3,9,67,82,61],improv:[87,34,92,19,84],calloc:64,immedi:[62,71,14,63,86,60,30,66,39],postpon:64,spend:[51,52,65,16,34,73,39],tradition:21,stdin:[1,85,89,60],vtailq_next:19,supdup:87,appropri:[24,32,35,27,66],all_added_weight:61,choos:[27,12,61,44],patchwork:77,macro:[78,19,26,43],page:[24,71,14,26,59,29,30,31,7,81,82,9,83,36,37,66,19,39,40,62,63,85,86,60,87,47,38,91],without:[1,51,71,3,65,74,21,27,58,59,30,78,80,36,10,12,19,54,39,85,42,43,87,64,89,86,34,6,91,92],sigsegv_handl:60,model:[87,25],roughli:[1,65],r01576:60,summer:[88,51],affair:12,abund:46,execut:[1,61,52,80,65,18,47,5,6,36,59,91,10,89,66,38],freshli:[64,36],resp:[50,64,52,74,26,47,48,7,6,36,91,59,60],bitmap:19,gdb:9,s_synth:59,kill:[87,25,51,52,65,59,60],multiplex:51,aspect:[10,22,19],touch:[40,34,60,2,53],monei:[34,42,54],listelm:19,speed:[29,87,65,2,31],mebibyt:29,http_resp_hdr_len:60,blow:[92,76],ixslvvxrgkjptxmcgnnsdxsvdmvfympg:30,downright:51,europ:39,struct:[52,59,64,78,54],hint:[91,5,6,34],mmap:[29,60],korken:66,except:[87,74,70,69,6,36,91,49,66,60],littl:[87,78,19,81,34,65,23,60],blog:31,"255b":60,vrt_ref_vcl:64,pile:[87,22,77,39,37],blob:64,exercis:35,tarreau:[87,92],vulner:[34,92,39],session_ling:48,earli:[87,23],psk:[10,1,30],around:[1,77,65,84,58,55,89,60,16,34,21,54,49,12,30],libm:43,secreci:1,read:[50,1,51,40,52,53,3,56,5,21,27,70,65,59,30,31,25,79,71,82,66,13,62,74,63,85,15,42,60,87,64,89,47,48,86,23],rfc2616:51,dark:10,privaci:[87,92],esi_level:[91,3],traffic:[87,64,77,51,25,92,44,65,18,5,21,83,73,10,60,66,61,17],darn:49,loos:[42,92],world:[87,92,35,22,66,19,39],unsign:[64,78,54],dare:43,tolow:[64,47],towel:68,stranger:34,whitespac:66,vcl_dir:[1,60],sc_resp_clos:59,mgt_param:60,exploit:25,integ:[64,74,47,42,54,91,30],server:[0,24,2,25,52,26,16,18,21,28,77,59,30,31,51,79,82,83,37,11,60,66,38,39,40,84,42,54,44,4,17,87,50,46,61,48,90,91],benefit:[87,12,34,42,58,92],shmfile:9,either:[51,3,6,70,65,29,31,80,82,11,66,19,62,85,43,59,60,64,46,74,48,21,91,92],output:[24,9,64,65,31,52,63,3,71,14,7,86,74,80,82,21,54,60],strcmp:65,reqprotocol:[52,83],fulfil:87,bans_lurker_tests_test:59,thermodynam:54,handshak:[22,92],esi_deliv:9,authent:[1,85,5,30],respect:[64,51,32,53,3,87,48,34,6,84,66],intact:24,auto_restart:[89,60],basic:[40,61,51,80,78,7,47,6,18,9,83,70,58,91,84,66,19],shmlog:60,micro:43,freebsd:[58,87,2,65,33,46,26,34,86,27,73,11,22,23,39],nazi:80,definit:[64,78,80,26,8,42,91,59],token:30,legal:[92,58],moon:[24,12],pioneer:23,backend_fail:59,exit:[62,25,71,53,14,89,86,85,6,63,59,60],"128kb":60,notabl:[3,87],overli:66,ntpd:19,refer:[31,64,78,71,32,66,60,87,26,6,8,82,21,36,84,44,70,39,52,30],needlessli:60,immun:54,timeout:[62,71,63,14,85,86,74,20,21,59,91,44,19,60],power:[1,49,18,62,36],whose:6,s_pipe_in:59,"0x8006b8d84":65,hexdump:30,utter:19,s_sess:59,fulli:[44,78,51,54],regexp:[64,60,30],getnameinfo:49,"throw":[87,80,89,34,36,54,22],lock:[1,52,53,64,26,19,8,59,23,60],src:[24,26],client_req:59,y2k:60,central:[34,1,82,25],coupl:[68,41,56,5,9,27,34,7,66,39],gethdr:78,drag:51,acm:23,acl:[1,52,67,69,36,91,70],chop:60,eur90k:34,stanc:92,bans_delet:59,act:[66,58],industri:34,processor:[24,18,43],road:[68,51],xnn:30,stevedor:[91,77],outlook:34,bom:60,effici:[87,80,3,16,53,60],paypal:34,surviv:[29,92,51,60],odd:[87,66],inbox:52,counterintuit:7,insuffici:59,your:[24,1,2,51,68,43,55,4,56,18,27,70,73,29,47,30,31,61,78,80,7,35,82,9,83,36,72,10,12,19,39,90,81,84,87,42,54,44,16,17,58,64,65,66,46,75,38,48,20,92],stare:[51,54],"14f0553caa5c796650ec82256e3f111ae2f20020a4b9029f135a01610932054":54,pcre_extra_match_limit_recurs:60,log:[1,25,71,52,53,77,14,26,56,5,21,76,65,79,8,82,9,83,72,10,17,66,39,13,62,84,63,42,60,74,86,47,48,6,91,92],area:[81,87,14,23],aren:66,hex:[10,30],overwrit:[53,86,83,74,71],start:[24,1,77,2,25,71,52,53,65,55,26,74,5,27,70,73,29,30,31,51,75,35,9,83,84,10,60,66,40,62,14,63,42,44,59,17,87,68,46,89,90,86,91,22,23],compliant:[87,78,58],mindless:[82,25],interfac:[1,79,85,84,55,64,89,8,20,42,36,43,10,60,30],low:[29,60,25,54],lot:[51,3,58,56,18,27,70,65,81,9,36,66,19,41,54,44,87,68,48,34,49,92,23],ipv6:[87,88,80,46,89,49,60],submiss:34,hen:[77,2,51,71,52,54,26,16,58,30,31,25,88,80,82,12,19,62,63,41,42,43,60,87,22,68,34,86,91,49,92],machin:[1,32,80,46,89,35,9,10,49,92],hei:68,unam:43,ago:[80,9,92,51,77],hard:[58,87,1,84,51,43,64,15,9,54,29,92,23],relic:43,unmask:60,enough:[64,80,65,68,34,42,54,44,19],conclud:34,bundl:[78,60],regard:[78,58],amongst:[60,19,43],cryptograph:[1,92,54],buggi:60,categor:[78,65],conclus:[80,34,92,87],longer:[31,78,51,85,15,4,48,36,59,19,60],notat:80,hire:34,fraud:77,possibl:[1,77,2,25,53,3,43,6,70,58,59,30,73,78,80,7,9,10,60,12,39,54,17,64,46,74,47,48,34,21,91,92],"default":[1,2,71,52,3,14,26,4,75,21,73,29,30,78,79,32,35,7,9,37,66,38,62,74,63,87,15,86,54,44,16,60,64,46,89,48,90,6,91,23],bucket:60,exp_kil:52,monopoli:25,deadlock:[91,23],expect:[52,53,58,34,26,35,82,21,54,91,59,66],gone:[1,48,20,42,36,10],ohh:[87,68,23,19],inflict:43,creat:[24,50,1,25,71,53,3,26,56,6,57,29,59,78,7,45,66,61,62,17,63,15,86,60,87,74,48,69,21,91,70],doxygen:82,certain:[24,1,52,33,87,15,4,18,36,91,44,60,66,61,57],real2integ:47,strongli:[87,1,64],intro:[29,55],decreas:[74,60],cloudflar:92,file:[24,1,77,65,25,71,52,53,3,43,55,26,16,18,58,29,30,7,75,8,82,83,60,19,39,62,63,85,42,54,44,59,17,64,46,89,47,90,86,91,22],legacy_broken_cm:66,proport:58,nerd:23,workdai:82,again:[40,64,25,80,68,89,75,34,9,42,10,39,92,38,17],collid:19,googl:[66,51,77],extract:[87,66,74],binocular:12,upcom:92,hybrid:87,backend_retri:59,prepend:[30,16],vcl_event_warm:64,field:[87,78,62,71,52,53,14,74,60,47,8,34,91,63,59,49,19,30],wai:[1,77,65,25,53,54,58,59,80,8,7,9,83,36,72,66,19,39,84,85,46,43,60,87,64,22,68,89,38,34,91,49,92,23],compet:12,copyright:[31,62,71,52,63,74,26,47,86,91,61,60],req_http10:59,writabl:91,you:[0,24,1,77,2,25,40,52,53,3,43,55,4,56,5,6,27,61,73,29,47,90,30,31,69,51,78,88,80,33,20,75,35,82,9,83,36,37,10,11,45,12,38,39,13,81,68,85,84,41,15,7,42,60,54,44,16,72,17,58,87,64,49,65,66,50,46,18,89,19,48,34,91,22,92,23,70],architectur:[31,87,2,51,47,21,19],sequenc:[74,71,79,30],symbol:9,listen_depth:60,lucki:51,ansi:43,briefli:[23,89],track:[64,78,51,92,41,9,39,66,60],http_front_end:89,z_ok:9,pool:[80,59,64,78,60],reduc:[24,4,7,42,73,29,60],philosoph:23,escal:60,neuter:82,directori:[1,64,26,35,8,28,29,60],invest:34,descript:[64,62,71,52,63,85,14,89,26,47,34,15,91,60,61,30],slt_error:66,fuse:34,tricki:[81,53,65],s_resp_bodybyt:59,mass:87,potenti:[1,37,87,74,7,6,65,91,60,39],escap:[71,9,14,74,30],invoic:34,overfund:34,cpu:[19,22,36,60,16],unset:[57,3,48,7,6,28,91,10,66,36],logarithm:[62,56],represent:[80,64],sc_pipe_overflow:59,usd15:34,consider:[20,78],lack:[59,34,66,87],standardis:19,month:[34,92,77],mp3:16,abil:[80,29,34,37],follow:[25,71,14,26,16,6,27,70,65,29,30,78,79,32,35,7,9,36,37,11,60,66,39,62,84,63,86,45,64,74,48,90,21,91],disk:[34,5,83,73,29,60],wash:59,children:[92,68],boukelmoun:30,secretfil:85,fetch_204:59,mathisen:[26,60],default_keep:60,spectacular:39,catastrophi:42,discard:[64,78,52,66,89,80,6,36,44,29,59,30],former:78,sc_:59,program:[1,25,71,52,58,55,26,56,5,65,30,78,8,82,83,10,17,66,19,62,63,41,86,60,64,89,92],solicit:34,queri:[78,62,48,71,63,74,86,47,8,7,9,83,91],neglig:18,introduc:[49,53,47,21,54,44,16,23],sound:[34,51,65],fax:34,liter:82,parcel:47,far:[24,87,49,51,58,74,34,54,22,66,19],faq:22,buer:[14,85,47,86,91,30],offlin:29,ouch:42,util:[31,62,71,63,79,14,85,86,56,21,47],candid:[52,6,58],mechan:[91,53,1,36,19],n_vcl_discard:59,failur:[59,64,74,26,60],veri:[24,1,51,58,56,5,65,29,25,80,35,82,10,66,19,39,41,42,54,87,64,47,34,92,23],ticket:[34,9,65,33,39],"06t08":47,uid:60,strang:92,unalt:6,colleagu:34,binheap:52,"99999999b":60,random:[31,1,88,61,47,77,64,16,82,54,44,4,38,39],emul:61,sane:15,sma:[53,59],node1:91,expban:52,enterpris:[35,75,33,73],queue_max:59,ten:[62,51],tea:27,rx_bodi:59,"4df9":21,sync:42,tex:82,syslog:[1,72,47,9,65,60],biolog:51,design:[87,1,25,51,64,89,54,91,10],pass:[0,64,71,52,3,85,60,16,6,48,20,21,57,58,91,59,47,66,17],further:[1,74,6,7,9,70,39],heartble:[34,92],dial:91,sub:[24,52,72,3,26,16,21,57,28,7,36,37,10,45,66,61,54,44,60,64,38,48,69,91,70],clock:[10,34,19,60],sun:47,sum:[61,78,37],advanc:34,abl:[58,64,1,65,51,25,85,54,68,5,15,89,87,82,42,73,22,92,19,60],overload:59,delet:[78,56,28,59,30,66,60],version:[24,1,2,71,52,3,14,6,27,73,30,31,79,7,82,11,17,66,62,63,87,86,43,60,64,48,91,49],time2r:47,deepli:[34,87],"public":[90,66,51],movement:25,cookie1:66,hasn:60,cookie2:66,hash:[0,61,62,52,78,56,21,48,18,6,36,54,91,59,84,88,38,60],variat:66,unmodifi:16,sessionclos:52,decid:[1,2,25,79,68,64,81,34,6,42,49,66,23],pcre_extra_match_limit:60,behaviour:[24,2,79,15,16,20,4,92,17],modular:51,http_resp_siz:60,lookup:[64,51,52,3,16,48,6,36,54,91,59,66,38,60],solari:[2,43,58,73,11,60],excess:[34,60],recompress:16,method:[1,71,52,7,48,69,21,27,36,91,60],ineffici:51,modifi:[50,1,74,32,3,84,64,16,6,89,21,85,7,91,47,30],legend:[52,54],valu:[56,64,74,62,71,52,43,14,87,60,16,21,48,6,70,79,73,91,47,61,30],search:[31,39],ahead:[59,51],ixslvvxrgkj:30,newlin:[91,70,30],observ:60,prior:73,airport:92,saintmod:21,pick:[1,78,52,92,90,21,36,58,88,66,61,39],real:[64,2,51,47,65,41,19,56,34,21,61,58,91,10,39,23,17],narrow:[42,41],magnitud:2,lurker:[59,36,60],shorthand:60,child_dump:59,primit:64,vcl_return:52,vcl_void:64,"while":[24,64,1,77,87,52,65,68,20,7,16,81,19,34,21,27,37,29,92,23,39],filenam:[1,62,71,63,14,64,86,82,42,30,60],href:24,famili:[54,68,39],sanction:49,suddenli:[80,34,58,37],acceptor_sleep_decai:60,select:[71,52,63,14,74,48,86,91,19],aggress:36,ear:39,hexadecim:30,ripe:87,distinct:[48,64],ctrl:14,regist:87,two:[1,2,46,3,65,26,27,77,59,78,80,37,10,66,42,54,44,17,87,68,89,34,91,49],coverag:23,almost:[1,65,89,34,27,54,10,66,19,60],formul:39,morn:92,brandei:92,taken:[87,71,53,68,47,21,27,28,59,92],md5:54,forcefulli:59,minor:[60,79,58],more:[1,2,25,53,3,43,26,16,21,27,61,73,59,47,30,51,78,32,34,82,9,83,10,66,19,39,13,68,74,41,42,54,44,60,87,64,65,46,89,38,48,20,91,49,92,23,70],diagnost:[52,59,66],precompil:64,flaw:[87,25],desir:[34,7],openvz:[33,73],mar:9,tumbl:68,hundr:39,mozilla:[7,66],flag:[64,52,14,55,91,10,60],vxid:[62,71,52,63,74,86],broke:19,particular:[87,64,51,53,3,18,47,34,27,36,80,91,30],known:[31,51,71,46,21,73,59,49,12,19],compani:[89,34,43,92,19,39],doom:19,cach:[0,24,77,2,74,25,71,52,72,3,65,55,26,4,18,21,27,59,29,89,30,31,51,80,35,8,7,9,83,36,37,10,60,66,38,40,81,14,84,87,15,42,44,16,17,64,50,46,5,47,48,90,6,91],none:[87,78,46,74,82,91,19,60],endpoint:[52,87,21,78,79],thread:[80,64,65,78,52,53,73,46,26,19,48,60,9,36,37,59,56,23,39],valuabl:[92,65],hous:[68,19],outlin:70,dev:[1,9,27,39],histori:[62,71,52,63,74,26,47,86,91,23,60],remain:[24,52,91,78],outliv:78,nine:22,caveat:[1,65],learn:[1,87,39],abandon:[62,71,53,14,86,82,6,58,63],avg_100:14,def:30,instantan:89,userbas:58,typograph:82,prompt:25,bogu:52,scan:71,challeng:[1,64,30],share:[1,25,71,52,53,56,21,27,59,78,79,80,8,9,83,10,19,62,63,85,60,64,74,47,91],accept:[1,78,3,60,89,26,56,91,59,16,66,17],firmli:51,minimum:[29,74,60],sharp:87,pong:83,varnishsoftwar:66,action:[0,64,18,36,84,91,44,66,57],garden:68,vrt_rel_vcl:64,stil:92,cours:[25,77],court:92,ixsl:30,kilobyt:54,divid:41,rather:[87,71,65,68,34,86,41,82,9,43,22,23,30],stig:[26,60],comfort:27,nostdreturn:19,fame:54,snippet:[7,66,78],heck:[19,77],fed:[5,34,54],reject:[91,70],s_req:59,simpl:[24,1,65,87,19,70,7,6,36,44,10,60,66,23,30],css:51,unabl:[91,70],idioci:19,plant:92,absentmindedli:12,resourc:[64,52,87,60,21,42,73,10,39,59,30],referenc:[10,64,74,60],variant:[87,6,66,36],sneak:87,"25k":60,time2integ:47,unlink:[29,60],associ:[92,78],director_mag:78,stabil:87,circumst:[42,25],github:7,coax:51,ani:[1,51,71,52,53,3,65,14,16,5,6,57,58,29,30,31,25,78,80,7,9,36,10,60,66,19,39,63,87,86,54,44,56,17,64,74,48,34,21,91,92,70],confus:[77,49,65,19,41],proto:[91,59,51,60],fulltim:66,dragon:72,caus:[87,65,73,34,9,59,54,29,12,60],thread_pool_max:[59,60],wrench:[10,51],shade:92,tangibl:87,shadi:92,max_retri:[6,60],backend_busi:59,sysctl:73,help:[89,47,65,25,52,53,85,33,60,34,26,41,87,5,9,36,73,10,39,30],max_ag:60,erod:34,backend_conn:59,soon:[64,78,68,42,73,59],reachabl:1,radar:87,berespstatu:[52,74],dough:[34,88],hierarchi:74,distract:92,suffer:[87,66],subrequest:74,typedef:64,render:[24,48],binari:[62,71,63,18,82,86,27],cache_req_bodi:47,brows:19,sc_rx_overflow:59,late:[64,77],harmless:49,rapidli:19,astonish:51,bypass:66,famou:[41,77],can_gzip:91,might:[13,87,81,66,59,54,16,35,19,82,9,27,36,42,37,44,12,38,60],alter:[24,2,67,16,18,6,57],epol:9,hipster:51,wouldn:[1,19],foon:30,good:[1,52,73,59,32,9,66,19,39,64,42,54,60,87,22,68,89,34,91,88,92,23],"return":[0,71,52,14,16,6,70,59,29,30,78,79,19,7,36,37,60,66,61,62,17,63,85,86,54,45,64,38,89,47,48,69,91,49],authorized_keys2:25,timestamp:[52,14,74,47,36,30],uhm:70,libwww:66,detour:60,framework:48,somebodi:[92,12,19,43],igabyt:60,barbarian:12,complain:34,bigger:[29,87,60],eventu:[74,64,6,87,49],pkgconfig:27,quoted_vclstr:30,rant:92,troubleshoot:[10,9,84],"0x8006b4307":65,userid:30,unlik:[87,65],refresh:[62,6,36,37,91,66,30],caseless:[86,63,62,71],easili:[34,66],achiev:[9,66,84,4],"0x416a70":9,"1tbit":87,undertak:92,khtml:7,ceas:66,dialin:[69,70],backtrac:[9,65],truncat:[29,60],subsystem:34,breakdown:59,n_lru_nuk:[81,59],mental:35,send_timeout:60,needless:[25,54],bereq:[24,50,52,3,60,26,47,48,7,36,91,16,66,57],set_ip_to:[64,47],monoton:19,idea:[13,64,2,52,92,3,77,89,60,34,43,22,12,19,39],procedur:[64,33,47,35,82,65],realli:[24,1,51,46,3,16,70,65,31,25,83,36,10,66,39,41,42,44,60,87,68,89,34,92],varnishadm:[31,1,79,85,64,15,89,8,5,21,60,30],iter:[91,26],s_req_hdrbyt:59,horribl:[80,27],beyond:37,todo:64,event:[64,78,52,87,8,21,29,60,39],"try":[65,51,53,3,54,16,27,58,30,25,78,80,35,82,9,36,17,12,19,39,87,43,60,64,46,61,48,92,23],flower:68,suprem:92,vmod_toupp:64,varnishhist:[62,52,63,14,26,56,8,86,76,60,17],fetch_304:59,publish:[34,49],research:[87,92,19],footnot:58,etag:[6,16],health:[78,52,80,84,8,18,21,37,91,44,59,30],print:[64,62,71,14,63,89,86,80,30,66,60],occurr:[91,60,47],nest:91,digest_len:54,ass:92,foreground:[60,30],php_sid:66,bass:87,accept_filt:60,dirt:68,bans_lurker_obj_kil:59,vrt_backend:78,differ:[24,51,53,3,43,26,18,21,29,30,78,80,90,7,10,66,19,87,42,54,44,64,5,38,48,34,22,92],like:[0,24,77,2,25,53,3,65,16,5,27,61,58,59,30,31,51,78,79,80,90,75,35,7,83,36,37,10,60,12,19,68,74,41,15,42,54,44,17,87,64,66,46,89,38,34,91,49,92,70],significantli:[87,22,79,43],quick:[5,46],reason:[35,87,78,25,52,92,89,47,6,82,9,27,58,91,10,22,12,19,39],base:[24,50,2,25,71,21,29,30,78,7,82,36,45,66,61,90,17,44,60,87,38,48,34],applewebkit:7,put:[58,40,64,49,77,51,47,52,43,46,75,15,38,82,60,54,59,22,92,19,17],decompress:16,basi:[87,32,82,58,91,44],thrown:34,driven:[2,26],vmod:[1,61,51,48,32,77,64,47,6,8,20,21,70,79,44,91,10,78,59,38,60],syntheth:59,drupal:66,vararg:64,g_smf:59,perhap:[7,21],due:[52,53,74,81,9,27,59,91,29],penetr:87,corkscrew:22,lifetim:91,assign:[87,78,64,70,91,60],logfil:53,feed:[34,54],sess_timeout:[31,48],"lyngst\u00f8l":[91,26],obviou:[80,92,89,37],upper:[86,63,19,62,60],feel:[87,25,51,77,89,19,27,54,23],articl:[24,34,7,54],misc:39,number:[1,51,52,53,3,65,14,26,6,27,73,59,30,80,83,10,19,62,63,41,86,54,60,87,64,22,46,74,47,48,91,49,92],evolut:51,footprint:30,done:[66,44,65,68,75,7,48,34,74,27,36,73,10,22,59,61,60],unhealthi:44,blank:60,stabl:53,miss:[87,62,71,3,65,74,60,4,7,6,36,42,59,91,10,56,17],defi:19,stage:[32,3,34],guess:[44,19],guest:68,exponenti:60,interact:[10,14],berespreason:52,construct:[24,68,60],"0x8006b3ef2":65,paint:77,stori:42,bumbl:77,expand:[29,21,23],saint:[80,21],illeg:34,sc_range_short:59,fetch_no_thread:59,scheme:[10,80],store:[50,64,2,52,53,3,68,87,16,81,42,54,91,29,60,38,17],vsm_use:59,statement:[24,64,79,52,72,48,28,65,91,70],relationship:25,blindli:41,park:[80,60],round_robin:[91,44,61,48],part:[87,1,71,53,74,14,64,47,70,48,42,36,43,10,66,60],hugepag:[33,73],wextra:60,consult:34,fastli:2,tebibyt:29,"0x429f8b":65,std:[64,71,52,79,47,48,21,37,91,60],kind:[87,1,78,51,53,77,64,7,89,34,21,65,91,74,92,60],simplist:51,grep:66,prebuilt:27,n_objecthead:59,whenev:[64,32,53,89,35,52,58,59,60],remot:[1,51,71,52,79,89,21,73,91,10],seamlessli:80,defail:6,horizont:[62,56],bugfre:25,reus:[52,53,60,78,59],pragma:[66,4],str:91,consumpt:30,stale:[62,71,63,14,86,6,21,37,44,30],toward:91,danc:78,weapon:51,randomli:[22,30],stataddr:63,comput:[87,77,25,58,82,61,34,43,11,89,19],default_grac:60,charset:48,grandios:87,peculiar:[40,5],packag:[33,46,90,27,58,10],ackward:87,expir:[62,52,63,41,86,42,36,91,59,60],dedic:[77,60],"null":[64,9,87,78],option:[1,71,52,55,26,16,73,30,9,83,36,66,62,14,63,85,86,44,56,60,87,64,46,74,91],sell:[87,68],mountain:73,entireti:74,built:[87,78,32,68,84,46,18,5,6,36,54,91,12,92,70],lib:[60,30],ee30d0770eb460634e9d5dcfb562a2c5:54,vcl_int:64,troublesom:[42,49],efh:65,also:[1,2,51,71,52,53,3,65,14,26,16,21,57,58,59,30,31,78,32,80,33,34,81,36,37,12,61,39,40,62,74,63,41,85,42,43,44,60,87,64,49,66,46,89,86,47,20,6,91,22,92],sc_rx_junk:59,invert:74,build:[64,51,33,68,7,26,34,27,12],hcb_lock:59,techniqu:61,donor:34,cc_command:[1,60],backend_health:52,bereqprotocol:52,tool:[31,64,88,25,52,66,92,87,4,81,82,86,43,10,56,59,19,60],pipelin:[51,77],distribut:[87,62,19,27,91,44,56,61],exec:60,wswitch:60,previou:[31,40,89,7,30,61,60],reach:[64,2,18,83,36,91,59],theoret:23,fetch_non:59,react:9,most:[0,24,77,2,51,52,68,3,43,56,18,21,27,65,29,89,30,32,80,35,82,9,36,10,66,39,63,41,15,42,54,60,87,64,50,46,5,34,49,92],plai:[44,34],must_restart:60,plan:[51,60,34,77,29,22,12,39],gzip_level:60,metacharact:49,wisdom:[12,19],vcl_purg:[6,36],appear:[87,62,71,14,63,34,86,91,30],fileread:47,esi_remove_bom:60,bug:[77,65,3,33,34,9,58,92,39],filesystem:[1,42,60],clear:[39,87,51,25,68,34,82,91,22,92,19,30],cover:[40,87,33,55,18,76,58,10,66,17],destruct:[88,68],clean:[53,64,6,27],page_s:60,pars:[64,52,3,4,6,91,59,66,30],subgroup:91,sector:42,ridicul:19,docutil:[82,27],carefulli:[34,12],cdn:10,alphanumer:66,fini:64,session:[86,87,52,63,74,60,47,9,73,59,22,61,30],particularli:[74,19,54],thread_pool_fail_delai:[48,60],finn:66,fine:66,find:[25,53,3,54,26,75,27,76,31,80,9,66,38,39,87,42,43,44,60,64,46,89,90,92],impact:[10,18,60,36,29],ambit:19,firewal:87,avg_1000:14,pretti:[1,37,68,7,42,54,92,23,39],avg_10:14,writer:[53,64,21],solut:[51,80,34,36,43,92],writev:60,threads_destroi:59,queu:[59,60],templat:[66,36],factor:31,lennon:77,child_di:59,remedi:87,hit:[24,71,52,3,65,56,6,57,77,59,80,9,83,36,37,10,17,66,62,60,74,91],unus:60,luke:87,financ:34,sydnei:19,cheaper:89,sfile:[21,9,65],nativ:[21,17,78,16],grew:58,s_fetch:59,contrari:6,banner:30,him:[12,23],restart:[0,31,64,51,25,40,52,53,3,89,74,48,75,6,65,91,10,60],silo:[29,60],vsl_reclen:60,esi_warn:59,synthet:[91,29,6,36,48],diffabl:82,synthes:[86,63,62,71],rfc:[52,48,49,66],common:[0,64,2,32,84,34,54],nowher:[27,19],remov:[24,87,64,57,78,66,3,84,89,60,16,48,7,6,28,44,10,47,59,61,36],wrote:[34,92,43],certif:[34,22,92],forego:34,set:[24,1,25,71,52,53,3,65,14,26,16,5,6,57,73,29,47,30,61,78,79,33,90,81,7,9,36,37,66,19,62,74,63,41,15,42,43,44,60,64,46,89,86,38,48,34,21,91],art:[19,25,17],adopt:[87,34,23],kibibyt:29,jade:49,startup:[1,21,46,42],proactiv:[20,21],celebr:10,delug:92,max_pool:60,bare:87,wg14:19,arg:[53,30],reserv:[91,48,19],vsm_cool:59,arm:42,project:[87,2,68,34,82,58,12],inconveni:54,systemat:11,someth:[58,64,77,65,51,66,44,33,87,47,35,82,9,27,59,37,10,12,92,72],grandmoth:68,particip:87,won:[0,64,68,9,36,84,92,19],mutex:[53,19,60],append_ua:7,architect:[87,2,51],subscript:[74,60],experi:[87,2,51,3,82,34,60],vmod_priv:64,altern:[1,27,87,60],sess_drop:59,appreci:77,numer:[46,74,89,43,49,19],javascript:66,lowercas:[38,47],succeed:[35,44,64,91,85],arrang:64,distinguish:[34,43],popul:50,hairi:[80,3],vclref:64,last:[9,64,62,52,74,14,87,60,47,34,21,42,44,56,30],delimit:70,hyperlink:[31,82],start_child:65,alon:[82,22],vdi_panic_f:78,anon:25,intercept:87,context:[64,79,80,65,41,7,4,48,82,21,54,91],pdf:[82,19],wronli:89,whole:[0,91,9,27,78],becam:[49,43],load:[24,1,25,5,6,59,30,78,80,37,10,17,61,64,54,44,60,87,89,19,90,21,91],simpli:[64,78,17,34,42,70,91,22,39],point:[64,2,78,52,80,3,92,87,23,35,19,36,44,29,22,66,38,60],instanti:[91,51],schedul:37,z_stream_end:9,leon:66,header:[50,2,71,52,3,56,21,57,65,59,30,35,7,84,10,17,66,61,87,86,43,16,60,64,38,4,67,74,47,48,6,91,28],provok:[51,26],hash_data:[91,7,38,54],suppli:[52,7],batteri:10,mistak:19,busy_wakeup:59,backend:[0,50,2,74,25,52,53,3,55,26,4,56,18,21,28,59,29,30,81,51,78,32,80,90,35,8,7,83,36,37,60,66,61,40,84,63,86,44,16,17,64,67,46,89,47,48,20,6,91,88,57],duh:51,identif:[91,54],faithfulli:87,becom:[24,87,58,51,43,68,64,7,82,54,19,30],java:44,"_atom":19,shm_flush:59,territori:42,devic:[87,84,7,18,29,44,17,30],first_byte_timeout:[91,60],empti:[1,71,80,14,47,34,59],accessor:79,secret:[1,22,75,85,5,65,49,30,60],pcre_match_limit:60,synth:[71,7,48,69,6,36],wwrite:60,thread_pool_destroy_delai:[48,60],nonexist:64,strategi:[24,1,42,7,78],firm:51,invis:60,ram:60,flight:92,squirrel:92,fire:35,imag:[81,87,3,28,16],densiti:87,great:[10,1,82,18,75],fund:34,understand:[51,25,7,34,9,54,91,66,19,17],workspace_sess:[79,60],station:49,tangenti:34,repetit:65,invit:68,fetch_eof:59,look:[24,1,65,51,52,3,43,5,6,58,30,31,25,78,35,83,36,37,12,19,13,62,84,85,42,54,44,60,87,64,66,46,75,38,90,91,49,92],libressl:92,solid:[23,60],straight:[42,39],volumin:51,real2tim:47,budget:12,durat:[64,51,41,26,47,91,89,19,60],ramif:51,pace:60,respprotocol:52,"256m":75,smart:[3,39,54,16],behavior:[61,26],doubli:60,fun:[68,51],vrt_backend_probe_handl:78,vmod_:64,everyon:[91,69,70,75],lingo:64,pack:19,subsect:[20,4],propag:78,malloc:[64,52,46,55,81,75,9,59,91,29,60],larger:[3,74,34,65,22,60],pounc:87,hcritbit:[9,65],readi:[52,27,64,2,80],ctx:64,workspace_cli:[48,64,60],rip:[68,43],bans_dup:59,revers:[31,1,2,23,60],rxreq:26,cento:[35,46,75,33,27],demot:58,seen:[9,53,63,82,7,41,5,21,54,59,12,19],"00z":19,rid:[89,78],time_firstbyt:71,overal:[53,87],shirt:19,sess_readahead:59,minim:[10,60,30],belong:[36,74],shorter:[15,60],anniversari:10,lengthi:47,grand:51,octal:30,s_resp_hdrbyt:59,higher:[6,74,60],archiv:23,x86:11,optic:34,imagin:[64,80,68,89,42,43],optim:[22,83,36,60],banter:39,unwarr:87,"1000x":31,alert:58,unintention:48,healthi:[78,47,48,37,91,44,61,30],moment:[24,64,37,65,44,39],temporari:[29,26,60],user:[1,2,25,40,52,77,4,5,21,58,31,51,79,71,34,7,84,66,38,39,13,63,87,42,54,44,56,60,64,68,74,48,20,91,92],dine:23,provabl:19,stack:[78,9,73,60,19,30],focal:87,recent:[41,11,27,34,30],expend:87,task:[87,64,25,52,41,89,81,34,54,44,90,30],equival:91,ampl:91,older:[19,60,27,36,30],entri:[53,63,74,56,8,9,83,70,91,66,38,60],parenthes:[91,70],joyent:58,person:[1,27,54],cheer:19,temperatur:[64,78,30],expens:[81,64],sc_tx_eof:59,bog:92,tast:[27,58],anybodi:82,ubuntu:[33,46,35,75,27,73],propos:[34,12,87,51],explan:[64,25,54,9,65,39],burden:58,sc_rx_bad:59,from:[0,24,1,77,2,74,51,71,52,53,3,43,14,4,56,18,21,27,28,76,59,29,30,31,61,78,79,32,80,33,20,70,82,9,83,36,37,10,11,60,12,19,39,90,81,62,68,84,63,41,7,86,54,44,16,17,87,64,49,65,66,50,46,89,47,48,34,6,91,22,92,57],uselessli:16,collabor:51,press:[31,82,83,62],shape:[19,51,77],pan_ic:[9,65],mob:87,regardless:91,pipesess:52,poller:80,failsaf:74,do_stream:91,fstack:60,bereqmethod:52,cut:51,"455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a":30,tablet:7,cup:27,libncurs:27,restructuredtext:[82,88],thatotherserv:46,vcl_pipe:[91,6],client_req_417:59,flush_head:60,cue:64,objcor:52,notifi:[64,36],appli:[64,52,63,3,14,87,74,86,73,29,60,12,30],input:[52,80,41,89,54,91,30,38,60],subsequ:[0,52,1,6],app:[92,83,54],useless:[19,60],bin:[24,26],hashedg:60,subroutin:[32,72,18,6,70,84,91],obsolet:30,format:[49,62,71,52,63,3,14,60,47,8,82,86,91,10,30,19,17],big:[87,64,72,84,46,34,81,80,82,77,10,22,92,19,60],misconfigur:9,do_gunzip:[91,3,16],intuit:[44,78],tabl:[31,87,60],simple_list:60,wiser:34,bit:[77,51,52,3,65,16,5,27,73,78,80,7,9,83,36,10,11,66,87,42,54,44,60,64,22,68,34,49,92,23],characterist:29,formal:87,strstr:47,brace:70,signal:[71,86,7,21,65,59,60],shortkei:31,resolv:[91,87,46,70,78],elaps:[86,63,62],collect:[31,51,25,67,34,47,82,21,65,49,74,19],esi_error:59,popular:[24,19,56],vcl_error:[52,48,6,60],interestingli:42,pipe_overflow:59,encount:[52,48,3,64],scare:22,unsuccess:[63,86,14,62,71],gnnsdxsvdmvfympg:30,creation:[52,59,3,60],some:[1,2,25,68,43,26,89,18,27,73,59,81,51,78,90,75,35,7,9,36,37,10,12,19,39,85,15,42,54,44,60,58,87,64,65,66,67,46,5,38,48,34,22,92,23],back:[80,64,2,51,25,66,89,6,48,34,21,42,43,29,39,59,30],understood:87,litter:19,unspecifi:74,sampl:14,n_lru_mov:59,mirror:90,sizeof:[64,58],surpris:34,sc_rx_bodi:59,"_bool":19,scale:[80,60,14,62,56],fifo:60,pet:34,chunksiz:60,per:[64,73,37,14,85,60,47,81,7,86,76,54,91,29,39,59,61,30],cli_resp:25,backend_idle_timeout:[21,60],substitut:[24,80],retri:[0,62,71,52,63,14,86,47,48,6,91,59,60],larg:[59,34,92,87,60],slash:[7,60],reproduc:65,taglist:[86,63,74],cgi:[24,7],book:[12,34,42,77,66,19],run:[1,77,2,25,40,52,72,3,58,55,26,16,75,21,27,73,29,30,31,51,79,71,90,35,8,9,84,10,45,66,39,13,62,14,74,63,85,60,42,43,44,59,17,64,49,65,46,89,34,86,91,22,92],lose:[51,54],agreement:34,viabl:92,indefinet:[86,63,62,71],step:[92,33,27,19,73],convent:[31,51],logrecord:76,squeez:[65,54],prerequisit:[11,33],meantim:[64,43],crap:43,major:[87,25,84,68,42,77,60],subtract:41,impos:92,mortgag:[34,92],constraint:81,reappear:29,gibibyt:29,preclud:82,prove:[42,19,30],manag:[64,1,51,25,79,53,78,65,20,60,85,34,27,36,44,91,10,30,59,23,17],percent:34,idl:60,preset:6,candi:17,formatfil:71,wait_silo:60,loadabl:[48,60],fetch_chunks:60,uncach:[91,48,6,66],cygwin:11,yyyi:14,miracl:87,doubl:[64,92,68,74,81,91,60,30,39],primarili:[64,60],plethora:9,within:[91,72,60,74,30],backend2:61,grydeland:[71,52,14,63,74,47,86,91],pastebin:39,tmpdir:26,frf91:7,contributor:[2,58],threads_fail:[59,60],perl:[91,66,70],toosmal:59,pcre:[91,27,74,60],occupi:60,inclus:[14,60],institut:[92,58],spam:39,errno:65,"512k":26,megabyt:[46,60],textual:87,custom:[8,34,42,78,48],systemcal:19,doubt:[65,39],includ:[24,1,51,52,53,3,26,16,6,27,70,73,59,30,31,80,29,7,9,36,72,17,19,84,63,86,60,64,74,34,91,22,92],suit:27,forward:[2,52,47,35,48,59,60,39],paren:91,datastructur:19,amaz:[19,51,43],vsc2rst:59,vienna:51,properli:[24,35,64,25],reorgan:58,fishi:47,log_alert:47,kristian:[91,26],wno:60,server2:44,navig:14,link:[24,40,52,53,74,81,82,27,60,19,39],multilevel:10,newer:[59,27,36],atom:41,line:[1,71,52,72,55,74,28,65,30,78,79,8,9,83,53,10,39,14,84,15,86,43,60,64,46,89,48,34,91,22,23],mitig:[87,66],redpil:91,info:[59,39],concaten:[91,64],utf:[48,60],consist:[87,2,53,84,14,74,9,42,54,30],munin:56,pageup:14,lifespan:78,intim:10,pkg_add:27,"export":[53,64],similar:[64,92,3,1,75,36,77,66],curv:19,derang:43,constant:[64,41],curs:14,bind:[1,9,14],palisad:12,parser:[52,3],lyx:82,composit:[24,84],repres:[87,79,32,80,26,48],"char":[64,78,54],incomplet:[86,63,74,62],webcach:66,chat:2,home:[92,34,22,66,41],journal:34,curl:47,gecko:7,bracket:[91,60],"200c":49,profil:62,titl:66,sequenti:64,redhat_transparent_hugepag:73,invalid:[89,48,5,21,36,91],proxi:[31,87,2,40,52,79,6,20,21,91,22,92,60],codec:7,librari:[64,92,47,27,10,22,66,19],beresp_bodybyt:59,unadult:37,responsetim:62,nice:[56,9,83,77,47,23],storage_hint:91,draw:23,claus:37,a937:21,"3f8":65,n_obj_purg:59,formatt:71,critbit:60,cs101:53,libtool:27,competitor:43,param:[64,85,15,89,30,60],deserv:92,pool_vbo:60,land:68,algorithm:[90,60,54],segfault:[72,9,84],verden:[31,62,71,52,63,74,34,86,91,60],pool_vbc:79,orbit:12,scream:47,depth:60,sess_herd:59,dot:[91,60],acceptor_sleep_max:60,syncvsl:60,fresh:[68,36],marvel:66,scroll:83,pluggabl:29,code:[1,25,52,72,3,65,26,56,18,6,27,70,58,59,89,30,61,78,32,7,82,9,37,10,66,19,39,87,42,43,60,64,49,46,5,38,48,34,91,22,92,23],partial:30,ip4:52,leak:[22,25],pipe_in:59,gang:[31,62,71,52,63,74,34,86,91,39,60],amiss:35,vcl_name:78,privat:[8,34,64],ulimit:[9,73],wizard:[51,60],elsewher:[48,61],friendli:[87,66,34,12,36],send:[50,87,65,3,58,60,7,26,47,35,34,6,37,91,44,56,66,17],granular:[29,60],lower:[1,19,30],estim:87,gzip_memlevel:60,"256k":60,sens:[51,52,41,16,81,42,58,59,66,19],bsdi:23,sent:[87,64,71,52,3,7,85,34,59,66,61,60],settl:41,nett:66,religi:49,unzip:91,rollback:[91,47,30],whichev:60,vrt_new_backend:78,workspace_thread:60,n_vcl_avail:59,reinterpret:82,objectcor:59,disast:92,vacat:[33,88,51,65],retriev:[91,1,6,30],implicitli:91,relev:[71,32,74,9,27,65,44,30,19,39],brinch:[88,23],tri:[2,25,51,16,48,43,60,39],log_us:47,magic:[64,78,3,16,42,92,30],client_req_400:59,complic:[3,66],perceiv:[34,19,51],geograph:10,fewer:[34,4],unquot:74,forsiden:66,"0x42cbe8":9,fetch_head:59,g_smf_larg:59,freed:[53,64,59],pleas:[24,64,2,51,47,72,3,83,46,60,16,9,27,70,65,91,44,39,66,30],malici:87,impli:63,smaller:[34,77,47],fortun:87,natur:[19,89,92,23,30],crop:87,uniqu:[91,90,7,19,65],jump:[70,48,36,43],parkinsson:12,video:7,detrim:60,download:[92,27,4],sess_queu:59,append:[71,53,46,48,86,10,30],compat:91,index:[52,31,51,54],n_backend:59,rate:[24,34,83,10,66,60],resembl:51,"64k":60,multimedia:66,access:[50,1,69,25,32,53,64,75,70,82,21,83,36,91,10,11,60,66,30],experiment:[29,55,60],garbag:[19,51],vcl_event_cold:64,tar:51,inspect:[15,9,36,44,49,92,30],absolut:[64,51,52,41,66,60],usag:[87,62,71,63,74,86,36,10,66],http_req_siz:60,len:64,bodi:[24,87,52,26,47,48,6,91,59,60,17],srvr:22,let:[24,90,1,2,78,51,3,75,19,35,36,82,9,28,42,65,44,22,66,38,30],symlink:43,filedescriptor:[25,30],http_resp:25,max_esi_depth:60,vertic:[62,56],g_smf_frag:59,convert:[91,74,47],northern:12,vbe:59,conceiv:[87,65,92,58],overseen:2,technolog:[60,45],host:[71,3,14,18,70,77,59,30,78,35,7,83,36,84,66,38,62,63,86,54,44,60,87,46,47,90,91,49],resurrect:65,opinion:87,chang:[0,1,77,2,51,52,53,65,14,16,75,21,27,73,59,30,31,25,79,80,35,7,10,66,38,39,62,87,54,44,60,64,68,89,48,20,6,91],honor:[91,48],chanc:[87,53,3,64,79],control:[1,2,25,52,3,14,4,6,70,30,79,7,8,82,9,36,84,10,66,85,60,87,89,48,69,91,49,92],short_pan:60,firefox:66,claim:19,bans_tests_test:59,approxim:[29,61,60],foundat:[34,51],apt:27,bans_persisted_byt:59,api:[78,52,53,74,58,10,49,19],deputi:12,vsl_space:60,beresp:[24,50,64,52,3,60,26,16,6,48,7,21,36,37,91,59,47,66,57],timesync:19,sourcefil:30,tailor:[7,41],fee:34,personel:25,max_connect:91,zip:52,commun:[2,51,25,52,63,84,55,7,34,86,58,59,92,19,39],frob:3,upgrad:[87,79,80,48,20,58,45],flat:10,maker:87,websit:[87,68,4,35,84,10,92,17],few:[87,1,2,5,89,81,34,70,65,10,60,39],latenc:7,usr:[31,90,9,27,46],nth:74,shm_cycl:59,thread_pool:[59,60],simpler:66,rick:66,sort:[51,25,63,41,47,34,83,36,77,12,17],vsm_keep:60,comparison:[41,74,47,70,91,30,60],impress:87,deflat:[52,3,87],resp_clos:59,trail:7,"transient":[53,55,15,84,29,60],insensit:[91,74],vclexamplehitmisshead:66,rare:65,htc:7,iii:43,fetcherror:52,"4d45b9544077921575c3c5a2a14c779bff6c4830d1fbafe4bd7e03e5dd93ca05":54,account:[52,34,25,47],alik:68,field_num:62,scalabl:2,tunnel:87,purg:[1,84,89,4,6,48,69,21,36,7,59],cumbersom:66,poul:[77,2,51,71,52,54,26,16,58,30,31,25,88,80,82,12,19,62,63,41,42,43,60,87,22,68,34,86,91,49,92],justic:92,obvious:[58,64,49,23,41],vcl_recv:[0,50,64,80,3,7,16,21,48,69,6,28,44,91,10,45,66,38,36],endian:19,bidirect:45,meet:39,fetch:[2,51,52,3,90,60,4,21,48,18,6,36,37,91,59,30,17],aliv:[33,74,60,83,73,59,30,17],proof:87,vsm_space:60,malform:59,bent:51,grace:[52,6,21,37,91,60],process:[0,24,1,2,25,71,52,53,3,55,26,16,5,21,65,59,30,79,32,8,9,83,36,72,10,60,12,39,40,62,14,74,63,85,86,56,17,64,89,34,6,91,22,92,23],n_object:59,sudo:27,tax:34,high:[87,65,84,7,37,34,75,4,82,9,73,66,19,54,60],shm_cont:59,"455c":30,tag:[24,62,52,63,74,47,86,83,60],vcl_:[91,48,70],tarbal:27,onlin:[91,66,27],esi_disable_xml_check:60,crimin:[25,17],weaken:[6,16],delai:[52,87,89,60],haproxi:92,surfac:92,forese:87,guru:[9,6,84],tamper:16,vcl_miss:[3,6,7],six:34,degre:[1,2],timeout_idl:[48,79,60],conn:59,subdirectori:[64,42],instead:[71,53,3,14,18,27,78,79,83,66,19,39,62,63,5,86,54,60,64,89,48,34,91,92],panic:[78,84,9,65,59,30,60],convers:[79,47],stand:[82,22,87,51],fare:87,everywher:[64,92],express:[71,89,28,29,30,82,8,7,36,66,62,63,64,41,86,44,60,87,74,91,88,70],attend:77,farm:87,watch:[81,68,66,78,77],gcc:60,sc_overload:59,men:[87,19],fcj8cnd5188:66,tier:58,netcat:79,redund:78,hasher:60,physic:[80,68],villag:12,alloc:[64,53,73,87,59,29,60],denounc:34,essenti:[66,78,4],seriou:[29,34,87,60],sit:[87,34,19,51],robot:17,element:[64,74,19,51,60],issu:[87,1,2,84,52,92,65,82,60,85,35,34,9,36,42,58,91,39,66,19,30],mainten:34,rfc3986:49,furious:65,fallback:[79,61,47],vcl2:64,vml:34,least:[24,64,78,51,92,68,87,34,54,66,60],bans_test:59,routin:[87,65],wit:[52,23,26,60],solv:[64,51,65,87,37,58],move:[68,52,14,46,48,7,21,59,60,17],pipe_if_loc:[91,70],sysconfig:[75,46],whilst:66,bans_req:59,comma:[63,86,46,74],"0xb75096d0":36,bunch:66,perfect:[68,54],consensu:51,chosen:[18,49,12,87,30],youtub:66,brook:87,labor:10,willing:3,infrastructur:[10,1,92,78],decai:60,"0x80":60,therefor:[64,77,65,25,80,54,92,87,48,34,42,27,73,66,19,39],dag:[62,71,14,63,86,60],crash:[65,84,72,33,9,73,60,30],pure:[53,87,25,37],thread_queue_limit:60,hurrican:10,auto:[64,21,30],spell:91,dai:[87,25,77,47,34,36,43,91,66,23,39],auth:[71,30],devel:27,mention:[1,51,3,7,11,49,12],so_sndtimeo:60,facilit:19,kiss:[22,23],front:[31,51,81,36,66,60],ban_lurker_ag:60,thread_pool_timeout:60,wrangler:1,libvarnishapi:80,somewher:[44,51],thrill:92,busy_kil:59,anyth:[64,1,51,3,65,41,7,19,87,82,58,89,92,38,60],edit:[35,82,64,75,58],xkei:21,nocach:66,n_expir:59,mode:[86,9,1,71,52,53,3,14,74,26,6,21,37,91,60,30],thread_pool_workspac:60,disregard:[24,91,66],cluster1:48,vsl_buffer:60,subset:[24,1,87],lie:51,cry:19,dgst:30,intellig:39,"_catch_bug":65,chunk:[87,52,53,5,59,39],fetch_length:59,consum:[52,74],"65k":66,"static":[78,58],our:[31,87,2,51,58,41,7,34,9,27,28,42,54,44,60,90,23,39],unload:[44,64,30],shannon:54,out:[77,65,51,53,3,43,26,4,5,21,27,76,58,59,89,31,25,80,35,7,36,37,12,19,39,54,44,60,87,66,68,18,38,34,91,23],variabl:[24,64,71,3,41,47,82,21,91,59,19,30],antiqu:19,vcc:[8,82,64,25,89],overridden:26,cleanli:59,influenc:[48,18,37],defend:25,req:[0,50,51,52,3,26,16,21,28,59,30,7,36,37,10,45,66,61,54,44,60,64,38,89,47,48,69,91],vcl:[24,50,1,2,25,71,52,72,3,77,55,26,16,18,21,28,65,59,89,30,31,51,78,79,32,80,90,75,35,8,7,9,36,37,10,60,66,38,39,13,84,41,85,74,44,17,61,64,67,46,5,47,48,20,6,91,88,70],defenc:92,rfc5861:21,stdnoreturn:19,suitabl:[52,34,63,64,56],disappear:[87,51],gorol:60,stead:44,leverag:78,ref:[24,44],defens:[10,34],red:[35,46,75,33,27],statist:[78,25,52,53,84,14,56,8,21,76,80,63,10,60,66,19,17],clarifi:51,shut:34,bereq_hdrbyt:59,insid:[53,34,66,51,60],parenthesi:74,ipod:74,unpars:52,contruct:[50,6],shm_write:59,standalon:64,sc_rx_timeout:59,hash_ignore_busi:91,pipe_hdrbyt:59,york:77,dictionari:87,advisor:12,releas:[64,77,51,73,60,47,34,21,27,37,39,92,30],critbit_cooloff:60,complianc:87,http_req_hdr_len:60,guarante:[64,53,19,54,22,23],unwant:66,could:[24,9,1,92,52,66,77,68,64,61,34,21,43,59,60,12,19,30],latest:[91,27,19,30],ask:[1,51,25,92,3,65,89,56,34,59,10,12,19,39],mac:[49,58],keep:[51,52,65,4,6,27,73,59,30,25,78,80,33,7,83,36,37,17,12,61,39,62,63,41,42,44,60,64,66,68,74,86,91,92,23],scari:66,length:[87,1,52,53,64,6,54,10,60,59,30],outsid:[81,72,7,78],pcre_exec:60,retain:0,timezon:39,ccgroup:60,thread_stats_r:60,softwar:[2,71,52,58,26,21,27,77,31,66,61,39,62,63,86,60,68,74,47,34,91,88,92],suffix:[29,60],frap:70,qualiti:[34,58],echo:[24,85,73],date:[24,64,71,52,80,87,37],wreturn:60,submit:[1,6],drastic:59,facil:[1,78,87,26,47,19,10,23],underscor:[66,19],utc:19,prioriti:47,forgeri:87,"long":[51,52,53,73,26,4,70,58,59,30,79,80,36,66,19,39,87,42,54,60,64,74,47,34,91,92],dump:[56,9,65,59,22,30,60],unknown:[91,66],licens:[24,62,71,52,63,74,26,47,34,86,91,61,60],perfectli:[34,66,19],system:[1,65,78,25,66,53,43,46,82,47,18,21,27,73,29,11,89,59,23,60],wrapper:[1,19],attach:[91,64,60,58],attack:[92,1,55,25,54],sadli:87,multiprogram:[23,19],ton:[87,43],scant:87,termin:[31,64,52,60,6,21,83,22,92,30],licenc:[62,71,52,63,74,26,47,86,61,60],man:[92,85,16,9,91,59,66,30],"final":[31,1,78,25,80,26,4,34,27,36,10],boil:78,misunderstood:66,udp:[87,78],shell:[9,60,49],rsh:87,joani:66,biggest:92,shall:19,nobodi:[87,25,51,64,34,37],rx_overflow:59,haven:10,cli_common:30,resist:1,hitmiss:71,gethdr_:64,bloat:19,free_spac:91,bother:[64,12],lion:73,structur:[64,74,78,65,34,23,82,42,54,91,29,19,60],charact:[87,62,52,65,14,74,56,70,54,91,66,30],"9fbb":21,num:86,collaps:47,sensit:[64,65,27,87,47],dubiou:60,"0x41f778":9,other:[24,1,77,74,25,71,53,3,65,55,16,18,6,27,70,58,59,81,51,78,79,80,34,35,82,9,83,36,37,10,11,66,19,39,68,84,63,87,42,54,44,56,60,64,46,5,86,61,48,20,21,91,22,92,23],sooner:54,greater:[34,88,68,74,60],webfold:35,"function":[1,2,54,4,6,77,30,78,79,32,8,66,19,41,43,60,64,74,47,48,21,91],counter:[80,81,52,53,14,60,56,6,8,21,76,44,10,30,59,17],plaintext:92,favorit:[35,44,90],barf:[70,26,54],msec:60,clearli:[87,77],correspond:[91,64],requrl:[52,63,74,56,83,66],have:[24,1,77,2,25,52,68,3,43,14,4,5,21,61,58,29,47,90,30,31,51,78,79,80,20,35,82,9,83,36,37,10,11,12,38,39,13,81,89,74,41,7,42,54,44,16,59,60,87,64,49,65,66,46,18,19,48,34,6,91,22,92,23],close:[9,25,31,52,80,58,74,6,34,21,73,59,60,30],need:[24,50,1,65,51,53,3,43,5,21,27,70,73,59,30,31,78,80,34,75,82,9,83,36,72,10,60,66,38,39,90,68,87,7,42,54,44,45,64,49,46,89,61,48,20,91,22,92],blix:[71,52,14,63,74,47,86,91],border:[12,51],devicetyp:7,jemalloc:[22,27],verbatim:71,soak:60,min:62,beresp_hdrbyt:59,rout:[44,87],"0x00":[91,70],sandbox:1,mix:[87,19],independend:6,preced:[74,41,70,91,66,60],best:[87,2,80,34,26,82,22,92,19,60],which:[1,77,2,25,52,53,3,43,26,16,18,21,27,61,73,29,89,30,51,78,79,32,80,75,82,10,60,12,19,68,74,63,85,42,54,44,56,59,17,58,87,64,65,66,46,5,47,48,34,6,91,22,92,23,70],roug:1,vpn:1,ncsa:[8,17,71,60,10],singl:[64,25,71,65,14,89,26,74,34,21,36,44,91,10,66,19],cli_limit:60,some_filenam:89,unless:[86,1,89,78,71,66,3,46,64,15,16,82,6,60,29,10,22,59,61,39],allow:[24,1,2,25,71,3,14,4,21,65,30,78,9,36,37,10,62,63,86,60,87,74,69,91],tcp_keepalive_prob:[60,73],deploy:[29,87],quantifi:47,who:[87,1,80,68,34,69,42,77,92,39],sc_req_http10:59,discov:[53,64],fragment:[24,29,60,59],jul:87,rush_expon:60,vcl_cooldown:[21,79,60],histogram:[8,56,62,17],segment:[10,9,83,60,59],why:[64,1,49,25,88,52,92,3,68,82,87,34,9,42,54,22,12,19],fair:9,hcb_nolock:59,urg:87,url:[24,51,71,52,3,26,56,57,59,30,7,36,66,61,74,63,54,44,60,64,89,47,38,91,49,28],"32k":60,gather:71,frederick:87,uri:87,sandbeck:[26,60],face:65,pipe:[0,62,71,52,3,60,16,56,6,70,91,59,17,45],deni:69,determin:[64,3,74,91,59,66],north:77,occasion:39,harsher:34,fetch_1xx:59,fact:[25,43,34,84,29,19],malamud:49,priv_vcl:64,tape:49,"62f5275f":21,text:[24,64,1,52,20,75,16,35,48,34,44,60,90,19,30],borderlin:87,verbos:[86,14,26],elif:91,connect:[1,25,71,52,53,14,74,5,6,59,30,78,79,80,83,62,63,85,86,44,60,87,89,20,21,91,92],bring:[92,34,12],thaumaturg:64,bedroom:68,extern:[10,60],lingua:82,rough:13,trivial:[51,53,92,42,66,23],res_writeobj:9,redirect:[7,21,66,86,71],highest:[87,41],locat:[31,87,52,53,85,35,7,84,38],tire:65,timeout_ling:[48,60],forev:21,should:[0,1,2,25,53,3,4,5,21,27,65,29,81,51,79,80,35,10,66,19,13,74,85,15,42,54,44,60,87,64,49,46,89,47,48,34,91,22],ixslvvxrgkjptxmc:30,"0x20":60,elseif:[24,91,7],local:[31,1,79,52,46,64,74,69,21,27,70,91,90,9],hope:[87,25,51,77,34,42,58,22,12],expkil:52,meant:19,explicitli:[52,44,60,89,48],obj2:51,contribut:[64,2],beat:87,approv:1,rush:[87,60],bear:[64,19,51],autom:78,regularli:56,autos:60,jpg:[57,16],mgt:59,increas:[24,92,74,4,81,48,6,36,73,44,60,59,19,30],vrt_delete_backend:78,edg:[24,60,12,84,16],fetch_chunk:59,coalesc:[44,37],esi_xmlerror:52,priv_task:64,enabl:[1,2,79,29,72,3,37,26,61,52,91,36,73,44,10,23,60],organ:[18,51,84],denmark:23,devast:34,stuff:[25,51,52,53,89,81,42,43,66],vcl_someth:72,integr:[10,87,92],partit:[1,46],ecosystem:21,compartement:92,grab:[51,39],do_esi:[24,91,3,26],view:[87,32,53,14,92,17],conform:3,btw:43,legaci:66,modulo:60,vcl_pass:[48,3,6,7],unimport:51,log_info:[72,60],frame:87,noteworthi:[20,21],ipng:49,shm:[59,60],c_fail:59,temporarili:7,fetch_fail:59,danger:[1,19],child_start:59,statu:[87,51,71,52,80,74,89,85,48,7,6,36,91,10,66,30],error:[80,35,64,62,71,52,63,65,14,89,86,4,6,48,9,10,29,59,66,60],threads_limit:59,vdi_http1pipe_f:78,reqhead:[52,83,63,74,56],mainli:78,boundari:[34,87,62],vsm_overflow:59,tcp_keepalive_intvl:[60,73],tend:[34,38,51,65],b00000:27,written:[2,71,52,77,14,26,16,5,21,27,70,65,59,30,83,66,19,62,63,85,86,60,64,12,74,47,34,91,49,23],unusu:41,crude:25,chemic:51,neither:[85,60,14,19,16],email:[34,65,87,51,39],midnight:34,bought:68,entic:[3,87],kei:[1,2,62,71,52,54,14,21,34,6,37,91,10,38,60],vrt:64,parseabl:59,reinforc:19,hikllqvw:26,job:[64,80,68,87,26,34,54,10,39,66,92,60],entir:[87,51,68,14,34,42,65,91,92,19,60],otherwis:[1,78,53,85,26,16,7,6,65,44],crc32:60,disput:34,thank:[2,51,68,34,58,92],doorwai:51,reqbodi:52,instant:[80,77],used_spac:91,plugin:[66,19,56],career:12,goal:51,mpg:30,ramp:[34,60],equal:[41,74],vtqe_prev:19,etc:[1,65,51,52,68,3,43,5,21,58,59,73,25,90,75,35,82,9,84,10,17,19,87,54,60,64,46,89,47,34],instanc:[1,51,71,52,53,3,14,74,70,58,30,25,78,80,8,10,19,62,63,41,85,86,60,87,64,89,91,49],admir:34,lru_interv:60,child_stop:59,afraid:58,strftime:71,preprocessor:19,comment:[24,7,35,18,70,91,44,22],vcl_probe:78,anti:60,unclear:87,toilet:68,wall:[34,12,19,60],last_us:48,arriv:[18,54],vcl_fini:6,walk:[80,36,78],vcl_synth:[91,48,7,6],ssl_clear:22,laugh:19,cli_run:65,"48k":60,rpm:27,admin:[5,66,25],unreferenc:60,quit:[39,51,68,58,14,5,41,70,34,9,83,36,54,44,30,66,19,82],slowli:83,tread:60,tx_eof:59,addition:[85,79],thread_fail_delai:59,ban_dup:60,polka:70,window:[52,44,11,83,91],cent:61,snort:92,willi:92,json:[24,14,84],besid:[34,83,65],treat:[74,89,60],querysort:47,varnishtop:[62,52,63,14,26,4,8,86,60,76,56,66,17],decend:58,"31d":9,hat:[87,33,46,35,75,27],backendopen:52,both:[64,1,87,52,53,74,46,82,19,21,80,34,6,27,58,41,89,66,23,60],inbound:18,bulk:22,lass:[2,14,85,91,59,30],req_clos:59,togeth:[24,64,74,16,90,44,38,30],"8001337af":65,overwhelmingli:34,present:[24,87,62,71,52,63,14,74,16,6,7,21,42,59,56,66,17],multi:[91,64,23],obj1:51,plain:[52,48,65],align:[48,60],shortliv:[29,15,60],defin:[1,51,26,6,78,80,36,66,61,62,63,86,42,44,60,64,46,19,48,90,21,91],decept:87,wild:7,backend_express:30,thunder:37,layer:[87,51,43],langaug:19,vapi:53,reacquir:[64,30],squid:[36,51],site:[24,87,2,68,46,81,75,65,44,66],scanf:19,objhdr:59,bans_complet:59,n_gunzip:59,fiddl:[80,77],incom:[44,5,2,34],revis:31,myfoo:64,surprisingli:51,scienc:[19,51],vrt_backend_probe_field:78,tcp:[1,78,79,52,33,46,87,6,21,73,91,10,59,60],outdat:36,ping_interv:60,welcom:[80,39,41,60,30],insight:51,vmod_event_f:64,parti:[21,68,77],sc_rem_clos:59,cross:[34,39],sz_want:59,member:64,python:[64,82,27,23],vtc_mode:60,vmod_priv_free_f:64,constel:41,android:7,inc:34,incl:[52,21],infer:21,difficult:66,phk:[87,26,86,30,23,39],competit:87,eur27k:34,rake:[34,88],http:[24,50,1,2,51,71,52,3,55,4,56,18,21,27,28,76,65,59,30,31,61,78,79,7,75,35,8,82,9,83,36,84,10,45,66,38,74,41,60,54,44,16,17,87,64,88,46,89,47,48,91,49,92,57],hostnam:[91,66,38,47],logic:[91,29,48,70,37],upon:[64,6],effect:[1,2,53,89,21,36,91,29,60],handi:[64,78],beast:65,unchalleng:51,sess_conn:59,pipe_out:59,dealloc:53,dust:68,php:44,thread_queue_len:59,fympg:30,prng:60,off:[89,62,66,52,53,3,71,14,18,60,16,34,86,77,63,4,5,23,39],center:14,vcl1:64,com:[24,46,7,36,91,44,30,66,39],vcl_real:64,knowledg:34,well:[1,51,25,68,74,46,87,16,82,6,83,42,29,11,49,66,19],overwork:92,regsubal:[91,66],thought:[87,25,51,82,42,77,88,19,39],vsl_mask:[79,60],exampl:[24,52,26,18,21,27,70,30,31,78,19,7,36,84,66,61,63,85,42,54,44,64,67,46,74,47,48,90,91,22,92],command:[31,1,84,46,85,65,55,64,15,89,8,5,9,36,53,10,60,66,30],english:66,undefin:74,piec:[64,54,68,34,44,10,92],usual:[0,35,64,49,2,87,21,9,27,36,65,39,66,30],sporad:[42,73],therebi:[36,4],http_gzip_support:[91,3,60,16],less:[87,2,73,74,34,77,92,38,39],"boolean":[91,41,74],compel:87,obtain:[85,60],vdi_resolve_f:78,tcl:82,vdi_getbody_f:78,g_space:59,heavili:64,skill:92,compar:[70,91,60,19,54],py3k:82,web:[24,31,1,2,51,25,40,92,54,87,65,16,35,83,28,37,44,4,66],rapid:60,amd64:65,bodylen:26,omit:60,bereq_bodybyt:59,onward:60,sky:37,knew:[42,19,43],discuss:[2,89],script:[24,1,25,43,64,26,7,82,27,73,10,30,23,17],add:[87,61,78,53,43,92,41,26,38,7,9,36,54,91,44,16,66,23,60],valid:[74,36,51,60],circular:29,rtld_now:64,inact:[64,21,30],invulner:1,kick:7,gmt:[87,9,47],"16g":81,esi_ignore_other_el:60,sick:[91,44,34,37,30],webpag:34,log_local_addr:52,arguabl:87,assert:[9,19,65],ldconfig:27,realiz:[92,68],five:[24,87,51,34,77,23,60],know:[1,51,52,53,3,58,5,21,27,77,30,88,7,83,66,13,42,60,64,22,46,89,49],unseen:14,thoughtlessli:60,mempool:59,password:65,recurs:60,loss:74,unplan:[29,60],tail:[86,63,62,71],resid:64,trac:[66,87,2],success:[64,6,27,77,91,59,60],incred:51,profound:51,fetch_bad:59,c1x:19,necessari:[64,32,68,46,48,42,27,73,60,30],martin:[71,52,14,63,74,47,86,91],workthread:[52,60],hashtwo:21,heen:59,decis:[10,1,12,89,59],backlog:39,"80013801e":65,exceed:[6,74],didn:[24,3,19,42,49,92,23],shutdown:[29,60],substanti:63,captur:[92,66,65],twitter:77,linux:[58,9,2,33,7,43,35,75,21,73,11],bogohead:52,self:[59,60,43],"12pm":92,vsa:64,vsc:53,reviv:42,shabbi:77,flush:[59,3,71,86,60],proper:[48,78],gave:[59,34,43],peter:12,vsl:[62,48,52,53,71,63,74,86,47,8,9,83,59,23,60],vsm:[62,25,71,53,14,8,86,63,59,60],transport:87,tmp:[29,22,26,65],nokia:58,trust:[1,43,3,25,82],leaf:78,rtld_local:64,lead:[29,21,19,47],truss:[9,65],avoid:[87,64,57,80,3,54,7,74,82,21,36,37,91,60,23,39],suckaddr:64,bereqacct:52,blurri:78,outgo:91,leav:[87,89,26,9,42,54,19],ipv4:[87,52,80,46,89,49,60],happend:12,eso:34,duplic:36,kiddi:17,esi:[24,64,88,84,51,52,3,77,74,26,16,21,48,20,6,59,91,10,4,60],encourag:[64,78],bereqhead:52,has_j:66,"enum":64,deprec:[91,64,6,42],disinfectant:92,paper:[34,77],vhost:[85,47],headerninja:66,toggl:14,offset:[53,54],handedli:19,microsecond:[10,2,71],expiri:[52,59],about:[1,77,2,51,40,52,53,3,43,55,16,5,21,27,58,81,80,35,82,84,10,60,12,19,39,13,87,42,54,44,56,17,64,49,65,66,68,48,34,22,92,23],misbehav:[84,16,18,9,37,44,66],actual:[51,65,5,77,29,35,25,78,81,83,36,10,66,19,39,85,42,43,17,87,34,91,92],socket:[9,1,49,78,51,52,58,55,64,85,21,73,91,10,84,22,60],linger:[34,60],column:[83,14],vcl_hit:[91,6,37],cache_hitpass:59,uplex:39,rem_clos:59,stamp:52,fear:[87,19],carrier:82,thread_pool_add_delai:[48,60],segovia:19,emperor:12,disabl:[87,1,78,62,71,63,14,89,16,48,86,36,73,91,60],compil:[64,78,25,32,33,89,60,48,5,27,43,91,10,17,19,30],getaddrinfo:47,own:[64,1,78,3,44,46,41,74,87,48,34,70,54,10,22,90,19,60],vcl_call:52,thread_pool_min:[59,60],tight:44,automat:[87,65,52,54,89,47,48,21,37,91,10,60,30],dataset:[29,56],warranti:64,automak:27,guard:25,merk:66,vdi_finish_f:78,protector:60,smarto:[2,58],pitfal:[66,4],pointless:39,automag:17,merg:79,backend_reus:59,vcach:[21,79],nuke:[59,60],val:26,pictur:[10,64,84],transfer:91,legibl:[91,70],support:[2,51,71,53,3,73,16,21,58,79,33,36,45,66,39,40,87,43,44,4,60,64,67,47,20,22,92],rotat:[29,86,71],regsub:[91,64,66,70,7],debian:[33,46,35,75,27,73,60],"12k":60,vax:42,much:[58,87,1,77,51,25,53,54,92,89,60,16,80,34,83,70,73,22,66,19,39],pool_req:60,"var":[9,85],trickeri:[8,53],deliveri:[31,52,53,3,74,89,16,6,22,60],alexa:77,unexpect:[59,47],sc_tx_error:59,advers:29,weight:61,yeah:49,admonish:87,acceptor_sleep_incr:60,gain:87,whistl:92,grate:34,overflow:59,inlin:[1,51,72,64,48,18,84,10,60,30],eat:60,count:[1,52,74,64,56,36,91,59,70],succe:[89,79],made:[64,1,51,52,68,20,89,87,48,34,54,91,59,92,19],wise:[82,22,87],krypto:22,tab:30,whether:[24,2,71,6,83,91,66],shrunk:43,murphi:10,wife:10,smooth:87,flip:83,"abstract":78,asynchron:[64,37],record:[62,71,52,53,65,63,74,56,86,59,10,23,60],below:[64,3,89,65,29,66,60],limit:[1,62,52,66,68,58,63,41,60,74,81,86,10,29,17,59,19,30],indefinit:14,monument:12,lvl:74,problem:[58,87,64,65,51,52,44,54,68,34,43,82,9,37,29,60,92,19,39],quickli:87,beresphead:52,"catch":51,"800m":74,dual:87,collis:54,"int":[91,64,47,19,41],mask:[52,89,60],dure:[24,1,52,3,87,60,6,42,59,91,10,22,17],pid:[71,86,60],twist:[87,54],implement:[24,64,61,51,32,80,3,78,87,16,48,42,43,91,22,92,19,60],some_nam:89,ing:7,pit:51,girl:77,probabl:[24,40,64,61,51,52,66,77,92,87,47,35,90,9,54,29,22,12,19,60],mutual:34,quot:[91,74,30],syslog_cli_traff:[1,60],boot:[21,19],detail:[51,71,52,26,16,21,76,59,30,31,7,10,61,13,62,63,86,60,74,47,34,91,49,92],virtual:[44,18,87,84],expr2:74,expr1:74,bool:[64,78,89,41,91,47,60],special:[87,3,7,61,48,82,21,70,91,66,19,17],rememb:[64,80,3,48,65,49,66,92],behold:[38,23],exp_mail:59,junk:59,repeat:[87,14,78,60],openoffic:82,confignam:[21,30],"1kb":[81,47],"class":[53,82,60,7,47],c_freed:59,june:51,amend:6,bans_persisted_fragment:59,humbl:87,serial:64,stai:36,multithread:64,outsourc:1,degrad:6,sphinx:[82,88,27],eof:59,reliabl:73,incompet:87,rule:[64,66,19,25,41],mulhuijzen:2,emerg:[89,51],auxiliari:60,elsif:[91,44,66],yell:34,invari:[34,54],sincer:51},objtypes:{},titles:["actions","Security first","The fundamentals of web proxy caching with Varnish","How GZIP, and GZIP+ESI works in Varnish","Varnish and Website Performance","Peculiarities","Built in subroutines","Device detection","The Varnish Reference Manual","Troubleshooting Varnish","The Big Varnish Picture","Prerequisites","What were they thinking ?","Now what?","varnishstat","Parameters","Compression","Varnish Glossary","VCL - Varnish Configuration Language","The Tools We Work With","What's new in Varnish 4.1","Changes in Varnish 4.1","Why no SSL ?","Brinch-Hansens Arrows","Content composition with Edge Side Includes","Security barriers in Varnish","varnishtest","Installing Varnish","Manipulating request headers in VCL","Storage backends","varnish-cli","Varnish Administrator Documentation","Varnish Processing States","Varnish Installation","Raking in the dough on Free and Open Source Software","Starting Varnish","Purging and banning","Misbehaving servers","Hashing","Getting help","The Varnish Tutorial","VCL Expressions","A persistent message","Did you call them autocrap tools ?","Backend servers","Adding WebSockets support","Important command line arguments","vmod_std","Upgrading to Varnish 4.0","IPv6 Suckage","Request and response VCL objects","What SPDY did to my summer vacation","VSL","VSM: Shared Memory Logging and Statistics","Varnish Does Not Hash","Starting and running Varnish","Statistics","Altering the backend response","Picking platforms","varnish-counters","varnishd","vmod_directors","varnishhist","varnishtop","VMOD - Varnish Modules","Reporting bugs","Achieving a high hitrate","VCL Examples","Wanton destruction for the greater good","ACLs","VCL Syntax","varnishncsa","Using inline C to extend Varnish","Platform specific notes","vsl-query","Put Varnish on port 80","Reporting and statistics","Thoughts on the eve of Varnish 3.0","Writing a Director","Upgrading to Varnish 4.1","What do you mean by 'backend' ?","Sizing your cache","Why Sphinx and reStructuredText ?","Logging in Varnish","The Varnish Users Guide","varnishadm","varnishlog","Why HTTP/2.0 does not seem interesting","Poul-Hennings random outbursts","CLI - bossing Varnish around","Backend servers","VCL","SSL revisited"],objnames:{},filenames:["users-guide/vcl-actions","users-guide/run_security","tutorial/introduction","phk/gzip","users-guide/performance","tutorial/peculiarities","users-guide/vcl-built-in-subs","users-guide/devicedetection","reference/index","users-guide/troubleshooting","users-guide/intro","installation/prerequisites","phk/thoughts","tutorial/now_what","reference/varnishstat","users-guide/params","users-guide/compression","glossary/index","users-guide/vcl","phk/thetoolsweworkwith","whats-new/index","whats-new/changes","phk/ssl","phk/brinch-hansens-arrows","users-guide/esi","phk/barriers","reference/varnishtest","installation/install","users-guide/vcl-example-manipulating-headers","users-guide/storage-backends","reference/varnish-cli","index","reference/states","installation/index","phk/dough","tutorial/starting_varnish","users-guide/purging","users-guide/vcl-grace","users-guide/vcl-hashing","installation/help","tutorial/index","phk/vcl_expr","phk/persistent","phk/autocrap","users-guide/vcl-backends","users-guide/vcl-example-websockets","users-guide/command-line","reference/vmod_std.generated","whats-new/upgrade-4.0","phk/ipv6suckage","users-guide/vcl-variables","phk/spdy","reference/vsl","reference/vsm","phk/varnish_does_not_hash","users-guide/running","users-guide/operation-statistics","users-guide/vcl-example-manipulating-responses","phk/platforms","reference/varnish-counters","reference/varnishd","reference/vmod_directors.generated","reference/varnishhist","reference/varnishtop","reference/vmod","installation/bugs","users-guide/increasing-your-hitrate","users-guide/vcl-examples","phk/wanton_destruction","users-guide/vcl-example-acls","users-guide/vcl-syntax","reference/varnishncsa","users-guide/vcl-inline-c","installation/platformnotes","reference/vsl-query","tutorial/putting_varnish_on_port_80","users-guide/report","phk/three-zero","reference/directors","whats-new/upgrading","phk/backends","users-guide/sizing-your-cache","phk/sphinx","users-guide/operation-logging","users-guide/index","reference/varnishadm","reference/varnishlog","phk/http20","phk/index","users-guide/run_cli","tutorial/backend_servers","reference/vcl","phk/ssl_again"]})varnish-4.1.1/doc/html/_static/0000755000201500234410000000000012652366773013344 500000000000000varnish-4.1.1/doc/html/_static/up-pressed.png0000644000201500234410000000056412652366773016066 00000000000000‰PNG  IHDRóÿasRGB®ÎébKGDùC» pHYs × ×B(›xtIMEÚ ,ˆ±ZeôIDAT8ËÍ“¿jAÆ—»*ÿW¥KkåØÙ-,ÓÙBòy‘@Ò- ÛÙˆ/`cáXYh!6jÎf GrOlXvØùvæûf¸k2±!ûóp!GOOÔ² &z·®f 6|M ©~¥%‘Ï`]*ð äΛM]K Õ‰úËZĆ1Eé¹rÅ%èȶÀc…¼ØmçÍ1Æ`ç¬ó³ÏÀ –H3Q5€ ©BàƒÇÄÆáä.@ $p³d!sý#ø~<<+"À¾xÓ ÀM›À0‡ÿêB™\€„Àt‘8K€@zŽB¦@F€˜&S `ËcbãP-`'æÓ€ø™{[”! ‘ eˆDh;¬ÏVŠEX0fKÄ9Ø-0IWfH°·ÀÎ ² 0Qˆ…){`È##x„™FòW<ñ+®ç*x™²<¹$9E[-qWW.(ÎI+6aaš@.Ây™24àóÌ ‘àƒóýxήÎÎ6޶_-ê¿ÿ"bbãþåÏ«p@át~Ñþ,/³€;€mþ¢%îh^  u÷‹f²@µ éÚWópø~<ß5°j>{‘-¨]cöK'XtÀâ÷ò»oÁÔ(€hƒáÏwÿï?ýG %€fI’q^D$.Tʳ?ÇD *°AôÁ,ÀÁÜÁ ü`6„B$ÄÂBB d€r`)¬‚B(†Í°*`/Ô@4ÀQh†“p.ÂU¸=púažÁ(¼ AÈa!ÚˆbŠX#Ž™…ø!ÁH‹$ ɈQ"K‘5H1RŠT UHò=r9‡\Fº‘;È2‚ü†¼G1”²Q=Ô µC¹¨7„F¢ Ðdt1š ›Ðr´=Œ6¡çЫhÚ>CÇ0Àè3Äl0.ÆÃB±8, “c˱"¬ «Æ°V¬»‰õcϱwEÀ 6wB aAHXLXNØH¨ $4Ú 7 „QÂ'"“¨K´&ºùÄb21‡XH,#Ö/{ˆCÄ7$‰C2'¹I±¤TÒÒFÒnR#é,©›4H#“ÉÚdk²9”, +È…ääÃä3ää!ò[ b@q¤øSâ(RÊjJåå4åe˜2AU£šRݨ¡T5ZB­¡¶R¯Q‡¨4uš9̓IK¥­¢•Óhh÷i¯ètºÝ•N—ÐWÒËéGè—èôw †ƒÇˆg(›gw¯˜L¦Ó‹ÇT071ë˜ç™™oUX*¶*|‘Ê •J•&•*/T©ª¦ªÞª UóUËT©^S}®FU3Sã© Ô–«UªPëSSg©;¨‡ªg¨oT?¤~Yý‰YÃLÃOC¤Q ±_ã¼Æ c³x,!k «†u5Ä&±ÍÙ|v*»˜ý»‹=ª©¡9C3J3W³Ró”f?ã˜qøœtN ç(§—ó~ŠÞï)â)¦4L¹1e\kª–—–X«H«Q«Gë½6®í§¦½E»YûAÇJ'\'GgÎçSÙSݧ §M=:õ®.ªk¥¡»Dw¿n§î˜ž¾^€žLo§Þy½çú}/ýTýmú§õG X³ $Û Î<Å5qo</ÇÛñQC]Ã@C¥a•a—á„‘¹Ñ<£ÕFFŒiÆ\ã$ãmÆmÆ£&&!&KMêMîšRM¹¦)¦;L;LÇÍÌÍ¢ÍÖ™5›=1×2ç›ç›×›ß·`ZxZ,¶¨¶¸eI²äZ¦Yî¶¼n…Z9Y¥XUZ]³F­­%Ö»­»§§¹N“N«žÖgðñ¶É¶©·°åØÛ®¶m¶}agbg·Å®Ã“}º}ý= ‡Ù«Z~s´r:V:ޚΜî?}Åô–é/gXÏÏØ3ã¶Ë)ÄiS›ÓGgg¹sƒóˆ‹‰K‚Ë.—>.›ÆÝȽäJtõq]ázÒõ›³›Âí¨Û¯î6îiî‡ÜŸÌ4Ÿ)žY3sÐÃÈCàQåÑ? Ÿ•0k߬~OCOgµç#/c/‘W­×°·¥wª÷aï>ö>rŸã>ã<7Þ2ÞY_Ì7À·È·ËOÃož_…ßC#ÿdÿzÿѧ€%g‰A[ûøz|!¿Ž?:Ûeö²ÙíAŒ ¹AA‚­‚åÁ­!hÈì­!÷ç˜Î‘Îi…P~èÖÐaæa‹Ã~ '…‡…W†?ŽpˆXÑ1—5wÑÜCsßDúD–DÞ›g1O9¯-J5*>ª.j<Ú7º4º?Æ.fYÌÕXXIlK9.*®6nl¾ßüíó‡ââ ã{˜/È]py¡ÎÂô…§©.,:–@LˆN8”ðA*¨Œ%òw%Ž yÂÂg"/Ñ6шØC\*NòH*Mz’쑼5y$Å3¥,幄'©¼L LÝ›:žšv m2=:½1ƒ’‘qBª!M“¶gêgæfvˬe…²þÅn‹·/•Ék³¬Y- ¶B¦èTZ(×*²geWf¿Í‰Ê9–«ž+Íí̳ÊÛ7œïŸÿíÂá’¶¥†KW-X潬j9²‰Š®Û—Ø(Üxå‡oÊ¿™Ü”´©«Ä¹dÏfÒféæÞ-ž[–ª—æ—n ÙÚ´ ßV´íõöEÛ/—Í(Û»ƒ¶C¹£¿<¸¼e§ÉÎÍ;?T¤TôTúT6îÒݵa×ønÑî{¼ö4ìÕÛ[¼÷ý>ɾÛUUMÕfÕeûIû³÷?®‰ªéø–ûm]­NmqíÇÒý#¶×¹ÔÕÒ=TRÖ+ëGǾþïw- 6 UœÆâ#pDyäé÷ ß÷ :ÚvŒ{¬áÓvg/jBšòšF›Sšû[b[ºOÌ>ÑÖêÞzüGÛœ499â?rýéü§CÏdÏ&žþ¢þË®/~øÕë×Îјѡ—ò—“¿m|¥ýêÀë¯ÛÆÂƾÉx31^ôVûíÁwÜwï£ßOä| (ÿhù±õSЧû“““ÿ˜óüc3-ÛbKGDÿÿÿ ½§“ pHYs  šœtIMEÚ 1;ïV·¿§IDAT8Ëu‘ËkÜUÇ?ßsgœ4ÔØøhª‚`µ©ÖG1 RQ‚”îܸp%èBªø”n"‚bРXJ ‹.4V iZð##T;m£µ!4™üæžãbâP­~7÷rîù>ιbwïý†cû†; m;‡oª”ÓAÜàΆ ζZ^«/®þôä£Ãç¸|îs¯ÝÉø{Óý;†¯y¿»Rº¥ð¸Â=È9(rÉt¦Vo¼¾û¡­ûG÷Í1±wíÞÿ#_àÓ©¹›{»¿ìî*•›E&ç å!€€ˆÀƒ(—Lç–VŸßuïÀ«oœéêûÁᲵ‘DŽÀ€ P„‡²G”“4ÿçÊ Ü:&€¯ç~™êî*ݳÖreˆuá: ‚ááS­-,ßUšœ©^Ÿ’ú›E&·™JY[ÃPà!RˆìB ŖޞʖR@_ÎôÈ€dBfó”€NvHfÂ"è2ØTÊî]­ˆR‘’ ³ö j§'BàÖ1‰ddAak…/DIJD… ’D2‘ÌH&L`&L† $Ex,6‹|Ö~_\©¿Pœ‘ $™ýMH`I˜©=Ÿ @¨±Z|õÈÎÁ|ttv´gcåЕ—WTZ'¤õ3rŽÈîje"ܵx¾9ÿö›¯°W> ¹mb©Ñ|by¥ˆ•fFRx{wí%Dúõå¹Z½±€áCíÿÞüô$õwdüÀôðÖ«ÞH¦mW÷nètaµ(ŠM<~;9¿ôáž]C/ñ_¸ãåŸ;÷ÉãÕ«§æã‹Õ#Ÿ}ûÀáÉïoÿ`zS§áÚ·ù_>:;x컓§?Ÿ©yóÝ©ÿ|}æ’~ûwam-/ž®7ž=¾0úìS÷5è»ØíR翚¾P"*Ö¯ IEND®B`‚varnish-4.1.1/doc/html/_static/sidebar.js0000644000201500234410000001120412652366773015231 00000000000000/* * sidebar.js * ~~~~~~~~~~ * * This script makes the Sphinx sidebar collapsible. * * .sphinxsidebar contains .sphinxsidebarwrapper. This script adds * in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton * used to collapse and expand the sidebar. * * When the sidebar is collapsed the .sphinxsidebarwrapper is hidden * and the width of the sidebar and the margin-left of the document * are decreased. When the sidebar is expanded the opposite happens. * This script saves a per-browser/per-session cookie used to * remember the position of the sidebar among the pages. * Once the browser is closed the cookie is deleted and the position * reset to the default (expanded). * * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ $(function() { // global elements used by the functions. // the 'sidebarbutton' element is defined as global after its // creation, in the add_sidebar_button function var bodywrapper = $('.bodywrapper'); var sidebar = $('.sphinxsidebar'); var sidebarwrapper = $('.sphinxsidebarwrapper'); // for some reason, the document has no sidebar; do not run into errors if (!sidebar.length) return; // original margin-left of the bodywrapper and width of the sidebar // with the sidebar expanded var bw_margin_expanded = bodywrapper.css('margin-left'); var ssb_width_expanded = sidebar.width(); // margin-left of the bodywrapper and width of the sidebar // with the sidebar collapsed var bw_margin_collapsed = '.8em'; var ssb_width_collapsed = '.8em'; // colors used by the current theme var dark_color = $('.related').css('background-color'); var light_color = $('.document').css('background-color'); function sidebar_is_collapsed() { return sidebarwrapper.is(':not(:visible)'); } function toggle_sidebar() { if (sidebar_is_collapsed()) expand_sidebar(); else collapse_sidebar(); } function collapse_sidebar() { sidebarwrapper.hide(); sidebar.css('width', ssb_width_collapsed); bodywrapper.css('margin-left', bw_margin_collapsed); sidebarbutton.css({ 'margin-left': '0', 'height': bodywrapper.height() }); sidebarbutton.find('span').text('»'); sidebarbutton.attr('title', _('Expand sidebar')); document.cookie = 'sidebar=collapsed'; } function expand_sidebar() { bodywrapper.css('margin-left', bw_margin_expanded); sidebar.css('width', ssb_width_expanded); sidebarwrapper.show(); sidebarbutton.css({ 'margin-left': ssb_width_expanded-12, 'height': bodywrapper.height() }); sidebarbutton.find('span').text('«'); sidebarbutton.attr('title', _('Collapse sidebar')); document.cookie = 'sidebar=expanded'; } function add_sidebar_button() { sidebarwrapper.css({ 'float': 'left', 'margin-right': '0', 'width': ssb_width_expanded - 28 }); // create the button sidebar.append( '
«
' ); var sidebarbutton = $('#sidebarbutton'); light_color = sidebarbutton.css('background-color'); // find the height of the viewport to center the '<<' in the page var viewport_height; if (window.innerHeight) viewport_height = window.innerHeight; else viewport_height = $(window).height(); sidebarbutton.find('span').css({ 'display': 'block', 'margin-top': (viewport_height - sidebar.position().top - 20) / 2 }); sidebarbutton.click(toggle_sidebar); sidebarbutton.attr('title', _('Collapse sidebar')); sidebarbutton.css({ 'color': '#FFFFFF', 'border-left': '1px solid ' + dark_color, 'font-size': '1.2em', 'cursor': 'pointer', 'height': bodywrapper.height(), 'padding-top': '1px', 'margin-left': ssb_width_expanded - 12 }); sidebarbutton.hover( function () { $(this).css('background-color', dark_color); }, function () { $(this).css('background-color', light_color); } ); } function set_position_from_cookie() { if (!document.cookie) return; var items = document.cookie.split(';'); for(var k=0; k to avoid XSS via location.hash (#9521) quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, // Check if a string has a non-whitespace character in it rnotwhite = /\S/, // Used for trimming whitespace trimLeft = /^\s+/, trimRight = /\s+$/, // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, // JSON RegExp rvalidchars = /^[\],:{}\s]*$/, rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, // Useragent RegExp rwebkit = /(webkit)[ \/]([\w.]+)/, ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, rmsie = /(msie) ([\w.]+)/, rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, // Matches dashed string for camelizing rdashAlpha = /-([a-z]|[0-9])/ig, rmsPrefix = /^-ms-/, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return ( letter + "" ).toUpperCase(); }, // Keep a UserAgent string for use with jQuery.browser userAgent = navigator.userAgent, // For matching the engine and version of the browser browserMatch, // The deferred used on DOM ready readyList, // The ready event handler DOMContentLoaded, // Save a reference to some core methods toString = Object.prototype.toString, hasOwn = Object.prototype.hasOwnProperty, push = Array.prototype.push, slice = Array.prototype.slice, trim = String.prototype.trim, indexOf = Array.prototype.indexOf, // [[Class]] -> type pairs class2type = {}; jQuery.fn = jQuery.prototype = { constructor: jQuery, init: function( selector, context, rootjQuery ) { var match, elem, ret, doc; // Handle $(""), $(null), or $(undefined) if ( !selector ) { return this; } // Handle $(DOMElement) if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; } // The body element only exists once, optimize finding it if ( selector === "body" && !context && document.body ) { this.context = document; this[0] = document.body; this.selector = selector; this.length = 1; return this; } // Handle HTML strings if ( typeof selector === "string" ) { // Are we dealing with HTML string or an ID? if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = quickExpr.exec( selector ); } // Verify a match, and that no context was specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; doc = ( context ? context.ownerDocument || context : document ); // If a single string is passed in and it's a single tag // just do a createElement and skip the rest ret = rsingleTag.exec( selector ); if ( ret ) { if ( jQuery.isPlainObject( context ) ) { selector = [ document.createElement( ret[1] ) ]; jQuery.fn.attr.call( selector, context, true ); } else { selector = [ doc.createElement( ret[1] ) ]; } } else { ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; } return jQuery.merge( this, selector ); // HANDLE: $("#id") } else { elem = document.getElementById( match[2] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || rootjQuery ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return rootjQuery.ready( selector ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }, // Start with an empty selector selector: "", // The current version of jQuery being used jquery: "1.7.1", // The default length of a jQuery object is 0 length: 0, // The number of elements contained in the matched element set size: function() { return this.length; }, toArray: function() { return slice.call( this, 0 ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num == null ? // Return a 'clean' array this.toArray() : // Return just the object ( num < 0 ? this[ this.length + num ] : this[ num ] ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set var ret = this.constructor(); if ( jQuery.isArray( elems ) ) { push.apply( ret, elems ); } else { jQuery.merge( ret, elems ); } // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if ( name === "find" ) { ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; } else if ( name ) { ret.selector = this.selector + "." + name + "(" + selector + ")"; } // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, ready: function( fn ) { // Attach the listeners jQuery.bindReady(); // Add the callback readyList.add( fn ); return this; }, eq: function( i ) { i = +i; return i === -1 ? this.slice( i ) : this.slice( i, i + 1 ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, slice: function() { return this.pushStack( slice.apply( this, arguments ), "slice", slice.call(arguments).join(",") ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: [].sort, splice: [].splice }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( length === i ) { target = this; --i; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ noConflict: function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }, // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Either a released hold or an DOMready/load event and not yet ready if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready, 1 ); } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.fireWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.trigger ) { jQuery( document ).trigger( "ready" ).off( "ready" ); } } }, bindReady: function() { if ( readyList ) { return; } readyList = jQuery.Callbacks( "once memory" ); // Catch cases where $(document).ready() is called after the // browser event has already occurred. if ( document.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready return setTimeout( jQuery.ready, 1 ); } // Mozilla, Opera and webkit nightlies currently support this event if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", jQuery.ready, false ); // If IE event model is used } else if ( document.attachEvent ) { // ensure firing before onload, // maybe late but safe also for iframes document.attachEvent( "onreadystatechange", DOMContentLoaded ); // A fallback to window.onload, that will always work window.attachEvent( "onload", jQuery.ready ); // If IE and not a frame // continually check to see if the document is ready var toplevel = false; try { toplevel = window.frameElement == null; } catch(e) {} if ( document.documentElement.doScroll && toplevel ) { doScrollCheck(); } } }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function( obj ) { return jQuery.type(obj) === "array"; }, // A crude way of determining if an object is a window isWindow: function( obj ) { return obj && typeof obj === "object" && "setInterval" in obj; }, isNumeric: function( obj ) { return !isNaN( parseFloat(obj) ) && isFinite( obj ); }, type: function( obj ) { return obj == null ? String( obj ) : class2type[ toString.call(obj) ] || "object"; }, isPlainObject: function( obj ) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } try { // Not own constructor property must be Object if ( obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } } catch ( e ) { // IE8,9 Will throw exceptions on certain host objects #9897 return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) {} return key === undefined || hasOwn.call( obj, key ); }, isEmptyObject: function( obj ) { for ( var name in obj ) { return false; } return true; }, error: function( msg ) { throw new Error( msg ); }, parseJSON: function( data ) { if ( typeof data !== "string" || !data ) { return null; } // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data ); // Attempt to parse using the native JSON parser first if ( window.JSON && window.JSON.parse ) { return window.JSON.parse( data ); } // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js if ( rvalidchars.test( data.replace( rvalidescape, "@" ) .replace( rvalidtokens, "]" ) .replace( rvalidbraces, "")) ) { return ( new Function( "return " + data ) )(); } jQuery.error( "Invalid JSON: " + data ); }, // Cross-browser xml parsing parseXML: function( data ) { var xml, tmp; try { if ( window.DOMParser ) { // Standard tmp = new DOMParser(); xml = tmp.parseFromString( data , "text/xml" ); } else { // IE xml = new ActiveXObject( "Microsoft.XMLDOM" ); xml.async = "false"; xml.loadXML( data ); } } catch( e ) { xml = undefined; } if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }, noop: function() {}, // Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { if ( data && rnotwhite.test( data ) ) { // We use execScript on Internet Explorer // We use an anonymous function so that context is window // rather than jQuery in Firefox ( window.execScript || function( data ) { window[ "eval" ].call( window, data ); } )( data ); } }, // Convert dashed to camelCase; used by the css and data modules // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); }, // args is for internal usage only each: function( object, callback, args ) { var name, i = 0, length = object.length, isObj = length === undefined || jQuery.isFunction( object ); if ( args ) { if ( isObj ) { for ( name in object ) { if ( callback.apply( object[ name ], args ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.apply( object[ i++ ], args ) === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isObj ) { for ( name in object ) { if ( callback.call( object[ name ], name, object[ name ] ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { break; } } } } return object; }, // Use native String.trim function wherever possible trim: trim ? function( text ) { return text == null ? "" : trim.call( text ); } : // Otherwise use our own trimming functionality function( text ) { return text == null ? "" : text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); }, // results is for internal usage only makeArray: function( array, results ) { var ret = results || []; if ( array != null ) { // The window, strings (and functions) also have 'length' // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 var type = jQuery.type( array ); if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { push.call( ret, array ); } else { jQuery.merge( ret, array ); } } return ret; }, inArray: function( elem, array, i ) { var len; if ( array ) { if ( indexOf ) { return indexOf.call( array, elem, i ); } len = array.length; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { // Skip accessing in sparse arrays if ( i in array && array[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var i = first.length, j = 0; if ( typeof second.length === "number" ) { for ( var l = second.length; j < l; j++ ) { first[ i++ ] = second[ j ]; } } else { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, inv ) { var ret = [], retVal; inv = !!inv; // Go through the array, only saving the items // that pass the validator function for ( var i = 0, length = elems.length; i < length; i++ ) { retVal = !!callback( elems[ i ], i ); if ( inv !== retVal ) { ret.push( elems[ i ] ); } } return ret; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, key, ret = [], i = 0, length = elems.length, // jquery objects are treated as arrays isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; // Go through the array, translating each of the items to their if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } // Go through every key on the object, } else { for ( key in elems ) { value = callback( elems[ key ], key, arg ); if ( value != null ) { ret[ ret.length ] = value; } } } // Flatten any nested arrays return ret.concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { if ( typeof context === "string" ) { var tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind var args = slice.call( arguments, 2 ), proxy = function() { return fn.apply( context, args.concat( slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; return proxy; }, // Mutifunctional method to get and set values to a collection // The value/s can optionally be executed if it's a function access: function( elems, key, value, exec, fn, pass ) { var length = elems.length; // Setting many attributes if ( typeof key === "object" ) { for ( var k in key ) { jQuery.access( elems, k, key[k], exec, fn, value ); } return elems; } // Setting one attribute if ( value !== undefined ) { // Optionally, function values get executed if exec is true exec = !pass && exec && jQuery.isFunction(value); for ( var i = 0; i < length; i++ ) { fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); } return elems; } // Getting an attribute return length ? fn( elems[0], key ) : undefined; }, now: function() { return ( new Date() ).getTime(); }, // Use of jQuery.browser is frowned upon. // More details: http://docs.jquery.com/Utilities/jQuery.browser uaMatch: function( ua ) { ua = ua.toLowerCase(); var match = rwebkit.exec( ua ) || ropera.exec( ua ) || rmsie.exec( ua ) || ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || []; return { browser: match[1] || "", version: match[2] || "0" }; }, sub: function() { function jQuerySub( selector, context ) { return new jQuerySub.fn.init( selector, context ); } jQuery.extend( true, jQuerySub, this ); jQuerySub.superclass = this; jQuerySub.fn = jQuerySub.prototype = this(); jQuerySub.fn.constructor = jQuerySub; jQuerySub.sub = this.sub; jQuerySub.fn.init = function init( selector, context ) { if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { context = jQuerySub( context ); } return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); }; jQuerySub.fn.init.prototype = jQuerySub.fn; var rootjQuerySub = jQuerySub(document); return jQuerySub; }, browser: {} }); // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); browserMatch = jQuery.uaMatch( userAgent ); if ( browserMatch.browser ) { jQuery.browser[ browserMatch.browser ] = true; jQuery.browser.version = browserMatch.version; } // Deprecated, use jQuery.browser.webkit instead if ( jQuery.browser.webkit ) { jQuery.browser.safari = true; } // IE doesn't match non-breaking spaces with \s if ( rnotwhite.test( "\xA0" ) ) { trimLeft = /^[\s\xA0]+/; trimRight = /[\s\xA0]+$/; } // All jQuery objects should point back to these rootjQuery = jQuery(document); // Cleanup functions for the document ready method if ( document.addEventListener ) { DOMContentLoaded = function() { document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); jQuery.ready(); }; } else if ( document.attachEvent ) { DOMContentLoaded = function() { // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( document.readyState === "complete" ) { document.detachEvent( "onreadystatechange", DOMContentLoaded ); jQuery.ready(); } }; } // The DOM ready check for Internet Explorer function doScrollCheck() { if ( jQuery.isReady ) { return; } try { // If IE is used, use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ document.documentElement.doScroll("left"); } catch(e) { setTimeout( doScrollCheck, 1 ); return; } // and execute any waiting functions jQuery.ready(); } return jQuery; })(); // String to Object flags format cache var flagsCache = {}; // Convert String-formatted flags into Object-formatted ones and store in cache function createFlags( flags ) { var object = flagsCache[ flags ] = {}, i, length; flags = flags.split( /\s+/ ); for ( i = 0, length = flags.length; i < length; i++ ) { object[ flags[i] ] = true; } return object; } /* * Create a callback list using the following parameters: * * flags: an optional list of space-separated flags that will change how * the callback list behaves * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible flags: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( flags ) { // Convert flags from String-formatted to Object-formatted // (we check in cache first) flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; var // Actual callback list list = [], // Stack of fire calls for repeatable lists stack = [], // Last fire value (for non-forgettable lists) memory, // Flag to know if list is currently firing firing, // First callback to fire (used internally by add and fireWith) firingStart, // End of the loop when firing firingLength, // Index of currently firing callback (modified by remove if needed) firingIndex, // Add one or several callbacks to the list add = function( args ) { var i, length, elem, type, actual; for ( i = 0, length = args.length; i < length; i++ ) { elem = args[ i ]; type = jQuery.type( elem ); if ( type === "array" ) { // Inspect recursively add( elem ); } else if ( type === "function" ) { // Add if not in unique mode and callback is not in if ( !flags.unique || !self.has( elem ) ) { list.push( elem ); } } } }, // Fire callbacks fire = function( context, args ) { args = args || []; memory = !flags.memory || [ context, args ]; firing = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; for ( ; list && firingIndex < firingLength; firingIndex++ ) { if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { memory = true; // Mark as halted break; } } firing = false; if ( list ) { if ( !flags.once ) { if ( stack && stack.length ) { memory = stack.shift(); self.fireWith( memory[ 0 ], memory[ 1 ] ); } } else if ( memory === true ) { self.disable(); } else { list = []; } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { var length = list.length; add( arguments ); // Do we need to add the callbacks to the // current firing batch? if ( firing ) { firingLength = list.length; // With memory, if we're not firing then // we should call right away, unless previous // firing was halted (stopOnFalse) } else if ( memory && memory !== true ) { firingStart = length; fire( memory[ 0 ], memory[ 1 ] ); } } return this; }, // Remove a callback from the list remove: function() { if ( list ) { var args = arguments, argIndex = 0, argLength = args.length; for ( ; argIndex < argLength ; argIndex++ ) { for ( var i = 0; i < list.length; i++ ) { if ( args[ argIndex ] === list[ i ] ) { // Handle firingIndex and firingLength if ( firing ) { if ( i <= firingLength ) { firingLength--; if ( i <= firingIndex ) { firingIndex--; } } } // Remove the element list.splice( i--, 1 ); // If we have some unicity property then // we only need to do this once if ( flags.unique ) { break; } } } } } return this; }, // Control if a given callback is in the list has: function( fn ) { if ( list ) { var i = 0, length = list.length; for ( ; i < length; i++ ) { if ( fn === list[ i ] ) { return true; } } } return false; }, // Remove all callbacks from the list empty: function() { list = []; return this; }, // Have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // Is it disabled? disabled: function() { return !list; }, // Lock the list in its current state lock: function() { stack = undefined; if ( !memory || memory === true ) { self.disable(); } return this; }, // Is it locked? locked: function() { return !stack; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { if ( stack ) { if ( firing ) { if ( !flags.once ) { stack.push( [ context, args ] ); } } else if ( !( flags.once && memory ) ) { fire( context, args ); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!memory; } }; return self; }; var // Static reference to slice sliceDeferred = [].slice; jQuery.extend({ Deferred: function( func ) { var doneList = jQuery.Callbacks( "once memory" ), failList = jQuery.Callbacks( "once memory" ), progressList = jQuery.Callbacks( "memory" ), state = "pending", lists = { resolve: doneList, reject: failList, notify: progressList }, promise = { done: doneList.add, fail: failList.add, progress: progressList.add, state: function() { return state; }, // Deprecated isResolved: doneList.fired, isRejected: failList.fired, then: function( doneCallbacks, failCallbacks, progressCallbacks ) { deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); return this; }, always: function() { deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); return this; }, pipe: function( fnDone, fnFail, fnProgress ) { return jQuery.Deferred(function( newDefer ) { jQuery.each( { done: [ fnDone, "resolve" ], fail: [ fnFail, "reject" ], progress: [ fnProgress, "notify" ] }, function( handler, data ) { var fn = data[ 0 ], action = data[ 1 ], returned; if ( jQuery.isFunction( fn ) ) { deferred[ handler ](function() { returned = fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); } else { newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); } }); } else { deferred[ handler ]( newDefer[ action ] ); } }); }).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { if ( obj == null ) { obj = promise; } else { for ( var key in promise ) { obj[ key ] = promise[ key ]; } } return obj; } }, deferred = promise.promise({}), key; for ( key in lists ) { deferred[ key ] = lists[ key ].fire; deferred[ key + "With" ] = lists[ key ].fireWith; } // Handle state deferred.done( function() { state = "resolved"; }, failList.disable, progressList.lock ).fail( function() { state = "rejected"; }, doneList.disable, progressList.lock ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( firstParam ) { var args = sliceDeferred.call( arguments, 0 ), i = 0, length = args.length, pValues = new Array( length ), count = length, pCount = length, deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? firstParam : jQuery.Deferred(), promise = deferred.promise(); function resolveFunc( i ) { return function( value ) { args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; if ( !( --count ) ) { deferred.resolveWith( deferred, args ); } }; } function progressFunc( i ) { return function( value ) { pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; deferred.notifyWith( promise, pValues ); }; } if ( length > 1 ) { for ( ; i < length; i++ ) { if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); } else { --count; } } if ( !count ) { deferred.resolveWith( deferred, args ); } } else if ( deferred !== firstParam ) { deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); } return promise; } }); jQuery.support = (function() { var support, all, a, select, opt, input, marginDiv, fragment, tds, events, eventName, i, isSupported, div = document.createElement( "div" ), documentElement = document.documentElement; // Preliminary tests div.setAttribute("className", "t"); div.innerHTML = "
a"; all = div.getElementsByTagName( "*" ); a = div.getElementsByTagName( "a" )[ 0 ]; // Can't get basic test support if ( !all || !all.length || !a ) { return {}; } // First batch of supports tests select = document.createElement( "select" ); opt = select.appendChild( document.createElement("option") ); input = div.getElementsByTagName( "input" )[ 0 ]; support = { // IE strips leading whitespace when .innerHTML is used leadingWhitespace: ( div.firstChild.nodeType === 3 ), // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables tbody: !div.getElementsByTagName("tbody").length, // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE htmlSerialize: !!div.getElementsByTagName("link").length, // Get the style information from getAttribute // (IE uses .cssText instead) style: /top/.test( a.getAttribute("style") ), // Make sure that URLs aren't manipulated // (IE normalizes it by default) hrefNormalized: ( a.getAttribute("href") === "/a" ), // Make sure that element opacity exists // (IE uses filter instead) // Use a regex to work around a WebKit issue. See #5145 opacity: /^0.55/.test( a.style.opacity ), // Verify style float existence // (IE uses styleFloat instead of cssFloat) cssFloat: !!a.style.cssFloat, // Make sure that if no value is specified for a checkbox // that it defaults to "on". // (WebKit defaults to "" instead) checkOn: ( input.value === "on" ), // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) optSelected: opt.selected, // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) getSetAttribute: div.className !== "t", // Tests for enctype support on a form(#6743) enctype: !!document.createElement("form").enctype, // Makes sure cloning an html5 element does not cause problems // Where outerHTML is undefined, this still works html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", // Will be defined later submitBubbles: true, changeBubbles: true, focusinBubbles: false, deleteExpando: true, noCloneEvent: true, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, reliableMarginRight: true }; // Make sure checked status is properly cloned input.checked = true; support.noCloneChecked = input.cloneNode( true ).checked; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as disabled) select.disabled = true; support.optDisabled = !opt.disabled; // Test to see if it's possible to delete an expando from an element // Fails in Internet Explorer try { delete div.test; } catch( e ) { support.deleteExpando = false; } if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { div.attachEvent( "onclick", function() { // Cloning a node shouldn't copy over any // bound event handlers (IE does this) support.noCloneEvent = false; }); div.cloneNode( true ).fireEvent( "onclick" ); } // Check if a radio maintains its value // after being appended to the DOM input = document.createElement("input"); input.value = "t"; input.setAttribute("type", "radio"); support.radioValue = input.value === "t"; input.setAttribute("checked", "checked"); div.appendChild( input ); fragment = document.createDocumentFragment(); fragment.appendChild( div.lastChild ); // WebKit doesn't clone checked state correctly in fragments support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; // Check if a disconnected checkbox will retain its checked // value of true after appended to the DOM (IE6/7) support.appendChecked = input.checked; fragment.removeChild( input ); fragment.appendChild( div ); div.innerHTML = ""; // Check if div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container. For more // info see bug #3333 // Fails in WebKit before Feb 2011 nightlies // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right if ( window.getComputedStyle ) { marginDiv = document.createElement( "div" ); marginDiv.style.width = "0"; marginDiv.style.marginRight = "0"; div.style.width = "2px"; div.appendChild( marginDiv ); support.reliableMarginRight = ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; } // Technique from Juriy Zaytsev // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ // We only care about the case where non-standard event systems // are used, namely in IE. Short-circuiting here helps us to // avoid an eval call (in setAttribute) which can cause CSP // to go haywire. See: https://developer.mozilla.org/en/Security/CSP if ( div.attachEvent ) { for( i in { submit: 1, change: 1, focusin: 1 }) { eventName = "on" + i; isSupported = ( eventName in div ); if ( !isSupported ) { div.setAttribute( eventName, "return;" ); isSupported = ( typeof div[ eventName ] === "function" ); } support[ i + "Bubbles" ] = isSupported; } } fragment.removeChild( div ); // Null elements to avoid leaks in IE fragment = select = opt = marginDiv = div = input = null; // Run tests that need a body at doc ready jQuery(function() { var container, outer, inner, table, td, offsetSupport, conMarginTop, ptlm, vb, style, html, body = document.getElementsByTagName("body")[0]; if ( !body ) { // Return for frameset docs that don't have a body return; } conMarginTop = 1; ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; vb = "visibility:hidden;border:0;"; style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; html = "
" + "" + "
"; container = document.createElement("div"); container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; body.insertBefore( container, body.firstChild ); // Construct the test element div = document.createElement("div"); container.appendChild( div ); // Check if table cells still have offsetWidth/Height when they are set // to display:none and there are still other visible table cells in a // table row; if so, offsetWidth/Height are not reliable for use when // determining if an element has been hidden directly using // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). // (only IE 8 fails this test) div.innerHTML = "
t
"; tds = div.getElementsByTagName( "td" ); isSupported = ( tds[ 0 ].offsetHeight === 0 ); tds[ 0 ].style.display = ""; tds[ 1 ].style.display = "none"; // Check if empty table cells still have offsetWidth/Height // (IE <= 8 fail this test) support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); // Figure out if the W3C box model works as expected div.innerHTML = ""; div.style.width = div.style.paddingLeft = "1px"; jQuery.boxModel = support.boxModel = div.offsetWidth === 2; if ( typeof div.style.zoom !== "undefined" ) { // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout // (IE < 8 does this) div.style.display = "inline"; div.style.zoom = 1; support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); // Check if elements with layout shrink-wrap their children // (IE 6 does this) div.style.display = ""; div.innerHTML = "
"; support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); } div.style.cssText = ptlm + vb; div.innerHTML = html; outer = div.firstChild; inner = outer.firstChild; td = outer.nextSibling.firstChild.firstChild; offsetSupport = { doesNotAddBorder: ( inner.offsetTop !== 5 ), doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) }; inner.style.position = "fixed"; inner.style.top = "20px"; // safari subtracts parent border width here which is 5px offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); inner.style.position = inner.style.top = ""; outer.style.overflow = "hidden"; outer.style.position = "relative"; offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); body.removeChild( container ); div = container = null; jQuery.extend( support, offsetSupport ); }); return support; })(); var rbrace = /^(?:\{.*\}|\[.*\])$/, rmultiDash = /([A-Z])/g; jQuery.extend({ cache: {}, // Please use with caution uuid: 0, // Unique for each copy of jQuery on the page // Non-digits removed to match rinlinejQuery expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), // The following elements throw uncatchable exceptions if you // attempt to add expando properties to them. noData: { "embed": true, // Ban all objects except for Flash (which handle expandos) "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", "applet": true }, hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); }, data: function( elem, name, data, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var privateCache, thisCache, ret, internalKey = jQuery.expando, getByName = typeof name === "string", // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary isNode = elem.nodeType, // Only DOM nodes need the global jQuery cache; JS object data is // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, isEvents = name === "events"; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { return; } if ( !id ) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { elem[ internalKey ] = id = ++jQuery.uuid; } else { id = internalKey; } } if ( !cache[ id ] ) { cache[ id ] = {}; // Avoids exposing jQuery metadata on plain JS objects when the object // is serialized using JSON.stringify if ( !isNode ) { cache[ id ].toJSON = jQuery.noop; } } // An object can be passed to jQuery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jQuery.extend( cache[ id ], name ); } else { cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } } privateCache = thisCache = cache[ id ]; // jQuery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if ( !pvt ) { if ( !thisCache.data ) { thisCache.data = {}; } thisCache = thisCache.data; } if ( data !== undefined ) { thisCache[ jQuery.camelCase( name ) ] = data; } // Users should not attempt to inspect the internal events object using jQuery.data, // it is undocumented and subject to change. But does anyone listen? No. if ( isEvents && !thisCache[ name ] ) { return privateCache.events; } // Check for both converted-to-camel and non-converted data property names // If a data property was specified if ( getByName ) { // First Try to find as-is property data ret = thisCache[ name ]; // Test for null|undefined property data if ( ret == null ) { // Try to find the camelCased property ret = thisCache[ jQuery.camelCase( name ) ]; } } else { ret = thisCache; } return ret; }, removeData: function( elem, name, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, i, l, // Reference to internal data cache key internalKey = jQuery.expando, isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, // See jQuery.data for more information id = isNode ? elem[ internalKey ] : internalKey; // If there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { thisCache = pvt ? cache[ id ] : cache[ id ].data; if ( thisCache ) { // Support array or space separated string names for data keys if ( !jQuery.isArray( name ) ) { // try the string as a key before any manipulation if ( name in thisCache ) { name = [ name ]; } else { // split the camel cased version by spaces unless a key with the spaces exists name = jQuery.camelCase( name ); if ( name in thisCache ) { name = [ name ]; } else { name = name.split( " " ); } } } for ( i = 0, l = name.length; i < l; i++ ) { delete thisCache[ name[i] ]; } // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { return; } } } // See jQuery.data for more information if ( !pvt ) { delete cache[ id ].data; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !isEmptyDataObject(cache[ id ]) ) { return; } } // Browsers that fail expando deletion also refuse to delete expandos on // the window, but it will allow it on all other JS objects; other browsers // don't care // Ensure that `cache` is not a window object #10080 if ( jQuery.support.deleteExpando || !cache.setInterval ) { delete cache[ id ]; } else { cache[ id ] = null; } // We destroyed the cache and need to eliminate the expando on the node to avoid // false lookups in the cache for entries that no longer exist if ( isNode ) { // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if ( jQuery.support.deleteExpando ) { delete elem[ internalKey ]; } else if ( elem.removeAttribute ) { elem.removeAttribute( internalKey ); } else { elem[ internalKey ] = null; } } }, // For internal use only. _data: function( elem, name, data ) { return jQuery.data( elem, name, data, true ); }, // A method for determining if a DOM node can handle the data expando acceptData: function( elem ) { if ( elem.nodeName ) { var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; if ( match ) { return !(match === true || elem.getAttribute("classid") !== match); } } return true; } }); jQuery.fn.extend({ data: function( key, value ) { var parts, attr, name, data = null; if ( typeof key === "undefined" ) { if ( this.length ) { data = jQuery.data( this[0] ); if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { attr = this[0].attributes; for ( var i = 0, l = attr.length; i < l; i++ ) { name = attr[i].name; if ( name.indexOf( "data-" ) === 0 ) { name = jQuery.camelCase( name.substring(5) ); dataAttr( this[0], name, data[ name ] ); } } jQuery._data( this[0], "parsedAttrs", true ); } } return data; } else if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } parts = key.split("."); parts[1] = parts[1] ? "." + parts[1] : ""; if ( value === undefined ) { data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); // Try to fetch any internally stored data first if ( data === undefined && this.length ) { data = jQuery.data( this[0], key ); data = dataAttr( this[0], key, data ); } return data === undefined && parts[1] ? this.data( parts[0] ) : data; } else { return this.each(function() { var self = jQuery( this ), args = [ parts[0], value ]; self.triggerHandler( "setData" + parts[1] + "!", args ); jQuery.data( this, key, value ); self.triggerHandler( "changeData" + parts[1] + "!", args ); }); } }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); function dataAttr( elem, key, data ) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : jQuery.isNumeric( data ) ? parseFloat( data ) : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} // Make sure we set the data so it isn't changed later jQuery.data( elem, key, data ); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isEmptyDataObject( obj ) { for ( var name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; } function handleQueueMarkDefer( elem, type, src ) { var deferDataKey = type + "defer", queueDataKey = type + "queue", markDataKey = type + "mark", defer = jQuery._data( elem, deferDataKey ); if ( defer && ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { // Give room for hard-coded callbacks to fire first // and eventually mark/queue something else on the element setTimeout( function() { if ( !jQuery._data( elem, queueDataKey ) && !jQuery._data( elem, markDataKey ) ) { jQuery.removeData( elem, deferDataKey, true ); defer.fire(); } }, 0 ); } } jQuery.extend({ _mark: function( elem, type ) { if ( elem ) { type = ( type || "fx" ) + "mark"; jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); } }, _unmark: function( force, elem, type ) { if ( force !== true ) { type = elem; elem = force; force = false; } if ( elem ) { type = type || "fx"; var key = type + "mark", count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); if ( count ) { jQuery._data( elem, key, count ); } else { jQuery.removeData( elem, key, true ); handleQueueMarkDefer( elem, type, "mark" ); } } }, queue: function( elem, type, data ) { var q; if ( elem ) { type = ( type || "fx" ) + "queue"; q = jQuery._data( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !q || jQuery.isArray(data) ) { q = jQuery._data( elem, type, jQuery.makeArray(data) ); } else { q.push( data ); } } return q || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), fn = queue.shift(), hooks = {}; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } jQuery._data( elem, type + ".run", hooks ); fn.call( elem, function() { jQuery.dequeue( elem, type ); }, hooks ); } if ( !queue.length ) { jQuery.removeData( elem, type + "queue " + type + ".run", true ); handleQueueMarkDefer( elem, type, "queue" ); } } }); jQuery.fn.extend({ queue: function( type, data ) { if ( typeof type !== "string" ) { data = type; type = "fx"; } if ( data === undefined ) { return jQuery.queue( this[0], type ); } return this.each(function() { var queue = jQuery.queue( this, type, data ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = setTimeout( next, time ); hooks.stop = function() { clearTimeout( timeout ); }; }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, object ) { if ( typeof type !== "string" ) { object = type; type = undefined; } type = type || "fx"; var defer = jQuery.Deferred(), elements = this, i = elements.length, count = 1, deferDataKey = type + "defer", queueDataKey = type + "queue", markDataKey = type + "mark", tmp; function resolve() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } } while( i-- ) { if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { count++; tmp.add( resolve ); } } resolve(); return defer.promise(); } }); var rclass = /[\n\t\r]/g, rspace = /\s+/, rreturn = /\r/g, rtype = /^(?:button|input)$/i, rfocusable = /^(?:button|input|object|select|textarea)$/i, rclickable = /^a(?:rea)?$/i, rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, getSetAttribute = jQuery.support.getSetAttribute, nodeHook, boolHook, fixSpecified; jQuery.fn.extend({ attr: function( name, value ) { return jQuery.access( this, name, value, true, jQuery.attr ); }, removeAttr: function( name ) { return this.each(function() { jQuery.removeAttr( this, name ); }); }, prop: function( name, value ) { return jQuery.access( this, name, value, true, jQuery.prop ); }, removeProp: function( name ) { name = jQuery.propFix[ name ] || name; return this.each(function() { // try/catch handles cases where IE balks (such as removing a property on window) try { this[ name ] = undefined; delete this[ name ]; } catch( e ) {} }); }, addClass: function( value ) { var classNames, i, l, elem, setClass, c, cl; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).addClass( value.call(this, j, this.className) ); }); } if ( value && typeof value === "string" ) { classNames = value.split( rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodeType === 1 ) { if ( !elem.className && classNames.length === 1 ) { elem.className = value; } else { setClass = " " + elem.className + " "; for ( c = 0, cl = classNames.length; c < cl; c++ ) { if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { setClass += classNames[ c ] + " "; } } elem.className = jQuery.trim( setClass ); } } } } return this; }, removeClass: function( value ) { var classNames, i, l, elem, className, c, cl; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).removeClass( value.call(this, j, this.className) ); }); } if ( (value && typeof value === "string") || value === undefined ) { classNames = ( value || "" ).split( rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodeType === 1 && elem.className ) { if ( value ) { className = (" " + elem.className + " ").replace( rclass, " " ); for ( c = 0, cl = classNames.length; c < cl; c++ ) { className = className.replace(" " + classNames[ c ] + " ", " "); } elem.className = jQuery.trim( className ); } else { elem.className = ""; } } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value, isBool = typeof stateVal === "boolean"; if ( jQuery.isFunction( value ) ) { return this.each(function( i ) { jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var className, i = 0, self = jQuery( this ), state = stateVal, classNames = value.split( rspace ); while ( (className = classNames[ i++ ]) ) { // check each className given, space seperated list state = isBool ? state : !self.hasClass( className ); self[ state ? "addClass" : "removeClass" ]( className ); } } else if ( type === "undefined" || type === "boolean" ) { if ( this.className ) { // store className if set jQuery._data( this, "__className__", this.className ); } // toggle whole className this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; } }); }, hasClass: function( selector ) { var className = " " + selector + " ", i = 0, l = this.length; for ( ; i < l; i++ ) { if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { return true; } } return false; }, val: function( value ) { var hooks, ret, isFunction, elem = this[0]; if ( !arguments.length ) { if ( elem ) { hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? // handle most common string cases ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction( value ); return this.each(function( i ) { var self = jQuery(this), val; if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call( this, i, self.val() ); } else { val = value; } // Treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jQuery.isArray( val ) ) { val = jQuery.map(val, function ( value ) { return value == null ? "" : value + ""; }); } hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; // If set returns undefined, fall back to normal setting if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); } }); jQuery.extend({ valHooks: { option: { get: function( elem ) { // attributes.value is undefined in Blackberry 4.7 but // uses .value. See #6932 var val = elem.attributes.value; return !val || val.specified ? elem.value : elem.text; } }, select: { get: function( elem ) { var value, i, max, option, index = elem.selectedIndex, values = [], options = elem.options, one = elem.type === "select-one"; // Nothing was selected if ( index < 0 ) { return null; } // Loop through all the selected options i = one ? index : 0; max = one ? index + 1 : options.length; for ( ; i < max; i++ ) { option = options[ i ]; // Don't return options that are disabled or in a disabled optgroup if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { // Get the specific value for the option value = jQuery( option ).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } // Fixes Bug #2551 -- select.val() broken in IE after form.reset() if ( one && !values.length && options.length ) { return jQuery( options[ index ] ).val(); } return values; }, set: function( elem, value ) { var values = jQuery.makeArray( value ); jQuery(elem).find("option").each(function() { this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; }); if ( !values.length ) { elem.selectedIndex = -1; } return values; } } }, attrFn: { val: true, css: true, html: true, text: true, data: true, width: true, height: true, offset: true }, attr: function( elem, name, value, pass ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set attributes on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } if ( pass && name in jQuery.attrFn ) { return jQuery( elem )[ name ]( value ); } // Fallback to prop when attributes are not supported if ( typeof elem.getAttribute === "undefined" ) { return jQuery.prop( elem, name, value ); } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); // All attributes are lowercase // Grab necessary hook if one is defined if ( notxml ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); } if ( value !== undefined ) { if ( value === null ) { jQuery.removeAttr( elem, name ); return; } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { elem.setAttribute( name, "" + value ); return value; } } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { ret = elem.getAttribute( name ); // Non-existent attributes return null, we normalize to undefined return ret === null ? undefined : ret; } }, removeAttr: function( elem, value ) { var propName, attrNames, name, l, i = 0; if ( value && elem.nodeType === 1 ) { attrNames = value.toLowerCase().split( rspace ); l = attrNames.length; for ( ; i < l; i++ ) { name = attrNames[ i ]; if ( name ) { propName = jQuery.propFix[ name ] || name; // See #9699 for explanation of this approach (setting first, then removal) jQuery.attr( elem, name, "" ); elem.removeAttribute( getSetAttribute ? name : propName ); // Set corresponding property to false for boolean attributes if ( rboolean.test( name ) && propName in elem ) { elem[ propName ] = false; } } } } }, attrHooks: { type: { set: function( elem, value ) { // We can't allow the type property to be changed (since it causes problems in IE) if ( rtype.test( elem.nodeName ) && elem.parentNode ) { jQuery.error( "type property can't be changed" ); } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { // Setting the type on a radio button after the value resets the value in IE6-9 // Reset value to it's default in case type is set after value // This is for element creation var val = elem.value; elem.setAttribute( "type", value ); if ( val ) { elem.value = val; } return value; } } }, // Use the value property for back compat // Use the nodeHook for button elements in IE6/7 (#1954) value: { get: function( elem, name ) { if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { return nodeHook.get( elem, name ); } return name in elem ? elem.value : null; }, set: function( elem, value, name ) { if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { return nodeHook.set( elem, value, name ); } // Does not return so that setAttribute is also used elem.value = value; } } }, propFix: { tabindex: "tabIndex", readonly: "readOnly", "for": "htmlFor", "class": "className", maxlength: "maxLength", cellspacing: "cellSpacing", cellpadding: "cellPadding", rowspan: "rowSpan", colspan: "colSpan", usemap: "useMap", frameborder: "frameBorder", contenteditable: "contentEditable" }, prop: function( elem, name, value ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set properties on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); if ( notxml ) { // Fix name and attach hooks name = jQuery.propFix[ name ] || name; hooks = jQuery.propHooks[ name ]; } if ( value !== undefined ) { if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { return ( elem[ name ] = value ); } } else { if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { return elem[ name ]; } } }, propHooks: { tabIndex: { get: function( elem ) { // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ var attributeNode = elem.getAttributeNode("tabindex"); return attributeNode && attributeNode.specified ? parseInt( attributeNode.value, 10 ) : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : undefined; } } } }); // Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; // Hook for boolean attributes boolHook = { get: function( elem, name ) { // Align boolean attributes with corresponding properties // Fall back to attribute presence where some booleans are not supported var attrNode, property = jQuery.prop( elem, name ); return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? name.toLowerCase() : undefined; }, set: function( elem, value, name ) { var propName; if ( value === false ) { // Remove boolean attributes when set to false jQuery.removeAttr( elem, name ); } else { // value is true since we know at this point it's type boolean and not false // Set boolean attributes to the same name and set the DOM property propName = jQuery.propFix[ name ] || name; if ( propName in elem ) { // Only set the IDL specifically if it already exists on the element elem[ propName ] = true; } elem.setAttribute( name, name.toLowerCase() ); } return name; } }; // IE6/7 do not support getting/setting some attributes with get/setAttribute if ( !getSetAttribute ) { fixSpecified = { name: true, id: true }; // Use this for any attribute in IE6/7 // This fixes almost every IE6/7 issue nodeHook = jQuery.valHooks.button = { get: function( elem, name ) { var ret; ret = elem.getAttributeNode( name ); return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? ret.nodeValue : undefined; }, set: function( elem, value, name ) { // Set the existing or create a new attribute node var ret = elem.getAttributeNode( name ); if ( !ret ) { ret = document.createAttribute( name ); elem.setAttributeNode( ret ); } return ( ret.nodeValue = value + "" ); } }; // Apply the nodeHook to tabindex jQuery.attrHooks.tabindex.set = nodeHook.set; // Set width and height to auto instead of 0 on empty string( Bug #8150 ) // This is for removals jQuery.each([ "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { set: function( elem, value ) { if ( value === "" ) { elem.setAttribute( name, "auto" ); return value; } } }); }); // Set contenteditable to false on removals(#10429) // Setting to empty string throws an error as an invalid value jQuery.attrHooks.contenteditable = { get: nodeHook.get, set: function( elem, value, name ) { if ( value === "" ) { value = "false"; } nodeHook.set( elem, value, name ); } }; } // Some attributes require a special call on IE if ( !jQuery.support.hrefNormalized ) { jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { get: function( elem ) { var ret = elem.getAttribute( name, 2 ); return ret === null ? undefined : ret; } }); }); } if ( !jQuery.support.style ) { jQuery.attrHooks.style = { get: function( elem ) { // Return undefined in the case of empty string // Normalize to lowercase since IE uppercases css property names return elem.style.cssText.toLowerCase() || undefined; }, set: function( elem, value ) { return ( elem.style.cssText = "" + value ); } }; } // Safari mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if ( !jQuery.support.optSelected ) { jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { get: function( elem ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; // Make sure that it also works with optgroups, see #5701 if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } return null; } }); } // IE6/7 call enctype encoding if ( !jQuery.support.enctype ) { jQuery.propFix.enctype = "encoding"; } // Radios and checkboxes getter/setter if ( !jQuery.support.checkOn ) { jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { get: function( elem ) { // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified return elem.getAttribute("value") === null ? "on" : elem.value; } }; }); } jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { set: function( elem, value ) { if ( jQuery.isArray( value ) ) { return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); } } }); }); var rformElems = /^(?:textarea|input|select)$/i, rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, rhoverHack = /\bhover(\.\S+)?\b/, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, quickParse = function( selector ) { var quick = rquickIs.exec( selector ); if ( quick ) { // 0 1 2 3 // [ _, tag, id, class ] quick[1] = ( quick[1] || "" ).toLowerCase(); quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); } return quick; }, quickIs = function( elem, m ) { var attrs = elem.attributes || {}; return ( (!m[1] || elem.nodeName.toLowerCase() === m[1]) && (!m[2] || (attrs.id || {}).value === m[2]) && (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) ); }, hoverHack = function( events ) { return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); }; /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { add: function( elem, types, handler, data, selector ) { var elemData, eventHandle, events, t, tns, type, namespaces, handleObj, handleObjIn, quick, handlers, special; // Don't attach events to noData or text/comment nodes (allow plain objects tho) if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first events = elemData.events; if ( !events ) { elemData.events = events = {}; } eventHandle = elemData.handle; if ( !eventHandle ) { elemData.handle = eventHandle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events eventHandle.elem = elem; } // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); types = jQuery.trim( hoverHack(types) ).split( " " ); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = tns[1]; namespaces = ( tns[2] || "" ).split( "." ).sort(); // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, origType: tns[1], data: data, handler: handler, guid: handler.guid, selector: selector, quick: quickParse( selector ), namespace: namespaces.join(".") }, handleObjIn ); // Init the event handler queue if we're the first handlers = events[ type ]; if ( !handlers ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, global: {}, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), t, tns, type, origType, namespaces, origCount, j, events, special, handle, eventType, handleObj; if ( !elemData || !(events = elemData.events) ) { return; } // Once for each type.namespace in types; type may be omitted types = jQuery.trim( hoverHack( types || "" ) ).split(" "); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = origType = tns[1]; namespaces = tns[2]; // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector? special.delegateType : special.bindType ) || type; eventType = events[ type ] || []; origCount = eventType.length; namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; // Remove matching events for ( j = 0; j < eventType.length; j++ ) { handleObj = eventType[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !namespaces || namespaces.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { eventType.splice( j--, 1 ); if ( handleObj.selector ) { eventType.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( eventType.length === 0 && origCount !== eventType.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { handle = elemData.handle; if ( handle ) { handle.elem = null; } // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete jQuery.removeData( elem, [ "events", "handle" ], true ); } }, // Events that are safe to short-circuit if no handlers are attached. // Native DOM events should not be added, they may have inline handlers. customEvent: { "getData": true, "setData": true, "changeData": true }, trigger: function( event, data, elem, onlyHandlers ) { // Don't do events on text and comment nodes if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { return; } // Event object or event type var type = event.type || event, namespaces = [], cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf( "!" ) >= 0 ) { // Exclusive events trigger only for the exact event (no namespaces) type = type.slice(0, -1); exclusive = true; } if ( type.indexOf( "." ) >= 0 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { // No jQuery handlers for this event type, and it can't have inline handlers return; } // Caller can pass in an Event, Object, or just an event type string event = typeof event === "object" ? // jQuery.Event object event[ jQuery.expando ] ? event : // Object literal new jQuery.Event( type, event ) : // Just the event type (string) new jQuery.Event( type ); event.type = type; event.isTrigger = true; event.exclusive = exclusive; event.namespace = namespaces.join( "." ); event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; // Handle a global trigger if ( !elem ) { // TODO: Stop taunting the data cache; remove global events and always attach to document cache = jQuery.cache; for ( i in cache ) { if ( cache[ i ].events && cache[ i ].events[ type ] ) { jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); } } return; } // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data != null ? jQuery.makeArray( data ) : []; data.unshift( event ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) eventPath = [[ elem, special.bindType || type ]]; if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; old = null; for ( ; cur; cur = cur.parentNode ) { eventPath.push([ cur, bubbleType ]); old = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( old && old === elem.ownerDocument ) { eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); } } // Fire handlers on the event path for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { cur = eventPath[i][0]; event.type = eventPath[i][1]; handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Note that this is a bare JS function and not a jQuery handler handle = ontype && cur[ ontype ]; if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { event.preventDefault(); } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) // IE<9 dies on focus/blur to hidden element (#1486) if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method old = elem[ ontype ]; if ( old ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; elem[ type ](); jQuery.event.triggered = undefined; if ( old ) { elem[ ontype ] = old; } } } } return event.result; }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event || window.event ); var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), delegateCount = handlers.delegateCount, args = [].slice.call( arguments, 0 ), run_all = !event.exclusive && !event.namespace, handlerQueue = [], i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; event.delegateTarget = this; // Determine handlers that should run if there are delegated events // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { // Pregenerate a single jQuery object for reuse with .is() jqcur = jQuery(this); jqcur.context = this.ownerDocument || this; for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { selMatch = {}; matches = []; jqcur[0] = cur; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; sel = handleObj.selector; if ( selMatch[ sel ] === undefined ) { selMatch[ sel ] = ( handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) ); } if ( selMatch[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, matches: matches }); } } } // Add the remaining (directly-bound) handlers if ( handlers.length > delegateCount ) { handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); } // Run delegates first; they may want to stop propagation beneath us for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { matched = handlerQueue[ i ]; event.currentTarget = matched.elem; for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { handleObj = matched.matches[ j ]; // Triggered event must either 1) be non-exclusive and have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { event.data = handleObj.data; event.handleObj = handleObj; ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { event.result = ret; if ( ret === false ) { event.preventDefault(); event.stopPropagation(); } } } } } return event.result; }, // Includes some event props shared by KeyEvent and MouseEvent // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { var eventDoc, doc, body, button = original.button, fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add relatedTarget, if necessary if ( !event.relatedTarget && fromElement ) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, originalEvent = event, fixHook = jQuery.event.fixHooks[ event.type ] || {}, copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = jQuery.Event( originalEvent ); for ( i = copy.length; i; ) { prop = copy[ --i ]; event[ prop ] = originalEvent[ prop ]; } // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) if ( !event.target ) { event.target = originalEvent.srcElement || document; } // Target should not be a text node (#504, Safari) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) if ( event.metaKey === undefined ) { event.metaKey = event.ctrlKey; } return fixHook.filter? fixHook.filter( event, originalEvent ) : event; }, special: { ready: { // Make sure the ready event is setup setup: jQuery.bindReady }, load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { delegateType: "focusin" }, blur: { delegateType: "focusout" }, beforeunload: { setup: function( data, namespaces, eventHandle ) { // We only want to do this special case on windows if ( jQuery.isWindow( this ) ) { this.onbeforeunload = eventHandle; } }, teardown: function( namespaces, eventHandle ) { if ( this.onbeforeunload === eventHandle ) { this.onbeforeunload = null; } } } }, simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.dispatch.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; // Some plugins are using, but it's undocumented/deprecated and will be removed. // The 1.7 special event interface should provide all the hooks needed now. jQuery.event.handle = jQuery.event.dispatch; jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } } : function( elem, type, handle ) { if ( elem.detachEvent ) { elem.detachEvent( "on" + type, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !(this instanceof jQuery.Event) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; function returnFalse() { return false; } function returnTrue() { return true; } // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { preventDefault: function() { this.isDefaultPrevented = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if preventDefault exists run it on the original event if ( e.preventDefault ) { e.preventDefault(); // otherwise set the returnValue property of the original event to false (IE) } else { e.returnValue = false; } }, stopPropagation: function() { this.isPropagationStopped = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if stopPropagation exists run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // otherwise set the cancelBubble property of the original event to true (IE) e.cancelBubble = true; }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); }, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse }; // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var target = this, related = event.relatedTarget, handleObj = event.handleObj, selector = handleObj.selector, ret; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || (related !== target && !jQuery.contains( target, related )) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); // IE submit delegation if ( !jQuery.support.submitBubbles ) { jQuery.event.special.submit = { setup: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Lazy-add a submit handler when a descendant form may potentially be submitted jQuery.event.add( this, "click._submit keypress._submit", function( e ) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; if ( form && !form._submit_attached ) { jQuery.event.add( form, "submit._submit", function( event ) { // If form was submitted by the user, bubble the event up the tree if ( this.parentNode && !event.isTrigger ) { jQuery.event.simulate( "submit", this.parentNode, event, true ); } }); form._submit_attached = true; } }); // return undefined since we don't need an event listener }, teardown: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Remove delegated handlers; cleanData eventually reaps submit handlers attached above jQuery.event.remove( this, "._submit" ); } }; } // IE change delegation and checkbox/radio fix if ( !jQuery.support.changeBubbles ) { jQuery.event.special.change = { setup: function() { if ( rformElems.test( this.nodeName ) ) { // IE doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. Eat the blur-change in special.change.handle. // This still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jQuery.event.add( this, "propertychange._change", function( event ) { if ( event.originalEvent.propertyName === "checked" ) { this._just_changed = true; } }); jQuery.event.add( this, "click._change", function( event ) { if ( this._just_changed && !event.isTrigger ) { this._just_changed = false; jQuery.event.simulate( "change", this, event, true ); } }); } return false; } // Delegated event; lazy-add a change handler on descendant inputs jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { jQuery.event.simulate( "change", this.parentNode, event, true ); } }); elem._change_attached = true; } }); }, handle: function( event ) { var elem = event.target; // Swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleObj.handler.apply( this, arguments ); } }, teardown: function() { jQuery.event.remove( this, "._change" ); return rformElems.test( this.nodeName ); } }; } // Create "bubbling" focus and blur events if ( !jQuery.support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler while someone wants focusin/focusout var attaches = 0, handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { if ( attaches++ === 0 ) { document.addEventListener( orig, handler, true ); } }, teardown: function() { if ( --attaches === 0 ) { document.removeEventListener( orig, handler, true ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var origFn, type; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // ( types-Object, data ) data = selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on.call( this, types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event var handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( var type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each(function() { jQuery.event.remove( this, types, fn, selector ); }); }, bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, live: function( types, data, fn ) { jQuery( this.context ).on( types, this.selector, data, fn ); return this; }, die: function( types, fn ) { jQuery( this.context ).off( types, this.selector || "**", fn ); return this; }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { if ( this[0] ) { return jQuery.event.trigger( type, data, this[0], true ); } }, toggle: function( fn ) { // Save reference to arguments for access in closure var args = arguments, guid = fn.guid || jQuery.guid++, i = 0, toggler = function( event ) { // Figure out which function to execute var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); // Make sure that clicks stop event.preventDefault(); // and execute the function return args[ lastToggle ].apply( this, arguments ) || false; }; // link all the functions, so any of them can unbind this click handler toggler.guid = guid; while ( i < args.length ) { args[ i++ ].guid = guid; } return this.click( toggler ); }, hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); } }); jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { // Handle event binding jQuery.fn[ name ] = function( data, fn ) { if ( fn == null ) { fn = data; data = null; } return arguments.length > 0 ? this.on( name, null, data, fn ) : this.trigger( name ); }; if ( jQuery.attrFn ) { jQuery.attrFn[ name ] = true; } if ( rkeyEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; } if ( rmouseEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; } }); /*! * Sizzle CSS Selector Engine * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, expando = "sizcache" + (Math.random() + '').replace('.', ''), done = 0, toString = Object.prototype.toString, hasDuplicate = false, baseHasDuplicate = true, rBackslash = /\\/g, rReturn = /\r\n/g, rNonWord = /\W/; // Here we check if the JavaScript engine is using some sort of // optimization where it does not always call our comparision // function. If that is the case, discard the hasDuplicate value. // Thus far that includes Google Chrome. [0, 0].sort(function() { baseHasDuplicate = false; return 0; }); var Sizzle = function( selector, context, results, seed ) { results = results || []; context = context || document; var origContext = context; if ( context.nodeType !== 1 && context.nodeType !== 9 ) { return []; } if ( !selector || typeof selector !== "string" ) { return results; } var m, set, checkSet, extra, ret, cur, pop, i, prune = true, contextXML = Sizzle.isXML( context ), parts = [], soFar = selector; // Reset the position of the chunker regexp (start from head) do { chunker.exec( "" ); m = chunker.exec( soFar ); if ( m ) { soFar = m[3]; parts.push( m[1] ); if ( m[2] ) { extra = m[3]; break; } } } while ( m ); if ( parts.length > 1 && origPOS.exec( selector ) ) { if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { set = posProcess( parts[0] + parts[1], context, seed ); } else { set = Expr.relative[ parts[0] ] ? [ context ] : Sizzle( parts.shift(), context ); while ( parts.length ) { selector = parts.shift(); if ( Expr.relative[ selector ] ) { selector += parts.shift(); } set = posProcess( selector, set, seed ); } } } else { // Take a shortcut and set the context if the root selector is an ID // (but not if it'll be faster if the inner selector is an ID) if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { ret = Sizzle.find( parts.shift(), context, contextXML ); context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; } if ( context ) { ret = seed ? { expr: parts.pop(), set: makeArray(seed) } : Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; if ( parts.length > 0 ) { checkSet = makeArray( set ); } else { prune = false; } while ( parts.length ) { cur = parts.pop(); pop = cur; if ( !Expr.relative[ cur ] ) { cur = ""; } else { pop = parts.pop(); } if ( pop == null ) { pop = context; } Expr.relative[ cur ]( checkSet, pop, contextXML ); } } else { checkSet = parts = []; } } if ( !checkSet ) { checkSet = set; } if ( !checkSet ) { Sizzle.error( cur || selector ); } if ( toString.call(checkSet) === "[object Array]" ) { if ( !prune ) { results.push.apply( results, checkSet ); } else if ( context && context.nodeType === 1 ) { for ( i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { results.push( set[i] ); } } } else { for ( i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && checkSet[i].nodeType === 1 ) { results.push( set[i] ); } } } } else { makeArray( checkSet, results ); } if ( extra ) { Sizzle( extra, origContext, results, seed ); Sizzle.uniqueSort( results ); } return results; }; Sizzle.uniqueSort = function( results ) { if ( sortOrder ) { hasDuplicate = baseHasDuplicate; results.sort( sortOrder ); if ( hasDuplicate ) { for ( var i = 1; i < results.length; i++ ) { if ( results[i] === results[ i - 1 ] ) { results.splice( i--, 1 ); } } } } return results; }; Sizzle.matches = function( expr, set ) { return Sizzle( expr, null, null, set ); }; Sizzle.matchesSelector = function( node, expr ) { return Sizzle( expr, null, null, [node] ).length > 0; }; Sizzle.find = function( expr, context, isXML ) { var set, i, len, match, type, left; if ( !expr ) { return []; } for ( i = 0, len = Expr.order.length; i < len; i++ ) { type = Expr.order[i]; if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { left = match[1]; match.splice( 1, 1 ); if ( left.substr( left.length - 1 ) !== "\\" ) { match[1] = (match[1] || "").replace( rBackslash, "" ); set = Expr.find[ type ]( match, context, isXML ); if ( set != null ) { expr = expr.replace( Expr.match[ type ], "" ); break; } } } } if ( !set ) { set = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( "*" ) : []; } return { set: set, expr: expr }; }; Sizzle.filter = function( expr, set, inplace, not ) { var match, anyFound, type, found, item, filter, left, i, pass, old = expr, result = [], curLoop = set, isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); while ( expr && set.length ) { for ( type in Expr.filter ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { filter = Expr.filter[ type ]; left = match[1]; anyFound = false; match.splice(1,1); if ( left.substr( left.length - 1 ) === "\\" ) { continue; } if ( curLoop === result ) { result = []; } if ( Expr.preFilter[ type ] ) { match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); if ( !match ) { anyFound = found = true; } else if ( match === true ) { continue; } } if ( match ) { for ( i = 0; (item = curLoop[i]) != null; i++ ) { if ( item ) { found = filter( item, match, i, curLoop ); pass = not ^ found; if ( inplace && found != null ) { if ( pass ) { anyFound = true; } else { curLoop[i] = false; } } else if ( pass ) { result.push( item ); anyFound = true; } } } } if ( found !== undefined ) { if ( !inplace ) { curLoop = result; } expr = expr.replace( Expr.match[ type ], "" ); if ( !anyFound ) { return []; } break; } } } // Improper expression if ( expr === old ) { if ( anyFound == null ) { Sizzle.error( expr ); } else { break; } } old = expr; } return curLoop; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; /** * Utility function for retreiving the text value of an array of DOM nodes * @param {Array|Element} elem */ var getText = Sizzle.getText = function( elem ) { var i, node, nodeType = elem.nodeType, ret = ""; if ( nodeType ) { if ( nodeType === 1 || nodeType === 9 ) { // Use textContent || innerText for elements if ( typeof elem.textContent === 'string' ) { return elem.textContent; } else if ( typeof elem.innerText === 'string' ) { // Replace IE's carriage returns return elem.innerText.replace( rReturn, '' ); } else { // Traverse it's children for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } } else { // If no nodeType, this is expected to be an array for ( i = 0; (node = elem[i]); i++ ) { // Do not traverse comment nodes if ( node.nodeType !== 8 ) { ret += getText( node ); } } } return ret; }; var Expr = Sizzle.selectors = { order: [ "ID", "NAME", "TAG" ], match: { ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ }, leftMatch: {}, attrMap: { "class": "className", "for": "htmlFor" }, attrHandle: { href: function( elem ) { return elem.getAttribute( "href" ); }, type: function( elem ) { return elem.getAttribute( "type" ); } }, relative: { "+": function(checkSet, part){ var isPartStr = typeof part === "string", isTag = isPartStr && !rNonWord.test( part ), isPartStrNotTag = isPartStr && !isTag; if ( isTag ) { part = part.toLowerCase(); } for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { if ( (elem = checkSet[i]) ) { while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? elem || false : elem === part; } } if ( isPartStrNotTag ) { Sizzle.filter( part, checkSet, true ); } }, ">": function( checkSet, part ) { var elem, isPartStr = typeof part === "string", i = 0, l = checkSet.length; if ( isPartStr && !rNonWord.test( part ) ) { part = part.toLowerCase(); for ( ; i < l; i++ ) { elem = checkSet[i]; if ( elem ) { var parent = elem.parentNode; checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; } } } else { for ( ; i < l; i++ ) { elem = checkSet[i]; if ( elem ) { checkSet[i] = isPartStr ? elem.parentNode : elem.parentNode === part; } } if ( isPartStr ) { Sizzle.filter( part, checkSet, true ); } } }, "": function(checkSet, part, isXML){ var nodeCheck, doneName = done++, checkFn = dirCheck; if ( typeof part === "string" && !rNonWord.test( part ) ) { part = part.toLowerCase(); nodeCheck = part; checkFn = dirNodeCheck; } checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); }, "~": function( checkSet, part, isXML ) { var nodeCheck, doneName = done++, checkFn = dirCheck; if ( typeof part === "string" && !rNonWord.test( part ) ) { part = part.toLowerCase(); nodeCheck = part; checkFn = dirNodeCheck; } checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); } }, find: { ID: function( match, context, isXML ) { if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [m] : []; } }, NAME: function( match, context ) { if ( typeof context.getElementsByName !== "undefined" ) { var ret = [], results = context.getElementsByName( match[1] ); for ( var i = 0, l = results.length; i < l; i++ ) { if ( results[i].getAttribute("name") === match[1] ) { ret.push( results[i] ); } } return ret.length === 0 ? null : ret; } }, TAG: function( match, context ) { if ( typeof context.getElementsByTagName !== "undefined" ) { return context.getElementsByTagName( match[1] ); } } }, preFilter: { CLASS: function( match, curLoop, inplace, result, not, isXML ) { match = " " + match[1].replace( rBackslash, "" ) + " "; if ( isXML ) { return match; } for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { if ( elem ) { if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { if ( !inplace ) { result.push( elem ); } } else if ( inplace ) { curLoop[i] = false; } } } return false; }, ID: function( match ) { return match[1].replace( rBackslash, "" ); }, TAG: function( match, curLoop ) { return match[1].replace( rBackslash, "" ).toLowerCase(); }, CHILD: function( match ) { if ( match[1] === "nth" ) { if ( !match[2] ) { Sizzle.error( match[0] ); } match[2] = match[2].replace(/^\+|\s*/g, ''); // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); // calculate the numbers (first)n+(last) including if they are negative match[2] = (test[1] + (test[2] || 1)) - 0; match[3] = test[3] - 0; } else if ( match[2] ) { Sizzle.error( match[0] ); } // TODO: Move to normal caching system match[0] = done++; return match; }, ATTR: function( match, curLoop, inplace, result, not, isXML ) { var name = match[1] = match[1].replace( rBackslash, "" ); if ( !isXML && Expr.attrMap[name] ) { match[1] = Expr.attrMap[name]; } // Handle if an un-quoted value was used match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); if ( match[2] === "~=" ) { match[4] = " " + match[4] + " "; } return match; }, PSEUDO: function( match, curLoop, inplace, result, not ) { if ( match[1] === "not" ) { // If we're dealing with a complex expression, or a simple one if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { match[3] = Sizzle(match[3], null, null, curLoop); } else { var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); if ( !inplace ) { result.push.apply( result, ret ); } return false; } } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { return true; } return match; }, POS: function( match ) { match.unshift( true ); return match; } }, filters: { enabled: function( elem ) { return elem.disabled === false && elem.type !== "hidden"; }, disabled: function( elem ) { return elem.disabled === true; }, checked: function( elem ) { return elem.checked === true; }, selected: function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, parent: function( elem ) { return !!elem.firstChild; }, empty: function( elem ) { return !elem.firstChild; }, has: function( elem, i, match ) { return !!Sizzle( match[3], elem ).length; }, header: function( elem ) { return (/h\d/i).test( elem.nodeName ); }, text: function( elem ) { var attr = elem.getAttribute( "type" ), type = elem.type; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); }, radio: function( elem ) { return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; }, checkbox: function( elem ) { return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; }, file: function( elem ) { return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; }, password: function( elem ) { return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; }, submit: function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && "submit" === elem.type; }, image: function( elem ) { return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; }, reset: function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && "reset" === elem.type; }, button: function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && "button" === elem.type || name === "button"; }, input: function( elem ) { return (/input|select|textarea|button/i).test( elem.nodeName ); }, focus: function( elem ) { return elem === elem.ownerDocument.activeElement; } }, setFilters: { first: function( elem, i ) { return i === 0; }, last: function( elem, i, match, array ) { return i === array.length - 1; }, even: function( elem, i ) { return i % 2 === 0; }, odd: function( elem, i ) { return i % 2 === 1; }, lt: function( elem, i, match ) { return i < match[3] - 0; }, gt: function( elem, i, match ) { return i > match[3] - 0; }, nth: function( elem, i, match ) { return match[3] - 0 === i; }, eq: function( elem, i, match ) { return match[3] - 0 === i; } }, filter: { PSEUDO: function( elem, match, i, array ) { var name = match[1], filter = Expr.filters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } else if ( name === "contains" ) { return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; } else if ( name === "not" ) { var not = match[3]; for ( var j = 0, l = not.length; j < l; j++ ) { if ( not[j] === elem ) { return false; } } return true; } else { Sizzle.error( name ); } }, CHILD: function( elem, match ) { var first, last, doneName, parent, cache, count, diff, type = match[1], node = elem; switch ( type ) { case "only": case "first": while ( (node = node.previousSibling) ) { if ( node.nodeType === 1 ) { return false; } } if ( type === "first" ) { return true; } node = elem; case "last": while ( (node = node.nextSibling) ) { if ( node.nodeType === 1 ) { return false; } } return true; case "nth": first = match[2]; last = match[3]; if ( first === 1 && last === 0 ) { return true; } doneName = match[0]; parent = elem.parentNode; if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { count = 0; for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { node.nodeIndex = ++count; } } parent[ expando ] = doneName; } diff = elem.nodeIndex - last; if ( first === 0 ) { return diff === 0; } else { return ( diff % first === 0 && diff / first >= 0 ); } } }, ID: function( elem, match ) { return elem.nodeType === 1 && elem.getAttribute("id") === match; }, TAG: function( elem, match ) { return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; }, CLASS: function( elem, match ) { return (" " + (elem.className || elem.getAttribute("class")) + " ") .indexOf( match ) > -1; }, ATTR: function( elem, match ) { var name = match[1], result = Sizzle.attr ? Sizzle.attr( elem, name ) : Expr.attrHandle[ name ] ? Expr.attrHandle[ name ]( elem ) : elem[ name ] != null ? elem[ name ] : elem.getAttribute( name ), value = result + "", type = match[2], check = match[4]; return result == null ? type === "!=" : !type && Sizzle.attr ? result != null : type === "=" ? value === check : type === "*=" ? value.indexOf(check) >= 0 : type === "~=" ? (" " + value + " ").indexOf(check) >= 0 : !check ? value && result !== false : type === "!=" ? value !== check : type === "^=" ? value.indexOf(check) === 0 : type === "$=" ? value.substr(value.length - check.length) === check : type === "|=" ? value === check || value.substr(0, check.length + 1) === check + "-" : false; }, POS: function( elem, match, i, array ) { var name = match[2], filter = Expr.setFilters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } } } }; var origPOS = Expr.match.POS, fescape = function(all, num){ return "\\" + (num - 0 + 1); }; for ( var type in Expr.match ) { Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); } var makeArray = function( array, results ) { array = Array.prototype.slice.call( array, 0 ); if ( results ) { results.push.apply( results, array ); return results; } return array; }; // Perform a simple check to determine if the browser is capable of // converting a NodeList to an array using builtin methods. // Also verifies that the returned array holds DOM nodes // (which is not the case in the Blackberry browser) try { Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; // Provide a fallback method if it does not work } catch( e ) { makeArray = function( array, results ) { var i = 0, ret = results || []; if ( toString.call(array) === "[object Array]" ) { Array.prototype.push.apply( ret, array ); } else { if ( typeof array.length === "number" ) { for ( var l = array.length; i < l; i++ ) { ret.push( array[i] ); } } else { for ( ; array[i]; i++ ) { ret.push( array[i] ); } } } return ret; }; } var sortOrder, siblingCheck; if ( document.documentElement.compareDocumentPosition ) { sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; return 0; } if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { return a.compareDocumentPosition ? -1 : 1; } return a.compareDocumentPosition(b) & 4 ? -1 : 1; }; } else { sortOrder = function( a, b ) { // The nodes are identical, we can exit early if ( a === b ) { hasDuplicate = true; return 0; // Fallback to using sourceIndex (in IE) if it's available on both nodes } else if ( a.sourceIndex && b.sourceIndex ) { return a.sourceIndex - b.sourceIndex; } var al, bl, ap = [], bp = [], aup = a.parentNode, bup = b.parentNode, cur = aup; // If the nodes are siblings (or identical) we can do a quick check if ( aup === bup ) { return siblingCheck( a, b ); // If no parents were found then the nodes are disconnected } else if ( !aup ) { return -1; } else if ( !bup ) { return 1; } // Otherwise they're somewhere else in the tree so we need // to build up a full list of the parentNodes for comparison while ( cur ) { ap.unshift( cur ); cur = cur.parentNode; } cur = bup; while ( cur ) { bp.unshift( cur ); cur = cur.parentNode; } al = ap.length; bl = bp.length; // Start walking down the tree looking for a discrepancy for ( var i = 0; i < al && i < bl; i++ ) { if ( ap[i] !== bp[i] ) { return siblingCheck( ap[i], bp[i] ); } } // We ended someplace up the tree so do a sibling check return i === al ? siblingCheck( a, bp[i], -1 ) : siblingCheck( ap[i], b, 1 ); }; siblingCheck = function( a, b, ret ) { if ( a === b ) { return ret; } var cur = a.nextSibling; while ( cur ) { if ( cur === b ) { return -1; } cur = cur.nextSibling; } return 1; }; } // Check to see if the browser returns elements by name when // querying by getElementById (and provide a workaround) (function(){ // We're going to inject a fake input element with a specified name var form = document.createElement("div"), id = "script" + (new Date()).getTime(), root = document.documentElement; form.innerHTML = ""; // Inject it into the root element, check its status, and remove it quickly root.insertBefore( form, root.firstChild ); // The workaround has to do additional checks after a getElementById // Which slows things down for other browsers (hence the branching) if ( document.getElementById( id ) ) { Expr.find.ID = function( match, context, isXML ) { if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; } }; Expr.filter.ID = function( elem, match ) { var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return elem.nodeType === 1 && node && node.nodeValue === match; }; } root.removeChild( form ); // release memory in IE root = form = null; })(); (function(){ // Check to see if the browser returns only elements // when doing getElementsByTagName("*") // Create a fake element var div = document.createElement("div"); div.appendChild( document.createComment("") ); // Make sure no comments are found if ( div.getElementsByTagName("*").length > 0 ) { Expr.find.TAG = function( match, context ) { var results = context.getElementsByTagName( match[1] ); // Filter out possible comments if ( match[1] === "*" ) { var tmp = []; for ( var i = 0; results[i]; i++ ) { if ( results[i].nodeType === 1 ) { tmp.push( results[i] ); } } results = tmp; } return results; }; } // Check to see if an attribute returns normalized href attributes div.innerHTML = ""; if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && div.firstChild.getAttribute("href") !== "#" ) { Expr.attrHandle.href = function( elem ) { return elem.getAttribute( "href", 2 ); }; } // release memory in IE div = null; })(); if ( document.querySelectorAll ) { (function(){ var oldSizzle = Sizzle, div = document.createElement("div"), id = "__sizzle__"; div.innerHTML = "

"; // Safari can't handle uppercase or unicode characters when // in quirks mode. if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { return; } Sizzle = function( query, context, extra, seed ) { context = context || document; // Only use querySelectorAll on non-XML documents // (ID selectors don't work in non-HTML documents) if ( !seed && !Sizzle.isXML(context) ) { // See if we find a selector to speed up var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { // Speed-up: Sizzle("TAG") if ( match[1] ) { return makeArray( context.getElementsByTagName( query ), extra ); // Speed-up: Sizzle(".CLASS") } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { return makeArray( context.getElementsByClassName( match[2] ), extra ); } } if ( context.nodeType === 9 ) { // Speed-up: Sizzle("body") // The body element only exists once, optimize finding it if ( query === "body" && context.body ) { return makeArray( [ context.body ], extra ); // Speed-up: Sizzle("#ID") } else if ( match && match[3] ) { var elem = context.getElementById( match[3] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id === match[3] ) { return makeArray( [ elem ], extra ); } } else { return makeArray( [], extra ); } } try { return makeArray( context.querySelectorAll(query), extra ); } catch(qsaError) {} // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { var oldContext = context, old = context.getAttribute( "id" ), nid = old || id, hasParent = context.parentNode, relativeHierarchySelector = /^\s*[+~]/.test( query ); if ( !old ) { context.setAttribute( "id", nid ); } else { nid = nid.replace( /'/g, "\\$&" ); } if ( relativeHierarchySelector && hasParent ) { context = context.parentNode; } try { if ( !relativeHierarchySelector || hasParent ) { return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); } } catch(pseudoError) { } finally { if ( !old ) { oldContext.removeAttribute( "id" ); } } } } return oldSizzle(query, context, extra, seed); }; for ( var prop in oldSizzle ) { Sizzle[ prop ] = oldSizzle[ prop ]; } // release memory in IE div = null; })(); } (function(){ var html = document.documentElement, matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; if ( matches ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9 fails this) var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), pseudoWorks = false; try { // This should fail with an exception // Gecko does not error, returns false instead matches.call( document.documentElement, "[test!='']:sizzle" ); } catch( pseudoError ) { pseudoWorks = true; } Sizzle.matchesSelector = function( node, expr ) { // Make sure that attribute selectors are quoted expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); if ( !Sizzle.isXML( node ) ) { try { if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { var ret = matches.call( node, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || !disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9, so check for that node.document && node.document.nodeType !== 11 ) { return ret; } } } catch(e) {} } return Sizzle(expr, null, null, [node]).length > 0; }; } })(); (function(){ var div = document.createElement("div"); div.innerHTML = "
"; // Opera can't find a second classname (in 9.6) // Also, make sure that getElementsByClassName actually exists if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { return; } // Safari caches class attributes, doesn't catch changes (in 3.2) div.lastChild.className = "e"; if ( div.getElementsByClassName("e").length === 1 ) { return; } Expr.order.splice(1, 0, "CLASS"); Expr.find.CLASS = function( match, context, isXML ) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { return context.getElementsByClassName(match[1]); } }; // release memory in IE div = null; })(); function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { var match = false; elem = elem[dir]; while ( elem ) { if ( elem[ expando ] === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 && !isXML ){ elem[ expando ] = doneName; elem.sizset = i; } if ( elem.nodeName.toLowerCase() === cur ) { match = elem; break; } elem = elem[dir]; } checkSet[i] = match; } } } function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { var match = false; elem = elem[dir]; while ( elem ) { if ( elem[ expando ] === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 ) { if ( !isXML ) { elem[ expando ] = doneName; elem.sizset = i; } if ( typeof cur !== "string" ) { if ( elem === cur ) { match = true; break; } } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { match = elem; break; } } elem = elem[dir]; } checkSet[i] = match; } } } if ( document.documentElement.contains ) { Sizzle.contains = function( a, b ) { return a !== b && (a.contains ? a.contains(b) : true); }; } else if ( document.documentElement.compareDocumentPosition ) { Sizzle.contains = function( a, b ) { return !!(a.compareDocumentPosition(b) & 16); }; } else { Sizzle.contains = function() { return false; }; } Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; var posProcess = function( selector, context, seed ) { var match, tmpSet = [], later = "", root = context.nodeType ? [context] : context; // Position selectors must be done after the filter // And so must :not(positional) so we move all PSEUDOs to the end while ( (match = Expr.match.PSEUDO.exec( selector )) ) { later += match[0]; selector = selector.replace( Expr.match.PSEUDO, "" ); } selector = Expr.relative[selector] ? selector + "*" : selector; for ( var i = 0, l = root.length; i < l; i++ ) { Sizzle( selector, root[i], tmpSet, seed ); } return Sizzle.filter( later, tmpSet ); }; // EXPOSE // Override sizzle attribute retrieval Sizzle.attr = jQuery.attr; Sizzle.selectors.attrMap = {}; jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.filters; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; })(); var runtil = /Until$/, rparentsprev = /^(?:parents|prevUntil|prevAll)/, // Note: This RegExp should be improved, or likely pulled from Sizzle rmultiselector = /,/, isSimple = /^.[^:#\[\.,]*$/, slice = Array.prototype.slice, POS = jQuery.expr.match.POS, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend({ find: function( selector ) { var self = this, i, l; if ( typeof selector !== "string" ) { return jQuery( selector ).filter(function() { for ( i = 0, l = self.length; i < l; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } }); } var ret = this.pushStack( "", "find", selector ), length, n, r; for ( i = 0, l = this.length; i < l; i++ ) { length = ret.length; jQuery.find( selector, this[i], ret ); if ( i > 0 ) { // Make sure that the results are unique for ( n = length; n < ret.length; n++ ) { for ( r = 0; r < length; r++ ) { if ( ret[r] === ret[n] ) { ret.splice(n--, 1); break; } } } } } return ret; }, has: function( target ) { var targets = jQuery( target ); return this.filter(function() { for ( var i = 0, l = targets.length; i < l; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, not: function( selector ) { return this.pushStack( winnow(this, selector, false), "not", selector); }, filter: function( selector ) { return this.pushStack( winnow(this, selector, true), "filter", selector ); }, is: function( selector ) { return !!selector && ( typeof selector === "string" ? // If this is a positional selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". POS.test( selector ) ? jQuery( selector, this.context ).index( this[0] ) >= 0 : jQuery.filter( selector, this ).length > 0 : this.filter( selector ).length > 0 ); }, closest: function( selectors, context ) { var ret = [], i, l, cur = this[0]; // Array (deprecated as of jQuery 1.7) if ( jQuery.isArray( selectors ) ) { var level = 1; while ( cur && cur.ownerDocument && cur !== context ) { for ( i = 0; i < selectors.length; i++ ) { if ( jQuery( cur ).is( selectors[ i ] ) ) { ret.push({ selector: selectors[ i ], elem: cur, level: level }); } } cur = cur.parentNode; level++; } return ret; } // String var pos = POS.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( i = 0, l = this.length; i < l; i++ ) { cur = this[i]; while ( cur ) { if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { ret.push( cur ); break; } else { cur = cur.parentNode; if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { break; } } } } ret = ret.length > 1 ? jQuery.unique( ret ) : ret; return this.pushStack( ret, "closest", selectors ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; } // index in selector if ( typeof elem === "string" ) { return jQuery.inArray( this[0], jQuery( elem ) ); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { var set = typeof selector === "string" ? jQuery( selector, context ) : jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), all = jQuery.merge( this.get(), set ); return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? all : jQuery.unique( all ) ); }, andSelf: function() { return this.add( this.prevObject ); } }); // A painfully simple check to see if an element is disconnected // from a document (should be improved, where feasible). function isDisconnected( node ) { return !node || !node.parentNode || node.parentNode.nodeType === 11; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return jQuery.nth( elem, 2, "nextSibling" ); }, prev: function( elem ) { return jQuery.nth( elem, 2, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( elem.parentNode.firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.makeArray( elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ); if ( !runtil.test( name ) ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { ret = ret.reverse(); } return this.pushStack( ret, name, slice.call( arguments ).join(",") ); }; }); jQuery.extend({ filter: function( expr, elems, not ) { if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 ? jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : jQuery.find.matches(expr, elems); }, dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, nth: function( cur, result, dir, elem ) { result = result || 1; var num = 0; for ( ; cur; cur = cur[dir] ) { if ( cur.nodeType === 1 && ++num === result ) { break; } } return cur; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { r.push( n ); } } return r; } }); // Implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { // Can't pass null or undefined to indexOf in Firefox 4 // Set to 0 to skip string check qualifier = qualifier || 0; if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { var retVal = !!qualifier.call( elem, i, elem ); return retVal === keep; }); } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem, i ) { return ( elem === qualifier ) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jQuery.grep(elements, function( elem ) { return elem.nodeType === 1; }); if ( isSimple.test( qualifier ) ) { return jQuery.filter(qualifier, filtered, !keep); } else { qualifier = jQuery.filter( qualifier, filtered ); } } return jQuery.grep(elements, function( elem, i ) { return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; }); } function createSafeFragment( document ) { var list = nodeNames.split( "|" ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( list.length ) { safeFrag.createElement( list.pop() ); } } return safeFrag; } var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, rtagName = /<([\w:]+)/, rtbody = /", "" ], legend: [ 1, "
", "
" ], thead: [ 1, "", "
" ], tr: [ 2, "", "
" ], td: [ 3, "", "
" ], col: [ 2, "", "
" ], area: [ 1, "", "" ], _default: [ 0, "", "" ] }, safeFragment = createSafeFragment( document ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; // IE can't serialize and

Security barriers in Varnish¶

Security is a very important design driver in Varnish, more likely than not, if you find yourself thinking "Why did he do _that_ ? the answer has to do with security.

The Varnish security model is based on some very crude but easy to understand barriers between the various components:

              .-->- provides ->---------------------------------------.
              |                                          |            |
     (ADMIN)--+-->- runs ----->---.                      |            |
              |                   |                      |            |
              |-->- cli_req -->---|                      v            v
              '--<- cli_resp -<---|                     VCL        MODULE
                                  |                      |            |
     (OPER)                       |                      |reads       |
       |                          |                      |            |
       |runs                      |                      |            |
       |      .-<- create -<-.    |    .->- fork ->-.    v            |
       v      |->- check -->-|-- MGR --|            |-- VCC <- loads -|
      VSM     |-<- write --<-'    |    '-<- wait -<-'    |            |
     TOOLS    |                   |                      |            |
       ^      |     .-------------'                      |            |
       |      |     |                                    |writes      |
       |reads |     |->- fork ----->-.                   |            |
       |      |     |->- cli_req -->-|                   |            |
      VSM ----'     |-<- cli_resp -<-|                   v            |
       |            '-<- wait -----<-|                VCL.SO          |
       |                             |                   |            |
       |                             |                   |            |
       |---->----- inherit --->------|--<-- loads -------'            |
       |---->-----  reads ---->------|                                |
       '----<----- writes ----<------|--<-- loads --------------------'
                                     |
                                     |
                                     |
         .--->-- http_req --->--.    |    .-->-- http_req --->--.
(ANON) --|                      |-- CLD --|                     |-- (BACKEND)
         '---<-- http_resp --<--'         '--<-- http_resp --<--'

(ASCII-ART rules!)

The really Important Barrier¶

The central actor in Varnish is the Manager process, "MGR", which is the process the administrator "(ADMIN)" starts to get web-cache service.

Having been there myself, I do not subscribe to the "I feel cool and important when I get woken up at 3AM to restart a dead process" school of thought, in fact, I think that is a clear sign of mindless stupidity: If we cannot get a computer to restart a dead process, why do we even have them ?

The task of the Manager process is therefore not cache web content, but to make sure there always is a process which does that, the Child "CLD" process.

That is the major barrier in Varnish: All management happens in one process all actual movement of traffic happens in another, and the Manager process does not trust the Child process at all.

The Child process is in a the totally unprotected domain: Any computer on the InterNet "(ANON)" can connect to the Child process and ask for some web-object.

If John D. Criminal manages to exploit a security hole in Varnish, it is the Child process he subverts. If he carries out a DoS attack, it is the Child process he tries to fell.

Therefore the Manager starts the Child with as low priviledge as practically possible, and we close all filedescriptors it should not have access to and so on.

There are only three channels of communication back to the Manager process: An exit code, a CLI response or writing stuff into the shared memory file "VSM" used for statistics and logging, all of these are well defended by the Manager process.

The Admin/Oper Barrier¶

If you look at the top left corner of the diagram, you will see that Varnish operates with separate Administrator "(ADMIN)" and Operator "(OPER)" roles.

The Administrator does things, changes stuff etc. The Operator keeps an eye on things to make sure they are as they should be.

These days Operators are often scripts and data collection tools, and there is no reason to assume they are bugfree, so Varnish does not trust the Operator role, that is a pure one-way relationship.

(Trick: If the Child process us run under user "nobody", you can allow marginally trusted operations personel access to the "nobody" account (for instance using .ssh/authorized_keys2), and they will be able to kill the Child process, prompting the Manager process to restart it again with the same parameters and settings.)

The Administrator has the final say, and of course, the administrator can decide under which circumstances that authority will be shared.

Needless to say, if the system on which Varnish runs is not properly secured, the Administrator's monopoly of control will be compromised.

All the other barriers¶

There are more barriers, you can spot them by following the arrows in the diagram, but they are more sort of "technical" than "political" and generally try to guard against programming flaws as much as security compromise.

For instance the VCC compiler runs in a separate child process, to make sure that a memory leak or other flaw in the compiler does not accumulate trouble for the Manager process.

Hope this explanation helps understand why Varnish is not just a single process like all other server programs.

Poul-Henning, 2010-06-28

Table Of Contents

Previous topic

Picking platforms

Next topic

What were they thinking ?

This Page

varnish-4.1.1/doc/html/phk/http20.html0000644000201500234410000004604012652366773014433 00000000000000 Why HTTP/2.0 does not seem interesting — Varnish version 4.1.1 documentation

Why HTTP/2.0 does not seem interesting¶

This is the email I sent to the IETF HTTP Working Group:

From:    Poul-Henning Kamp <phk@phk.freebsd.dk>
Subject: HTTP/2 Expression of luke-warm interest: Varnish
To:      HTTP Working Group <ietf-http-wg@w3.org>
Message-Id: <41677.1342136900@critter.freebsd.dk>
Date:    Thu, 12 Jul 2012 23:48:20 GMT

This is Varnish' response to the call for expression of interest in HTTP/2[1].

Varnish¶

Presently Varnish[2] only implements a subset of HTTP/1.1 consistent with its hybrid/dual "http-server" / "http-proxy" role.

I cannot at this point say much about what Varnish will or will not implement protocol wise in the future.

Our general policy is to only add protocols if we can do a better job than the alternative, which is why we have not implemented HTTPS for instance.

Should the outcome of the HTTP/2.0 effort result in a protocol which gains traction, Varnish will probably implement it, but we are unlikely to become an early implementation, given the current proposals at the table.

Why I'm not impressed¶

I have read all, and participated in one, of the three proposals presently on the table.

Overall, I find all three proposals are focused on solving yesteryears problems, rather than on creating a protocol that stands a chance to last us the next 20 years.

Each proposal comes out of a particular "camp" and therefore all seem to suffer a certain amount from tunnel-vision.

It is my considered opinion that none of the proposals have what it will take to replace HTTP/1.1 in practice.

What if they made a new protocol, and nobody used it ?¶

We have learned, painfully, that an IPv6 which is only marginally better than IPv4 and which offers no tangible benefit for the people who have the cost/trouble of the upgrade, does not penetrate the network on its own, and barely even on governments mandate.

We have also learned that a protocol which delivers the goods can replace all competition in virtually no time.

See for instance how SSH replaced TELNET, REXEC, RSH, SUPDUP, and to a large extent KERBEROS, in a matter of a few years.

Or I might add, how HTTP replaced GOPHER[3].

HTTP/1.1 is arguably in the top-five most used protocols, after IP, TCP, UDP and, sadly, ICMP, and therefore coming up with a replacement should be approached humbly.

Beating HTTP/1.1¶

Fortunately, there are many ways to improve over HTTP/1.1, which lacks support for several widely used features, and sports many trouble-causing weeds, both of which are ripe for HTTP/2.0 to pounce on.

Most notably HTTP/1.1 lacks a working session/endpoint-identity facility, a shortcoming which people have pasted over with the ill-conceived Cookie hack.

Cookies are, as the EU commission correctly noted, fundamentally flawed, because they store potentially sensitive information on whatever computer the user happens to use, and as a result of various abuses and incompetences, EU felt compelled to legislate a "notice and announce" policy for HTTP-cookies.

But it doesn't stop there: The information stored in cookies have potentially very high value for the HTTP server, and because the server has no control over the integrity of the storage, we are now seeing cookies being crypto-signed, to prevent forgeries.

The term "bass ackwards" comes to mind.

Cookies are also one of the main wasters of bandwidth, disabling caching by default, sending lots of cookies were they are are not needed, which made many sites register separate domains for image content, to "save" bandwidth by avoiding cookies.

The term "not really helping" also comes to mind.

In my view, HTTP/2.0 should kill Cookies as a concept, and replace it with a session/identity facility, which makes it easier to do things right with HTTP/2.0 than with HTTP/1.1.

Being able to be "automatically in compliance" by using HTTP/2.0 no matter how big dick-heads your advertisers are or how incompetent your web-developers are, would be a big selling point for HTTP/2.0 over HTTP/1.1.

However, as I read them, none of the three proposals try to address, much less remedy, this situation, nor for that matter any of the many other issues or troubles with HTTP/1.x.

What's even worse, they are all additive proposals, which add a new layer of complexity without removing any of the old complexity from the protocol.

My conclusion is that HTTP/2.0 is really just a grandiose name for HTTP/1.2: An attempt to smooth out some sharp corners, to save a bit of bandwidth, but not get anywhere near all the architectural problems of HTTP/1.1 and to preserve faithfully its heritage of badly thought out sedimentary hacks.

And therefore, I don't see much chance that the current crop of HTTP/2.0 proposals will fare significantly better than IPv6 with respect to adoption.

HTTP Routers¶

One particular hot-spot in the HTTP world these days is the "load-balancer" or as I prefer to call it, the "HTTP router".

These boxes sit at the DNS resolved IP numbers and distributes client requests to a farm of HTTP servers, based on simple criteria such as "Host:", URI patterns and/or server availability, sometimes with an added twist of geo-location[4].

HTTP routers see very high traffic densities, the highest traffic densities, because they are the focal point of DoS mitigation, flash mobs and special event traffic spikes.

In the time frame where HTTP/2.0 will become standardized, HTTP routers will routinely deal with 40Gbit/s traffic and people will start to architect for 1Tbit/s traffic.

HTTP routers are usually only interested in a small part of the HTTP request and barely in the response at all, usually only the status code.

The demands for bandwidth efficiency has made makers of these devices take many unwarranted shortcuts, for instance assuming that requests always start on a packet boundary, "nulling out" HTTP headers by changing the first character and so on.

Whatever HTTP/2.0 becomes, I strongly urge IETF and the WG to formally recognize the role of HTTP routers, and to actively design the protocol to make life easier for HTTP routers, so that they can fulfill their job, while being standards compliant.

The need for HTTP routers does not disappear just because HTTPS is employed, and serious thought should be turned to the question of mixing HTTP and HTTPS traffic on the same TCP connection, while allowing a HTTP router on the server side to correctly distribute requests to different servers.

One simple way to gain a lot of benefit for little cost in this area, would be to assign "flow-labels" which each are restricted to one particular Host: header, allowing HTTP routers to only examine the first request on each flow.

SPDY¶

SPDY has come a long way, and has served as a very worthwhile proof of concept prototype, to document that there are gains to be had.

But as Frederick P. Brooks admonishes us: Always throw the prototype away and start over, because you will throw it away eventually, and doing so early saves time and effort.

Overall, I find the design approach taken in SPDY deeply flawed.

For instance identifying the standardized HTTP headers, by a 4-byte length and textual name, and then applying a deflate compressor to save bandwidth is totally at odds with the job of HTTP routers which need to quickly extract the Host: header in order to route the traffic, preferably without committing extensive resources to each request.

It is also not at all clear if the built-in dictionary is well researched or just happens to work well for some subset of present day websites, and at the very least some kind of versioning of this dictionary should be incorporated.

It is still unclear for me if or how SPDY can be used on TCP port 80 or if it will need a WKS allocation of its own, which would open a ton of issues with firewalling, filtering and proxying during deployment.

(This is one of the things which makes it hard to avoid the feeling that SPDY really wants to do away with all the "middle-men")

With my security-analyst hat on, I see a lot of DoS potential in the SPDY protocol, many ways in which the client can make the server expend resources, and foresee a lot of complexity in implementing the server side to mitigate and deflect malicious traffic.

Server Push breaks the HTTP transaction model, and opens a pile of cans of security and privacy issues, which would not be sneaked in during the design of a transport-encoding for HTTP/1+ traffic, but rather be standardized as an independent and well analysed extension to HTTP in general.

HTTP Speed+Mobility¶

Is really just SPDY with WebSockets underneath.

I'm really not sure I see any benefit to that, except that the encoding chosen is marginally more efficient to implement in hardware than SPDY.

I have not understood why it has "mobility" in the name, a word which only makes an appearance in the ID as part of the name.

If the use of the word "mobility" only refers only to bandwidth usage, I would call its use borderline-deceptive.

If it covers session stability across IP# changes for mobile devices, I have missed it in my reading.

draft-tarreau-httpbis-network-friendly-00¶

I have participated a little bit in this draft initially, but it uses a number of concepts which I think are very problematic for high performance (as in 1Tbit/s) implementations, for instance variant-size length fields etc.

I do think the proposal is much better than the other two, taking a much more fundamental view of the task, and if for no other reason, because it takes an approach to bandwidth-saving based on enumeration and repeat markers, rather than throwing everything after deflate and hope for a miracle.

I think this protocol is the best basis to start from, but like the other two, it has a long way to go, before it can truly earn the name HTTP/2.0.

Conclusion¶

Overall, I don't see any of the three proposals offer anything that will make the majority of web-sites go "Ohh we've been waiting for that!"

Bigger sites will be enticed by small bandwidth savings, but the majority of the HTTP users will see scant or no net positive benefit if one or more of these three proposals were to become HTTP/2.0

Considering how sketchy the HTTP/1.1 interop is described it is hard to estimate how much trouble (as in: "Why doesn't this website work ?") their deployment will cause, nor is it entirely clear to what extent the experience with SPDY is representative of a wider deployment or only of 'flying under the radar' with respect to people with an interest in intercepting HTTP traffic.

Given the role of HTTP/1.1 in the net, I fear that the current rush to push out a HTTP/2.0 by purely additive means is badly misguided, and approaching a critical mass which will delay or prevent adoption on its own.

At the end of the day, a HTTP request or a HTTP response is just some metadata and an optional chunk of bytes as body, and if it already takes 700 pages to standardize that, and HTTP/2.0 will add another 100 pages to it, we're clearly doing something wrong.

I think it would be far better to start from scratch, look at what HTTP/2.0 should actually do, and then design a simple, efficient and future proof protocol to do just that, and leave behind all the aggregations of badly thought out hacks of HTTP/1.1.

But to the extent that the WG produces a HTTP/2.0 protocol which people will start to use, the Varnish project will be interested.

Poul-Henning Kamp

Author of Varnish

[1] http://trac.tools.ietf.org/wg/httpbis/trac/wiki/Http2CfI

[2] https://www.varnish-cache.org/

[3] Yes, I'm that old.

[4] Which is really a transport level job, but it was left out of IPv6
along with other useful features, to not delay adoption[5].

[5] No, I'm not kidding.

varnish-4.1.1/doc/html/phk/index.html0000644000201500234410000001477212652366773014430 00000000000000 Poul-Hennings random outbursts — Varnish version 4.1.1 documentation varnish-4.1.1/doc/html/phk/backends.html0000644000201500234410000002351112652366773015062 00000000000000 What do you mean by 'backend' ? — Varnish version 4.1.1 documentation

What do you mean by 'backend' ?¶

Given that we are approaching Varnish 3.0, you would think I had this question answered conclusively long time ago, but once you try to be efficient, things get hairy fast.

One of the features of Varnish we are very fundamental about, is the ability to have multiple VCLs loaded at the same time, and to switch between them instantly and seamlessly.

So imagine you have 1000 backends in your VCL, not an unreasonable number, each configured with health-polling.

Now you fiddle your vcl_recv{} a bit and load the VCL again, but since you are not sure which is the best way to do it, you keep both VCL's loaded so you can switch forth and back seamlessly.

To switch seamlessly, the health status of each backend needs to be up to date the instant we switch to the other VCL.

This basically means that either all VCLs poll all their backends, or they must share, somehow.

We can dismiss the all VCLs poll all their backends scenario, because it scales truly horribly, and would pummel backends with probes if people forget to vcl.discard their old dusty VCLs.

Share And Enjoy¶

In addition to health-status (including the saint-list), we also want to share cached open connections and stats counters.

It would be truly stupid to close 100 ready and usable connections to a backend, and open 100 other, just because we switch to a different VCL that has an identical backend definition.

But what is an identical backend definition in this context?

It is important to remember that we are not talking physical backends: For instance, there is nothing preventing a VCL for having the same physical backend declared as 4 different VCL backends.

The most obvious thing to do, is to use the VCL name of the backend as identifier, but that is not enough. We can have two different VCLs where backend "b1" points at two different physical machines, for instance when we migrate or upgrade the backend.

The identity of the state than can be shared is therefore the triplet:
{VCL-name, IPv4+port, IPv6+port}

No Information without Representation¶

Since the health-status will be for each of these triplets, we will need to find a way to represent them in CLI and statistics contexts.

As long as we just print them out, that is not a big deal, but what if you just want the health status for one of your 1000 backends, how do you tell which one ?

The syntax-nazi way of doing that, is forcing people to type it all every time:

backend.health b1(127.0.0.1:8080,[::1]:8080)

That will surely not be a hit with people who have just one backend.

I think, but until I implement I will not commit to, that the solution is a wildcard-ish scheme, where you can write things like:

b1                              # The one and only backend b1 or error

b1()                            # All backends named b1

b1(127.0.0.1)                   # All b1s on IPv4 lookback

b1(:8080)                       # All b1s on port 8080, (IPv4 or IPv6)

b1(192.168.60.1,192.168.60.2)   # All b1s on one of those addresses.

(Input very much welcome)

The final question is if we use shortcut notation for output from varnishd, and the answer is no, because we do not want the stats-counters to change name because we load another VCL and suddenly need disabiguation.

Sharing Health Status¶

To avoid the over-polling, we define that maximum one VCL polls at backend at any time, and the active VCL gets preference. It is not important which particular VCL polls the backends not in the active VCL, as long as one of them do.

Implementation¶

The poll-policy can be implemented by updating a back-pointer to the poll-specification for all backends on vcl.use execution.

On vcl.discard, if this vcl was the active poller, it needs to walk the list of vcls and substitute another. If the list is empty the backend gets retired anyway.

We should either park a thread on each backend, or have a poller thread which throws jobs into the work-pool as the backends needs polled.

The pattern matching is confined to CLI and possibly libvarnishapi

I think this will work,

Until next time,

Poul-Henning, 2010-08-09

Table Of Contents

Previous topic

IPv6 Suckage

Next topic

Picking platforms

This Page

varnish-4.1.1/doc/html/phk/varnish_does_not_hash.html0000644000201500234410000002436012652366773017662 00000000000000 Varnish Does Not Hash — Varnish version 4.1.1 documentation

Varnish Does Not Hash¶

A spate of security advisories related to hash-collisions have made a lot of people stare at Varnish and wonder if it is affected.

The answer is no, but the explanation is probably not what most of you expected:

Varnish does not hash, at least not by default, and even if it does, it's still as immune to the attacks as can be.

To understand what is going on, I have to introduce a concept from Shannon's information theory: "entropy."

Entropy is hard to explain, and according to legend, that is exactly why Shannon recycled that term from thermodynamics.

In this context, we can get away with thinking about entropy as how much our "keys" differ:

Low entropy (1 bit):
        /foo/bar/barf/some/cms/content/article?article=2
        /foo/bar/barf/some/cms/content/article?article=3

High entropy (65 bits):
        /i?ee30d0770eb460634e9d5dcfb562a2c5.html
        /i?bca3633d52607f38a107cb5297fd66e5.html

Hashing consists of calculating a hash-index from the key and storing the objects in an array indexed by that key.

Typically, but not always, the key is a string and the index is a (smallish) integer, and the job of the hash-function is to squeeze the key into the integer, without losing any of the entropy.

Needless to say, the more entropy you have to begin with, the more of it you can afford to lose, and lose some you almost invariably will.

There are two families of hash-functions, the fast ones, and the good ones, and the security advisories are about the fast ones.

The good ones are slower, but probably not so much slower that you care, and therefore, if you want to fix your web-app:

Change::
foo=somedict[$somekey]
To::
foo=somedict[md5($somekey)]

and forget about the advisories.

Yes, that's right: Cryptographic hash algorithms are the good ones, they are built to not throw any entropy away, and they are built to have very hard to predict collisions, which is exactly the problem with the fast hash-functions in the advisories.

What Varnish Does¶

The way to avoid having hash-collisions is to not use a hash: Use a tree instead. There every object has its own place and there are no collisions.

Varnish does that, but with a twist.

The "keys" in Varnish can be very long; by default they consist of:

sub vcl_hash {
    hash_data(req.url);
    if (req.http.host) {
        hash_data(req.http.host);
    } else {
        hash_data(server.ip);
    }
    return (hash);
}

But some users will add cookies, user identification and many other bits and pieces of string in there, and in the end the keys can be kilobytes in length, and quite often, as in the first example above, the first difference may not come until pretty far into the keys.

Trees generally need to have a copy of the key around to be able to tell if they have a match, and more importantly to compare tree-leaves in order to "re-balance" the tree and other such arcanae of data structures.

This would add another per-object memory load to Varnish, and it would feel particularly silly to store 48 identical characters for each object in the far too common case seen above.

But furthermore, we want the tree to be very fast to do lookups in, preferably it should be lockless for lookups, and that means that we cannot (realistically) use any of the "smart" trees which automatically balance themselves, etc.

You (generally) don't need a "smart" tree if your keys look like random data in the order they arrive, but we can pretty much expect the opposite as article number 4, 5, 6 etc are added to the CMS in the first example.

But we can make the keys look random, and make them small and fixed size at the same time, and the perfect functions designed for just that task are the "good" hash-functions, the cryptographic ones.

So what Varnish does is "key-compression": All the strings fed to hash_data() are pushed through a cryptographic hash algorithm called SHA256, which, as the name says, always spits out 256 bits (= 32 bytes), no matter how many bits you feed it.

This does not eliminate the key-storage requirement, but now all the keys are 32 bytes and can be put directly into the data structure:

struct objhead {
        [...]
        unsigned char           digest[DIGEST_LEN];
};

In the example above, the output of SHA256 for the 1 bit difference in entropy becomes:

/foo/bar/barf/some/cms/content/article?article=2
-> 14f0553caa5c796650ec82256e3f111ae2f20020a4b9029f135a01610932054e
/foo/bar/barf/some/cms/content/article?article=3
-> 4d45b9544077921575c3c5a2a14c779bff6c4830d1fbafe4bd7e03e5dd93ca05

That should be random enough.

But the key-compression does introduce a risk of collisions, since not even SHA256 can guarantee different outputs for all possible inputs: Try pushing all the possible 33-byte files through SHA256 and sooner or later you will get collisions.

The risk of collision is very small however, and I can all but promise you, that you will be fully offset in fame and money for any inconvenience a collision might cause, because you will be the first person to find a SHA256 collision.

Poul-Henning, 2012-01-03

Table Of Contents

Previous topic

Why HTTP/2.0 does not seem interesting

Next topic

The Tools We Work With

This Page

varnish-4.1.1/doc/html/phk/platforms.html0000644000201500234410000002244512652366773015324 00000000000000 Picking platforms — Varnish version 4.1.1 documentation

Picking platforms¶

Whenever you write Open Source Software, you have to make a choice of what platforms you are going to support.

Generally you want to make your program as portable as possible and cover as many platforms, distros and weird computers as possible.

But making your program run on everything is hard work very hard work.

For instance, did you know that:

sizeof(void*) != sizeof(void * const)

is legal in a ISO-C compliant environment ?

Varnish runs on a Nokia N900 but I am not going to go out of my way to make sure that is always the case.

To make sense for Varnish, a platform has to be able to deliver, both in terms of performance, but also in terms of the APIs we use to get that performance.

In the FreeBSD project where I grew up, we ended up instituting platform-tiers, in an effort to document which platforms we cared about and which we did love quite as much.

If we did the same for Varnish, the result would look something like:

A - Platforms we care about¶

We care about these platforms because our users use them and because they deliver a lot of bang for the buck with Varnish.

These platforms are in our "tinderbox" tests, we use them ourselves and they pass all regression tests all the time. Platform specific bug reports gets acted on.

FreeBSD

Linux

Obviously you can forget about running Varnish on your WRT54G but if you have a real computer, you can expect Varnish to work "ok or better" on any distro that has a package available.

B - Platforms we try not to break¶

We try not to break these platforms, because they basically work, possibly with some footnotes or minor limitations, and they have an active userbase.

We may or may not test on these platforms on a regular basis, or we may rely on contributors to alert us to problems. Platform specific bug reports without patches will likely live a quiet life.

Mac OS/X

Solaris-decendants (Oracle Solaris, OmniOS, Joyent SmartOS)

Mac OS/X is regarded as a developer platform, not as a production platform.

Solaris-decendants are regarded as a production platform.

NetBSD, AIX and HP-UX are conceivably candidates for this level, but so far I have not heard much, if any, user interest.

C - Platforms we tolerate¶

We tolerate any other platform, as long as the burden of doing so is proportional to the benefit to the Varnish community.

Do not file bug reports specific to these platforms without attaching a patch that solves the problem, we will just close it.

For now, anything else goes here, certainly the N900 and the WRT54G.

I'm afraid I have to put OpenBSD here for now, it is seriously behind on socket APIs and working around those issues is just not worth the effort.

If people send us a small non-intrusive patches that makes Varnish run on these platforms, we'll take it.

If they send us patches that reorganizes everything, hurts code readability, quality or just generally do not satisfy our taste, they get told that thanks, but no thanks.

Is that it ? Abandon all hope etc. ?¶

These tiers are not static, if for some reason Varnish suddenly becomes a mandatory accessory to some technically sensible platform, (zOS anyone ?) that platform will get upgraded. If the pessimists are right about Oracles intentions, Solaris may get demoted.

Until next time,

Poul-Henning, 2010-08-03 Edited Nils, 2014-03-18 with Poul-Hennings concent

varnish-4.1.1/doc/html/phk/ipv6suckage.html0000644000201500234410000001570512652366773015545 00000000000000 IPv6 Suckage — Varnish version 4.1.1 documentation

IPv6 Suckage¶

In my drawer full of cassette tapes, is a 6 tape collection published by Carl Malamuds "Internet Talk Radio", the first and by far the geekiest radio station on the internet.

The tapes are from 1994 and the topic is "IPng", the IPv4 replacement that eventually became IPv6. To say that I am a bit jaded about IPv6 by now, is accusing the pope of being religious.

IPv4 addresses in numeric form, are written as 192.168.0.1 and to not confuse IPv6 with IPv4, it was decided in RFC1884 that IPv6 would use colons and groups of 16 bits, and because 128 bits are a lot of bits, the secret '::' trick was introduced, to supress all the zero bits that we may not ever need anyway: 1080::8:800:200C:417A

Colon was chosen because it was already used in MAC/ethernet addresses and did no damage there and it is not a troublesome metacharacter in shells. No worries.

Most protocols have a Well Known Service number, TELNET is 23, SSH is 22 and HTTP is 80 so usually people will only have to care about the IP number.

Except when they don't, for instance when they run more than one webserver on the same machine.

No worries, says the power that controls what URLs look like, we will just stick the port number after the IP# with a colon:

That obviously does not work with IPv6, so RFC3986 comes around and says "darn, we didn't think of that" and puts the IPV6 address in [...] giving us:

Remember that "harmless in shells" detail ? Yeah, sorry about that.

Now, there are also a RFC sanctioned API for translating a socket address into an ascii string, getnameinfo(), and if you tell it that you want a numeric return, you get a numeric return, and you don't even need to know if it is a IPv4 or IPv6 address in the first place.

But it returns the IP# in one buffer and the port number in another, so if you want to format the sockaddr in the by RFC5952 recommended way (the same as RFC3986), you need to inspect the version field in the sockaddr to see if you should do

"%s:%s", host, port

or

"[%s]:%s", host, port

Careless standardization costs code, have I mentioned this before ?

Varnish reports socket addresses as two fields: IP space PORT, now you know why.

Until next time,

Poul-Henning, 2010-08-24

Previous topic

VCL Expressions

Next topic

What do you mean by 'backend' ?

This Page

varnish-4.1.1/doc/html/phk/wanton_destruction.html0000644000201500234410000001732012652366773017242 00000000000000 Wanton destruction for the greater good — Varnish version 4.1.1 documentation

Wanton destruction for the greater good¶

We live in an old house, and it's all wrong for us.

When I bought this house, it was perfect, or at least perfect enough.

But times have changed.

I have no small kids anymore, and rather than just right for two kids to tumble in, the garden is now too small for all the flowers we want.

And the rooms are not where we want them, there are too many stairs in all the wrong places, and the kitchen needs to be torn out and a new built.

I'm sure that some other family will be able to fall in love with this house, the way we did, but there is no realistic way to rebuild it, to become the house we want now.

For one thing, doing major surgery on a house while you live in it is double-minus-fun and it always slows the rebuild project down when you have to keep at least one toilet working and sanitary and be able to cook and sleep on the building site.

So we'll be building a new house on a plot of land on the other side of the road, one of the coming years, a house which is right for us, and then we will sell this old house, to a family with small children, who will love it, and rip out the old funky kitchen and make a new one before they move in.

One would think that software would be nothing like an old house, but they are more alike than most people imagine.

Using a major piece of software, is like moving into a house: You need to adapt your life and the house or the software to each other, since nothing is ever quite perfect, there will be limitations.

And those limitations affect how you think: If you live in a 2 bedroom apartment, you won't even be considering inviting 80 guests to a party.

A lot of Varnish-users have taken time to figure out how Varnish fits into their lives and made the compromises necessary to make it work, and once you've done that, you moved on to other problems, but the limitations of Varnish keeps affecting how you think about your website, even if you don't realize this.

Well, I've got news for you: You'll be moving into a new house in the next couple of years, it'll be called Varnish V4 and that means that you will have to decide who gets which room and where to store the towels and grandmothers old china, all over again.

I'm sure you'll hate me for it, "Why do we have to move ?", "It really wasn't that bad after all" and so on and so forth. But if I do my job right, that will soon turn into "Ohh, that's pretty neat, I always wanted one of those..." and "Hey... Watch me do THIS!" etc.

I could have started with a fresh GIT repository, to make it clear that what is happening right now is the construction of an entirely new house, but software isn't built from physical objects, so I don't need to do that: You can keep using Varnish, while I rebuild it, and thanks to the wonder of bits, you won't see a trace of dirt or dust while it happens.

So don't be alarmed by the wanton destruction you will see in -trunk the coming weeks, it is not destroying the Varnish you are using for your website today, it is building the new one you will be using in the future.

And it's going to be perfect for you, at least for some years...

Poul-Henning, 2013-03-18

Previous topic

Raking in the dough on Free and Open Source Software

Next topic

What SPDY did to my summer vacation

This Page

varnish-4.1.1/doc/html/phk/thetoolsweworkwith.html0000644000201500234410000003220212652366773017301 00000000000000 The Tools We Work With — Varnish version 4.1.1 documentation

The Tools We Work With¶

"Only amateurs were limited by their tools" is an old wisdom, and the world is littered with art and architecture that very much proves this point.

But as amazing as the Aquaeduct of Segovia is, tools are the reason why it looks nowhere near as fantastic as the Sydney Opera House.

Concrete has been known since antiquity, but steel-reinforced concrete and massive numerical calculations of stress-distribution, is the tools that makes the difference between using concrete as a filler material between stones, and as gravity-defying curved but perfectly safe load-bearing wall.

My tool for writing Varnish is the C-language which in many ways is unique amongst all of the computer programming languages for having no ambitions.

The C language was invented as a portable assembler language, it doesn't do objects and garbage-collection, it does numbers and pointers, just like your CPU.

Compared to the high ambitions, then as now, of new programming languages, that was almost ridiculous unambitious. Other people were trying to make their programming languages provably correct, or safe for multiprogramming and quite an effort went into using natural languages as programming languages.

But C was written to write programs, not to research computer science and that's exactly what made it useful and popular.

Unfortunately C fell in bad company over the years, and the reason for this outburst is that I just browsed the latest draft from the ISO-C standardisation working-group 14.

I won't claim that it is enough to make grown men cry, but it certainly was enough to make me angry.

Let me give you an example of their utter sillyness:

The book which defined the C langauge had a list af reserved identifiers, all of them lower-case words. The UNIX libraries defined a lot of functions, all of them lower-case words.

When compiled, the assembler saw all of these words prefixed with an underscore, which made it easy to mix assembler and C code.

All the macros for the C-preprocessor on the other hand, were UPPERCASE, making them easy to spot.

Which meant that if you mixed upper and lower case, in your identifiers, you were safe: That wouldn't collide with anything.

First the ISO-C standards people got confused about the leading underscore, and I'll leave you guessing as to what the current text actually means:

All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use.

Feel free to guess, there's more such on pdf page 200 of the draft.

Next, they broke the upper/lower rule, by adding special keywords in mixed case, probably because they thought it looked nicer:

_Atomic, _Bool, _Noreturn &c

Then, presumably, somebody pointed out that this looked ugly:

void _Noreturn foo(int bar);

So they have come up with a #include file called <stdnoreturn.h> so that instead you can write:

#include <nostdreturn.h>
void noreturn foo(int bar);

The <nostdreturn.h> file according to the standard shall have exactly this content:

#define noreturn _Noreturn

Are you crying or laughing yet ? You should be.

Another thing brought by the new draft is an entirely new thread API, which is incompatible with the POSIX 'pthread' API which have been used for about 20 years now.

If they had improved on the shortcomings of the pthreads, I would have cheered them on, because there are some very annoying mistakes in pthreads.

But they didn't, in fact, as far as I can tell, the C1X draft's threads are worse than the 20 years older pthreads in all relevant aspects.

For instance, neither pthreads nor C1X-threads offer a "assert I'm holding this mutex locked" facility. I will posit that you cannot successfully develop real-world threaded programs and APIs without that, or without wasting a lot of time debugging silly mistakes.

If you look in the Varnish source code, which uses pthreads, you will see that I have wrapped pthread mutexes in my own little datastructure, to be able to do those asserts, and to get some usable statistics on lock-contention.

Another example where C1X did not improve on pthreads at all, was in timed sleeps, where you say "get me this lock, but give up if it takes longer than X time".

The way both pthreads and C1X threads do this, is you specify a UTC wall clock time you want to sleep until.

The only problem with that is that UTC wall clock time is not continuous when implemented on a computer, and it may not even be monotonously increasing, since NTPD or other timesync facilites may step the clock backwards, particularly in the first minutes after boot.

If the practice of saying "get me this lock before 16:00Z" was widespread, I could see the point, but I have actually never seen that in any source code. What I have seen are wrappers that take the general shape of:

int
get_lock_timed(lock, timeout)
{
        while (timeout > 0) {
                t0 = time();
                i = get_lock_before(lock, t + timeout));
                if (i == WASLOCKED)
                        return (i);
                t1 = time();
                timeout -= (t1 - t0);
        }
        return (TIMEDOUT);
}

Because it's not like the call is actually guaranteed to return at 16:00Z if you ask it to, you are only promised it will not return later than that, so you have to wrap the call in a loop.

Whoever defined the select(2) and poll(2) systemcalls knew better than the POSIX and ISO-C group-think: They specifed a maximum duration for the call, because then it doesn't matter what time it is, only how long time has transpired.

Ohh, and setting the stack-size for a new thread ? That is apparently "too dangerous" so there is no argument in the C1X API for doing so, a clear step backwards from pthreads.

But guess what: Thread stacks are like T-shirts: There is no "one size fits all."

I have no idea what the "danger" they perceived were, my best guess is that feared it might make the API useful ?

This single idiocy will single-handedly doom the C1X thread API to uselessness.

Now, don't get me wrong: There are lot of ways to improve the C language that would make sense: Bitmaps, defined structure packing (think: communication protocol packets), big/little endian variables (data sharing), sensible handling of linked lists etc.

As ugly as it is, even the printf()/scanf() format strings could be improved, by offering a sensible plugin mechanism, which the compiler can understand and use to issue warnings.

Heck, even a simple basic object facility would be good addition, now that C++ have become this huge bloated monster language.

But none of that is apparently as important as <stdnoreturn.h> and a new, crippled and therefore useless thread API.

The neat thing about the C language, and the one feature that made it so popular, is that not even an ISO-C working group can prevent you from implementing all these things using macros and other tricks.

But it would be better to have them in the language, so the compiler could issue sensible warnings and programmers won't have to write monsters like:

#define VTAILQ_INSERT_BEFORE(listelm, elm, field) do {              \
    (elm)->field.vtqe_prev = (listelm)->field.vtqe_prev;            \
    VTAILQ_NEXT((elm), field) = (listelm);                          \
    *(listelm)->field.vtqe_prev = (elm);                            \
    (listelm)->field.vtqe_prev = &VTAILQ_NEXT((elm), field);        \
} while (0)

To put an element on a linked list.

I could go on like this, but it would rapidly become boring for both you and me, because the current C1X draft is 701 pages, and it contains not a single explanatory example if how to use any of the verbiage in practice.

Compare this with The C Programming Language, a book of 274 pages which in addition to define the C language, taught people how to program through well-thought-out examples.

From where I sit, ISO WG14 are destroying the C language I use and love.

Poul-Henning, 2011-12-20

Previous topic

Varnish Does Not Hash

Next topic

Thoughts on the eve of Varnish 3.0

This Page

varnish-4.1.1/doc/html/phk/vcl_expr.html0000644000201500234410000001472612652366773015142 00000000000000 VCL Expressions — Varnish version 4.1.1 documentation

VCL Expressions¶

I have been working on VCL expressions recently, and we are approaching the home stretch now.

The data types in VCL are "sort of weird" seen with normal programming language eyes, in that they are not "general purpose" types, but rather tailored types for the task at hand.

For instance, we have both a TIME and a DURATION type, a quite unusual constellation for a programming language.

But in HTTP context, it makes a lot of sense, you really have to keep track of what is a relative time (age) and what is absolute time (Expires).

Obviously, you can add a TIME and DURATION, the result is a TIME.

Equally obviously, you can not add TIME to TIME, but you can subtract TIME from TIME, resulting in a DURATION.

VCL do also have "naked" numbers, like INT and REAL, but what you can do with them is very limited. For instance you can multiply a duration by a REAL, but you can not multiply a TIME by anything.

Given that we have our own types, the next question is what precedence operators have.

The C programming language is famous for having a couple of gottchas in its precedence rules and given our limited and narrow type repetoire, blindly importing a set of precedence rules may confuse a lot more than it may help.

Here are the precedence rules I have settled on, from highest to lowest precedence:

Atomic

'true', 'false', constants

function calls

variables

'(' expression ')'

Multiply/Divide

INT * INT

INT / INT

DURATION * REAL

Add/Subtract

STRING + STRING

INT +/- INT

TIME +/- DURATION

TIME - TIME

DURATION +/- DURATION

Comparisons

'==', '!=', '<', '>', '~' and '!~'

string existence check (-> BOOL)

Boolean not
'!'
Boolean and
'&&'
Boolean or
'||'

Input and feedback most welcome!

Until next time,

Poul-Henning, 2010-09-21

Previous topic

How GZIP, and GZIP+ESI works in Varnish

Next topic

IPv6 Suckage

This Page

varnish-4.1.1/doc/html/phk/autocrap.html0000644000201500234410000001745512652366773015140 00000000000000 Did you call them autocrap tools ? — Varnish version 4.1.1 documentation

Did you call them autocrap tools ?¶

Yes, in fact I did, because they are the worst possible non-solution to a self-inflicted problem.

Back in the 1980'ies, the numerous mini- and micro-computer companies all jumped on the UNIX band-wagon, because it gave them an operating system for their hardware, but they also tried to "distinguish" themselves from the competitors, by "adding value".

That "value" was incompatibility.

You never knew where they put stuff, what arguments the compiler needed to behave sensibly, or for that matter, if there were a compiler to begin with.

So some deranged imagination, came up with the idea of the configure script, which sniffed at your system and set up a Makefile that would work.

Writing configure scripts was hard work, for one thing you needed a ton of different systems to test them on, so copy&paste became the order of the day.

Then some even more deranged imagination, came up with the idea of writing a script for writing configure scripts, and in an amazing and daring attempt at the "all time most deranged" crown, used an obscure and insufferable macro-processor called m4 for the implementation.

Now, as it transpires, writing the specification for the configure producing macros was tedious, so somebody wrote a tool to...

...do you detect the pattern here ?

Now, if the result of all this crap, was that I could write my source-code and tell a tool where the files were, and not only assume, but actually trust that things would just work out, then I could live with it.

But as it transpires, that is not the case. For one thing, all the autocrap tools add another layer of version-madness you need to get right before you can even think about compiling the source code.

Second, it doesn't actually work, you still have to do the hard work and figure out the right way to explain to the autocrap tools what you are trying to do and how to do it, only you have to do so in a language which is used to produce M4 macro invocations etc. etc.

In the meantime, the UNIX diversity has shrunk from 50+ significantly different dialects to just a handful: Linux, *BSD, Solaris and AIX and the autocrap tools have become part of the portability problem, rather than part of the solution.

Amongst the silly activities of the autocrap generated configure script in Varnish are:

  • Looks for ANSI-C header files (show me a system later than 1995 without them ?)
  • Existence and support for POSIX mandated symlinks, (which are not used by Varnish btw.)
  • Tests, 19 different ways, that the compiler is not a relic from SYS III days. (Find me just one SYS III running computer with an ethernet interface ?)
  • Checks if the ISO-C and POSIX mandated cos() function exists in libm (No, I have no idea either...)

&c. &c. &c.

Some day when I have the time, I will rip out all the autocrap stuff and replace it with a 5 line shellscript that calls uname -s.

Poul-Henning, 2010-04-20

Previous topic

What were they thinking ?

Next topic

Why Sphinx and reStructuredText ?

This Page

varnish-4.1.1/doc/html/phk/persistent.html0000644000201500234410000002050612652366773015511 00000000000000 A persistent message — Varnish version 4.1.1 documentation

A persistent message¶

This message is about -spersistent and why you should not use it, even though it is still present in Varnish 4.x.

TL;DR:¶

Under narrow and ill defined circumstances, -spersistent works well, but in general it is more trouble than it is worth for you to run it, and we don't presently have the development resources to fix that.

If you think you have these circumstances, you need to specify

-sdeprecated_persistent

in order to use it.

The long story¶

When we added -spersistent, to Varnish, it was in response to, and sponsored by a specific set of customers who really wanted this.

A persistent storage module is an entirely different kettle of vax than a non-persistent module, because of all the ugly consistency issues it raises.

Let me give you an example.

Imagine a cluster of some Varnish servers on which bans are used.

Without persistent storage, if one of them goes down and comes back up, all the old cached objects are gone, and so are, by definition all the banned objects.

With persistent storage, we not only have to store the still live bans with the cached objects, and keep the two painfully in sync, so the bans gets revived with the objects, we also have to worry about missing bans during the downtime, since those might ban objects we will recover on startup.

Ouch: Straight into database/filesystem consistency territory.

But we knew that, and I thought I had a good strategy to deal with this.

And in a sense I did.

Varnish has the advantage over databases and filesystems that we can actually loose objects without it being a catastrophy. It would be better if we didn't, but we can simply ditch stuff which doesn't look consistent and we'll be safe.

The strategy was to do a "Log Structured Filesystem", a once promising concept which soon proved very troublesome to implement well.

Interestingly, today the ARM chip in your SSD most likely implements a LFS for wear-levelling, but with a vastly reduced feature set: All "files" are one sector long, filenames are integers and there are no subdirectories or rename operations. On the other hand, there is extra book-keeping about the state of the flash array.

A LFS consists of two major components: The bit that reads and writes, which is pretty trivial, and the bit which makes space available which isn't.

Initially we didn't even do the second part, because in varnish objects expire, and provided they do so fast enough, the space will magically make itself available. This worked well enough for our initial users, and they only used bans sporadically so that was cool too.

In other words, a classic 20% effort, 80% benefit.

Unfortunately we have not been able to find time and money for the other 80% effort which gives the last 20% benefit, and therefor -spersistent has ended up in limbo.

Today we decided to officially deprecate -spersistent, and start warning people against using it, but we will leave it in the source code for now, in order to keep the interfaces necessary for a persistent storage working, in the hope that we will get to use them again later.

So you can still use persistent storage, if you really want to, and if you know what you're doing, by using:

-sdeprecated_persistent

You've been warned.

Poul-Henning, 2014-05-26

Table Of Contents

Previous topic

SSL revisited

Next topic

Raking in the dough on Free and Open Source Software

This Page

varnish-4.1.1/doc/html/phk/three-zero.html0000644000201500234410000001607212652366773015400 00000000000000 Thoughts on the eve of Varnish 3.0 — Varnish version 4.1.1 documentation

Thoughts on the eve of Varnish 3.0¶

Five years ago, I was busy transforming my pile of random doddles on 5mm squared paper into software, according to "git log" working on the first stevedores.

In two weeks I will be attending the Varnish 3.0 release party in Oslo.

Sometimes I feel that development of Varnish takes for ever and ever, and that it must be like watching paint dry for the users, but 3 major releases in 5 years is actually not too shabby come to think of it.

Varnish 3.0 "only" has two big new features, VMOD and GZIP, and a host of smaller changes, which you will notice if they are new features, and not notice if they are bug fixes.

GZIP will probably be most important to the ESI users, and I wonder if all the time I spent fiddling bits in the middle of compressed data pays off, or if the concept of patchwork-quilting GZIP files was a bad idea from end to other.

VMODs on the other hand, was an instant success, because they make it much easier for people to extend Varnish with new functionality, and I know of several VMODs in the pipeline which will make it possible to do all sorts of wonderful things from VCL.

All in all, I feel happy about the 3.0 release, and I hope the users will too.

We are not finished of course, ideas and patches for Varnish 4.0 are already starting to pile up, and hopefully we can get that into a sensible shape 18 months from now, late 2012-ish.

"Life is what happens to you while you're busy making other plans"

said John Lennon, a famous murder victim from New York.

I feel a similar irony in the way Varnish happened to me:

My homepage is written in raw HTML using the vi(1) editor, runs on a book-sized Soekris NET5501 computer, averages 50 hits a day with an Alexa rank just north of the 3.5 million mark. A normal server with Varnish could deliver all traffic my webserver has ever delivered, in less than a second.

But varnish-cache.org has Alexa rank around 30.000, "varnish cache" shows a nice trend on Google and #varnish confuses the heck out of teenage girls and wood workers on Twitter, so clearly I am doing something right.

I still worry about the The Fraud Police though, "I have no idea what I'm doing, and I totally make shit up as I go along." is a disturbingly precise summary of how I feel about my work in Varnish.

The Varnish 3.0 release is therefore dedicated to all the kind Varnish developers and users, who have tested, reported bugs, suggested ideas and generally put up with me and my bumbling ways for these past five years.

Much appreciated,

Poul-Henning, 2011-06-02

Previous topic

The Tools We Work With

Next topic

Why no SSL ?

This Page

varnish-4.1.1/doc/html/phk/ssl.html0000644000201500234410000001627712652366773014124 00000000000000 Why no SSL ? — Varnish version 4.1.1 documentation

Why no SSL ?¶

This is turning into a bit of a FAQ, but the answer is too big to fit in the margin we use for those.

There are a number of reasons why there are no plans in sight that will grow SSL support in Varnish.

First, I have yet to see a SSL library where the source code is not a nightmare.

As I am writing this, the varnish source-code tree contains 82.595 lines of .c and .h files, including JEmalloc (12.236 lines) and Zlib (12.344 lines).

OpenSSL, as imported into FreeBSD, is 340.722 lines of code, nine times larger than the Varnish source code, 27 times larger than each of Zlib or JEmalloc.

This should give you some indication of how insanely complex the canonical implementation of SSL is.

Second, it is not exactly the best source-code in the world. Even if I have no idea what it does, there are many aspect of it that scares me.

Take this example in a comment, randomly found in s3-srvr.c:

/* Throw away what we have done so far in the current handshake,
 * which will now be aborted. (A full SSL_clear would be too much.)
 * I hope that tmp.dh is the only thing that may need to be cleared
 * when a handshake is not completed ... */

I hope they know what they are doing, but this comment doesn't exactly carry that point home, does it ?

But let us assume that a good SSL library can be found, what would Varnish do with it ?

We would terminate SSL sessions, and we would burn CPU cycles doing that. You can kiss the highly optimized delivery path in Varnish goodbye for SSL, we cannot simply tell the kernel to put the bytes on the socket, rather, we have to corkscrew the data through the SSL library and then write it to the socket.

Will that be significantly different, performance wise, from running a SSL proxy in separate process ?

No, it will not, because the way varnish would have to do it would be to ... start a separate process to do the SSL handling.

There is no other way we can guarantee that secret krypto-bits do not leak anywhere they should not, than by fencing in the code that deals with them in a child process, so the bulk of varnish never gets anywhere near the certificates, not even during a core-dump.

Would I be able to write a better stand-alone SSL proxy process than the many which already exists ?

Probably not, unless I also write my own SSL implementation library, including support for hardware crypto engines and the works.

That is not one of the things I dreamt about doing as a kid and if I dream about it now I call it a nightmare.

So the balance sheet, as far as I can see it, lists "It would be a bit easier to configure" on the plus side, and everything else piles up on the minus side, making it a huge waste of time and effort to even think about it..

Poul-Henning, 2011-02-15

Previous topic

Thoughts on the eve of Varnish 3.0

Next topic

How GZIP, and GZIP+ESI works in Varnish

This Page

varnish-4.1.1/doc/html/phk/thoughts.html0000644000201500234410000001337612652366773015165 00000000000000 What were they thinking ? — Varnish version 4.1.1 documentation

What were they thinking ?¶

The reason I try to write these notes is the chinese wall.

Ever since I first saw it on a school-book map, I have been wondering what the decision making process were like.

We would like to think that the emperor asked for ideas, and that advisors came up with analyses, budgets, cost/benefit calculations and project plans for various proposals, and that the emperor applied his wisdom to choose the better idea.

But it could also be, that The Assistant to The Deputy Viceminister of Northern Affairs, edged in sideways, at a carefully chosen time where the emperor looked relaxed and friendly, and sort of happend to mention that 50 villages had been sort of raided by the barbarians, hoping for the reply, which would not be a career opportunity for The Assistant to The Assistant to The Deputy Viceminister of Northern Affairs.

And likely as not, the emperor absentmindedly grunted "Why don't you just build a wall to keep them out or something ?" probably wondering about the competence of an administration, which could not figure out to build palisades around border villages without bothering him and causing a monument to the Peter Principle and Parkinssons Law to be built, which can be seen from orbit, and possibly from the moon, if you bring your binoculars.

If somebody had written some notes, we might have known.

Poul-Henning, 2010-05-28

Previous topic

Security barriers in Varnish

Next topic

Did you call them autocrap tools ?

This Page

varnish-4.1.1/doc/html/phk/ssl_again.html0000644000201500234410000002734112652366773015255 00000000000000 SSL revisited — Varnish version 4.1.1 documentation

SSL revisited¶

Four years ago, I wrote a rant about why Varnish has no SSL support (Why no SSL ?) and the upcoming 4.1 release is good excuse to revisit that issue.

A SSL/TLS library¶

In 2011 I critized OpenSSL's source-code as being a nightmare, and as much as I Hate To Say I Told You So, I Told You So: See also "HeartBleed".

The good news is that HeartBleed made people realize that FOSS maintainers also have mortgages and hungry kids.

Various initiatives have been launched to make prevent critical infrastructure software from being maintained sunday evening between 11 and 12PM by a sleep-deprived and overworked parent, worried about about being able to pay the bills come the next month.

We're not there yet, but it's certainly getting better.

However, implementing TLS and SSL is stil insanely complex, and thanks to Edward Snowdens whistle-blowing, we have very good reasons to belive that didn't happen by accident.

The issue of finding a good TLS/SSL implementation is still the same and I still don't see one I would want my name associated with.

OpenBSD's LibreSSL is certainly a step in a right direction, but time will show if it is viable in the long run -- they do have a tendency to be -- "SQUIRREL!!" -- distracted.

Handling Certificates¶

I still don't see a way to do that. The Varnish worker-process is not built to compartementalize bits at a cryptographic level and making it do that would be a non-trivial undertaking.

But there is new loop-hole here. One night, waiting for my flight home in Oslo airport, I went though the entire TLS/SSL handshake process to see if there were anything one could do, and I realized that you can actually terminate TLS/SSL without holding the certificate, provided you can ask some process which does to do a tiny bit of work.

The next morning CloudFlare announced the very same thing:

This could conceivably be a way to terminate TLS/SSL in the Varnish-worker process, while keeping the most valuable crypto-bits away from it.

But it's still a bad idea¶

As I write this, the news that apps with 350 million downloads in total are (still) vulnerable to some SSL/TLS Man-In-The-Middle attack is doing the rounds.

Code is hard, crypto code is double-plus-hard, if not double-squared-hard, and the world really don't need another piece of code that does an half-assed job at cryptography.

If I, or somebody else, were to implement SSL/TLS in Varnish, it would talk at least half a year to bring the code to a point where I would be willing to show it to the world.

Until I get my time-machine working, that half year would be taken away of other Varnish development, so the result had better be worth it: If it isn't, we have just increased the total attack-surface and bug-probability for no better reason than "me too!".

When I look at something like Willy Tarreau's HAProxy I have a hard time to see any significant opportunity for improvement.

Conclusion¶

No, Varnish still won't add SSL/TLS support.

Instead in Varnish 4.1 we have added support for Willys PROXY protocol which makes it possible to communicate the extra details from a SSL-terminating proxy, such as HAProxy, to Varnish.

From a security point of view, this is also much better solution than having SSL/TLS integrated in Varnish.

When (not if!) the SSL/TLS proxy you picked is compromised by a possibly planted software bug, you can pick another one to replace it, without loosing all the benefits of Varnish.

That idea is called the "Software Tools Principle", it's a very old idea, but it is still one of the best we have.

Political PostScript¶

I realize that the above is a pretty strange stance to take in the current "SSL Everywhere" political climate.

I'm not too thrilled about the "SSL Everywhere" idea, for a large number of reasons.

The most obvious example is that you don't want to bog down your country's civil defence agency with SSL/TLS protocol negotiations, if their website is being deluged by people trying to survive a natural disaster.

The next big issue is that there are people who do not have a right to privacy. In many countries this includes children, prisoners, stock-traders, flight-controllers, first responders and so on.

SSL Everywhere will force institutions to either block any internet connectivity or impose Man-in-The-Middle proxies to comply with legal requirements of logging and inspection. A clear step in the wrong direction in my view.

But one of the biggest problem I have with SSL Everywhere is that it gives privacy to the actors I think deserve it the least.

Again and again shady behaviour of big transnational, and therefore law-less, companies have been exposed by security researchers (or just interested lay-people) who ran tcpdump. snort or similar traffic capture programs and saw what went on.

Remember all the different kind of "magic cookies" used to track users across the web, against their wish and against laws and regulations ?

Pretty much all of those were exposed with trivial packet traces.

With SSL Everywhere, these actors get much more privacy to invade the privacy of every human being with an internet connection, because it takes a lot more skill to look into a SSL connection than a plaintext HTTP connection.

"Sunshine is said to be the best of disinfectantants" wrote supreme court justice Brandeis, SSL Everywhere puts all traffic in the shade.

Poul-Henning, 2015-04-28

Table Of Contents

Previous topic

Brinch-Hansens Arrows

Next topic

A persistent message

This Page

varnish-4.1.1/doc/html/phk/gzip.html0000644000201500234410000002657312652366773014274 00000000000000 How GZIP, and GZIP+ESI works in Varnish — Varnish version 4.1.1 documentation

How GZIP, and GZIP+ESI works in Varnish¶

First of all, everything you read about GZIP here, is controlled by the parameter:

http_gzip_support

Which defaults to "on" if you do not want Varnish to try to be smart about compression, set it to "off" instead.

What does http_gzip_support do¶

A request which is sent into 'pipe' or 'pass' mode from vcl_recv{} will not experience any difference, this processing only affects cache hit/miss requests.

Unless vcl_recv{} results in "pipe" or "pass", we determine if the client is capable of receiving gzip'ed content. The test amounts to:

Is there a Accept-Encoding header that mentions gzip, and if is has a q=# number, is it larger than zero.

Clients which can do gzip, gets their header rewritten to:

Accept-Encoding: gzip

And clients which do not support gzip gets their Accept-Encoding header removed. This ensures conformity with respect to creating Vary: strings during object creation.

During lookup, we ignore any "Accept-encoding" in objects Vary: strings, to avoid having a gzip and gunzip'ed version of the object, varnish can gunzip on demand. (We implement this bit of magic at lookup time, so that any objects stored in persistent storage can be used with or without gzip support enabled.)

Varnish will not do any other types of compressions than gzip, in particular we will not do deflate, as there are browser bugs in that case.

Before vcl_miss{} is called, the backend requests Accept-Encoding is always set to:

Accept-Encoding: gzip

Even if this particular client does not support

To always entice the backend into sending us gzip'ed content.

Varnish will not gzip any content on its own (but see below), we trust the backend to know what content can be sensibly gzip'ed (html) and what can not (jpeg)

If in vcl_backend_response{} we find out that we are trying to deliver a gzip'ed object to a client that has not indicated willingness to receive gzip, we will ungzip the object during deliver.

Tuning, tweaking and frobbing¶

In vcl_recv{} you have a chance to modify the client's Accept-Encoding: header before anything else happens.

In vcl_pass{} the clients Accept-Encoding header is copied to the backend request unchanged. Even if the client does not support gzip, you can force the A-C header to "gzip" to save bandwidth between the backend and varnish, varnish will gunzip the object before delivering to the client.

In vcl_miss{} you can remove the "Accept-Encoding: gzip" header, if you do not want the backend to gzip this object.

In vcl_backend_response{} two new variables allow you to modify the gzip-ness of objects during fetch:

set beresp.do_gunzip = true;

Will make varnish gunzip an already gzip'ed object from the backend during fetch. (I have no idea why/when you would use this...)

set beresp.do_gzip = true;

Will make varnish gzip the object during fetch from the backend, provided the backend didn't send us a gzip'ed object.

Remember that a lot of content types cannot sensibly be gziped, most notably compressed image formats like jpeg, png and similar, so a typical use would be:

sub vcl_backend_response {
        if (bereq.url ~ "html$") {
                set beresp.do_gzip = true;
        }
}

GZIP and ESI¶

First, note the new syntax for activating ESI:

sub vcl_backend_response {
        set beresp.do_esi = true;
}

In theory, and hopefully in practice, all you read above should apply also when you enable ESI, if not it is a bug you should report.

But things are vastly more complicated now. What happens for instance, when the backend sends a gzip'ed object we ESI process it and it includes another object which is not gzip'ed, and we want to send the result gziped to the client ?

Things can get really hairy here, so let me explain it in stages.

Assume we have a ungzipped object we want to ESI process.

The ESI parser will run through the object looking for the various magic strings and produce a byte-stream we call the "VEC" for Varnish ESI Codes.

The VEC contains instructions like "skip 234 bytes", "deliver 12919 bytes", "include /foobar", "deliver 122 bytes" etc and it is stored with the object.

When we deliver an object, and it has a VEC, special esi-delivery code interprets the VEC string and sends the output to the client as ordered.

When the VEC says "include /foobar" we do what amounts to a restart with the new URL and possibly Host: header, and call vcl_recv{} etc. You can tell that you are in an ESI include by examining the 'req.esi_level' variable in VCL.

The ESI-parsed object is stored gzip'ed under the same conditions as above: If the backend sends gzip'ed and VCL did not ask for do_gunzip, or if the backend sends ungzip'ed and VCL asked for do_gzip.

Please note that since we need to insert flush and reset points in the gzip file, it will be slightly larger than a normal gzip file of the same object.

When we encounter gzip'ed include objects which should not be, we gunzip them, but when we encounter gunzip'ed objects which should be, we gzip them, but only at compression level zero.

So in order to avoid unnecessary work, and in order to get maximum compression efficiency, you should:

sub vcl_miss {
        if (object needs ESI processing) {
                unset req.http.accept-encoding;
        }
}

sub vcl_backend_response {
        if (object needs ESI processing) {
                set beresp.do_esi = true;
                set beresp.do_gzip = true;
        }
}

So that the backend sends these objects uncompressed to varnish.

You should also attempt to make sure that all objects which are esi:included are gziped, either by making the backend do it or by making varnish do it.

Table Of Contents

Previous topic

Why no SSL ?

Next topic

VCL Expressions

This Page

varnish-4.1.1/doc/html/phk/dough.html0000644000201500234410000004211512652366773014417 00000000000000 Raking in the dough on Free and Open Source Software — Varnish version 4.1.1 documentation

Raking in the dough on Free and Open Source Software¶

I'm writing this on the third day after the "Heartbleed" bug in OpenSSL devasted internet security, and while I have been very critical of the OpenSSL source code since I first saw it, I have nothing but admiration for the OpenSSL crew and their effort.

In particular considering what they're paid for it.

Inspired by an article in Wall Street Journal which tangentially touches on the lack of funding for OpenSSL development, I have decided to write up my own experiences with funding Open Source Software development in some detail.

I've been in the software industry for 30 years now, and I have made a living more or less directly from Open Source Software for the most recent 15 years.

Sometimes the money came from helping a customer use Open Source Software, some times I wrote the Open Source Software for their needs and sometimes, as with the Varnish Moral License I get paid to develop and maintain Open Source Software for the greater common good.

FreeBSD community funding¶

My first crowd-funding of Free and Open Source Software, was in 2004, where I solicited the FreeBSD community for money, so that I could devote three to six months of my time to the FreeBSD disk-I/O subsystem.

At that time I had spent 10 years as one of the central and key FreeBSD developers, so there were no question about my ability or suitability for the task at hand.

But in 2004 crowd-funding was not yet "in", and I had to figure out how to do it myself.

My parents brought me up to think that finances is a private matter but I concluded that the only way you could ask strangers to throw money at you, would be to run an open book, where they could see what happened to them, so I did open books.

My next dilemma was about my rate, again I had always perceived my rate to be a private matter between me and my customers.

My rate is about half of what most people expect -- because I wont work for most people: I only work on things I really care about.

One of my worries therefore were that publishing my rate would undercut friends and colleagues in the FreeBSD project who made a living consulting.

But again, there were no way around it, so I published my rate but made every attempt to distinguish it from a consulting rate, and I never heard any complaints.

And so, having agonized over the exact text and sounded it off on a couple of close friends in the FreeBSD project, I threw the proposal out there -- and wondered what would happen next.

I had a perfectly safe fall-back plan, you have to when you have two kids and a mortgage to feed, but I really had no idea what would happen.

Worst case, I'd cause the mother of all bikesheds get thrown out of the FreeBSD project, and be denounced for my "ideological impurity" with respect to Free and Open Source Software.

Best case, I expected to get maybe one or two months funded.

The FreeBSD community responded overwhelmingly, my company has never sent as many invoices as it did in 2004, and my accountant nearly blew a fuse.

And suddenly I found myself in a situation I had never even considered how to handle: How to stop people from sending me money.

I had simply set up a PayPal account, (more on that in a bit), and at least at that time, there were no way to prevent people from dropping money into it, no matter how much you wanted to stop them.

In the end I managed to yell loud enough and only got overfunded a few percent, and I belive that my attempt to deflect the surplus to the FreeBSD Foundation gave them a little boost that year.

So about PayPal: The first thing they did was to shut my account, and demand all kinds of papers to be faxed to them, including a copy of my passport, despite the fact that Danish law was quite clear on that being illegal. Then, as now, their dispute resolution process was less than user-friendly, and in the end it took an appeal to a high-ranking officer in PayPal and quite a bit of time to actually get the money people had donated.

I swore to myself that next time, if there ever came a next time, PayPal would not be involved. Besides, I found their fees quite excessive.

In total I made EUR27K, and it kept my kids fed and my bank happy for the six months I worked on it.

And work I did.

I've never had a harsher boss than those six months, and it surprised me how much it stressed me, because I felt like I was working on a stage, with the entire FreeBSD project in audience, wondering if I were going to deliver the goods or not.

As a result, the 187 donors certainly got their moneys worth, most of that half year I worked 80 hour weeks, which made me decide not to continue, despite many donors indicating that they were perfectly willing to fund several more months.

Varnish community funding¶

Five years later, having developed Varnish 1.0 for Norways "Verdens Gang" newspaper, I decided to give community funding a go again.

Wiser from experience, I structured the Varnish Moral License to tackle the issues which had caused me grief the first time around:

Contact first, then send money, not the other way around, and also a focus on fewer larger sponsors, rather than people sending me EUR10 or USD15 or even, in one case, the EUR1 which happened to linger in his PayPal Account.

I ran even more open books this time, on the VML webpages you can see how many hours and a one-line description of what I did in them, for every single day I've been working under the VML since 2010.

I also decided to be honest with myself and my donors, one hour of work was one hour of work -- nobody would benefit from me dying from stress.

In practice it doesn't quite work like that, there are plenty of thinking in the shower, emails and IRC answers at all hours of the day and a lot of "just checking a detail" that happens off the clock, because I like my job, and nothing could stop me anyway.

In each of 2010, 2011 and 2013 I worked around 950 hours work on Varnish, funded by the community.

In 2012 I only worked 589 hours, because I was building a prototype computer cluster to do adaptive optics real-time calculations for the ESO Extremely Large Telescope ("ELT") -- There was no way I could say no to that contract :-)

In 2014 I actually have hours available do even more Varnish work, and I have done so in the ramp up to the 4.0.0 release, but despite my not so subtle hints, the current outlook is still only for 800 hours to be funded, but I'm crossing my fingers that more sponsors will appear now that V4 is released. (Nudge, nudge, wink, wink, he said knowingly! :-)

Why Free and Open Source costs money¶

Varnish is about 90.000 lines of code, the VML brings in about EUR90K a year, and that means that Varnish has me working and caring about issues big and small.

Not that I am satisfied with our level of effort, we should have much better documentation, our wish-list of features is far too long and we take too long to close tickets.

But I'm not going to complain, because the Heartbleed vulnerability revealed that even though OpenSSL is about three to five times larger in terms of code, the OpenSSL Foundation Inc. took in only about EUR700K last year.

And most of that EUR700K was for consulting and certification, not for "free-range" development and maintenance of the OpenSSL source code base so badly needs.

I really hope that the Heartbleed vulnerability helps bring home the message to other communities, that Free and Open Source Software does not materialize out of empty space, it is written by people.

People who love what we do, which is why I'm sitting here, way past midnight on a friday evening, writing this pamphlet.

But software is written by people, real people with kids, cars, mortgages, leaky roofs, sick pets, infirm parents and all other kinds of perfectly normal worries of an adult human being.

The best way to improve the quality of Free and Open Source Software, is to make it possible for these people to spend time on it.

They need time to review submissions carefully, time to write and run test-cases, time to respond and fix to bug-reports, time to code and most of all, time to think about the code.

But it would not even be close to morally defensible to ask these people to forego time to play with their kids, so that they instead develop and maintain the software that drives other peoples companies.

The right way to go -- the moral way to go -- and by far the most productive way to go, is to pay the developers so they can make the software they love their living.

How to fund Free and Open Source Software¶

One way is to hire them, with the understanding that they spend some company time on the software.

Experience has shown that these people almost invariably have highly desirable brains which employers love to throw at all sorts of interesting problems, which tends to erode the "donated" company time.

But a lot of Free and Open Source Software has been, and still is developed and maintained this way, with or without written agreements or even knowledge of this being the case.

Another way is for software projects to set up foundations to collect money and hire developers. This is a relatively complex thing to do, and it will only be available for larger projects.

The Apache Foundation "adopts" smaller projects inside their field of interest, and I belive that works OK, but I'm not sure if it can easily be transplanted to different topics.

The final way is to simply throw money a the developers, the way the FreeBSD and Varnish communities have done with me.

It is a far more flexible solution with respect to level of engangement, national boundaries etc. etc, but in many ways it demands more from both sides of the deal, in particular with respect to paperwork, taxes and so on.

Conclusion¶

I am obiously biased, I derive a large fraction of my relatively modest income from community funding, for which I am the Varnish community deeply grateful.

But biased as I may be, I belive that the Varnish community and I has shown that a tiny investment goes a long way in Free and Open Source Software.

I hope to see that mutual benefit spread to other communities and projects, not just to OpenSSL and not just because they found a really bad bug the other day, but to any community around any piece of software which does serious work for serious companies.

Thanks in advance,

Poul-Henning, 2014-04-11

varnish-4.1.1/doc/html/phk/brinch-hansens-arrows.html0000644000201500234410000001532412652366773017530 00000000000000 Brinch-Hansens Arrows — Varnish version 4.1.1 documentation

Brinch-Hansens Arrows¶

As you may have noticed, I am a bit of a IT-history nerd, and we do have some rather important early IT history in Denmark.

If you have a solid CS background, you have undoubtedly heard about both dining philosophers and Brinch-Hansens work in multiprogramming.

Multiprogramming is fundamentally hard, because you cannot have one thread holding lock A trying to get lock B, while another holds lock B trying to get lock A.

Brinch-Hansen did a lot of both theoretical and practical work in the area of multiprogramming and being both good at it and one of the pioneers, he was awarded the ACM Turing Prize for it.

You can read more about him here: Brinch-Hansen Archive

Along the way he came up with a trivial and practical way to guarantee that a given multiprogramming system was free of deadlocks: Draw the locking order and make sure all the arrows point to the right.

When we started working with multi-core systems in FreeBSD, we were sure to have deadlocks in our future, and we adopted and expanded a facility called "WITNESS" originally written for BSDI, which keeps an eye on Brinch-Hansens arrows in real time.

Historically I have been pretty good at avoiding deadlocks, it seems to come natural to me to think about locking order, but not everybody feels that way about them, and WITNESS have caught a lot of "Ohh, didn't think about that" situations over the years.

It is no accident that Varnish has a very simple locking structure, but as we add more and more flexibility and extensibility to Varnish it grows a little here and there, and I managed to introduce a lock-order reversal the other day - my first in about five years I think.

Since I'm obviously getting old and slipping up here, I though it was about time I carried out the Brinch-Hansen check on Varnish.

I briefly pondered porting WITNESS into Varnish, but it's 3k lines and we have extremely good code coverage in our regression tests so I decided to KISS and do it as post-processing.

I have added default-off debug code to emit VSL "Witness" records, taught varnishtest how to enable that code, and added a small python script to process the records into a nice plot:

And yo and behold: All the arrows point to the right.

phk

Previous topic

Poul-Hennings random outbursts

Next topic

SSL revisited

This Page

varnish-4.1.1/doc/html/phk/spdy.html0000644000201500234410000003013412652366773014266 00000000000000 What SPDY did to my summer vacation — Varnish version 4.1.1 documentation

What SPDY did to my summer vacation¶

It's dawning on me that I'm sort of the hipster of hipsters, in the sense that I tend to do things far before other people do, but totally fail to communicate what's going on out there in the future, and thus by the time the "real hipsters" catch up, I'm already somewhere different and more interesting.

My one lucky break was the bikeshed email where I actually did sit down and compose some of my thoughts, thus firmly sticking a stick in the ground as one of the first to seriously think about how you organize open source collaborations.

I mention this because what I am going to write probably seems very unimportant for most of the Varnish users right now, but down the road, three, five or maybe even ten years ahead, I think it will become important.

Feel free to not read it until then.

The evolution of Varnish¶

When we started out, seven years ago, our only and entire goal was to build a server-side cache better than squid. That we did.

Since then we have added stuff to Varnish (ESI:includes, gzip support, VMODS) and I'm staring at streaming and conditional backend fetches right now.

Varnish is a bit more than a web-cache now, but it is still, basically, a layer of polish you put in front of your webserver to get it to look and work better.

Google's experiments with SPDY have forced a HTTP/2.0 effort into motion, but if past performance is any indication, that is not something we have to really worry about for a number of years. The IETF WG has still to manage to "clarify" RFC2616 which defines HTTP/1.1, and to say there is anything even remotely resembling consensus behind SPDY would be a downright lie.

RFC2616 is from June 1999, which, to me, means that we should look at 2035 when we design HTTP/2.0, and predicting things is well known to be hard, in particular with respect to the future.

So what's a Varnish architect to do?

What I did this summer vacation, was to think a lot about how Varnish can be architected to cope with the kind of changes SPDY and maybe HTTP/2.0 drag in: Pipelining, multiplexing, etc., without committing us to one particular path of science fiction about life in 2035.

Profound insights often sound incredibly simplistic, bordering trivial, until you consider the full ramifications. The implementation of "Do Not Kill" in current law is surprisingly voluminous. (If you don't think so, you probably forgot to #include the Vienna Treaty and the convention about chemical and biological weapons.)

So my insight about Varnish, that it has to become a socket-wrench-like toolchest for doing things with HTTP traffic, will probably elicit a lot of "duh!" reactions, until people, including me, understand the ramifications more fully.

Things you cannot do with Varnish today¶

As much as Varnish can be bent, tweaked and coaxed into doing today, there are things you cannot do, or at least things which are very hard and very inefficient to do with Varnish.

For instance we consider "a transaction" something that starts with a request from a client, and involves zero or more backend fetches of finite sized data elements.

That is not how the future looks.

For instance one of the things SPDY has tried out is "server push", where you fetch index.html and the webserver says "you'll also want main.css and cat.gif then" and pushes those objects on the client, to save the round-trip times wasted waiting for the client to ask for them.

Today, something like that is impossible in Varnish, since objects are independent and you can only look up one at a time.

I already can hear some of you amazing VCL wizards say "Well, if you inline-C grab a refcount, then restart and ..." but let's be honest, that's not how it should look.

You should be able to do something like:

if (req.proto == "SPDY" && req.url ~ "index.html") {
        req.obj1 = lookup(backend1, "/main.css")
        if (req.obj1.status == 200) {
                sess.push(req.obj1, bla, bla, bla);
        }
        req.obj2 = lookup(backend1, "/cat.gif")
        if (req.obj1.status == 200) {
                sess.push(req.obj2, bla, bla, bla);
        }
}

And doing that is not really that hard, I think. We just need to keep track of all the objects we instantiate and make sure they disappear and die when nobody is using them any more.

A lot of the assumptions we made back in 2006 are no longer valid under such an architecture, but those same assumptions are what gives Varnish such astonishing performance, so just replacing them with standard CS-textbook solutions like "garbage collection" would make Varnish lose a lot of its lustre.

As some of you know, there is a lot of modularity hidden inside Varnish but not quite released for public use in VCL. Much of what is going to happen will be polishing up and documenting that modularity and releasing it for you guys to have fun with, so it is not like we are starting from scratch or anything.

But some of that modularity stands on foundations which are no longer firm; for instance, the initiating request exists for the full duration of a backend fetch.

Those will take some work to fix.

But, before you start to think I have a grand plan or even a clear-cut road map, I'd better make it absolutely clear that is not the case: I perceive some weird shapes in the fog of the future and I'll aim in that direction and either they are the doorways I suspect or they are trapdoors to tar-pits, time will show.

I'm going to be making a lot of changes and things that used to be will no longer be as they used to be, but I think they will be better in the long run, so please bear with me, if your favourite detail of how Varnish works changes.

Varnish is not speedy, Varnish is fast!¶

As I said I'm not a fan of SPDY and I sincerely hope that no bit of the current proposal survives unchallenged in whatever HTTP/2.0 standard emerges down the road.

But I do want to thank the people behind that mess, not for the mess, but for having provoked me to spend some summertime thinking hard about what it is that I'm trying to do with Varnish and what problem Varnish is here to solve.

This is going to be FUN!

Poul-Henning 2012-09-14

Author of Varnish

PS: See you at VUG6 where I plan to talk more about this.

varnish-4.1.1/doc/html/phk/sphinx.html0000644000201500234410000001753612652366773014633 00000000000000 Why Sphinx and reStructuredText ? — Varnish version 4.1.1 documentation

Why Sphinx and reStructuredText ?¶

The first school of thought on documentation, is the one we subscribe to in Varnish right now: "Documentation schmocumentation..." It does not work for anybody.

The second school is the "Write a {La}TeX document" school, where the documentation is seen as a stand alone product, which is produced independently. This works great for PDF output, and sucks royally for HTML and TXT output.

The third school is the "Literate programming" school, which abandons readability of both the program source code and the documentation source, which seems to be one of the best access protections one can put on the source code of either.

The fourth school is the "DoxyGen" school, which lets a program collect a mindless list of hyperlinked variable, procedure, class and filenames, and call that "documentation".

And the fifth school is anything that uses a fileformat that cannot be put into a version control system, because it is binary and non-diff'able. It doesn't matter if it is OpenOffice, LyX or Word, a non-diffable doc source is a no go with programmers.

Quite frankly, none of these works very well in practice.

One of the very central issues, is that writing documentation must not become a big and clear context-switch from programming. That precludes special graphical editors, browser-based (wiki!) formats etc.

Yes, if you write documentation for half your workday, that works, but if you write code most of your workday, that does not work. Trust me on this, I have 25 years of experience avoiding using such tools.

I found one project which has thought radically about the problem, and their reasoning is interesting, and quite attractive to me:

  1. TXT files are the lingua franca of computers, even if you are logged with TELNET using IP over Avian Carriers (Which is more widespread in Norway than you would think) you can read documentation in a .TXT format.
  2. TXT is the most restrictive typographical format, so rather than trying to neuter a high-level format into .TXT, it is smarter to make the .TXT the source, and reinterpret it structurally into the more capable formats.

In other words: we are talking about the ReStructuredText of the Python project, as wrapped by the Sphinx project.

Unless there is something I have totally failed to spot, that is going to be the new documentation platform in Varnish.

Take a peek at the Python docs, and try pressing the "show source" link at the bottom of the left menu:

(link to random python doc page:)

Dependency wise, that means you can edit docs with no special tools, you need python+docutils+sphinx to format HTML and a LaTex (pdflatex ?) to produce PDFs, something I only expect to happen on the project server on a regular basis.

I can live with that, I might even rewrite the VCC scripts from Tcl to Python in that case.

Poul-Henning, 2010-04-11

Previous topic

Did you call them autocrap tools ?

Next topic

Varnish Glossary

This Page

varnish-4.1.1/doc/html/_sources/0000755000201500234410000000000012652366773013540 500000000000000varnish-4.1.1/doc/html/_sources/phk/0000755000201500234410000000000012652366773014322 500000000000000varnish-4.1.1/doc/html/_sources/phk/wanton_destruction.txt0000644000201500234410000000631312652366773020737 00000000000000.. _phk_wanton: ======================================= Wanton destruction for the greater good ======================================= We live in an old house, and it's all wrong for us. When I bought this house, it was perfect, or at least perfect enough. But times have changed. I have no small kids anymore, and rather than just right for two kids to tumble in, the garden is now too small for all the flowers we want. And the rooms are not where we want them, there are too many stairs in all the wrong places, and the kitchen needs to be torn out and a new built. I'm sure that some other family will be able to fall in love with this house, the way we did, but there is no realistic way to rebuild it, to become the house we want now. For one thing, doing major surgery on a house while you live in it is double-minus-fun and it always slows the rebuild project down when you have to keep at least one toilet working and sanitary and be able to cook and sleep on the building site. So we'll be building a new house on a plot of land on the other side of the road, one of the coming years, a house which is right for us, and then we will sell this old house, to a family with small children, who will love it, and rip out the old funky kitchen and make a new one before they move in. One would think that software would be nothing like an old house, but they are more alike than most people imagine. Using a major piece of software, is like moving into a house: You need to adapt your life and the house or the software to each other, since nothing is ever quite perfect, there will be limitations. And those limitations affect how you think: If you live in a 2 bedroom apartment, you won't even be considering inviting 80 guests to a party. A lot of Varnish-users have taken time to figure out how Varnish fits into their lives and made the compromises necessary to make it work, and once you've done that, you moved on to other problems, but the limitations of Varnish keeps affecting how you think about your website, even if you don't realize this. Well, I've got news for you: You'll be moving into a new house in the next couple of years, it'll be called Varnish V4 and that means that you will have to decide who gets which room and where to store the towels and grandmothers old china, all over again. I'm sure you'll hate me for it, "Why do we have to move ?", "It really wasn't that bad after all" and so on and so forth. But if I do my job right, that will soon turn into "Ohh, that's pretty neat, I always wanted one of those..." and "Hey... Watch me do THIS!" etc. I could have started with a fresh GIT repository, to make it clear that what is happening right now is the construction of an entirely new house, but software isn't built from physical objects, so I don't need to do that: You can keep using Varnish, while I rebuild it, and thanks to the wonder of bits, you won't see a trace of dirt or dust while it happens. So don't be alarmed by the wanton destruction you will see in -trunk the coming weeks, it is not destroying the Varnish you are using for your website today, it is building the new one you will be using in the future. And it's going to be perfect for you, at least for some years... Poul-Henning, 2013-03-18 varnish-4.1.1/doc/html/_sources/phk/brinch-hansens-arrows.txt0000644000201500234410000000453612652366773021230 00000000000000.. _phk_brinch_hansens_arrows: ===================== Brinch-Hansens Arrows ===================== As you may have noticed, I am a bit of a IT-history nerd, and we do have some rather important early IT history in Denmark. If you have a solid CS background, you have undoubtedly heard about both dining philosophers and Brinch-Hansens work in multiprogramming. Multiprogramming is fundamentally hard, because you cannot have one thread holding lock A trying to get lock B, while another holds lock B trying to get lock A. Brinch-Hansen did a lot of both theoretical and practical work in the area of multiprogramming and being both good at it and one of the pioneers, he was awarded the ACM Turing Prize for it. You can read more about him here: `Brinch-Hansen Archive `_ Along the way he came up with a trivial and practical way to guarantee that a given multiprogramming system was free of deadlocks: Draw the locking order and make sure all the arrows point to the right. When we started working with multi-core systems in FreeBSD, we were sure to have deadlocks in our future, and we adopted and expanded a facility called "WITNESS" originally written for BSDI, which keeps an eye on Brinch-Hansens arrows in real time. Historically I have been pretty good at avoiding deadlocks, it seems to come natural to me to think about locking order, but not everybody feels that way about them, and WITNESS have caught a lot of "Ohh, didn't think about *that*" situations over the years. It is no accident that Varnish has a very simple locking structure, but as we add more and more flexibility and extensibility to Varnish it grows a little here and there, and I managed to introduce a lock-order reversal the other day - my first in about five years I think. Since I'm obviously getting old and slipping up here, I though it was about time I carried out the Brinch-Hansen check on Varnish. I briefly pondered porting WITNESS into Varnish, but it's 3k lines and we have extremely good code coverage in our regression tests so I decided to KISS and do it as post-processing. I have added default-off debug code to emit VSL "Witness" records, taught varnishtest how to enable that code, and added a small python script to process the records into a nice plot: .. image:: brinch_hansens_arrows_1.svg And yo and behold: All the arrows point to the right. *phk* varnish-4.1.1/doc/html/_sources/phk/ssl.txt0000644000201500234410000000537112652366773015612 00000000000000.. _phk_ssl: ============ Why no SSL ? ============ This is turning into a bit of a FAQ, but the answer is too big to fit in the margin we use for those. There are a number of reasons why there are no plans in sight that will grow SSL support in Varnish. First, I have yet to see a SSL library where the source code is not a nightmare. As I am writing this, the varnish source-code tree contains 82.595 lines of .c and .h files, including JEmalloc (12.236 lines) and Zlib (12.344 lines). OpenSSL, as imported into FreeBSD, is 340.722 lines of code, nine times larger than the Varnish source code, 27 times larger than each of Zlib or JEmalloc. This should give you some indication of how insanely complex the canonical implementation of SSL is. Second, it is not exactly the best source-code in the world. Even if I have no idea what it does, there are many aspect of it that scares me. Take this example in a comment, randomly found in s3-srvr.c:: /* Throw away what we have done so far in the current handshake, * which will now be aborted. (A full SSL_clear would be too much.) * I hope that tmp.dh is the only thing that may need to be cleared * when a handshake is not completed ... */ I hope they know what they are doing, but this comment doesn't exactly carry that point home, does it ? But let us assume that a good SSL library can be found, what would Varnish do with it ? We would terminate SSL sessions, and we would burn CPU cycles doing that. You can kiss the highly optimized delivery path in Varnish goodbye for SSL, we cannot simply tell the kernel to put the bytes on the socket, rather, we have to corkscrew the data through the SSL library and then write it to the socket. Will that be significantly different, performance wise, from running a SSL proxy in separate process ? No, it will not, because the way varnish would have to do it would be to ... start a separate process to do the SSL handling. There is no other way we can guarantee that secret krypto-bits do not leak anywhere they should not, than by fencing in the code that deals with them in a child process, so the bulk of varnish never gets anywhere near the certificates, not even during a core-dump. Would I be able to write a better stand-alone SSL proxy process than the many which already exists ? Probably not, unless I also write my own SSL implementation library, including support for hardware crypto engines and the works. That is not one of the things I dreamt about doing as a kid and if I dream about it now I call it a nightmare. So the balance sheet, as far as I can see it, lists "It would be a bit easier to configure" on the plus side, and everything else piles up on the minus side, making it a huge waste of time and effort to even think about it.. Poul-Henning, 2011-02-15 varnish-4.1.1/doc/html/_sources/phk/persistent.txt0000644000201500234410000000645012652366773017210 00000000000000.. _phk_pesistent: ==================== A persistent message ==================== This message is about -spersistent and why you should not use it, even though it is still present in Varnish 4.x. TL;DR: ------ Under narrow and ill defined circumstances, -spersistent works well, but in general it is more trouble than it is worth for you to run it, and we don't presently have the development resources to fix that. If you think you have these circumstances, you need to specify -sdeprecated_persistent in order to use it. The long story -------------- When we added -spersistent, to Varnish, it was in response to, and sponsored by a specific set of customers who really wanted this. A persistent storage module is an entirely different kettle of vax than a non-persistent module, because of all the ugly consistency issues it raises. Let me give you an example. Imagine a cluster of some Varnish servers on which bans are used. Without persistent storage, if one of them goes down and comes back up, all the old cached objects are gone, and so are, by definition all the banned objects. With persistent storage, we not only have to store the still live bans with the cached objects, and keep the two painfully in sync, so the bans gets revived with the objects, we also have to worry about missing bans during the downtime, since those might ban objects we will recover on startup. Ouch: Straight into database/filesystem consistency territory. But we knew that, and I thought I had a good strategy to deal with this. And in a sense I did. Varnish has the advantage over databases and filesystems that we can actually loose objects without it being a catastrophy. It would be better if we didn't, but we can simply ditch stuff which doesn't look consistent and we'll be safe. The strategy was to do a "Log Structured Filesystem", a once promising concept which soon proved very troublesome to implement well. Interestingly, today the ARM chip in your SSD most likely implements a LFS for wear-levelling, but with a vastly reduced feature set: All "files" are one sector long, filenames are integers and there are no subdirectories or rename operations. On the other hand, there is extra book-keeping about the state of the flash array. A LFS consists of two major components: The bit that reads and writes, which is pretty trivial, and the bit which makes space available which isn't. Initially we didn't even do the second part, because in varnish objects expire, and provided they do so fast enough, the space will magically make itself available. This worked well enough for our initial users, and they only used bans sporadically so that was cool too. In other words, a classic 20% effort, 80% benefit. Unfortunately we have not been able to find time and money for the other 80% effort which gives the last 20% benefit, and therefor -spersistent has ended up in limbo. Today we decided to officially deprecate -spersistent, and start warning people against using it, but we will leave it in the source code for now, in order to keep the interfaces necessary for a persistent storage working, in the hope that we will get to use them again later. So you can still use persistent storage, if you really want to, and if you know what you're doing, by using: -sdeprecated_persistent You've been warned. Poul-Henning, 2014-05-26 varnish-4.1.1/doc/html/_sources/phk/autocrap.txt0000644000201500234410000000577412652366773016636 00000000000000.. _phk_autocrap: ==================================== Did you call them *autocrap* tools ? ==================================== Yes, in fact I did, because they are the worst possible non-solution to a self-inflicted problem. Back in the 1980'ies, the numerous mini- and micro-computer companies all jumped on the UNIX band-wagon, because it gave them an operating system for their hardware, but they also tried to "distinguish" themselves from the competitors, by "adding value". That "value" was incompatibility. You never knew where they put stuff, what arguments the compiler needed to behave sensibly, or for that matter, if there were a compiler to begin with. So some deranged imagination, came up with the idea of the ``configure`` script, which sniffed at your system and set up a ``Makefile`` that would work. Writing configure scripts was hard work, for one thing you needed a ton of different systems to test them on, so copy&paste became the order of the day. Then some even more deranged imagination, came up with the idea of writing a script for writing configure scripts, and in an amazing and daring attempt at the "all time most deranged" crown, used an obscure and insufferable macro-processor called ``m4`` for the implementation. Now, as it transpires, writing the specification for the configure producing macros was tedious, so somebody wrote a tool to... ...do you detect the pattern here ? Now, if the result of all this crap, was that I could write my source-code and tell a tool where the files were, and not only assume, but actually *trust* that things would just work out, then I could live with it. But as it transpires, that is not the case. For one thing, all the autocrap tools add another layer of version-madness you need to get right before you can even think about compiling the source code. Second, it doesn't actually work, you still have to do the hard work and figure out the right way to explain to the autocrap tools what you are trying to do and how to do it, only you have to do so in a language which is used to produce M4 macro invocations etc. etc. In the meantime, the UNIX diversity has shrunk from 50+ significantly different dialects to just a handful: Linux, \*BSD, Solaris and AIX and the autocrap tools have become part of the portability problem, rather than part of the solution. Amongst the silly activities of the autocrap generated configure script in Varnish are: * Looks for ANSI-C header files (show me a system later than 1995 without them ?) * Existence and support for POSIX mandated symlinks, (which are not used by Varnish btw.) * Tests, 19 different ways, that the compiler is not a relic from SYS III days. (Find me just one SYS III running computer with an ethernet interface ?) * Checks if the ISO-C and POSIX mandated ``cos()`` function exists in ``libm`` (No, I have no idea either...) &c. &c. &c. Some day when I have the time, I will rip out all the autocrap stuff and replace it with a 5 line shellscript that calls ``uname -s``. Poul-Henning, 2010-04-20 varnish-4.1.1/doc/html/_sources/phk/backends.txt0000644000201500234410000001021312652366773016552 00000000000000.. _phk_backends: =============================== What do you mean by 'backend' ? =============================== Given that we are approaching Varnish 3.0, you would think I had this question answered conclusively long time ago, but once you try to be efficient, things get hairy fast. One of the features of Varnish we are very fundamental about, is the ability to have multiple VCLs loaded at the same time, and to switch between them instantly and seamlessly. So imagine you have 1000 backends in your VCL, not an unreasonable number, each configured with health-polling. Now you fiddle your vcl_recv{} a bit and load the VCL again, but since you are not sure which is the best way to do it, you keep both VCL's loaded so you can switch forth and back seamlessly. To switch seamlessly, the health status of each backend needs to be up to date the instant we switch to the other VCL. This basically means that either all VCLs poll all their backends, or they must share, somehow. We can dismiss the all VCLs poll all their backends scenario, because it scales truly horribly, and would pummel backends with probes if people forget to vcl.discard their old dusty VCLs. Share And Enjoy =============== In addition to health-status (including the saint-list), we also want to share cached open connections and stats counters. It would be truly stupid to close 100 ready and usable connections to a backend, and open 100 other, just because we switch to a different VCL that has an identical backend definition. But what is an identical backend definition in this context? It is important to remember that we are not talking physical backends: For instance, there is nothing preventing a VCL for having the same physical backend declared as 4 different VCL backends. The most obvious thing to do, is to use the VCL name of the backend as identifier, but that is not enough. We can have two different VCLs where backend "b1" points at two different physical machines, for instance when we migrate or upgrade the backend. The identity of the state than can be shared is therefore the triplet: {VCL-name, IPv4+port, IPv6+port} No Information without Representation ===================================== Since the health-status will be for each of these triplets, we will need to find a way to represent them in CLI and statistics contexts. As long as we just print them out, that is not a big deal, but what if you just want the health status for one of your 1000 backends, how do you tell which one ? The syntax-nazi way of doing that, is forcing people to type it all every time:: backend.health b1(127.0.0.1:8080,[::1]:8080) That will surely not be a hit with people who have just one backend. I think, but until I implement I will not commit to, that the solution is a wildcard-ish scheme, where you can write things like:: b1 # The one and only backend b1 or error b1() # All backends named b1 b1(127.0.0.1) # All b1s on IPv4 lookback b1(:8080) # All b1s on port 8080, (IPv4 or IPv6) b1(192.168.60.1,192.168.60.2) # All b1s on one of those addresses. (Input very much welcome) The final question is if we use shortcut notation for output from :ref:`varnishd(1)`, and the answer is no, because we do not want the stats-counters to change name because we load another VCL and suddenly need disabiguation. Sharing Health Status ===================== To avoid the over-polling, we define that maximum one VCL polls at backend at any time, and the active VCL gets preference. It is not important which particular VCL polls the backends not in the active VCL, as long as one of them do. Implementation ============== The poll-policy can be implemented by updating a back-pointer to the poll-specification for all backends on vcl.use execution. On vcl.discard, if this vcl was the active poller, it needs to walk the list of vcls and substitute another. If the list is empty the backend gets retired anyway. We should either park a thread on each backend, or have a poller thread which throws jobs into the work-pool as the backends needs polled. The pattern matching is confined to CLI and possibly libvarnishapi I think this will work, Until next time, Poul-Henning, 2010-08-09 varnish-4.1.1/doc/html/_sources/phk/ipv6suckage.txt0000644000201500234410000000445512652366773017242 00000000000000.. _phk_ipv6suckage: ============ IPv6 Suckage ============ In my drawer full of cassette tapes, is a 6 tape collection published by Carl Malamuds "Internet Talk Radio", the first and by far the geekiest radio station on the internet. The tapes are from 1994 and the topic is "IPng", the IPv4 replacement that eventually became IPv6. To say that I am a bit jaded about IPv6 by now, is accusing the pope of being religious. IPv4 addresses in numeric form, are written as 192.168.0.1 and to not confuse IPv6 with IPv4, it was decided in RFC1884 that IPv6 would use colons and groups of 16 bits, and because 128 bits are a lot of bits, the secret '::' trick was introduced, to supress all the zero bits that we may not ever need anyway: 1080::8:800:200C:417A Colon was chosen because it was already used in MAC/ethernet addresses and did no damage there and it is not a troublesome metacharacter in shells. No worries. Most protocols have a Well Known Service number, TELNET is 23, SSH is 22 and HTTP is 80 so usually people will only have to care about the IP number. Except when they don't, for instance when they run more than one webserver on the same machine. No worries, says the power that controls what URLs look like, we will just stick the port number after the IP# with a colon: http://192.168.0.1:8080/... That obviously does not work with IPv6, so RFC3986 comes around and says "darn, we didn't think of that" and puts the IPV6 address in [...] giving us: http://[1080::8:800:200C:417A]:8080/ Remember that "harmless in shells" detail ? Yeah, sorry about that. Now, there are also a RFC sanctioned API for translating a socket address into an ascii string, getnameinfo(), and if you tell it that you want a numeric return, you get a numeric return, and you don't even need to know if it is a IPv4 or IPv6 address in the first place. But it returns the IP# in one buffer and the port number in another, so if you want to format the sockaddr in the by RFC5952 recommended way (the same as RFC3986), you need to inspect the version field in the sockaddr to see if you should do "%s:%s", host, port or "[%s]:%s", host, port Careless standardization costs code, have I mentioned this before ? Varnish reports socket addresses as two fields: IP space PORT, now you know why. Until next time, Poul-Henning, 2010-08-24 varnish-4.1.1/doc/html/_sources/phk/sphinx.txt0000644000201500234410000000612312652366773016316 00000000000000.. _phk_sphinx: =================================== Why Sphinx_ and reStructuredText_ ? =================================== The first school of thought on documentation, is the one we subscribe to in Varnish right now: "Documentation schmocumentation..." It does not work for anybody. The second school is the "Write a {La}TeX document" school, where the documentation is seen as a stand alone product, which is produced independently. This works great for PDF output, and sucks royally for HTML and TXT output. The third school is the "Literate programming" school, which abandons readability of *both* the program source code *and* the documentation source, which seems to be one of the best access protections one can put on the source code of either. The fourth school is the "DoxyGen" school, which lets a program collect a mindless list of hyperlinked variable, procedure, class and filenames, and call that "documentation". And the fifth school is anything that uses a fileformat that cannot be put into a version control system, because it is binary and non-diff'able. It doesn't matter if it is OpenOffice, LyX or Word, a non-diffable doc source is a no go with programmers. Quite frankly, none of these works very well in practice. One of the very central issues, is that writing documentation must not become a big and clear context-switch from programming. That precludes special graphical editors, browser-based (wiki!) formats etc. Yes, if you write documentation for half your workday, that works, but if you write code most of your workday, that does not work. Trust me on this, I have 25 years of experience avoiding using such tools. I found one project which has thought radically about the problem, and their reasoning is interesting, and quite attractive to me: #. TXT files are the lingua franca of computers, even if you are logged with TELNET using IP over Avian Carriers (Which is more widespread in Norway than you would think) you can read documentation in a .TXT format. #. TXT is the most restrictive typographical format, so rather than trying to neuter a high-level format into .TXT, it is smarter to make the .TXT the source, and reinterpret it structurally into the more capable formats. In other words: we are talking about the ReStructuredText_ of the Python project, as wrapped by the Sphinx_ project. Unless there is something I have totally failed to spot, that is going to be the new documentation platform in Varnish. Take a peek at the Python docs, and try pressing the "show source" link at the bottom of the left menu: (link to random python doc page:) https://docs.python.org/py3k/reference/expressions.html Dependency wise, that means you can edit docs with no special tools, you need python+docutils+sphinx to format HTML and a LaTex (pdflatex ?) to produce PDFs, something I only expect to happen on the project server on a regular basis. I can live with that, I might even rewrite the VCC scripts from Tcl to Python in that case. Poul-Henning, 2010-04-11 .. _Sphinx: http://sphinx.pocoo.org/ .. _reStructuredText: http://docutils.sourceforge.net/rst.html varnish-4.1.1/doc/html/_sources/phk/dough.txt0000644000201500234410000002545312652366773016122 00000000000000.. _phk_dough: ==================================================== Raking in the dough on Free and Open Source Software ==================================================== I'm writing this on the third day after the "Heartbleed" bug in OpenSSL devasted internet security, and while I have been very critical of the OpenSSL source code since I first saw it, I have nothing but admiration for the OpenSSL crew and their effort. In particular considering what they're paid for it. Inspired by an article in `Wall Street Journal`_ which tangentially touches on the lack of funding for OpenSSL development, I have decided to write up my own experiences with funding Open Source Software development in some detail. I've been in the software industry for 30 years now, and I have made a living more or less directly from Open Source Software for the most recent 15 years. Sometimes the money came from helping a customer use Open Source Software, some times I wrote the Open Source Software for their needs and sometimes, as with the `Varnish Moral License`_ I get paid to develop and maintain Open Source Software for the greater common good. FreeBSD community funding ========================= My first crowd-funding of Free and Open Source Software, was in 2004, where I `solicited the FreeBSD community`_ for money, so that I could devote three to six months of my time to the FreeBSD disk-I/O subsystem. At that time I had spent 10 years as one of the central and key FreeBSD developers, so there were no question about my ability or suitability for the task at hand. But in 2004 crowd-funding was not yet "in", and I had to figure out how to do it myself. My parents brought me up to think that finances is a private matter but I concluded that the only way you could ask strangers to throw money at you, would be to run an open book, where they could see what happened to them, so I did open books. My next dilemma was about my rate, again I had always perceived my rate to be a private matter between me and my customers. My rate is about half of what most people expect -- because I wont work for most people: I only work on things I really *care* about. One of my worries therefore were that publishing my rate would undercut friends and colleagues in the FreeBSD project who made a living consulting. But again, there were no way around it, so I published my rate but made every attempt to distinguish it from a consulting rate, and I never heard any complaints. And so, having agonized over the exact text and sounded it off on a couple of close friends in the FreeBSD project, I threw the proposal out there -- and wondered what would happen next. I had a perfectly safe fall-back plan, you have to when you have two kids and a mortgage to feed, but I really had no idea what would happen. Worst case, I'd cause the mother of all `bikesheds`_ get thrown out of the FreeBSD project, and be denounced for my "ideological impurity" with respect to Free and Open Source Software. Best case, I expected to get maybe one or two months funded. The FreeBSD community responded overwhelmingly, my company has never sent as many invoices as it did in 2004, and my accountant nearly blew a fuse. And suddenly I found myself in a situation I had never even considered how to handle: How to stop people from sending me money. I had simply set up a PayPal account, (more on that in a bit), and at least at that time, there were no way to prevent people from dropping money into it, no matter how much you wanted to stop them. In the end I managed to yell loud enough and only got overfunded a few percent, and I belive that my attempt to deflect the surplus to the FreeBSD Foundation gave them a little boost that year. So about PayPal: The first thing they did was to shut my account, and demand all kinds of papers to be faxed to them, including a copy of my passport, despite the fact that Danish law was quite clear on that being illegal. Then, as now, their dispute resolution process was less than user-friendly, and in the end it took an appeal to a high-ranking officer in PayPal and quite a bit of time to actually get the money people had donated. I swore to myself that next time, if there ever came a next time, PayPal would not be involved. Besides, I found their fees quite excessive. In total I made EUR27K, and it kept my kids fed and my bank happy for the six months I worked on it. And work I did. I've never had a harsher boss than those six months, and it surprised me how much it stressed me, because I felt like I was working on a stage, with the entire FreeBSD project in audience, wondering if I were going to deliver the goods or not. As a result, the 187 donors certainly got their moneys worth, most of that half year I worked 80 hour weeks, which made me decide not to continue, despite many donors indicating that they were perfectly willing to fund several more months. Varnish community funding ========================= Five years later, having developed Varnish 1.0 for Norways "Verdens Gang" newspaper, I decided to give community funding a go again. Wiser from experience, I structured the `Varnish Moral License`_ to tackle the issues which had caused me grief the first time around: Contact first, then send money, not the other way around, and also a focus on fewer larger sponsors, rather than people sending me EUR10 or USD15 or even, in one case, the EUR1 which happened to linger in his PayPal Account. I ran even more open books this time, on the VML webpages you can see how many hours and a one-line description of what I did in them, for every single day I've been working under the VML since 2010. I also decided to be honest with myself and my donors, one hour of work was one hour of work -- nobody would benefit from me dying from stress. In practice it doesn't quite work like that, there are plenty of thinking in the shower, emails and IRC answers at all hours of the day and a lot of "just checking a detail" that happens off the clock, because I like my job, and nothing could stop me anyway. In each of 2010, 2011 and 2013 I worked around 950 hours work on Varnish, funded by the community. In 2012 I only worked 589 hours, because I was building a prototype computer cluster to do adaptive optics real-time calculations for the ESO `Extremely Large Telescope`_ ("ELT") -- There was no way I could say no to that contract :-) In 2014 I actually have hours available do even more Varnish work, and I have done so in the ramp up to the 4.0.0 release, but despite my not so subtle hints, the current outlook is still only for 800 hours to be funded, but I'm crossing my fingers that more sponsors will appear now that V4 is released. (Nudge, nudge, wink, wink, he said knowingly! :-) Why Free and Open Source costs money ==================================== Varnish is about 90.000 lines of code, the VML brings in about EUR90K a year, and that means that Varnish has me working and caring about issues big and small. Not that I am satisfied with our level of effort, we should have much better documentation, our wish-list of features is far too long and we take too long to close tickets. But I'm not going to complain, because the Heartbleed vulnerability revealed that even though OpenSSL is about three to five times larger in terms of code, the OpenSSL Foundation Inc. took in only about EUR700K last year. And most of that EUR700K was for consulting and certification, not for "free-range" development and maintenance of the OpenSSL source code base so badly needs. I really hope that the Heartbleed vulnerability helps bring home the message to other communities, that Free and Open Source Software does not materialize out of empty space, it is written by people. People who love what we do, which is why I'm sitting here, way past midnight on a friday evening, writing this pamphlet. But software *is* written by people, real people with kids, cars, mortgages, leaky roofs, sick pets, infirm parents and all other kinds of perfectly normal worries of an adult human being. The best way to improve the quality of Free and Open Source Software, is to make it possible for these people to spend time on it. They need time to review submissions carefully, time to write and run test-cases, time to respond and fix to bug-reports, time to code and most of all, time to think about the code. But it would not even be close to morally defensible to ask these people to forego time to play with their kids, so that they instead develop and maintain the software that drives other peoples companies. The right way to go -- the moral way to go -- and by far the most productive way to go, is to pay the developers so they can make the software they love their living. How to fund Free and Open Source Software ========================================= One way is to hire them, with the understanding that they spend some company time on the software. Experience has shown that these people almost invariably have highly desirable brains which employers love to throw at all sorts of interesting problems, which tends to erode the "donated" company time. But a lot of Free and Open Source Software has been, and still is developed and maintained this way, with or without written agreements or even knowledge of this being the case. Another way is for software projects to set up foundations to collect money and hire developers. This is a relatively complex thing to do, and it will only be available for larger projects. The Apache Foundation "adopts" smaller projects inside their field of interest, and I belive that works OK, but I'm not sure if it can easily be transplanted to different topics. The final way is to simply throw money a the developers, the way the FreeBSD and Varnish communities have done with me. It is a far more flexible solution with respect to level of engangement, national boundaries etc. etc, but in many ways it demands more from both sides of the deal, in particular with respect to paperwork, taxes and so on. Conclusion ========== I am obiously biased, I derive a large fraction of my relatively modest income from community funding, for which I am the Varnish community deeply grateful. But biased as I may be, I belive that the Varnish community and I has shown that a tiny investment goes a long way in Free and Open Source Software. I hope to see that mutual benefit spread to other communities and projects, not just to OpenSSL and not just because they found a really bad bug the other day, but to any community around any piece of software which does serious work for serious companies. Thanks in advance, Poul-Henning, 2014-04-11 .. _Wall Street Journal: http://online.wsj.com/news/articles/SB10001424052702303873604579491350251315132 .. _Varnish Moral License: http://phk.freebsd.dk/VML .. _solicited the FreeBSD community: https://people.freebsd.org/~phk/funding.html .. _Extremely Large Telescope: http://www.eso.org/public/teles-instr/e-elt/ .. _bikesheds: http://bikeshed.org/ varnish-4.1.1/doc/html/_sources/phk/ssl_again.txt0000644000201500234410000001350212652366773016744 00000000000000.. _phk_ssl_again: ============= SSL revisited ============= Four years ago, I wrote a rant about why Varnish has no SSL support (:ref:`phk_ssl`) and the upcoming 4.1 release is good excuse to revisit that issue. A SSL/TLS library ~~~~~~~~~~~~~~~~~ In 2011 I critized OpenSSL's source-code as being a nightmare, and as much as I Hate To Say I Told You So, I Told You So: See also "HeartBleed". The good news is that HeartBleed made people realize that FOSS maintainers also have mortgages and hungry kids. Various initiatives have been launched to make prevent critical infrastructure software from being maintained sunday evening between 11 and 12PM by a sleep-deprived and overworked parent, worried about about being able to pay the bills come the next month. We're not there yet, but it's certainly getting better. However, implementing TLS and SSL is stil insanely complex, and thanks to Edward Snowdens whistle-blowing, we have very good reasons to belive that didn't happen by accident. The issue of finding a good TLS/SSL implementation is still the same and I still don't see one I would want my name associated with. OpenBSD's LibreSSL is certainly a step in a right direction, but time will show if it is viable in the long run -- they do have a tendency to be -- "SQUIRREL!!" -- distracted. Handling Certificates ~~~~~~~~~~~~~~~~~~~~~ I still don't see a way to do that. The Varnish worker-process is not built to compartementalize bits at a cryptographic level and making it do that would be a non-trivial undertaking. But there is new loop-hole here. One night, waiting for my flight home in Oslo airport, I went though the entire TLS/SSL handshake process to see if there were anything one could do, and I realized that you can actually terminate TLS/SSL without holding the certificate, provided you can ask some process which does to do a tiny bit of work. The next morning `CloudFlare announced the very same thing`_: .. _CloudFlare announced the very same thing: https://blog.cloudflare.com/keyless-ssl-the-nitty-gritty-technical-details/ This could conceivably be a way to terminate TLS/SSL in the Varnish-worker process, while keeping the most valuable crypto-bits away from it. But it's still a bad idea ~~~~~~~~~~~~~~~~~~~~~~~~~ As I write this, the news that `apps with 350 million downloads`_ in total are (still) vulnerable to some SSL/TLS Man-In-The-Middle attack is doing the rounds. .. _apps with 350 million downloads: http://arstechnica.com/security/2015/04/27/android-apps-still-suffer-game-over-https-defects-7-months-later/ Code is hard, crypto code is double-plus-hard, if not double-squared-hard, and the world really don't need another piece of code that does an half-assed job at cryptography. If I, or somebody else, were to implement SSL/TLS in Varnish, it would talk at least half a year to bring the code to a point where I would be willing to show it to the world. Until I get my time-machine working, that half year would be taken away of other Varnish development, so the result had better be worth it: If it isn't, we have just increased the total attack-surface and bug-probability for no better reason than "me too!". When I look at something like Willy Tarreau's `HAProxy`_ I have a hard time to see any significant opportunity for improvement. .. _HAProxy: http://www.haproxy.org/ Conclusion ~~~~~~~~~~ No, Varnish still won't add SSL/TLS support. Instead in Varnish 4.1 we have added support for Willys `PROXY`_ protocol which makes it possible to communicate the extra details from a SSL-terminating proxy, such as `HAProxy`_, to Varnish. .. _PROXY: http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt From a security point of view, this is also much better solution than having SSL/TLS integrated in Varnish. When (not if!) the SSL/TLS proxy you picked is compromised by a possibly planted software bug, you can pick another one to replace it, without loosing all the benefits of Varnish. That idea is called the "Software Tools Principle", it's a very old idea, but it is still one of the best we have. Political PostScript ~~~~~~~~~~~~~~~~~~~~ I realize that the above is a pretty strange stance to take in the current "SSL Everywhere" political climate. I'm not too thrilled about the "SSL Everywhere" idea, for a large number of reasons. The most obvious example is that you don't want to bog down your country's civil defence agency with SSL/TLS protocol negotiations, if their website is being deluged by people trying to survive a natural disaster. The next big issue is that there are people who do not have a right to privacy. In many countries this includes children, prisoners, stock-traders, flight-controllers, first responders and so on. SSL Everywhere will force institutions to either block any internet connectivity or impose Man-in-The-Middle proxies to comply with legal requirements of logging and inspection. A clear step in the wrong direction in my view. But one of the biggest problem I have with SSL Everywhere is that it gives privacy to the actors I think deserve it the least. Again and again shady behaviour of big transnational, and therefore law-less, companies have been exposed by security researchers (or just interested lay-people) who ran tcpdump. snort or similar traffic capture programs and saw what went on. Remember all the different kind of "magic cookies" used to track users across the web, against their wish and against laws and regulations ? Pretty much all of those were exposed with trivial packet traces. With SSL Everywhere, these actors get much more privacy to invade the privacy of every human being with an internet connection, because it takes a lot more skill to look into a SSL connection than a plaintext HTTP connection. "Sunshine is said to be the best of disinfectantants" wrote supreme court justice Brandeis, SSL Everywhere puts all traffic in the shade. Poul-Henning, 2015-04-28 varnish-4.1.1/doc/html/_sources/phk/thetoolsweworkwith.txt0000644000201500234410000001751312652366773021006 00000000000000.. _phk_thetoolsweworkwith: ====================== The Tools We Work With ====================== "Only amateurs were limited by their tools" is an old wisdom, and the world is littered with art and architecture that very much proves this point. But as amazing as the Aquaeduct of Segovia is, tools are the reason why it looks nowhere near as fantastic as the Sydney Opera House. Concrete has been known since antiquity, but steel-reinforced concrete and massive numerical calculations of stress-distribution, is the tools that makes the difference between using concrete as a filler material between stones, and as gravity-defying curved but perfectly safe load-bearing wall. My tool for writing Varnish is the C-language which in many ways is unique amongst all of the computer programming languages for having no ambitions. The C language was invented as a portable assembler language, it doesn't do objects and garbage-collection, it does numbers and pointers, just like your CPU. Compared to the high ambitions, then as now, of new programming languages, that was almost ridiculous unambitious. Other people were trying to make their programming languages provably correct, or safe for multiprogramming and quite an effort went into using natural languages as programming languages. But C was written to write programs, not to research computer science and that's exactly what made it useful and popular. Unfortunately C fell in bad company over the years, and the reason for this outburst is that I just browsed the latest draft from the ISO-C standardisation working-group 14. I won't claim that it is enough to make grown men cry, but it certainly was enough to make me angry. Let me give you an example of their utter sillyness: The book which defined the C langauge had a list af reserved identifiers, all of them lower-case words. The UNIX libraries defined a lot of functions, all of them lower-case words. When compiled, the assembler saw all of these words prefixed with an underscore, which made it easy to mix assembler and C code. All the macros for the C-preprocessor on the other hand, were UPPERCASE, making them easy to spot. Which meant that if you mixed upper and lower case, in your identifiers, you were safe: That wouldn't collide with anything. First the ISO-C standards people got confused about the leading underscore, and I'll leave you guessing as to what the current text actually means: All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use. Feel free to guess, there's more such on pdf page 200 of the draft. Next, they broke the upper/lower rule, by adding special keywords in mixed case, probably because they thought it looked nicer:: _Atomic, _Bool, _Noreturn &c Then, presumably, somebody pointed out that this looked ugly:: void _Noreturn foo(int bar); So they have come up with a #include file called so that instead you can write:: #include void noreturn foo(int bar); The file according to the standard shall have exactly this content:: #define noreturn _Noreturn Are you crying or laughing yet ? You should be. Another thing brought by the new draft is an entirely new thread API, which is incompatible with the POSIX 'pthread' API which have been used for about 20 years now. If they had improved on the shortcomings of the pthreads, I would have cheered them on, because there are some very annoying mistakes in pthreads. But they didn't, in fact, as far as I can tell, the C1X draft's threads are worse than the 20 years older pthreads in all relevant aspects. For instance, neither pthreads nor C1X-threads offer a "assert I'm holding this mutex locked" facility. I will posit that you cannot successfully develop real-world threaded programs and APIs without that, or without wasting a lot of time debugging silly mistakes. If you look in the Varnish source code, which uses pthreads, you will see that I have wrapped pthread mutexes in my own little datastructure, to be able to do those asserts, and to get some usable statistics on lock-contention. Another example where C1X did not improve on pthreads at all, was in timed sleeps, where you say "get me this lock, but give up if it takes longer than X time". The way both pthreads and C1X threads do this, is you specify a UTC wall clock time you want to sleep until. The only problem with that is that UTC wall clock time is not continuous when implemented on a computer, and it may not even be monotonously increasing, since NTPD or other timesync facilites may step the clock backwards, particularly in the first minutes after boot. If the practice of saying "get me this lock before 16:00Z" was widespread, I could see the point, but I have actually never seen that in any source code. What I have seen are wrappers that take the general shape of:: int get_lock_timed(lock, timeout) { while (timeout > 0) { t0 = time(); i = get_lock_before(lock, t + timeout)); if (i == WASLOCKED) return (i); t1 = time(); timeout -= (t1 - t0); } return (TIMEDOUT); } Because it's not like the call is actually guaranteed to return at 16:00Z if you ask it to, you are only promised it will not return later than that, so you have to wrap the call in a loop. Whoever defined the select(2) and poll(2) systemcalls knew better than the POSIX and ISO-C group-think: They specifed a maximum duration for the call, because then it doesn't matter what time it is, only how long time has transpired. Ohh, and setting the stack-size for a new thread ? That is apparently "too dangerous" so there is no argument in the C1X API for doing so, a clear step backwards from pthreads. But guess what: Thread stacks are like T-shirts: There is no "one size fits all." I have no idea what the "danger" they perceived were, my best guess is that feared it might make the API useful ? This single idiocy will single-handedly doom the C1X thread API to uselessness. Now, don't get me wrong: There are lot of ways to improve the C language that would make sense: Bitmaps, defined structure packing (think: communication protocol packets), big/little endian variables (data sharing), sensible handling of linked lists etc. As ugly as it is, even the printf()/scanf() format strings could be improved, by offering a sensible plugin mechanism, which the compiler can understand and use to issue warnings. Heck, even a simple basic object facility would be good addition, now that C++ have become this huge bloated monster language. But none of that is apparently as important as and a new, crippled and therefore useless thread API. The neat thing about the C language, and the one feature that made it so popular, is that not even an ISO-C working group can prevent you from implementing all these things using macros and other tricks. But it would be better to have them in the language, so the compiler could issue sensible warnings and programmers won't have to write monsters like:: #define VTAILQ_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.vtqe_prev = (listelm)->field.vtqe_prev; \ VTAILQ_NEXT((elm), field) = (listelm); \ *(listelm)->field.vtqe_prev = (elm); \ (listelm)->field.vtqe_prev = &VTAILQ_NEXT((elm), field); \ } while (0) To put an element on a linked list. I could go on like this, but it would rapidly become boring for both you and me, because the current C1X draft is 701 pages, and it contains not a single explanatory example if how to use any of the verbiage in practice. Compare this with The C Programming Language, a book of 274 pages which in addition to define the C language, taught people how to program through well-thought-out examples. From where I sit, ISO WG14 are destroying the C language I use and love. Poul-Henning, 2011-12-20 varnish-4.1.1/doc/html/_sources/phk/thoughts.txt0000644000201500234410000000266312652366773016657 00000000000000.. _phk_thoughts: ========================= What were they thinking ? ========================= The reason I try to write these notes is the chinese wall. Ever since I first saw it on a school-book map, I have been wondering what the decision making process were like. We would like to think that the emperor asked for ideas, and that advisors came up with analyses, budgets, cost/benefit calculations and project plans for various proposals, and that the emperor applied his wisdom to choose the better idea. But it could also be, that The Assistant to The Deputy Viceminister of Northern Affairs, edged in sideways, at a carefully chosen time where the emperor looked relaxed and friendly, and sort of happend to mention that 50 villages had been sort of raided by the barbarians, hoping for the reply, which would not be a career opportunity for The Assistant to The Assistant to The Deputy Viceminister of Northern Affairs. And likely as not, the emperor absentmindedly grunted "Why don't you just build a wall to keep them out or something ?" probably wondering about the competence of an administration, which could not figure out to build palisades around border villages without bothering him and causing a monument to the Peter Principle and Parkinssons Law to be built, which can be seen from orbit, and possibly from the moon, if you bring your binoculars. If somebody had written some notes, we might have known. Poul-Henning, 2010-05-28 varnish-4.1.1/doc/html/_sources/phk/three-zero.txt0000644000201500234410000000524012652366773017070 00000000000000.. _phk_3.0: ================================== Thoughts on the eve of Varnish 3.0 ================================== Five years ago, I was busy transforming my pile of random doddles on 5mm squared paper into software, according to "git log" working on the first stevedores. In two weeks I will be attending the Varnish 3.0 release party in Oslo. Sometimes I feel that development of Varnish takes for ever and ever, and that it must be like watching paint dry for the users, but 3 major releases in 5 years is actually not too shabby come to think of it. Varnish 3.0 "only" has two big new features, VMOD and GZIP, and a host of smaller changes, which you will notice if they are new features, and not notice if they are bug fixes. GZIP will probably be most important to the ESI users, and I wonder if all the time I spent fiddling bits in the middle of compressed data pays off, or if the concept of patchwork-quilting GZIP files was a bad idea from end to other. VMODs on the other hand, was an instant success, because they make it much easier for people to extend Varnish with new functionality, and I know of several VMODs in the pipeline which will make it possible to do all sorts of wonderful things from VCL. All in all, I feel happy about the 3.0 release, and I hope the users will too. We are not finished of course, ideas and patches for Varnish 4.0 are already starting to pile up, and hopefully we can get that into a sensible shape 18 months from now, late 2012-ish. "Life is what happens to you while you're busy making other plans" said John Lennon, a famous murder victim from New York. I feel a similar irony in the way Varnish happened to me: My homepage is written in raw HTML using the vi(1) editor, runs on a book-sized Soekris NET5501 computer, averages 50 hits a day with an Alexa rank just north of the 3.5 million mark. A normal server with Varnish could deliver all traffic my webserver has ever delivered, in less than a second. But varnish-cache.org has Alexa rank around 30.000, "varnish cache" shows a nice trend on Google and #varnish confuses the heck out of teenage girls and wood workers on Twitter, so clearly I am doing something right. I still worry about the `The Fraud Police `_ though, "I have no idea what I'm doing, and I totally make shit up as I go along." is a disturbingly precise summary of how I feel about my work in Varnish. The Varnish 3.0 release is therefore dedicated to all the kind Varnish developers and users, who have tested, reported bugs, suggested ideas and generally put up with me and my bumbling ways for these past five years. Much appreciated, Poul-Henning, 2011-06-02 varnish-4.1.1/doc/html/_sources/phk/barriers.txt0000644000201500234410000001344512652366773016623 00000000000000.. _phk_barriers: ============================ Security barriers in Varnish ============================ Security is a very important design driver in Varnish, more likely than not, if you find yourself thinking "Why did he do _that_ ? the answer has to do with security. The Varnish security model is based on some very crude but easy to understand barriers between the various components:: .-->- provides ->---------------------------------------. | | | (ADMIN)--+-->- runs ----->---. | | | | | | |-->- cli_req -->---| v v '--<- cli_resp -<---| VCL MODULE | | | (OPER) | |reads | | | | | |runs | | | | .-<- create -<-. | .->- fork ->-. v | v |->- check -->-|-- MGR --| |-- VCC <- loads -| VSM |-<- write --<-' | '-<- wait -<-' | | TOOLS | | | | ^ | .-------------' | | | | | |writes | |reads | |->- fork ----->-. | | | | |->- cli_req -->-| | | VSM ----' |-<- cli_resp -<-| v | | '-<- wait -----<-| VCL.SO | | | | | | | | | |---->----- inherit --->------|--<-- loads -------' | |---->----- reads ---->------| | '----<----- writes ----<------|--<-- loads --------------------' | | | .--->-- http_req --->--. | .-->-- http_req --->--. (ANON) --| |-- CLD --| |-- (BACKEND) '---<-- http_resp --<--' '--<-- http_resp --<--' (ASCII-ART rules!) The really Important Barrier ============================ The central actor in Varnish is the Manager process, "MGR", which is the process the administrator "(ADMIN)" starts to get web-cache service. Having been there myself, I do not subscribe to the "I feel cool and important when I get woken up at 3AM to restart a dead process" school of thought, in fact, I think that is a clear sign of mindless stupidity: If we cannot get a computer to restart a dead process, why do we even have them ? The task of the Manager process is therefore not cache web content, but to make sure there always is a process which does that, the Child "CLD" process. That is the major barrier in Varnish: All management happens in one process all actual movement of traffic happens in another, and the Manager process does not trust the Child process at all. The Child process is in a the totally unprotected domain: Any computer on the InterNet "(ANON)" can connect to the Child process and ask for some web-object. If John D. Criminal manages to exploit a security hole in Varnish, it is the Child process he subverts. If he carries out a DoS attack, it is the Child process he tries to fell. Therefore the Manager starts the Child with as low priviledge as practically possible, and we close all filedescriptors it should not have access to and so on. There are only three channels of communication back to the Manager process: An exit code, a CLI response or writing stuff into the shared memory file "VSM" used for statistics and logging, all of these are well defended by the Manager process. The Admin/Oper Barrier ====================== If you look at the top left corner of the diagram, you will see that Varnish operates with separate Administrator "(ADMIN)" and Operator "(OPER)" roles. The Administrator does things, changes stuff etc. The Operator keeps an eye on things to make sure they are as they should be. These days Operators are often scripts and data collection tools, and there is no reason to assume they are bugfree, so Varnish does not trust the Operator role, that is a pure one-way relationship. (Trick: If the Child process us run under user "nobody", you can allow marginally trusted operations personel access to the "nobody" account (for instance using .ssh/authorized_keys2), and they will be able to kill the Child process, prompting the Manager process to restart it again with the same parameters and settings.) The Administrator has the final say, and of course, the administrator can decide under which circumstances that authority will be shared. Needless to say, if the system on which Varnish runs is not properly secured, the Administrator's monopoly of control will be compromised. All the other barriers ====================== There are more barriers, you can spot them by following the arrows in the diagram, but they are more sort of "technical" than "political" and generally try to guard against programming flaws as much as security compromise. For instance the VCC compiler runs in a separate child process, to make sure that a memory leak or other flaw in the compiler does not accumulate trouble for the Manager process. Hope this explanation helps understand why Varnish is not just a single process like all other server programs. Poul-Henning, 2010-06-28 varnish-4.1.1/doc/html/_sources/phk/varnish_does_not_hash.txt0000644000201500234410000001207712652366773021361 00000000000000.. _phk_varnish_does_not_hash: ===================== Varnish Does Not Hash ===================== A spate of security advisories related to hash-collisions have made a lot of people stare at Varnish and wonder if it is affected. The answer is no, but the explanation is probably not what most of you expected: Varnish does not hash, at least not by default, and even if it does, it's still as immune to the attacks as can be. To understand what is going on, I have to introduce a concept from Shannon's information theory: "entropy." Entropy is hard to explain, and according to legend, that is exactly why Shannon recycled that term from thermodynamics. In this context, we can get away with thinking about entropy as how much our "keys" differ:: Low entropy (1 bit): /foo/bar/barf/some/cms/content/article?article=2 /foo/bar/barf/some/cms/content/article?article=3 High entropy (65 bits): /i?ee30d0770eb460634e9d5dcfb562a2c5.html /i?bca3633d52607f38a107cb5297fd66e5.html Hashing consists of calculating a hash-index from the key and storing the objects in an array indexed by that key. Typically, but not always, the key is a string and the index is a (smallish) integer, and the job of the hash-function is to squeeze the key into the integer, without losing any of the entropy. Needless to say, the more entropy you have to begin with, the more of it you can afford to lose, and lose some you almost invariably will. There are two families of hash-functions, the fast ones, and the good ones, and the security advisories are about the fast ones. The good ones are slower, but probably not so much slower that you care, and therefore, if you want to fix your web-app: Change:: foo=somedict[$somekey] To:: foo=somedict[md5($somekey)] and forget about the advisories. Yes, that's right: Cryptographic hash algorithms are the good ones, they are built to not throw any entropy away, and they are built to have very hard to predict collisions, which is exactly the problem with the fast hash-functions in the advisories. ----------------- What Varnish Does ----------------- The way to avoid having hash-collisions is to not use a hash: Use a tree instead. There every object has its own place and there are no collisions. Varnish does that, but with a twist. The "keys" in Varnish can be very long; by default they consist of:: sub vcl_hash { hash_data(req.url); if (req.http.host) { hash_data(req.http.host); } else { hash_data(server.ip); } return (hash); } But some users will add cookies, user identification and many other bits and pieces of string in there, and in the end the keys can be kilobytes in length, and quite often, as in the first example above, the first difference may not come until pretty far into the keys. Trees generally need to have a copy of the key around to be able to tell if they have a match, and more importantly to compare tree-leaves in order to "re-balance" the tree and other such arcanae of data structures. This would add another per-object memory load to Varnish, and it would feel particularly silly to store 48 identical characters for each object in the far too common case seen above. But furthermore, we want the tree to be very fast to do lookups in, preferably it should be lockless for lookups, and that means that we cannot (realistically) use any of the "smart" trees which automatically balance themselves, etc. You (generally) don't need a "smart" tree if your keys look like random data in the order they arrive, but we can pretty much expect the opposite as article number 4, 5, 6 etc are added to the CMS in the first example. But we can make the keys look random, and make them small and fixed size at the same time, and the perfect functions designed for just that task are the "good" hash-functions, the cryptographic ones. So what Varnish does is "key-compression": All the strings fed to hash_data() are pushed through a cryptographic hash algorithm called SHA256, which, as the name says, always spits out 256 bits (= 32 bytes), no matter how many bits you feed it. This does not eliminate the key-storage requirement, but now all the keys are 32 bytes and can be put directly into the data structure:: struct objhead { [...] unsigned char digest[DIGEST_LEN]; }; In the example above, the output of SHA256 for the 1 bit difference in entropy becomes:: /foo/bar/barf/some/cms/content/article?article=2 -> 14f0553caa5c796650ec82256e3f111ae2f20020a4b9029f135a01610932054e /foo/bar/barf/some/cms/content/article?article=3 -> 4d45b9544077921575c3c5a2a14c779bff6c4830d1fbafe4bd7e03e5dd93ca05 That should be random enough. But the key-compression does introduce a risk of collisions, since not even SHA256 can guarantee different outputs for all possible inputs: Try pushing all the possible 33-byte files through SHA256 and sooner or later you will get collisions. The risk of collision is very small however, and I can all but promise you, that you will be fully offset in fame and money for any inconvenience a collision might cause, because you will be the first person to find a SHA256 collision. Poul-Henning, 2012-01-03 varnish-4.1.1/doc/html/_sources/phk/platforms.txt0000644000201500234410000000710212652366773017012 00000000000000.. _phk_platforms: ================= Picking platforms ================= Whenever you write Open Source Software, you have to make a choice of what platforms you are going to support. Generally you want to make your program as portable as possible and cover as many platforms, distros and weird computers as possible. But making your program run on everything is hard work very hard work. For instance, did you know that: sizeof(void*) != sizeof(void * const) is legal in a ISO-C compliant environment ? Varnish `runs on a Nokia N900 `_ but I am not going to go out of my way to make sure that is always the case. To make sense for Varnish, a platform has to be able to deliver, both in terms of performance, but also in terms of the APIs we use to get that performance. In the FreeBSD project where I grew up, we ended up instituting platform-tiers, in an effort to document which platforms we cared about and which we did love quite as much. If we did the same for Varnish, the result would look something like: A - Platforms we care about --------------------------- We care about these platforms because our users use them and because they deliver a lot of bang for the buck with Varnish. These platforms are in our "tinderbox" tests, we use them ourselves and they pass all regression tests all the time. Platform specific bug reports gets acted on. *FreeBSD* *Linux* Obviously you can forget about running Varnish on your `WRT54G `_ but if you have a real computer, you can expect Varnish to work "ok or better" on any distro that has a package available. B - Platforms we try not to break --------------------------------- We try not to break these platforms, because they basically work, possibly with some footnotes or minor limitations, and they have an active userbase. We may or may not test on these platforms on a regular basis, or we may rely on contributors to alert us to problems. Platform specific bug reports without patches will likely live a quiet life. *Mac OS/X* *Solaris-decendants* (Oracle Solaris, OmniOS, Joyent SmartOS) Mac OS/X is regarded as a developer platform, not as a production platform. Solaris-decendants are regarded as a production platform. NetBSD, AIX and HP-UX are conceivably candidates for this level, but so far I have not heard much, if any, user interest. C - Platforms we tolerate ------------------------- We tolerate any other platform, as long as the burden of doing so is proportional to the benefit to the Varnish community. Do not file bug reports specific to these platforms without attaching a patch that solves the problem, we will just close it. For now, anything else goes here, certainly the N900 and the WRT54G. I'm afraid I have to put OpenBSD here for now, it is seriously behind on socket APIs and working around those issues is just not worth the effort. If people send us a small non-intrusive patches that makes Varnish run on these platforms, we'll take it. If they send us patches that reorganizes everything, hurts code readability, quality or just generally do not satisfy our taste, they get told that thanks, but no thanks. Is that it ? Abandon all hope etc. ? ------------------------------------- These tiers are not static, if for some reason Varnish suddenly becomes a mandatory accessory to some technically sensible platform, (zOS anyone ?) that platform will get upgraded. If the pessimists are right about Oracles intentions, Solaris may get demoted. Until next time, Poul-Henning, 2010-08-03 Edited Nils, 2014-03-18 with Poul-Hennings concent varnish-4.1.1/doc/html/_sources/phk/gzip.txt0000644000201500234410000001320712652366773015757 00000000000000.. _phk_gzip: ======================================= How GZIP, and GZIP+ESI works in Varnish ======================================= First of all, everything you read about GZIP here, is controlled by the parameter: http_gzip_support Which defaults to "on" if you do not want Varnish to try to be smart about compression, set it to "off" instead. What does http_gzip_support do ------------------------------ A request which is sent into 'pipe' or 'pass' mode from vcl_recv{} will not experience any difference, this processing only affects cache hit/miss requests. Unless vcl_recv{} results in "pipe" or "pass", we determine if the client is capable of receiving gzip'ed content. The test amounts to: Is there a Accept-Encoding header that mentions gzip, and if is has a q=# number, is it larger than zero. Clients which can do gzip, gets their header rewritten to: Accept-Encoding: gzip And clients which do not support gzip gets their Accept-Encoding header removed. This ensures conformity with respect to creating Vary: strings during object creation. During lookup, we ignore any "Accept-encoding" in objects Vary: strings, to avoid having a gzip and gunzip'ed version of the object, varnish can gunzip on demand. (We implement this bit of magic at lookup time, so that any objects stored in persistent storage can be used with or without gzip support enabled.) Varnish will not do any other types of compressions than gzip, in particular we will not do deflate, as there are browser bugs in that case. Before vcl_miss{} is called, the backend requests Accept-Encoding is always set to: Accept-Encoding: gzip Even if this particular client does not support To always entice the backend into sending us gzip'ed content. Varnish will not gzip any content on its own (but see below), we trust the backend to know what content can be sensibly gzip'ed (html) and what can not (jpeg) If in vcl_backend_response{} we find out that we are trying to deliver a gzip'ed object to a client that has not indicated willingness to receive gzip, we will ungzip the object during deliver. Tuning, tweaking and frobbing ----------------------------- In vcl_recv{} you have a chance to modify the client's Accept-Encoding: header before anything else happens. In vcl_pass{} the clients Accept-Encoding header is copied to the backend request unchanged. Even if the client does not support gzip, you can force the A-C header to "gzip" to save bandwidth between the backend and varnish, varnish will gunzip the object before delivering to the client. In vcl_miss{} you can remove the "Accept-Encoding: gzip" header, if you do not want the backend to gzip this object. In vcl_backend_response{} two new variables allow you to modify the gzip-ness of objects during fetch: set beresp.do_gunzip = true; Will make varnish gunzip an already gzip'ed object from the backend during fetch. (I have no idea why/when you would use this...) set beresp.do_gzip = true; Will make varnish gzip the object during fetch from the backend, provided the backend didn't send us a gzip'ed object. Remember that a lot of content types cannot sensibly be gziped, most notably compressed image formats like jpeg, png and similar, so a typical use would be:: sub vcl_backend_response { if (bereq.url ~ "html$") { set beresp.do_gzip = true; } } GZIP and ESI ------------ First, note the new syntax for activating ESI:: sub vcl_backend_response { set beresp.do_esi = true; } In theory, and hopefully in practice, all you read above should apply also when you enable ESI, if not it is a bug you should report. But things are vastly more complicated now. What happens for instance, when the backend sends a gzip'ed object we ESI process it and it includes another object which is not gzip'ed, and we want to send the result gziped to the client ? Things can get really hairy here, so let me explain it in stages. Assume we have a ungzipped object we want to ESI process. The ESI parser will run through the object looking for the various magic strings and produce a byte-stream we call the "VEC" for Varnish ESI Codes. The VEC contains instructions like "skip 234 bytes", "deliver 12919 bytes", "include /foobar", "deliver 122 bytes" etc and it is stored with the object. When we deliver an object, and it has a VEC, special esi-delivery code interprets the VEC string and sends the output to the client as ordered. When the VEC says "include /foobar" we do what amounts to a restart with the new URL and possibly Host: header, and call vcl_recv{} etc. You can tell that you are in an ESI include by examining the 'req.esi_level' variable in VCL. The ESI-parsed object is stored gzip'ed under the same conditions as above: If the backend sends gzip'ed and VCL did not ask for do_gunzip, or if the backend sends ungzip'ed and VCL asked for do_gzip. Please note that since we need to insert flush and reset points in the gzip file, it will be slightly larger than a normal gzip file of the same object. When we encounter gzip'ed include objects which should not be, we gunzip them, but when we encounter gunzip'ed objects which should be, we gzip them, but only at compression level zero. So in order to avoid unnecessary work, and in order to get maximum compression efficiency, you should:: sub vcl_miss { if (object needs ESI processing) { unset req.http.accept-encoding; } } sub vcl_backend_response { if (object needs ESI processing) { set beresp.do_esi = true; set beresp.do_gzip = true; } } So that the backend sends these objects uncompressed to varnish. You should also attempt to make sure that all objects which are esi:included are gziped, either by making the backend do it or by making varnish do it. varnish-4.1.1/doc/html/_sources/phk/spdy.txt0000644000201500234410000001447612652366773015776 00000000000000.. _phk_spdy: =================================== What SPDY did to my summer vacation =================================== It's dawning on me that I'm sort of the hipster of hipsters, in the sense that I tend to do things far before other people do, but totally fail to communicate what's going on out there in the future, and thus by the time the "real hipsters" catch up, I'm already somewhere different and more interesting. My one lucky break was the `bikeshed email `_ where I actually did sit down and compose some of my thoughts, thus firmly sticking a stick in the ground as one of the first to seriously think about how you organize open source collaborations. I mention this because what I am going to write probably seems very unimportant for most of the Varnish users right now, but down the road, three, five or maybe even ten years ahead, I think it will become important. Feel free to not read it until then. The evolution of Varnish ------------------------ When we started out, seven years ago, our only and entire goal was to build a server-side cache better than squid. That we did. Since then we have added stuff to Varnish (ESI:includes, gzip support, VMODS) and I'm staring at streaming and conditional backend fetches right now. Varnish is a bit more than a web-cache now, but it is still, basically, a layer of polish you put in front of your webserver to get it to look and work better. Google's experiments with SPDY have forced a HTTP/2.0 effort into motion, but if past performance is any indication, that is not something we have to really worry about for a number of years. The IETF WG has still to manage to "clarify" RFC2616 which defines HTTP/1.1, and to say there is anything even remotely resembling consensus behind SPDY would be a downright lie. RFC2616 is from June 1999, which, to me, means that we should look at 2035 when we design HTTP/2.0, and predicting things is well known to be hard, in particular with respect to the future. So what's a Varnish architect to do? What I did this summer vacation, was to think a lot about how Varnish can be architected to cope with the kind of changes SPDY and maybe HTTP/2.0 drag in: Pipelining, multiplexing, etc., without committing us to one particular path of science fiction about life in 2035. Profound insights often sound incredibly simplistic, bordering trivial, until you consider the full ramifications. The implementation of "Do Not Kill" in current law is surprisingly voluminous. (If you don't think so, you probably forgot to #include the Vienna Treaty and the convention about chemical and biological weapons.) So my insight about Varnish, that it has to become a socket-wrench-like toolchest for doing things with HTTP traffic, will probably elicit a lot of "duh!" reactions, until people, including me, understand the ramifications more fully. Things you cannot do with Varnish today --------------------------------------- As much as Varnish can be bent, tweaked and coaxed into doing today, there are things you cannot do, or at least things which are very hard and very inefficient to do with Varnish. For instance we consider "a transaction" something that starts with a request from a client, and involves zero or more backend fetches of finite sized data elements. That is not how the future looks. For instance one of the things SPDY has tried out is "server push", where you fetch index.html and the webserver says "you'll also want main.css and cat.gif then" and pushes those objects on the client, to save the round-trip times wasted waiting for the client to ask for them. Today, something like that is impossible in Varnish, since objects are independent and you can only look up one at a time. I already can hear some of you amazing VCL wizards say "Well, if you inline-C grab a refcount, then restart and ..." but let's be honest, that's not how it should look. You should be able to do something like:: if (req.proto == "SPDY" && req.url ~ "index.html") { req.obj1 = lookup(backend1, "/main.css") if (req.obj1.status == 200) { sess.push(req.obj1, bla, bla, bla); } req.obj2 = lookup(backend1, "/cat.gif") if (req.obj1.status == 200) { sess.push(req.obj2, bla, bla, bla); } } And doing that is not really *that* hard, I think. We just need to keep track of all the objects we instantiate and make sure they disappear and die when nobody is using them any more. A lot of the assumptions we made back in 2006 are no longer valid under such an architecture, but those same assumptions are what gives Varnish such astonishing performance, so just replacing them with standard CS-textbook solutions like "garbage collection" would make Varnish lose a lot of its lustre. As some of you know, there is a lot of modularity hidden inside Varnish but not quite released for public use in VCL. Much of what is going to happen will be polishing up and documenting that modularity and releasing it for you guys to have fun with, so it is not like we are starting from scratch or anything. But some of that modularity stands on foundations which are no longer firm; for instance, the initiating request exists for the full duration of a backend fetch. Those will take some work to fix. But, before you start to think I have a grand plan or even a clear-cut road map, I'd better make it absolutely clear that is not the case: I perceive some weird shapes in the fog of the future and I'll aim in that direction and either they are the doorways I suspect or they are trapdoors to tar-pits, time will show. I'm going to be making a lot of changes and things that used to be will no longer be as they used to be, but I think they will be better in the long run, so please bear with me, if your favourite detail of how Varnish works changes. Varnish is not speedy, Varnish is fast! --------------------------------------- As I said I'm not a fan of SPDY and I sincerely hope that no bit of the current proposal survives unchallenged in whatever HTTP/2.0 standard emerges down the road. But I do want to thank the people behind that mess, not for the mess, but for having provoked me to spend some summertime thinking hard about what it is that I'm trying to do with Varnish and what problem Varnish is here to solve. This is going to be FUN! Poul-Henning 2012-09-14 Author of Varnish PS: See you at `VUG6 `_ where I plan to talk more about this. varnish-4.1.1/doc/html/_sources/phk/http20.txt0000644000201500234410000002740512652366773016134 00000000000000.. _phk_http20_lack_of_interest: ====================================== Why HTTP/2.0 does not seem interesting ====================================== This is the email I sent to the IETF HTTP Working Group:: From: Poul-Henning Kamp Subject: HTTP/2 Expression of luke-warm interest: Varnish To: HTTP Working Group Message-Id: <41677.1342136900@critter.freebsd.dk> Date: Thu, 12 Jul 2012 23:48:20 GMT This is Varnish' response to the call for expression of interest in HTTP/2[1]. Varnish ------- Presently Varnish[2] only implements a subset of HTTP/1.1 consistent with its hybrid/dual "http-server" / "http-proxy" role. I cannot at this point say much about what Varnish will or will not implement protocol wise in the future. Our general policy is to only add protocols if we can do a better job than the alternative, which is why we have not implemented HTTPS for instance. Should the outcome of the HTTP/2.0 effort result in a protocol which gains traction, Varnish will probably implement it, but we are unlikely to become an early implementation, given the current proposals at the table. Why I'm not impressed --------------------- I have read all, and participated in one, of the three proposals presently on the table. Overall, I find all three proposals are focused on solving yesteryears problems, rather than on creating a protocol that stands a chance to last us the next 20 years. Each proposal comes out of a particular "camp" and therefore all seem to suffer a certain amount from tunnel-vision. It is my considered opinion that none of the proposals have what it will take to replace HTTP/1.1 in practice. What if they made a new protocol, and nobody used it ? ------------------------------------------------------ We have learned, painfully, that an IPv6 which is only marginally better than IPv4 and which offers no tangible benefit for the people who have the cost/trouble of the upgrade, does not penetrate the network on its own, and barely even on governments mandate. We have also learned that a protocol which delivers the goods can replace all competition in virtually no time. See for instance how SSH replaced TELNET, REXEC, RSH, SUPDUP, and to a large extent KERBEROS, in a matter of a few years. Or I might add, how HTTP replaced GOPHER[3]. HTTP/1.1 is arguably in the top-five most used protocols, after IP, TCP, UDP and, sadly, ICMP, and therefore coming up with a replacement should be approached humbly. Beating HTTP/1.1 ---------------- Fortunately, there are many ways to improve over HTTP/1.1, which lacks support for several widely used features, and sports many trouble-causing weeds, both of which are ripe for HTTP/2.0 to pounce on. Most notably HTTP/1.1 lacks a working session/endpoint-identity facility, a shortcoming which people have pasted over with the ill-conceived Cookie hack. Cookies are, as the EU commission correctly noted, fundamentally flawed, because they store potentially sensitive information on whatever computer the user happens to use, and as a result of various abuses and incompetences, EU felt compelled to legislate a "notice and announce" policy for HTTP-cookies. But it doesn't stop there: The information stored in cookies have potentially very high value for the HTTP server, and because the server has no control over the integrity of the storage, we are now seeing cookies being crypto-signed, to prevent forgeries. The term "bass ackwards" comes to mind. Cookies are also one of the main wasters of bandwidth, disabling caching by default, sending lots of cookies were they are are not needed, which made many sites register separate domains for image content, to "save" bandwidth by avoiding cookies. The term "not really helping" also comes to mind. In my view, HTTP/2.0 should kill Cookies as a concept, and replace it with a session/identity facility, which makes it easier to do things right with HTTP/2.0 than with HTTP/1.1. Being able to be "automatically in compliance" by using HTTP/2.0 no matter how big dick-heads your advertisers are or how incompetent your web-developers are, would be a big selling point for HTTP/2.0 over HTTP/1.1. However, as I read them, none of the three proposals try to address, much less remedy, this situation, nor for that matter any of the many other issues or troubles with HTTP/1.x. What's even worse, they are all additive proposals, which add a new layer of complexity without removing any of the old complexity from the protocol. My conclusion is that HTTP/2.0 is really just a grandiose name for HTTP/1.2: An attempt to smooth out some sharp corners, to save a bit of bandwidth, but not get anywhere near all the architectural problems of HTTP/1.1 and to preserve faithfully its heritage of badly thought out sedimentary hacks. And therefore, I don't see much chance that the current crop of HTTP/2.0 proposals will fare significantly better than IPv6 with respect to adoption. HTTP Routers ------------ One particular hot-spot in the HTTP world these days is the "load-balancer" or as I prefer to call it, the "HTTP router". These boxes sit at the DNS resolved IP numbers and distributes client requests to a farm of HTTP servers, based on simple criteria such as "Host:", URI patterns and/or server availability, sometimes with an added twist of geo-location[4]. HTTP routers see very high traffic densities, the highest traffic densities, because they are the focal point of DoS mitigation, flash mobs and special event traffic spikes. In the time frame where HTTP/2.0 will become standardized, HTTP routers will routinely deal with 40Gbit/s traffic and people will start to architect for 1Tbit/s traffic. HTTP routers are usually only interested in a small part of the HTTP request and barely in the response at all, usually only the status code. The demands for bandwidth efficiency has made makers of these devices take many unwarranted shortcuts, for instance assuming that requests always start on a packet boundary, "nulling out" HTTP headers by changing the first character and so on. Whatever HTTP/2.0 becomes, I strongly urge IETF and the WG to formally recognize the role of HTTP routers, and to actively design the protocol to make life easier for HTTP routers, so that they can fulfill their job, while being standards compliant. The need for HTTP routers does not disappear just because HTTPS is employed, and serious thought should be turned to the question of mixing HTTP and HTTPS traffic on the same TCP connection, while allowing a HTTP router on the server side to correctly distribute requests to different servers. One simple way to gain a lot of benefit for little cost in this area, would be to assign "flow-labels" which each are restricted to one particular Host: header, allowing HTTP routers to only examine the first request on each flow. SPDY ---- SPDY has come a long way, and has served as a very worthwhile proof of concept prototype, to document that there are gains to be had. But as Frederick P. Brooks admonishes us: Always throw the prototype away and start over, because you will throw it away eventually, and doing so early saves time and effort. Overall, I find the design approach taken in SPDY deeply flawed. For instance identifying the standardized HTTP headers, by a 4-byte length and textual name, and then applying a deflate compressor to save bandwidth is totally at odds with the job of HTTP routers which need to quickly extract the Host: header in order to route the traffic, preferably without committing extensive resources to each request. It is also not at all clear if the built-in dictionary is well researched or just happens to work well for some subset of present day websites, and at the very least some kind of versioning of this dictionary should be incorporated. It is still unclear for me if or how SPDY can be used on TCP port 80 or if it will need a WKS allocation of its own, which would open a ton of issues with firewalling, filtering and proxying during deployment. (This is one of the things which makes it hard to avoid the feeling that SPDY really wants to do away with all the "middle-men") With my security-analyst hat on, I see a lot of DoS potential in the SPDY protocol, many ways in which the client can make the server expend resources, and foresee a lot of complexity in implementing the server side to mitigate and deflect malicious traffic. Server Push breaks the HTTP transaction model, and opens a pile of cans of security and privacy issues, which would not be sneaked in during the design of a transport-encoding for HTTP/1+ traffic, but rather be standardized as an independent and well analysed extension to HTTP in general. HTTP Speed+Mobility ------------------- Is really just SPDY with WebSockets underneath. I'm really not sure I see any benefit to that, except that the encoding chosen is marginally more efficient to implement in hardware than SPDY. I have not understood why it has "mobility" in the name, a word which only makes an appearance in the ID as part of the name. If the use of the word "mobility" only refers only to bandwidth usage, I would call its use borderline-deceptive. If it covers session stability across IP# changes for mobile devices, I have missed it in my reading. draft-tarreau-httpbis-network-friendly-00 ----------------------------------------- I have participated a little bit in this draft initially, but it uses a number of concepts which I think are very problematic for high performance (as in 1Tbit/s) implementations, for instance variant-size length fields etc. I do think the proposal is much better than the other two, taking a much more fundamental view of the task, and if for no other reason, because it takes an approach to bandwidth-saving based on enumeration and repeat markers, rather than throwing everything after deflate and hope for a miracle. I think this protocol is the best basis to start from, but like the other two, it has a long way to go, before it can truly earn the name HTTP/2.0. Conclusion ---------- Overall, I don't see any of the three proposals offer anything that will make the majority of web-sites go "Ohh we've been waiting for that!" Bigger sites will be enticed by small bandwidth savings, but the majority of the HTTP users will see scant or no net positive benefit if one or more of these three proposals were to become HTTP/2.0 Considering how sketchy the HTTP/1.1 interop is described it is hard to estimate how much trouble (as in: "Why doesn't this website work ?") their deployment will cause, nor is it entirely clear to what extent the experience with SPDY is representative of a wider deployment or only of 'flying under the radar' with respect to people with an interest in intercepting HTTP traffic. Given the role of HTTP/1.1 in the net, I fear that the current rush to push out a HTTP/2.0 by purely additive means is badly misguided, and approaching a critical mass which will delay or prevent adoption on its own. At the end of the day, a HTTP request or a HTTP response is just some metadata and an optional chunk of bytes as body, and if it already takes 700 pages to standardize that, and HTTP/2.0 will add another 100 pages to it, we're clearly doing something wrong. I think it would be far better to start from scratch, look at what HTTP/2.0 should actually do, and then design a simple, efficient and future proof protocol to do just that, and leave behind all the aggregations of badly thought out hacks of HTTP/1.1. But to the extent that the WG produces a HTTP/2.0 protocol which people will start to use, the Varnish project will be interested. Poul-Henning Kamp Author of Varnish [1] http://trac.tools.ietf.org/wg/httpbis/trac/wiki/Http2CfI [2] https://www.varnish-cache.org/ [3] Yes, I'm that old. [4] Which is really a transport level job, but it was left out of IPv6 along with other useful features, to not delay adoption[5]. [5] No, I'm not kidding. varnish-4.1.1/doc/html/_sources/phk/vcl_expr.txt0000644000201500234410000000347012652366773016631 00000000000000.. _phk_vcl_expr: =============== VCL Expressions =============== I have been working on VCL expressions recently, and we are approaching the home stretch now. The data types in VCL are "sort of weird" seen with normal programming language eyes, in that they are not "general purpose" types, but rather tailored types for the task at hand. For instance, we have both a TIME and a DURATION type, a quite unusual constellation for a programming language. But in HTTP context, it makes a lot of sense, you really have to keep track of what is a relative time (age) and what is absolute time (Expires). Obviously, you can add a TIME and DURATION, the result is a TIME. Equally obviously, you can not add TIME to TIME, but you can subtract TIME from TIME, resulting in a DURATION. VCL do also have "naked" numbers, like INT and REAL, but what you can do with them is very limited. For instance you can multiply a duration by a REAL, but you can not multiply a TIME by anything. Given that we have our own types, the next question is what precedence operators have. The C programming language is famous for having a couple of gottchas in its precedence rules and given our limited and narrow type repetoire, blindly importing a set of precedence rules may confuse a lot more than it may help. Here are the precedence rules I have settled on, from highest to lowest precedence: Atomic 'true', 'false', constants function calls variables '(' expression ')' Multiply/Divide INT * INT INT / INT DURATION * REAL Add/Subtract STRING + STRING INT +/- INT TIME +/- DURATION TIME - TIME DURATION +/- DURATION Comparisons '==', '!=', '<', '>', '~' and '!~' string existence check (-> BOOL) Boolean not '!' Boolean and '&&' Boolean or '||' Input and feedback most welcome! Until next time, Poul-Henning, 2010-09-21 varnish-4.1.1/doc/html/_sources/phk/index.txt0000644000201500234410000000073412652366773016116 00000000000000.. _phk: Poul-Hennings random outbursts ============================== You may or may not want to know what Poul-Henning thinks. .. toctree:: :maxdepth: 1 brinch-hansens-arrows.rst ssl_again.rst persistent.rst dough.rst wanton_destruction.rst spdy.rst http20.rst varnish_does_not_hash.rst thetoolsweworkwith.rst three-zero.rst ssl.rst gzip.rst vcl_expr.rst ipv6suckage.rst backends.rst platforms.rst barriers.rst thoughts.rst autocrap.rst sphinx.rst varnish-4.1.1/doc/html/_sources/reference/0000755000201500234410000000000012652366773015476 500000000000000varnish-4.1.1/doc/html/_sources/reference/vmod_std.generated.txt0000644000201500234410000002170412652366773021737 00000000000000.. .. NB: This file is machine generated, DO NOT EDIT! .. .. Edit vmod.vcc and run make instead .. .. role:: ref(emphasis) .. _vmod_std(3): ======== vmod_std ======== ----------------------- Varnish Standard Module ----------------------- :Manual section: 3 SYNOPSIS ======== import std [from "path"] ; DESCRIPTION =========== `vmod_std` contains basic functions which are part and parcel of Varnish, but which for reasons of architecture fit better in a VMOD. One particular class of functions in vmod_std is the conversions functions which all have the form:: TYPE type(STRING, TYPE) These functions attempt to convert STRING to the TYPE, and if that fails, they return the second argument, which must have the given TYPE. CONTENTS ======== * :ref:`func_cache_req_body` * :ref:`func_collect` * :ref:`func_duration` * :ref:`func_fileread` * :ref:`func_healthy` * :ref:`func_integer` * :ref:`func_ip` * :ref:`func_log` * :ref:`func_port` * :ref:`func_querysort` * :ref:`func_random` * :ref:`func_real` * :ref:`func_real2integer` * :ref:`func_real2time` * :ref:`func_rollback` * :ref:`func_set_ip_tos` * :ref:`func_strstr` * :ref:`func_syslog` * :ref:`func_time` * :ref:`func_time2integer` * :ref:`func_time2real` * :ref:`func_timestamp` * :ref:`func_tolower` * :ref:`func_toupper` .. _func_toupper: STRING toupper(STRING_LIST) --------------------------- Prototype STRING toupper(STRING_LIST s) Description Converts the string *s* to uppercase. Example set beresp.http.scream = std.toupper("yes!"); .. _func_tolower: STRING tolower(STRING_LIST) --------------------------- Prototype STRING tolower(STRING_LIST s) Description Converts the string *s* to lowercase. Example set beresp.http.nice = std.tolower("VerY"); .. _func_set_ip_tos: VOID set_ip_tos(INT) -------------------- Prototype VOID set_ip_tos(INT tos) Description Sets the IP type-of-service (TOS) field for the current session to *tos*. Please note that the TOS field is not removed by the end of the request so probably want to set it on every request should you utilize it. Example | if (req.url ~ "^/slow/") { | std.set_ip_tos(0); | } .. _func_random: REAL random(REAL, REAL) ----------------------- Prototype REAL random(REAL lo, REAL hi) Description Returns a random real number between *lo* and *hi*. Example set beresp.http.random-number = std.random(1, 100); .. _func_log: VOID log(STRING_LIST) --------------------- Prototype VOID log(STRING_LIST s) Description Logs the string *s* to the shared memory log, using VSL tag *SLT_VCL_Log*. Example std.log("Something fishy is going on with the vhost " + req.http.host); .. _func_syslog: VOID syslog(INT, STRING_LIST) ----------------------------- Prototype VOID syslog(INT priority, STRING_LIST s) Description Logs the string *s* to syslog tagged with *priority*. *priority* is formed by ORing the facility and level values. See your system's syslog.h file for possible values. Example std.syslog(9, "Something is wrong"); This will send a message to syslog using LOG_USER | LOG_ALERT. .. _func_fileread: STRING fileread(PRIV_CALL, STRING) ---------------------------------- Prototype STRING fileread(PRIV_CALL, STRING) Description Reads a file and returns a string with the content. Please note that it is not recommended to send variables to this function the caching in the function doesn't take this into account. Also, files are not re-read. Example set beresp.http.served-by = std.fileread("/etc/hostname"); .. _func_collect: VOID collect(HEADER) -------------------- Prototype VOID collect(HEADER hdr) Description Collapses multiple *hdr* headers into one long header. Care should be taken when collapsing headers. In particular collapsing Set-Cookie will lead to unexpected results on the browser side. Example std.collect(req.http.cookie); .. _func_duration: DURATION duration(STRING, DURATION) ----------------------------------- Prototype DURATION duration(STRING s, DURATION fallback) Description Converts the string *s* to seconds. *s* must be quantified with ms (milliseconds), s (seconds), m (minutes), h (hours), d (days), w (weeks) or y (years) units. If conversion fails, *fallback* will be returned. Example set beresp.ttl = std.duration("1w", 3600s); .. _func_integer: INT integer(STRING, INT) ------------------------ Prototype INT integer(STRING s, INT fallback) Description Converts the string *s* to an integer. If conversion fails, *fallback* will be returned. Example | if (std.integer(req.http.foo, 0) > 5) { | ... | } .. _func_ip: IP ip(STRING, IP) ----------------- Prototype IP ip(STRING s, IP fallback) Description Converts the string *s* to the first IP number returned by the system library function getaddrinfo(3). If conversion fails, *fallback* will be returned. Example | if (std.ip(req.http.X-forwarded-for, "0.0.0.0") ~ my_acl) { | ... | } .. _func_real: REAL real(STRING, REAL) ----------------------- Prototype REAL real(STRING s, REAL fallback) Description Converts the string *s* to a real. If conversion fails, *fallback* will be returned. Example | if (std.real(req.http.foo, 0.0) > 5.5) { | ... | } .. _func_real2integer: INT real2integer(REAL, INT) --------------------------- Prototype INT real2integer(REAL r, INT fallback) Description Converts the real *r* to an integer. If conversion fails, *fallback* will be returned. Example set req.http.integer = std.real2integer(1140618699.00, 0); .. _func_real2time: TIME real2time(REAL, TIME) -------------------------- Prototype TIME real2time(REAL r, TIME fallback) Description Converts the real *r* to a time. If conversion fails, *fallback* will be returned. Example set req.http.time = std.real2time(1140618699.00, now); .. _func_time2integer: INT time2integer(TIME, INT) --------------------------- Prototype INT time2integer(TIME t, INT fallback) Description Converts the time *t* to a integer. If conversion fails, *fallback* will be returned. Example set req.http.int = std.time2integer(now, 0); .. _func_time2real: REAL time2real(TIME, REAL) -------------------------- Prototype REAL time2real(TIME t, REAL fallback) Description Converts the time *t* to a real. If conversion fails, *fallback* will be returned. Example set req.http.real = std.time2real(now, 1.0); .. _func_healthy: BOOL healthy(BACKEND) --------------------- Prototype BOOL healthy(BACKEND be) Description Returns `true` if the backend *be* is healthy. .. _func_port: INT port(IP) ------------ Prototype INT port(IP ip) Description Returns the port number of the IP address *ip*. .. _func_rollback: VOID rollback(HTTP) ------------------- Prototype VOID rollback(HTTP h) Description Restores the *h* HTTP headers to their original state. Example std.rollback(bereq); .. _func_timestamp: VOID timestamp(STRING) ---------------------- Prototype VOID timestamp(STRING s) Description Introduces a timestamp in the log with the current time, using the string *s* as the label. This is useful to time the execution of lengthy VCL procedures, and makes the timestamps inserted automatically by Varnish more accurate. Example std.timestamp("curl-request"); .. _func_querysort: STRING querysort(STRING) ------------------------ Prototype STRING querysort(STRING) Description Sorts the query string for cache normalization purposes. Example set req.url = std.querysort(req.url); .. _func_cache_req_body: VOID cache_req_body(BYTES) -------------------------- Prototype VOID cache_req_body(BYTES size) Description Cache the req.body if it is smaller than *size*. Caching the req.body makes it possible to retry pass operations (POST, PUT). Example std.cache_req_body(1KB); This will cache the req.body if its size is smaller than 1KB. .. _func_strstr: STRING strstr(STRING, STRING) ----------------------------- Prototype STRING strstr(STRING s1, STRING s2) Description Returns a string beginning at the first occurrence of the string *s2* in the string *s1*, or an empty string if *s2* is not found. Note that the comparison is case sensitive. Example | if (std.strstr(req.url, req.http.restrict)) { | ... | } This will check if the content of req.http.restrict occurs anywhere in req.url. .. _func_time: TIME time(STRING, TIME) ----------------------- Prototype TIME time(STRING s, TIME fallback) Description Converts the string *s* to a time. If conversion fails, *fallback* will be returned. Supported formats: | "Sun, 06 Nov 1994 08:49:37 GMT" | "Sunday, 06-Nov-94 08:49:37 GMT" | "Sun Nov 6 08:49:37 1994" | "1994-11-06T08:49:37" | "784111777.00" | "784111777" Example | if (std.time(resp.http.last-modified, now) < now - 1w) { | ... | } SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`vsl(7)` HISTORY ======= The Varnish standard module was released along with Varnish Cache 3.0. This manual page was written by Per Buer with help from Martin Blix Grydeland. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2010-2015 Varnish Software AS varnish-4.1.1/doc/html/_sources/reference/varnishstat.txt0000644000201500234410000001146412652366773020533 00000000000000.. role:: ref(emphasis) .. _varnishstat(1): =========== varnishstat =========== ------------------------ Varnish Cache statistics ------------------------ :Manual section: 1 SYNOPSIS ======== varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-t seconds|] [-V] .. TODO: autogenerate this synopsis like the others. DESCRIPTION =========== The varnishstat utility displays statistics from a running varnishd(1) instance. OPTIONS ======= The following options are available: -1 Instead of presenting a continuously updated display, print the statistics to stdout. -f Field inclusion glob. A field glob consists of three parts, type, ident and name, where ident is optional. Each part can contain a '*' character at the end to match a prefix. Use backslash to escape characters. If the argument starts with '^' it is used as an exclusion glob. Multiple -f arguments may be given, and they will be applied in order. -l Lists the available fields to use with the -f option. -n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. -N Specify a the filename of a stale VSM instance. When using this option the abandonment checking is disabled. -t seconds| Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this any seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinitely for the Varnish instance to appear. Defaults to 5 seconds. -V Display the version number and exit. -x Displays the result as XML. -j Displays the result as JSON. CURSES MODE =========== When neither -1, -j or -x options are given, the application starts up in curses mode. This shows a continuously updated view of the counter values, along with their description. The top area shows process uptime information. The center area shows a list of counter values. The bottom area shows the description of the currently selected counter. Columns ------- The following columns are displayed, from left to right: Name The name of the counter Current The current value of the counter. Change The average per second change over the last update interval. Average The average value of this counter over the runtime of the Varnish daemon, or a period if the counter can't be averaged. Avg_10 The moving average over the last 10 update intervals. Avg_100 The moving average over the last 100 update intervals. Avg_1000 The moving average over the last 1000 update intervals. Key bindings ------------ The following keys control the interactive display: Navigate the counter list one line up. Navigate the counter list one line down. or Navigate the counter list one page up. or Navigate the counter list one page down. Toggle between showing and hiding unseen counters. Unseen counters are those that has been zero for the entire runtime of varnishstat. Defaults to hide unseen counters. Toggle scaling of values. Go to the top of the counter list. Go to the bottom of the counter list. Cycle through the verbosity levels. Defaults to only showing informational counters. Quit. Sample now. XML Output ========== When using the -x option, the output is:: FIELD TYPE FIELD IDENT FIELD NAME FIELD VALUE FIELD SEMANTICS FIELD DISPLAY FORMAT FIELD DESCRIPTION [..] JSON OUTPUT =========== With -j the output format is:: { "timestamp": "YYYY-MM-DDTHH:mm:SS", "FIELD NAME": { "description": "FIELD DESCRIPTION", "type": "FIELD TYPE", "ident": "FIELD IDENT", "flag": "FIELD SEMANTICS", "format": "FIELD DISPLAY FORMAT", "value": FIELD VALUE }, "FIELD2 NAME": { "description": "FIELD2 DESCRIPTION", "type": "FIELD2 TYPE", "ident": "FIELD2 IDENT", "flag": "FIELD2 SEMANTICS", "format": "FIELD2 DISPLAY FORMAT", "value": FIELD2 VALUE }, [..] } Type and ident are optional. Timestamp is the time when the report was generated by varnishstat. Repeated output with -1, -x or -j will have a single empty line (\\n) between each block of output. SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`varnishhist(1)` * :ref:`varnishlog(1)` * :ref:`varnishncsa(1)` * :ref:`varnishtop(1)` * curses(3) * :ref:`varnish-counters(7)` AUTHORS ======= This manual page was written by Dag-Erling Smørgrav, Per Buer, Lasse Karstensen and Martin Blix Grydeland. varnish-4.1.1/doc/html/_sources/reference/vmod_directors.generated.txt0000644000201500234410000001501712652366773023143 00000000000000.. .. NB: This file is machine generated, DO NOT EDIT! .. .. Edit vmod.vcc and run make instead .. .. role:: ref(emphasis) .. _vmod_directors(3): ============== vmod_directors ============== ------------------------ Varnish Directors Module ------------------------ :Manual section: 3 SYNOPSIS ======== import directors [from "path"] ; DESCRIPTION =========== `vmod_directors` enables backend load balancing in Varnish. The module implements a set of basic load balancing techniques, and also serves as an example on how one could extend the load balancing capabilities of Varnish. To enable load balancing you must import this vmod (directors). Then you define your backends. Once you have the backends declared you can add them to a director. This happens in executed VCL code. If you want to emulate the previous behavior of Varnish 3.0 you can just initialize the directors in vcl_init, like this:: sub vcl_init { new vdir = directors.round_robin(); vdir.add_backend(backend1); vdir.add_backend(backend2); } As you can see there is nothing keeping you from manipulating the directors elsewhere in VCL. So, you could have VCL code that would add more backends to a director when a certain URL is called. Note that directors can use other directors as backends. CONTENTS ======== * :ref:`obj_fallback` * :ref:`func_fallback.add_backend` * :ref:`func_fallback.backend` * :ref:`func_fallback.remove_backend` * :ref:`obj_hash` * :ref:`func_hash.add_backend` * :ref:`func_hash.backend` * :ref:`func_hash.remove_backend` * :ref:`obj_random` * :ref:`func_random.add_backend` * :ref:`func_random.backend` * :ref:`func_random.remove_backend` * :ref:`obj_round_robin` * :ref:`func_round_robin.add_backend` * :ref:`func_round_robin.backend` * :ref:`func_round_robin.remove_backend` .. _obj_round_robin: Object round_robin ================== Description Create a round robin director. This director will pick backends in a round robin fashion. Example new vdir = directors.round_robin(); .. _func_round_robin.add_backend: VOID round_robin.add_backend(BACKEND) ------------------------------------- Prototype VOID round_robin.add_backend(BACKEND) Description Add a backend to the round-robin director. Example vdir.add_backend(backend1); vdir.add_backend(backend2); .. _func_round_robin.remove_backend: VOID round_robin.remove_backend(BACKEND) ---------------------------------------- Prototype VOID round_robin.remove_backend(BACKEND) Description Remove a backend from the round-robin director. Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); .. _func_round_robin.backend: BACKEND round_robin.backend() ----------------------------- Prototype BACKEND round_robin.backend() Description Pick a backend from the director. Example set req.backend_hint = vdir.backend(); .. _obj_fallback: Object fallback =============== Description Create a fallback director. A fallback director will try each of the added backends in turn, and return the first one that is healthy. Example new vdir = directors.fallback(); .. _func_fallback.add_backend: VOID fallback.add_backend(BACKEND) ---------------------------------- Prototype VOID fallback.add_backend(BACKEND) Description Add a backend to the director. Note that the order in which this is done matters for the fallback director. Example vdir.add_backend(backend1); vdir.add_backend(backend2); .. _func_fallback.remove_backend: VOID fallback.remove_backend(BACKEND) ------------------------------------- Prototype VOID fallback.remove_backend(BACKEND) Description Remove a backend from the director. Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); .. _func_fallback.backend: BACKEND fallback.backend() -------------------------- Prototype BACKEND fallback.backend() Description Pick a backend from the director. Example set req.backend_hint = vdir.backend(); .. _obj_random: Object random ============= Description Create a random backend director. The random director distributes load over the backends using a weighted random probability distribution. Example new vdir = directors.random(); .. _func_random.add_backend: VOID random.add_backend(BACKEND, REAL) -------------------------------------- Prototype VOID random.add_backend(BACKEND, REAL) Description Add a backend to the director with a given weight. Each backend backend will receive approximately 100 * (weight / (sum(all_added_weights))) per cent of the traffic sent to this director. Example # 2/3 to backend1, 1/3 to backend2. vdir.add_backend(backend1, 10.0); vdir.add_backend(backend2, 5.0); .. _func_random.remove_backend: VOID random.remove_backend(BACKEND) ----------------------------------- Prototype VOID random.remove_backend(BACKEND) Description Remove a backend from the director. Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); .. _func_random.backend: BACKEND random.backend() ------------------------ Prototype BACKEND random.backend() Description Pick a backend from the director. Example set req.backend_hint = vdir.backend(); .. _obj_hash: Object hash =========== Description Create a hashing backend director. The director chooses the backend server by computing a hash/digest of the string given to .backend(). Commonly used with ``client.ip`` or a session cookie to get sticky sessions. Example new vdir = directors.hash(); .. _func_hash.add_backend: VOID hash.add_backend(BACKEND, REAL) ------------------------------------ Prototype VOID hash.add_backend(BACKEND, REAL) Description Add a backend to the director with a certain weight. Weight is used as in the random director. Recommended value is 1.0 unless you have special needs. Example vdir.add_backend(backend1, 1.0); vdir.add_backend(backend2, 1.0); .. _func_hash.remove_backend: VOID hash.remove_backend(BACKEND) --------------------------------- Prototype VOID hash.remove_backend(BACKEND) Description Remove a backend from the director. Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); .. _func_hash.backend: BACKEND hash.backend(STRING_LIST) --------------------------------- Prototype BACKEND hash.backend(STRING_LIST) Description Pick a backend from the backend director. Use the string or list of strings provided to pick the backend. Example # pick a backend based on the cookie header from the client set req.backend_hint = vdir.backend(req.http.cookie); COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2013-2015 Varnish Software AS varnish-4.1.1/doc/html/_sources/reference/varnishncsa.txt0000644000201500234410000000655612652366773020512 00000000000000.. role:: ref(emphasis) .. _varnishncsa(1): =========== varnishncsa =========== --------------------------------------------------------- Display Varnish logs in Apache / NCSA combined log format --------------------------------------------------------- :Manual section: 1 SYNOPSIS ======== .. include:: ../include/varnishncsa_synopsis.rst varnishncsa |synopsis| DESCRIPTION =========== The varnishncsa utility reads varnishd(1) shared memory logs and presents them in the Apache / NCSA "combined" log format. Each log line produced is based on a single Request type transaction gathered from the shared memory log. The Request transaction is then scanned for the relevant parts in order to output one log line. To filter the log lines produced, use the query language to select the applicable transactions. Non-request transactions are ignored. The following options are available: .. include:: ../include/varnishncsa_options.rst FORMAT ====== Specify the log format used. If no format is specified the default log format is used. The default log format is:: %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i" Escape sequences \\n and \\t are supported. Supported formatters are: %b Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent. %D Time taken to serve the request, in microseconds. %H The request protocol. Defaults to HTTP/1.0 if not known. %h Remote host. Defaults to '-' if not known. %I Total bytes received from client. %{X}i The contents of request header X. %l Remote logname (always '-') %m Request method. Defaults to '-' if not known. %{X}o The contents of response header X. %O Total bytes sent to client. %q The query string, if no query string exists, an empty string. %r The first line of the request. Synthesized from other fields, so it may not be the request verbatim. %s Status sent to the client %t Time when the request was received, in HTTP date/time format. %{X}t Time when the request was received, in the format specified by X. The time specification format is the same as for strftime(3). %T Time taken to serve the request, in seconds. %U The request URL without any query string. Defaults to '-' if not known. %u Remote user from auth %{X}x Extended variables. Supported variables are: Varnish:time_firstbyte Time from when the request processing starts until the first byte is sent to the client. Varnish:hitmiss Whether the request was a cache hit or miss. Pipe and pass are considered misses. Varnish:handling How the request was handled, whether it was a cache hit, miss, pass, pipe or synth. VCL_Log:key Output value set by std.log("key:value") in VCL. SIGNALS ======= SIGHUP Rotate the log file (see -w option) SIGUSR1 Flush any outstanding transactions SEE ALSO ======== :ref:`varnishd(1)` :ref:`varnishlog(1)` :ref:`varnishstat(1)` HISTORY ======= The varnishncsa utility was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS. This manual page was initially written by Dag-Erling Smørgrav , and later updated by Martin Blix Grydeland. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/html/_sources/reference/varnishtop.txt0000644000201500234410000000321012652366773020350 00000000000000.. role:: ref(emphasis) .. _varnishtop(1): ========== varnishtop ========== ------------------------- Varnish log entry ranking ------------------------- :Manual section: 1 SYNOPSIS ======== .. include:: ../include/varnishtop_synopsis.rst varnishtop |synopsis| DESCRIPTION =========== The varnishtop utility reads :ref:`varnishd(1)` shared memory logs and presents a continuously updated list of the most commonly occurring log entries. With suitable filtering using the ``-I``, ``-i``, ``-X`` and ``-x`` options, it can be used to display a ranking of requested documents, clients, user agents, or any other information which is recorded in the log. The following options are available: .. include:: ../include/varnishtop_options.rst EXAMPLES ======== The following example displays a continuously updated list of the most frequently requested URLs:: varnishtop -i ReqURL The following example displays a continuously updated list of the most commonly used user agents:: varnishtop -C -I ReqHeader:User-Agent SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`varnishhist(1)` * :ref:`varnishlog(1)` * :ref:`varnishncsa(1)` * :ref:`varnishstat(1)` HISTORY ======= The varnishtop utility was originally developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS, and later substantially rewritten by Dag-Erling Smørgrav. This manual page was written by Dag-Erling Smørgrav, and later updated by Martin Blix Grydeland. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/html/_sources/reference/vsm.txt0000644000201500234410000000772212652366773016774 00000000000000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VSM: Shared Memory Logging and Statistics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Varnish uses shared memory to export parameters, logging and statistics, because it is faster and much more efficient than regular files. "Varnish Shared Memory" or VSM, is the overall mechanism, which manages a number of allocated "chunks" inside the same shared memory file. Each Chunk is just a slap of memory, which has a three-part name (class, type, ident) and a length. The Class indicates what type of data is stored in the chunk, for instance "Arg" for command line arguments useful for establishing an CLI connection to the varnishd, "Stat" for statistics counters (VSC) and "Log" for log records (VSL). The type and ident name parts are mostly used with stats counters, where they identify dynamic counters, such as: SMA.Transient.c_bytes The size of the VSM is a parameter, but changes only take effect when the child process is restarted. Shared memory trickery ---------------------- Shared memory is faster than regular files, but it is also slightly tricky in ways a regular logfile is not. When you open a file in "append" mode, the operating system guarantees that whatever you write will not overwrite existing data in the file. The neat result of this is that multiple processes or threads writing to the same file does not even need to know about each other, it all works just as you would expect. With a shared memory log, we get no such help from the kernel, the writers need to make sure they do not stomp on each other, and they need to make it possible and safe for the readers to access the data. The "CS101" way to deal with that, is to introduce locks, and much time is spent examining the relative merits of the many kinds of locks available. Inside the varnishd (worker) process, we use mutexes to guarantee consistency, both with respect to allocations, log entries and stats counters. We do not want a varnishncsa trying to push data through a stalled ssh connection to stall the delivery of content, so readers like that are purely read-only, they do not get to affect the varnishd process and that means no locks for them. Instead we use "stable storage" concepts, to make sure the view seen by the readers is consistent at all times. As long as you only add stuff, that is trivial, but taking away stuff, such as when a backend is taken out of the configuration, we need to give the readers a chance to discover this, a "cooling off" period. The Varnish way: ---------------- If varnishd starts, and finds a locked shared memory file, it will exit with a message about using different -n arguments if you want multiple instances of varnishd. Otherwise, it will create a new shared memory file each time it starts a child process, since that marks a clean break in operation anyway. To the extent possible, old shared memory files are marked as abandoned by setting the alloc_seq field to zero, which should be monitored by all readers of the VSM. Processes subscribing to VSM files for a long time, should notice if the VSM file goes "silent" and check that the file has not been renamed due to a child restart. Chunks inside the shared memory file form a linked list, and whenever that list changes, the alloc_seq field changes. The linked list and other metadata in the VSM file, works with offsets relative to the start address of where the VSM file is memory mapped, so it need not be mapped at any particular address. When new chunks are allocated, for instance when a new backend is added, they are appended to the list, no matter where they are located in the VSM file. When a chunk is freed, it will be taken out of the linked list of allocations, its length will be set to zero and alloc_seq will be changed to indicate a change of layout. For the next 60 seconds the chunk will not be touched or reused, giving other subscribers a chance to discover the deallocation. The include file provides the supported API for accessing VSM files. varnish-4.1.1/doc/html/_sources/reference/varnishlog.txt0000644000201500234410000000214212652366773020332 00000000000000.. role:: ref(emphasis) .. _varnishlog(1): ========== varnishlog ========== -------------------- Display Varnish logs -------------------- :Manual section: 1 SYNOPSIS ======== .. include:: ../include/varnishlog_synopsis.rst varnishlog |synopsis| OPTIONS ======= The following options are available: .. include:: ../include/varnishlog_options.rst SIGNALS ======= * SIGHUP Rotate the log file (see -w option) * SIGUSR1 Flush any outstanding transactions SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`varnishhist(1)` * :ref:`varnishncsa(1)` * :ref:`varnishstat(1)` * :ref:`varnishtop(1)` * :ref:`vsl(7)` * :ref:`vsl-query(7)` HISTORY ======= The varnishlog utility was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS. This manual page was initially written by Dag-Erling Smørgrav, and later updated by Per Buer and Martin Blix Grydeland. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/html/_sources/reference/varnish-counters.txt0000644000201500234410000000055012652366773021471 00000000000000.. _varnish-counters(7): ================ varnish-counters ================ --------------------------------- Varnish counter field definitions --------------------------------- :Manual section: 7 .. include:: ../include/counters.rst AUTHORS ======= This man page was written by Lasse Karstensen, using content from vsc2rst written by Tollef Fog Heen. varnish-4.1.1/doc/html/_sources/reference/varnishhist.txt0000644000201500234410000000242312652366773020522 00000000000000.. role:: ref(emphasis) .. _varnishhist(1): =========== varnishhist =========== ------------------------- Varnish request histogram ------------------------- :Manual section: 1 SYNOPSIS ======== .. include:: ../include/varnishhist_synopsis.rst varnishhist |synopsis| DESCRIPTION =========== The varnishhist utility reads varnishd(1) shared memory logs and 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 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: .. include:: ../include/varnishhist_options.rst SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`varnishlog(1)` * :ref:`varnishncsa(1)` * :ref:`varnishstat(1)` * :ref:`varnishtop(1)` HISTORY ======= The varnishhist 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. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/html/_sources/reference/directors.txt0000644000201500234410000001611612652366773020162 00000000000000.. _ref-writing-a-director: %%%%%%%%%%%%%%%%%% Writing a Director %%%%%%%%%%%%%%%%%% Varnish already provides a set of general-purpose directors, and since Varnish 4, it is bundled in the built-in :ref:`vmod_directors(3)`. Writing a director boils down to writing a VMOD, using the proper data structures and APIs. Not only can you write your own director if none of the built-ins fit your needs, but since Varnish 4.1 you can even write your own backends. Backends can be categorized as such: - static: native backends declared in VCL - dynamic: native backends created by VMODs - custom: backends created and fully managed by VMODs Backends vs Directors ===================== The intuitive classification for backend and director is an endpoint for the former and a cluster for the latter, but the actual implementation is a bit more subtle. VMODs can accept backend arguments and return backends in VCL (see :ref:`ref-vmod-vcl-c-types`), but the underlying C type is ``struct director``. Under the hood director is a generic concept, and a backend is a kind of director. The line between the two is somewhat blurry at this point, let's look at some code instead:: struct director { unsigned magic; #define DIRECTOR_MAGIC 0x3336351d const char *name; char *vcl_name; vdi_http1pipe_f *http1pipe; vdi_healthy_f *healthy; vdi_resolve_f *resolve; vdi_gethdrs_f *gethdrs; vdi_getbody_f *getbody; vdi_getip_f *getip; vdi_finish_f *finish; vdi_panic_f *panic; void *priv; const void *priv2; }; A director can be summed up as: - a name (used for panics) - a VCL name - a set of operations - the associated state The difference between a *cluster* director and a *backend* director is mainly The functions they will implement. Cluster Directors ================= As in :ref:`vmod_directors(3)`, you can write directors that will group backends sharing the same role, and pick them according to a strategy. If you need more than the built-in strategies (round-robin, hash, ...), even though they can be stacked, it is always possible to write your own. In this case you simply need to implement the ``resolve`` function for the director. Directors are walked until a leaf director is found. A leaf director doesn't have a ``resolve`` function and is used to actually make the backend request, just like the backends you declare in VCL. Dynamic Backends ================ If you want to speak HTTP/1 over TCP, but for some reason VCL does not fit the bill, you can instead reuse the whole backend facility. It allows you for instance to add and remove backends on-demand without the need to reload your VCL. You can then leverage your provisioning system. Consider the following snippet:: backend default { .host = "localhost"; } The VCL compiler turns this declaration into a ``struct vrt_backend``. When the VCL is loaded, Varnish calls ``VRT_new_backend`` in order to create the director. Varnish doesn't expose its data structure for actual backends, only the director abstraction and dynamic backends are built just like static backends, one *struct* at a time. You can get rid of the ``struct vrt_backend`` as soon as you have the ``struct director``. A (dynamic) backend can't exceed its VCL's lifespan, because native backends are *owned* by VCLs. Though a dynamic backend can't outlive its VCL, it can be deleted any time with ``VRT_delete_backend``. The VCL will delete the remaining backends once discarded, you don't need to take care of it. .. XXX Consider using an object (see :ref:`ref-vmod-objects`) to manipulate dynamic Consider using an object to manipulate dynamic backends. They are tied to the VCL life cycle and make a handy data structure to keep track of backends and objects have a VCL name you can reuse for the director. It is also true for *cluster* directors that may reference native backends. Finally, Varnish will take care of event propagation for *all* native backends, but dynamic backends can only be created when the VCL is warm. If your backends are created by an independent thread (basically outside of VCL scope) you must subscribe to VCL events and watch for VCL state (see :ref:`ref-vmod-event-functions`). Varnish will panic if you try to create a backend on a cold VCL, and ``VRT_new_backend`` will return ``NULL`` if the VCL is cooling. You are also encouraged to comply with the :ref:`ref_vcl_temperature` in general. .. _ref-writing-a-director-cluster: Health Probes ============= It is possible in a VCL program to query the health of a director (see :ref:`func_healthy`). A director can report its health if it implements the ``healthy`` function, it is otherwise always considered healthy. Unless you are making a dynamic backend, you need to take care of the health probes yourselves. For *cluster* directors, being healthy typically means having at least one healthy underlying backend or director. For dynamic backends, it is just a matter of assigning the ``probe`` field in the ``struct vrt_backend``. Once the director is created, the probe definition too is no longer needed. It is then Varnish that will take care of the health probe and disable the feature on a cold VCL (see :ref:`ref-vmod-event-functions`). Instead of initializing your own probe definition, you can get a ``VCL_PROBE`` directly built from VCL (see :ref:`ref-vmod-vcl-c-types`). What's the difference ? Custom Backends =============== If you want to implement a custom backend, have a look at how Varnish implements native backends. It is the canonical implementation, and though it provides other services like connection pooling or statistics, it is essentially a director which state is a ``struct backend``. Varnish native backends currently speak HTTP/1 over TCP, and as such, you need to make your own custom backend if you want Varnish to do otherwise such as connect over UDP or UNIX-domain sockets or speak a different protocol. If you want to leverage probes declarations in VCL, which have the advantage of being reusable since they are only specifications, you can. However, you need to implement the whole probing infrastructure from scratch. You may also consider making your custom backend compliant with regards to the VCL state (see :ref:`ref-vmod-event-functions`). Data structure considerations ----------------------------- When you are creating a custom backend, you may want to provide the semantics of the native backends. In this case, instead of repeating the redundant fields between data structures, you can use the macros ``VRT_BACKEND_FIELDS`` and ``VRT_BACKEND_PROBE_FIELDS`` to declare them all at once. This is the little dance Varnish uses to copy data between the ``struct vrt_backend`` and its internal data structure for example. The copy can be automated with the macros ``VRT_BACKEND_HANDLE`` and ``VRT_BACKEND_PROBE_HANDLE``. You can look at how they can be used in the Varnish code base. varnish-4.1.1/doc/html/_sources/reference/varnishd.txt0000644000201500234410000002461512652366773020005 00000000000000.. role:: ref(emphasis) .. _varnishd(1): ======== varnishd ======== ----------------------- HTTP accelerator daemon ----------------------- :Manual section: 1 SYNOPSIS ======== varnishd [-a address[:port][,PROTO]] [-b host[:port]] [-C] [-d] [-F] [-f config] [-h type[,options]] [-i identity] [-j jail[,jailoptions]] [-l vsl[,vsm]] [-M address:port] [-n name] [-P file] [-p param=value] [-r param[,param...]] [-S secret-file] [-s [name=]kind[,options]] [-T address[:port]] [-t TTL] [-V] [-W waiter] DESCRIPTION =========== The `varnishd` daemon accepts HTTP requests from clients, passes them on to a backend server and caches the returned documents to better satisfy future requests for the same document. .. _ref-varnishd-options: OPTIONS ======= -a Listen for client requests on the specified address and port. The address can be a host 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, port 80 (http) is used. An additional protocol type can be set for the listening socket with PROTO. Valid protocol types are: HTTP/1 (default), and PROXY. Multiple listening addresses can be specified by using multiple -a arguments. -b 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 to compile with the -f option. -d Enables debugging mode: The parent process runs in the foreground with a CLI connection on stdin/stdout, and the child process must be started explicitly with a CLI command. Terminating the parent process will also terminate the child. -F Do not fork, run in the foreground. -f config Use the specified VCL configuration file instead of the builtin default. See :ref:`vcl(7)` for details on VCL syntax. When neither a -f nor a -b argument are given, `varnishd` will not start the worker process but process cli commands. -h Specifies the hash algorithm. See `Hash Algorithm Options`_ for a list of supported algorithms. -i identity Specify the identity of the Varnish server. This can be accessed using ``server.identity`` from VCL. -j Specify the jailing technology to use. -l Specifies size of shmlog file. vsl is the space for the VSL records [80M] and vsm is the space for stats counters [1M]. Scaling suffixes like 'K' and 'M' can be used up to (G)igabytes. Default is 81 Megabytes. -M Connect to this port and offer the command line 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. -n name Specify the name for this instance. Amongst other things, this name is used to construct the name of the directory in which `varnishd` keeps temporary files and persistent state. If the specified name begins with a forward slash, it is interpreted as the absolute path to the directory which should be used for this purpose. -P file Write the PID of the process to the specified file. -p Set the parameter specified by param to the specified value, see `List of Parameters`_ for details. This option can be used multiple times to specify multiple parameters. -r Make the listed parameters read only. This gives the system administrator a way to limit what the Varnish CLI can do. Consider making parameters such as *cc_command*, *vcc_allow_inline_c* and *vmod_dir* read only as these can potentially be used to escalate privileges from the CLI. -S file Path to a file containing a secret used for authorizing access to the management port. If not provided a new secret will be drawn from the system PRNG. -s <[name=]type[,options]> Use the specified storage backend, see `Storage Backend Options`_. This option can be used multiple times to specify multiple storage files. Names are referenced in logs, VCL, statistics, etc. -T Offer a management interface on the specified address and port. See `Management Interface`_ for a list of management commands. -t TTL Specifies the default time to live (TTL) for cached objects. This is a shortcut for specifying the *default_ttl* run-time parameter. -V Display the version number and exit. -W waiter Specifies the waiter type to use. .. _opt_h: Hash Algorithm Options ---------------------- The following hash algorithms are available: -h critbit self-scaling tree structure. The default hash algorithm in Varnish Cache 2.1 and onwards. In comparison to a more traditional B tree the critbit tree is almost completely lockless. Do not change this unless you are certain what you're doing. -h simple_list A simple doubly-linked list. Not recommended for production use. -h A standard hash table. The hash key is the CRC32 of the object's URL modulo the size of the hash table. Each table entry points to a list of elements which share the same hash key. The buckets parameter specifies the number of entries in the hash table. The default is 16383. .. _ref-varnishd-opt_s: Storage Backend Options ----------------------- The following storage types are available: -s malloc is a memory based backend. -s The file backend stores data in a file on disk. The file will be accessed using mmap. The path is mandatory. If path points to a directory, a temporary file will be created in that directory and immediately unlinked. If path points to a non-existing file, the file will be created. If size is omitted, and path points to an existing file with a size greater than zero, the size of that file will be used. If not, an error is reported. Granularity sets the allocation block size. Defaults to the system page size or the filesystem block size, whichever is larger. -s Persistent storage. Varnish will store objects in a file in a manner that will secure the survival of *most* of the objects in the event of a planned or unplanned shutdown of Varnish. The persistent storage backend has multiple issues with it and will likely be removed from a future version of Varnish. .. _ref-varnishd-opt_j: Jail Options ------------ Varnish jails are a generalization over various platform specific methods to reduce the privileges of varnish processes. They may have specific options. Available jails are: -j solaris Reduce privileges(5) for `varnishd` and sub-process to the minimally required set. Only available on platforms which have the setppriv(2) call. -j Default on all other platforms if `varnishd` is either started with an effective uid of 0 ("as root") or as user ``varnish``. With the ``unix`` jail technology activated, varnish will switch to an alternative user for subprocesses and change the effective uid of the master process whenever possible. The optional `user` argument specifies which alternative user to use. It defaults to ``varnish`` The optional `ccgroup` argument specifies a group to add to varnish subprocesses requiring access to a c-compiler. There is no default. -j none last resort jail choice: With jail technology ``none``, varnish will run all processes with the privileges it was started with. .. _ref-varnishd-opt_T: Management Interface -------------------- If the -T option was specified, `varnishd` will offer a command-line management interface on the specified address and port. The recommended way of connecting to the command-line management interface is through varnishadm(1). The commands available are documented in varnish(7). .. _ref-varnishd-params: RUN TIME PARAMETERS =================== Run Time Parameter Flags ------------------------ Runtime parameters are marked with shorthand flags to avoid repeating the same text over and over in the table below. The meaning of the flags are: * `experimental` We have no solid information about good/bad/optimal values for this parameter. Feedback with experience and observations are most welcome. * `delayed` This parameter can be changed on the fly, but will not take effect immediately. * `restart` The worker process must be stopped and restarted, before this parameter takes effect. * `reload` The VCL programs must be reloaded for this parameter to take effect. * `experimental` We're not really sure about this parameter, tell us what you find. * `wizard` Do not touch unless you *really* know what you're doing. * `only_root` Only works if `varnishd` is running as root. Default Value Exceptions on 32 bit Systems ------------------------------------------ Be aware that on 32 bit systems, certain default values are reduced relative to the values listed below, in order to conserve VM space: * workspace_client: 16k * thread_pool_workspace: 16k * http_resp_size: 8k * http_req_size: 12k * gzip_stack_buffer: 4k * thread_pool_stack: 64k List of Parameters ------------------ This text is produced from the same text you will find in the CLI if you use the param.show command: .. include:: ../include/params.rst EXIT CODES ========== Varnish and bundled tools will, in most cases, exit with one of the following codes * `0` OK * `1` Some error which could be system-dependent and/or transient * `2` Serious configuration / parameter error - retrying with the same configuration / parameters is most likely useless The `varnishd` master process may also OR its exit code * with `0x20` when the `varnishd` child process died, * with `0x40` when the `varnishd` child process was terminated by a signal and * with `0x80` when a core was dumped. SEE ALSO ======== * :ref:`varnishlog(1)` * :ref:`varnishhist(1)` * :ref:`varnishncsa(1)` * :ref:`varnishstat(1)` * :ref:`varnishtop(1)` * :ref:`varnish-cli(7)` * :ref:`vcl(7)` HISTORY ======= The `varnishd` daemon was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software. This manual page was written by Dag-Erling Smørgrav with updates by Stig Sandbeck Mathisen , Nils Goroll and others. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2007-2015 Varnish Software AS varnish-4.1.1/doc/html/_sources/reference/vsl.txt0000644000201500234410000000523712652366773016772 00000000000000.. role:: ref(emphasis) .. _vsl(7): === VSL === ----------------------------- Varnish Shared Memory Logging ----------------------------- :Manual section: 7 OVERVIEW ======== This document describes the format and content of all the Varnish shared memory logging tags. These tags are used by the varnishlog(1), varnishtop(1), etc. logging tools supplied with Varnish. VSL tags ~~~~~~~~ .. include:: ../../../lib/libvarnishapi/vsl-tags.rst TIMESTAMPS ========== Timestamps are inserted in the log on completing certain events during the worker thread's task handling. The timestamps has a label showing which event was completed. The reported fields show the absolute time of the event, the time spent since the start of the task and the time spent since the last timestamp was logged. The timestamps logged automatically by Varnish are inserted after completing events that are expected to have delays (e.g. network IO or spending time on a waitinglist). Timestamps can also be inserted from VCL using the std.timestamp() method. If one is doing time consuming tasks in the VCL configuration, it's a good idea to log a timestamp after completing that task. This keeps the timing information in subsequent timestamps from including the time spent on the VCL event. Request handling timestamps ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Start The start of request processing (first byte received or restart). Req Complete client request received. ReqBody Client request body processed (discarded, cached or passed to the backend). Waitinglist Came off waitinglist. Fetch Fetch processing finished (completely fetched or ready for streaming). Process Processing finished, ready to deliver the client response. Resp Delivery of response to the client finished. Restart Client request is being restarted. Pipe handling timestamps ~~~~~~~~~~~~~~~~~~~~~~~~ Pipe Opened a pipe to the backend and forwarded the request. PipeSess The pipe session has finished. Backend fetch timestamps ~~~~~~~~~~~~~~~~~~~~~~~~ Start Start of the backend fetch processing. Bereq Backend request sent. Beresp Backend response headers received. BerespBody Backend response body received. Retry Backend request is being retried. Error Backend request failed to vcl_backend_error. HISTORY ======= This document was initially written by Poul-Henning Kamp, and later updated by Martin Blix Grydeland. SEE ALSO ======== * :ref:`varnishhist(1)` * :ref:`varnishlog(1)` * :ref:`varnishncsa(1)` * :ref:`varnishtop(1)` COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/html/_sources/reference/vmod.txt0000644000201500234410000003660412652366773017135 00000000000000.. _ref-vmod: %%%%%%%%%%%%%%%%%%%%%% VMOD - Varnish Modules %%%%%%%%%%%%%%%%%%%%%% For all you can do in VCL, there are things you can not do. Look an IP number up in a database file for instance. VCL provides for inline C code, and there you can do everything, but it is not a convenient or even readable way to solve such problems. This is where VMODs come into the picture: A VMOD is a shared library with some C functions which can be called from VCL code. For instance:: import std; sub vcl_deliver { set resp.http.foo = std.toupper(req.url); } The "std" vmod is one you get with Varnish, it will always be there and we will put "boutique" functions in it, such as the "toupper" function shown above. The full contents of the "std" module is documented in vmod_std(3). 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 can find contributed VMODs etc. This explanation will use the "std" VMOD as example, having a Varnish source tree handy may be a good idea. VMOD Directory ============== The VMOD directory is an up-to-date compilation of maintained extensions written for Varnish Cache: https://www.varnish-cache.org/vmods The vmod.vcc file ================= The interface between your VMOD and the VCL compiler ("VCC") and the VCL runtime ("VRT") is defined in the vmod.vcc file which a python script called "vmodtool.py" turns into thaumaturgically challenged C data structures that does all the hard work. The std VMODs vmod.vcc file looks somewhat like this:: $Module std 3 $Event event_function $Function STRING toupper(STRING_LIST) $Function STRING tolower(STRING_LIST) $Function VOID set_ip_tos(INT) The first line gives the name of the module and the manual section where the documentation will reside. The second line specifies an optional "Event" function, which will be called whenever a VCL program which imports this VMOD is loaded or transitions to any of the warm, active, cold or discarded states. More on this below. The next three lines define three functions in the VMOD, along with the types of the arguments, and that is probably where the hardest bit of writing a VMOD is to be found, so we will talk about that at length in a moment. Notice that the third function returns VOID, that makes it a "procedure" in VCL lingo, meaning that it cannot be used in expressions, right side of assignments and such. Instead it can be used as a primary action, something functions which return a value can not:: sub vcl_recv { std.set_ip_tos(32); } Running vmodtool.py on the vmod.vcc file, produces a "vcc_if.c" and "vcc_if.h" files, which you must use to build your shared library file. Forget about vcc_if.c everywhere but your Makefile, you will never need to care about its contents, and you should certainly never modify it, that voids your warranty instantly. But vcc_if.h is important for you, it contains the prototypes for the functions you want to export to VCL. For the std VMOD, the compiled vcc_if.h file looks like this:: struct vmod_priv; VCL_STRING vmod_toupper(VRT_CTX, const char *, ...); VCL_STRING vmod_tolower(VRT_CTX, const char *, ...); VCL_VOID vmod_set_ip_tos(VRT_CTX, VCL_INT); vmod_event_f event_function; Those are your C prototypes. Notice the ``vmod_`` prefix on the function names. .. _ref-vmod-vcl-c-types: VCL and C data types ==================== VCL data types are targeted at the job, so for instance, we have data types like "DURATION" and "HEADER", but they all have some kind of C language representation. Here is a description of them. All but the PRIV and STRING_LIST types have typedefs: VCL_INT, VCL_REAL, etc. .. TODO document ACL if patchwork #314 is merged BACKEND C-type: ``const struct director *`` A type for backend and director implementations. See :ref:`ref-writing-a-director`. BLOB C-type: ``const struct vmod_priv *`` An opaque type to pass random bits of memory between VMOD functions. BOOL C-type: ``unsigned`` Zero means false, anything else means true. BYTES C-type: ``double`` Unit: bytes. A storage space, as in 1024 bytes. DURATION C-type: ``double`` Unit: seconds. A time interval, as in 25 seconds. ENUM C-type: ``const char *`` TODO HEADER C-type: ``const struct gethdr_s *`` These are VCL compiler generated constants referencing a particular header in a particular HTTP entity, for instance ``req.http.cookie`` or ``beresp.http.last-modified``. By passing a reference to the header, the VMOD code can both read and write the header in question. If the header was passed as STRING, the VMOD code only sees the value, but not where it came from. HTTP C-type: ``struct http *`` TODO INT C-type: ``long`` A (long) integer as we know and love them. IP C-type: ``const struct suckaddr *`` This is an opaque type, see the ``include/vsa.h`` file for which primitives we support on this type. PRIV_CALL See :ref:`ref-vmod-private-pointers` below. PRIV_TASK See :ref:`ref-vmod-private-pointers` below. PRIV_TOP See :ref:`ref-vmod-private-pointers` below. PRIV_VCL See :ref:`ref-vmod-private-pointers` below. PROBE C-type: ``const struct vrt_backend_probe *`` A named standalone backend probe definition. REAL C-type: ``double`` A floating point value. STRING C-type: ``const char *`` A NUL-terminated text-string. Can be NULL to indicate a nonexistent string, for instance in:: mymod.foo(req.http.foobar); If there were no "foobar" HTTP header, the vmod_foo() function would be passed a NULL pointer as argument. When used as a return value, the producing function is responsible for arranging memory management. Either by freeing the string later by whatever means available or by using storage allocated from the client or backend workspaces. STRING_LIST C-type: ``const char *, ...`` A multi-component text-string. We try very hard to avoid doing text-processing in Varnish, and this is one way we to avoid that, by not editing separate pieces of a string together to one string, unless we have to. Consider this contrived example:: set req.http.foo = std.toupper(req.http.foo + req.http.bar); The usual way to do this, would be be to allocate memory for the concatenated string, then pass that to ``toupper()`` which in turn would return another freshly allocated string with the modified result. Remember: strings in VCL are ``const``, we cannot just modify the string in place. What we do instead, is declare that ``toupper()`` takes a "STRING_LIST" as argument. This makes the C function implementing ``toupper()`` a vararg function (see the prototype above) and responsible for considering all the ``const char *`` arguments it finds, until the magic marker "vrt_magic_string_end" is encountered. Bear in mind that the individual strings in a STRING_LIST can be NULL, as described under STRING, that is why we do not use NULL as the terminator. Right now we only support STRING_LIST being the last argument to a function, we may relax that at a latter time. If you don't want to bother with STRING_LIST, just use STRING and make sure your workspace_client and workspace_backend params are big enough. TIME C-type: ``double`` Unit: seconds since UNIX epoch. An absolute time, as in 1284401161. VOID C-type: ``void`` Can only be used for return-value, which makes the function a VCL procedure. .. _ref-vmod-private-pointers: Private Pointers ================ It is often useful for library functions to maintain local state, this can be anything from a precompiled regexp to open file descriptors and vast data structures. The VCL compiler supports the following private pointers: * ``PRIV_CALL`` "per call" private pointers are useful to cache/store state relative to the specific call or its arguments, for instance a compiled regular expression specific to a regsub() statement or a simply caching the last output of some expensive lookup. * ``PRIV_TASK`` "per task" private pointers are useful for state that applies to calls for either a specific request or a backend request. For instance this can be the result of a parsed cookie specific to a client. Note that ``PRIV_TASK`` contexts are separate for the client side and the backend side, so use in ``vcl_backend_*`` will yield a different private pointer from the one used on the client side. * ``PRIV_TOP`` "per top-request" private pointers live for the duration of one request and all its ESI-includes. They are only defined for the client side. When used from backend VCL subs, a NULL pointer will be passed. * ``PRIV_VCL`` "per vcl" private pointers are useful for such global state that applies to all calls in this VCL, for instance flags that determine if regular expressions are case-sensitive in this vmod or similar. The ``PRIV_VCL`` object is the same object that is passed to the VMOD's event function. The way it works in the vmod code, is that a ``struct vmod_priv *`` is passed to the functions where one of the ``PRIV_*`` argument types is specified. This structure contains three members:: typedef void vmod_priv_free_f(void *); struct vmod_priv { void *priv; int len; vmod_priv_free_f *free; }; The "priv" element can be used for whatever the vmod code wants to use it for, it defaults to a NULL pointer. The "len" element is used primarily for BLOBs to indicate its size. The "free" element defaults to NULL, and it is the modules responsibility to set it to a suitable function, which can clean up whatever the "priv" pointer points to. When a VCL program is discarded, all private pointers are checked to see if both the "priv" and "free" elements are non-NULL, and if they are, the "free" function will be called with the "priv" pointer as the only argument. In the common case where a private data structure is allocated with malloc would look like this:: if (priv->priv == NULL) { priv->priv = calloc(sizeof(struct myfoo), 1); AN(priv->priv); priv->free = free; /* free(3) */ mystate = priv->priv; mystate->foo = 21; ... } else { mystate = priv->priv; } if (foo > 25) { ... } The per-call vmod_privs are freed before the per-vcl vmod_priv. .. _ref-vmod-event-functions: Event functions =============== VMODs can have an "event" function which is called when a VCL which imports the VMOD is loaded, made active, or discarded. This corresponds to the ``VCL_EVENT_LOAD``, and ``VCL_EVENT_DISCARD`` events, respectively. In addition, this function will be called when the VCL temperature is changed to cold or warm, corresponding to the ``VCL_EVENT_COLD`` and ``VCL_EVENT_WARM`` events. The first argument to the event function is a VRT context. The second argument is the vmod_priv specific to this particular VCL, and if necessary, a VCL specific VMOD "fini" function can be attached to its "free" hook. The third argument is the event. If the VMOD has private global state, which includes any sockets or files opened, any memory allocated to global or private variables in the C-code etc, it is the VMODs own responsibility to track how many VCLs were loaded or discarded and free this global state when the count reaches zero. VMOD writers are *strongly* encouraged to release all per-VCL resources for a given VCL when it emits a ``VCL_EVENT_COLD`` event. You will get a chance to reacquire the resources before the VCL becomes active again and be notified first with a ``VCL_EVENT_WARM`` event. Unless a user decides that a given VCL should always be warm, an inactive VMOD will eventually become cold and should manage resources accordingly. An event function must return zero upon success. It is only possible to fail an initialization with the ``VCL_EVENT_LOAD`` or ``VCL_EVENT_WARM`` events. Should such a failure happen, a ``VCL_EVENT_DISCARD`` or ``VCL_EVENT_COLD`` event will be sent to the VMODs that succeeded to put them back in a cold state. The VMOD that failed will not receive this event, and therefore must not be left half-initialized should a failure occur. If your VMOD is running an asynchronous background job you can hold a reference to the VCL to prevent it from going cold too soon and get the same guarantees as backends with ongoing requests for instance. For that, you must acquire the reference by calling ``VRT_ref_vcl`` when you receive a ``VCL_EVENT_WARM`` and later calling ``VRT_rel_vcl`` once the background job is over. Receiving a ``VCL_EVENT_COLD`` is your cue to terminate any background job bound to a VCL. You can find an example of VCL references in vmod-debug:: priv_vcl->vclref = VRT_ref_vcl(ctx, "vmod-debug"); ... VRT_rel_vcl(&ctx, &priv_vcl->vclref); In this simplified version, you can see that you need at least a VCL-bound data structure like a ``PRIV_VCL`` or a VMOD object to keep track of the reference and later release it. You also have to provide a description, it will be printed to the user if they try to warm up a cooling VCL:: $ varnishadm vcl.list available auto/cooling 0 vcl1 active auto/warm 0 vcl2 $ varnishadm vcl.state vcl1 warm Command failed with error code 300 Failed Message: VCL vcl1 is waiting for: - vmod-debug In the case where properly releasing resources may take some time, you can opt for an asynchronous worker, either by spawning a thread and tracking it, or by using Varnish's worker pools. There is also a ``VCL_EVENT_USE`` event. Please note that this event is now deprecated and may be removed in a future release. A warm VCL should be ready to use so no additional task should be postponed at use time. When to lock, and when not to lock ================================== Varnish is heavily multithreaded, so by default VMODs must implement their own locking to protect shared resources. When a VCL is loaded or unloaded, the event and priv->free are run sequentially all in a single thread, and there is guaranteed to be no other activity related to this particular VCL, nor are there init/fini activity in any other VCL or VMOD at this time. That means that the VMOD init, and any object init/fini functions are already serialized in sensible order, and won't need any locking, unless they access VMOD specific global state, shared with other VCLs. Traffic in other VCLs which also import this VMOD, will be happening while housekeeping is going on. Updating VMODs ============== A compiled VMOD is a shared library file which Varnish dlopen(3)'s using flags RTLD_NOW | RTLD_LOCAL. As a general rule, once a file is opened with dlopen(3) you should never modify it, but it is safe to rename it and put a new file under the name it had, which is how most tools installs and updates shared libraries. However, when you call dlopen(3) with the same filename multiple times it will give you the same single copy of the shared library file, without checking if it was updated in the meantime. This is obviously an oversight in the design of the dlopen(3) library function, but back in the late 1980s nobody could imagine why a program would ever want to have multiple different versions of the same shared library mapped at the same time. Varnish does that, and therefore you must restart the worker process before Varnish will discover an updated VMOD. If you want to test a new version of a VMOD, while being able to instantly switch back to the old version, you will have to install each version with a distinct filename or in a distinct subdirectory and use ``import foo from "...";`` to reference it in your VCL. We're not happy about this, but have found no sensible workarounds. varnish-4.1.1/doc/html/_sources/reference/vcl.txt0000644000201500234410000002357112652366773016753 00000000000000.. role:: ref(emphasis) .. _vcl(7): === VCL === ------------------------------ Varnish Configuration Language ------------------------------ :Manual section: 7 DESCRIPTION =========== The VCL language is a small domain-specific language designed to be used to describe request handling and document caching policies for Varnish Cache. When a new configuration is loaded, the varnishd management process translates the VCL code to C and compiles it to a shared object which is then loaded into the server process. This document focuses on the syntax of the VCL language. For a full description of syntax and semantics, with ample examples, please see the online documentation at https://www.varnish-cache.org/docs/ . Starting with Varnish 4.0, each VCL file must start by declaring its version with a special "vcl 4.0;" marker at the top of the file. Operators --------- The following operators are available in VCL: = Assignment operator. == Comparison. ~ Match. Can either be used with regular expressions or ACLs. ! Negation. && Logical and. || Logical or. Conditionals ------------ VCL has *if* and *else* statements. Nested logic can be implemented with the *elseif* statement (*elsif*/*elif*/*else if* are equivalent). Note that there are no loops or iterators of any kind in VCL. Strings, booleans, time, duration and integers ---------------------------------------------- These are the data types in Varnish. You can *set* or *unset* these. Example:: set req.http.User-Agent = "unknown"; unset req.http.Range; Strings ~~~~~~~ Basic strings are enclosed in double quotes (" ... "), and may not contain newlines. Long strings are enclosed in {" ... "}. They may contain any character including single double quotes ("), newline and other control characters except for the NUL (0x00) character. Booleans ~~~~~~~~ Booleans can be either *true* or *false*. Time ---- VCL has time. The function *now* returns a time. A duration can be added to a time to make another time. In string context they return a formatted string. Durations --------- Durations are defined by a number and a designation. The number can be a real so 1.5w is allowed. ms milliseconds s seconds m minutes h hours d days w weeks y years Integers -------- Certain fields are integers, used as expected. In string context they return a string. Real numbers ------------ VCL understands real numbers. As with integers, when used in a string context they will return a string. Regular Expressions ------------------- Varnish uses Perl-compatible regular expressions (PCRE). For a complete description please see the pcre(3) man page. To send flags to the PCRE engine, such as to do case insensitive matching, add the flag within parens following a question mark, like this:: # If host is NOT example dot com.. if (req.http.host !~ "(?i)example.com$") { ... } Include statement ----------------- To include a VCL file in another file use the include keyword:: include "foo.vcl"; Import statement ---------------- The *import* statement is used to load Varnish Modules (VMODs.) Example:: import std; sub vcl_recv { std.log("foo"); } Comments -------- Single lines of VCL can be commented out using // or #. Multi-line blocks can be commented out with \/\* block \/\*. Example:: sub vcl_recv { // Single line of out-commented VCL. # Another way of commenting out a single line. /* Multi-line block of commented-out VCL. */ } Backend definition ------------------ A backend declaration creates and initialises a named backend object. A declaration start with the keyword *backend* followed by the name of the backend. The actual declaration is in curly brackets, in a key/value fashion.:: backend name { .attribute = "value"; } The only mandatory attribute is *host*. The attributes will inherit their defaults from the global parameters. The following attributes are available: host (mandatory) The host to be used. IP address or a hostname that resolves to a single IP address. port The port on the backend that Varnish should connect to. host_header A host header to add. connect_timeout Timeout for connections. first_byte_timeout Timeout for first byte. between_bytes_timeout Timeout between bytes. probe Attach a probe to the backend. See `Probes`_ max_connections Maximum number of open connections towards this backend. If Varnish reaches the maximum Varnish it will start failing connections. Backends can be used with *directors*. Please see the :ref:`vmod_directors(3)` man page for more information. .. _reference-vcl_probes: Probes ------ Probes will query the backend for status on a regular basis and mark the backend as down it they fail. A probe is defined as this:: probe name { .attribute = "value"; } There are no mandatory options. These are the options you can set: url The URL to query. Defaults to "/". request Specify a full HTTP request using multiple strings. .request will have \\r\\n automatically inserted after every string. If specified, .request will take precedence over .url. expected_response The expected HTTP response code. Defaults to 200. timeout The timeout for the probe. Default is 2s. interval How often the probe is run. Default is 5s. initial How many of the polls in .window are considered good when Varnish starts. Defaults to the value of threshold - 1. In this case, the backend starts as sick and requires one single poll to be considered healthy. window How many of the latest polls we examine to determine backend health. Defaults to 8. threshold How many of the polls in .window must have succeeded for us to consider the backend healthy. Defaults to 3. Access Control List (ACL) ------------------------- An Access Control List (ACL) declaration creates and initialises a named access control list which can later be used to match client addresses:: acl localnetwork { "localhost"; # myself "192.0.2.0"/24; # and everyone on the local network ! "192.0.2.23"; # except for the dial-in router } If an ACL entry specifies a host name which Varnish is unable to resolve, it will match any address it is compared to. Consequently, if it is preceded by a negation mark, it will reject any address it is compared to, which may not be what you intended. If the entry is enclosed in parentheses, however, it will simply be ignored. To match an IP address against an ACL, simply use the match operator:: if (client.ip ~ localnetwork) { return (pipe); } VCL objects ----------- A VCL object can be instantiated with the *new* keyword:: sub vcl_init { new b = directors.round_robin() b.add_backend(node1); } This is only available in vcl_init. Subroutines ----------- A subroutine is used to group code for legibility or reusability:: sub pipe_if_local { if (client.ip ~ localnetwork) { return (pipe); } } Subroutines in VCL do not take arguments, nor do they return values. The built in subroutines all have names beginning with vcl\_, which is reserved. To call a subroutine, use the call keyword followed by the subroutine's name:: sub vcl_recv { call pipe_if_local; } Return statements ~~~~~~~~~~~~~~~~~ The ongoing vcl\_* subroutine execution ends when a return(*action*) statement is made. The *action* specifies how execution should proceed. The context defines which actions are available. Multiple subroutines ~~~~~~~~~~~~~~~~~~~~ If multiple subroutines with the name of one of the built-in ones are defined, they are concatenated in the order in which they appear in the source. The built-in VCL distributed with Varnish will be implicitly concatenated when the VCL is compiled. Variables --------- In VCL you have access to certain variable objects. These contain requests and responses currently being worked on. What variables are available depends on context. .. include:: ../include/vcl_var.rst Functions --------- The following built-in functions are available: ban(expression) Invalidates all objects in cache that match the expression with the ban mechanism. hash_data(input) Adds an input to the hash input. In the built-in VCL hash_data() is called on the host and URL of the *request*. Available in vcl_hash. rollback() Restore *req* HTTP headers to their original state. This function is deprecated. Use std.rollback() instead. synthetic(STRING) Prepare a synthetic response body containing the STRING. Available in vcl_synth and vcl_backend_error. .. list above comes from struct action_table[] in vcc_action.c. regsub(str, regex, sub) Returns a copy of str with the first occurrence of the regular expression regex replaced with sub. Within sub, \\0 (which can also be spelled \\&) is replaced with the entire matched string, and \\n is replaced with the contents of subgroup n in the matched string. regsuball(str, regex, sub) As regsub() but this replaces all occurrences. .. regsub* is in vcc_expr.c For converting or casting VCL values between data types use the functions available in the std VMOD. EXAMPLES ======== For examples, please see the online documentation. SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`vmod_directors(3)` * :ref:`vmod_std(3)` HISTORY ======= VCL was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Redpill Linpro and Varnish Software. This manual page is written by Per Buer, Poul-Henning Kamp, Martin Blix Grydeland, Kristian Lyngstøl, Lasse Karstensen and possibly others. COPYRIGHT ========= This document is licensed under the same license as Varnish itself. See LICENSE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/html/_sources/reference/varnish-cli.txt0000644000201500234410000002277212652366773020410 00000000000000.. role:: ref(emphasis) .. _varnish-cli(7): =========== varnish-cli =========== ------------------------------ Varnish Command Line Interface ------------------------------ :Manual section: 7 DESCRIPTION =========== Varnish as a command line interface (CLI) which can control and change most of the operational parameters and the configuration of Varnish, without interrupting the running service. The CLI can be used for the following tasks: configuration You can upload, change and delete VCL files from the CLI. parameters You can inspect and change the various parameters Varnish has available through the CLI. The individual parameters are documented in the varnishd(1) man page. bans Bans are filters that are applied to keep Varnish from serving stale content. When you issue a ban Varnish will not serve any *banned* object from cache, but rather re-fetch it from its backend servers. process management You can stop and start the cache (child) process though the CLI. You can also retrieve the latest stack trace if the child process has crashed. If you invoke varnishd(1) with -T, -M or -d the CLI will be available. In debug mode (-d) the CLI will be in the foreground, with -T you can connect to it with varnishadm or telnet and with -M varnishd will connect back to a listening service *pushing* the CLI to that service. Please see :ref:`varnishd(1)` for details. Syntax ------ Commands are usually terminated with a newline. Long command can be entered using sh style *here documents*. The format of here-documents is:: << word here document word *word* can be any continuous string chosen to make sure it doesn't appear naturally in the following *here document*. When using the here document style of input there are no restrictions on length. When using newline-terminated commands maximum length is limited by the varnishd parameter *cli_buffer*. When commands are newline terminated they get *tokenized* before parsing so if you have significant spaces enclose your strings in double quotes. Within the quotes you can escape characters with \\. The \n, \r and \t get translated to newlines, carriage returns and tabs. Double quotes themselves can be escaped with a backslash. To enter characters in octals use the \\nnn syntax. Hexadecimals can be entered with the \\xnn syntax. Commands -------- help [] Show command/protocol help. ping [] Keep connection alive. auth Authenticate. quit Close connection. banner Print welcome banner. status Check status of Varnish cache process. start Start the Varnish cache process. stop Stop the Varnish cache process. vcl.load [auto|cold|warm] Compile and load the VCL file under the name provided. vcl.inline [auto|cold|warm] Compile and load the VCL data under the name provided. vcl.use Switch to the named configuration immediately. vcl.discard Unload the named configuration (when possible). vcl.list List all loaded configuration. vcl.show [-v] Display the source code for the specified configuration. vcl.state Force the state of the specified configuration. State is any of auto, warm or cold values. param.show [-l] [] Show parameters and their values. param.set Set parameter value. panic.show Return the last panic, if any. panic.clear [-z] Clear the last panic, if any. -z will clear related varnishstat counter(s). storage.list List storage devices. backend.list [-p] [] List backends. backend.set_health Set health status on the backends. State is any of auto, healthy or sick values. ban [&& ...] Mark obsolete all objects where all the conditions match. ban.list List the active bans. Backend Expression ------------------ A backend expression can be a backend name or a combination of backend name, IP address and port in "name(IP address:port)" format. All fields are optional. If no exact matching backend is found, partial matching will be attempted based on the provided name, IP address and port fields. Examples:: backend.list def* backend.set_health default sick backend.set_health def* healthy backend.set_health * auto Ban Expressions --------------- A ban expression consists of one or more conditions. A condition consists of a field, an operator, and an argument. Conditions can be ANDed together with "&&". A field can be any of the variables from VCL, for instance req.url, req.http.host or obj.http.set-cookie. Operators are "==" for direct comparison, "~" for a regular expression match, and ">" or "<" for size comparisons. Prepending an operator with "!" negates the expression. The argument could be a quoted string, a regexp, or an integer. Integers can have "KB", "MB", "GB" or "TB" appended for size related fields. .. _ref_vcl_temperature: VCL Temperature --------------- A VCL program goes through several states related to the different commands: it can be loaded, used, and later discarded. You can load several VCL programs and switch at any time from one to another. There is only one active VCL, but the previous active VCL will be maintained active until all its transactions are over. Over time, if you often refresh your VCL and keep the previous versions around, resource consumption will increase, you can't escape that. However, most of the time you want only one to pay the price only for the active VCL and keep older VCLs in case you'd need to rollback to a previous version. The VCL temperature allows you to minimize the footprint of inactive VCLs. Once a VCL becomes cold, Varnish will release all the resources that can be be later reacquired. You can manually set the temperature of a VCL or let varnish automatically handle it. Scripting --------- If you are going to write a script that talks CLI to varnishd, the include/cli.h contains the relevant magic numbers. One particular magic number to know, is that the line with the status 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. .. _ref_psk_auth: How -S/PSK Authentication Works ------------------------------- If the -S secret-file is given as argument to varnishd, all network CLI connections must authenticate, by proving they know the contents of that file. The file is read at the time the auth command is issued and the contents is not cached in varnishd, so it is possible to update the file on the fly. Use the unix file permissions to control access to the file. An authenticated session looks like this:: critter phk> telnet localhost 1234 Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 107 59 ixslvvxrgkjptxmcgnnsdxsvdmvfympg Authentication required. auth 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a 200 193 ----------------------------- Varnish HTTP accelerator CLI. ----------------------------- Type 'help' for command list. Type 'quit' to close CLI session. Type 'start' to launch worker process. The CLI status of 107 indicates that authentication is necessary. The first 32 characters of the response text is the challenge "ixsl...mpg". The challenge is randomly generated for each CLI connection, and changes each time a 107 is emitted. The most recently emitted challenge must be used for calculating the authenticator "455c...c89a". The authenticator is calculated by applying the SHA256 function to the following byte sequence: * Challenge string * Newline (0x0a) character. * Contents of the secret file * Challenge string * Newline (0x0a) character. and dumping the resulting digest in lower-case hex. In the above example, the secret file contained foo\n and thus:: critter phk> cat > _ ixslvvxrgkjptxmcgnnsdxsvdmvfympg foo ixslvvxrgkjptxmcgnnsdxsvdmvfympg ^D critter phk> hexdump -C _ 00000000 69 78 73 6c 76 76 78 72 67 6b 6a 70 74 78 6d 63 |ixslvvxrgkjptxmc| 00000010 67 6e 6e 73 64 78 73 76 64 6d 76 66 79 6d 70 67 |gnnsdxsvdmvfympg| 00000020 0a 66 6f 6f 0a 69 78 73 6c 76 76 78 72 67 6b 6a |.foo.ixslvvxrgkj| 00000030 70 74 78 6d 63 67 6e 6e 73 64 78 73 76 64 6d 76 |ptxmcgnnsdxsvdmv| 00000040 66 79 6d 70 67 0a |fympg.| 00000046 critter phk> sha256 _ SHA256 (_) = 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a critter phk> openssl dgst -sha256 < _ 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a The sourcefile lib/libvarnish/cli_auth.c contains a useful function which calculates the response, given an open filedescriptor to the secret file, and the challenge string. EXAMPLES ======== Simple example: All requests where req.url exactly matches the string /news are banned from the cache:: req.url == "/news" Example: Ban all documents where the serving host is "example.com" or "www.example.com", and where the Set-Cookie header received from the backend contains "USERID=1663":: req.http.host ~ "^(?i)(www\.)example.com$" && obj.http.set-cookie ~ "USERID=1663" AUTHORS ======= This manual page was originally written by Per Buer and later modified by Federico G. Schwindt, Dridi Boukelmoune, Lasse Karstensen and Poul-Henning Kamp. SEE ALSO ======== * :ref:`varnishadm(1)` * :ref:`varnishd(1)` * :ref:`vcl(7)` varnish-4.1.1/doc/html/_sources/reference/varnishadm.txt0000644000201500234410000000446212652366773020321 00000000000000.. role:: ref(emphasis) .. _varnishadm(1): ========== varnishadm ========== Control a running Varnish instance ---------------------------------- :Manual section: 1 SYNOPSIS ======== varnishadm [-n ident] [-t timeout] [-S secretfile] [-T [address]:port] [command [...]] DESCRIPTION =========== The `varnishadm` utility establishes a CLI connection to varnishd either using -n *name* or using the -T and -S arguments. If -n *name* is given the location of the secret file and the address:port is looked up in shared memory. If neither is given `varnishadm` will look for an instance without a given name. If a command is given, the command and arguments are sent over the CLI connection and the result returned on stdout. If no command argument is given `varnishadm` will pass commands and replies between the CLI socket and stdin/stdout. OPTIONS ======= -n ident Connect to the instance of `varnishd` with this name. -S secretfile Specify the authentication secret file. This should be the same -S argument as was given to `varnishd`. Only processes which can read the contents of this file, will be able to authenticate the CLI connection. -t timeout Wait no longer than this many seconds for an operation to finish. -T Connect to the management interface at the specified address and port. The syntax and operation of the actual CLI interface is described in the :ref:`varnish-cli(7)` manual page. Parameters are described in :ref:`varnishd(1)` manual page. Additionally, a summary of commands can be obtained by issuing the *help* command, and a summary of parameters can be obtained by issuing the *param.show* command. EXIT STATUS =========== If a command is given, the exit status of the `varnishadm` utility is zero if the command succeeded, and non-zero otherwise. EXAMPLES ======== Some ways you can use varnishadm:: varnishadm -T localhost:999 -S /var/db/secret vcl.use foo echo vcl.use foo | varnishadm -T localhost:999 -S /var/db/secret echo vcl.use foo | ssh vhost varnishadm -T localhost:999 -S /var/db/secret SEE ALSO ======== * :ref:`varnishd(1)` * :ref:`varnish-cli(7)` AUTHORS ======= The `varnishadm` utility and this manual page were written by Cecilie Fritzvold. This man page has later been modified by Per Buer, Federico G. Schwindt and Lasse Karstensen. varnish-4.1.1/doc/html/_sources/reference/vsl-query.txt0000644000201500234410000002116512652366773020133 00000000000000.. role:: ref(emphasis) .. _vsl-query(7): ========= vsl-query ========= ----------------------------- Varnish VSL Query Expressions ----------------------------- :Manual section: 7 OVERVIEW ======== The Varnish VSL Query Expressions extracts transactions from the Varnish shared memory log, and perform queries on the transactions before reporting matches. A transaction is a set of log lines that belongs together, e.g. a client request or a backend request. The API monitors the log, and collects all log records that make up a transaction before reporting on that transaction. Transactions can also be grouped, meaning backend transactions are reported together with the client transaction that initiated it. A query is run on a group of transactions. A query expression is true if there is a log record within the group that satisfies the condition. It is false only if none of the log records satisfies the condition. Query expressions can be combined using boolean functions. GROUPING ======== When grouping transactions, there is a hierarchy structure showing which transaction initiated what. The level increases by one on 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. Request restart transactions don't get their level increased to make it predictable. Levels start counting at 1, except when using raw where it will always be 0. The grouping modes are: * Session All transactions initiated by a client connection are reported together. Client connections are open ended when using HTTP keep-alives, so it is undefined when the session will be reported. If the transaction timeout period is exceeded an incomplete session will be reported. Non-transactional data (VXID == 0) is not reported. * Request Transactions are grouped by request, where the set will include the request itself as well as any backend requests or ESI-subrequests. Session data and non-transactional data (VXID == 0) is not reported. * VXID Transactions are not grouped, so each VXID is reported in it's entirety. Sessions, requests, ESI-requests and backend requests are all reported individually. Non-transactional data is not reported (VXID == 0). This is the default. * Raw Every log record will make up a transaction of it's own. All data, including non-transactional data will be reported. Transaction Hierarchy --------------------- Example transaction hierarchy using request grouping mode :: Lvl 1: Client request (cache miss) Lvl 2: Backend request Lvl 2: ESI subrequest (cache miss) Lvl 3: Backend request Lvl 3: Backend request (VCL restart) Lvl 3: ESI subrequest (cache miss) Lvl 4: Backend request Lvl 2: ESI subrequest (cache hit) MEMORY USAGE ============ The API will use pointers to shared memory log data as long as possible to keep memory usage at a minimum. But as the shared memory log is a ring buffer, data will get overwritten eventually, so the API creates local copies of referenced log data when varnishd comes close to overwriting still unreported content. This process avoids loss of log data in many scenarios, but it is not failsafe: Overruns where varnishd "overtakes" the log reader process in the ring buffer can still happen when API clients cannot keep up reading and/or copying, for instance due to output blocking. Though being unrelated to grouping in principle, copying of log data is particularly relevant for session grouping together with long lasting client connections - for this grouping, the logging API client process is likely to consume relevant amounts of memory. As the vxid grouping also logs (potentially long lasting) sessions, it is also likely to require memory for copies of log entries, but far less than session grouping. QUERY LANGUAGE ============== A query expression consists of record selection criteria, and optionally an operator and a value to match against the selected records. :: Record selection criteria ------------------------- The record selection criteria determines what kind records from the transaction group the expression applies to. Syntax: :: {level}taglist:record-prefix[field] Taglist is mandatory, the other components are optional. The level limits the expression to a transaction at that level. If left unspecified, the expression is applied to transactions at all levels. Level is a positive integer or zero. If level is followed by a '+' character, it expresses greater than or equal. If level is followed by a '-', it expresses less than or equal. The taglist is a comma-separated list of VSL record tags that this expression should be checked against. Each list element can be a tag name or a tag glob. Globs allow a '*' either in the beginning of the name or at the end, and will select all tags that match either the prefix or subscript. A single '*' will select all tags. The record prefix will further limit the matches to those records that has this prefix as it's first part of the record content followed by a colon. The part of the log record matched against will then be limited to what follows the prefix and colon. This is useful when matching against specific HTTP headers. The record prefix matching is done case insensitive. The field will, if present, treat the log record as a white space separated list of fields, and only the nth part of the record will be matched against. Fields start counting at 1. An expression using only a record selection criteria will be true if there is any record in the transaction group that is selected by the criteria. Operators --------- The following matching operators are available: * == != < <= > >= Numerical comparison. The record contents will be converted to either an integer or a float before comparison, depending on the type of the operand. * eq ne String comparison. 'eq' tests string equality, 'ne' tests for not equality. * ~ !~ Regular expression matching. '~' is a positive match, '!~' is a non-match. Operand ------- The operand is the value the selected records will be matched against. An operand can be quoted or unquoted. Quotes can be either single or double quotes, and for quoted operands a backslash can be used to escape the quotes. Unquoted operands can only consist of the following characters: :: a-z A-Z 0-9 + - _ . * The following types of operands are available: * Integer A number without any fractional part, valid for the numerical comparison operators. The integer type is used when the operand does not contain any period (.) characters. * Float A number with a fractional part, valid for the numerical comparison operators. The float type is used when the operand does contain a period (.) character. * String A sequence of characters, valid for the string equality operators. * Regular expression A PCRE regular expression. Valid for the regular expression operators. Boolean functions ----------------- Query expressions can be linked together using boolean functions. The following are available, in decreasing precedence: * not Inverts the result of * and True only if both expr1 and expr2 are true * or True if either of expr1 or expr2 is true Expressions can be grouped using parenthesis. QUERY EXPRESSION EXAMPLES ========================= * Transaction group contains a request URL that equals to "/foo" :: ReqURL eq "/foo" * Transaction group contains a request cookie header :: ReqHeader:cookie * Transaction group doesn't contain a request cookie header :: not ReqHeader:cookie * Client request where internal handling took more than 800ms.:: Timestamp:Process[2] > 0.8 * Transaction group contains a request user-agent header that contains "iPod" and the request delivery time exceeds 1 second :: ReqHeader:user-agent ~ "iPod" and Timestamp:Resp[2] > 1. * Transaction group contains a backend response status larger than or equal to 500 :: BerespStatus >= 500 * Transaction group contains a request response status of 304, but where the request did not contain an if-modified-since header :: ReqStatus == 304 and not ReqHeader:if-modified-since * Transactions that have had backend failures or long delivery time on their ESI subrequests. (Assumes request grouping mode). :: BerespStatus >= 500 or {2+}Timestamp:Process[2] > 1. HISTORY ======= This document was written by Martin Blix Grydeland. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS varnish-4.1.1/doc/html/_sources/reference/varnishtest.txt0000644000201500234410000000741312652366773020536 00000000000000.. role:: ref(emphasis) .. _varnishtest(1): =========== varnishtest =========== ------------------------ Test program for Varnish ------------------------ :Manual section: 1 SYNOPSIS ======== varnishtest [-hikLlqvW] [-b size] [-D name=val] [-j jobs] [-n iter] [-t duration] file [file ...] DESCRIPTION =========== The varnishtest program is a script driven program used to test the Varnish Cache. The varnishtest program, when started and given one or more script files, can create a number of threads representing backends, some threads representing clients, and a varnishd process. This is then used to simulate a transaction to provoke a specific behavior. The following options are available: -b size Set internal buffer size (default: 512K) -D name=val Define macro for use in scripts -h Show help -i Find varnishd in build tree -j jobs Run this many tests in parallel -k Continue on test failure -L Always leave temporary vtc.* -l Leave temporary vtc.* if test fails -n iterations Run tests this many times -q Quiet mode: report only failures -t duration Time tests out after this long -v Verbose mode: always report test log -W Enable the witness facility for locking file File to use as a script Macro definitions that can be overridden. varnishd Path to varnishd to use [varnishd] If `TMPDIR` is set in the environment, varnishtest creates temporary `vtc.*` directories for each test in `$TMPDIR`, otherwise in `/tmp`. SCRIPTS ======= The script language used for Varnishtest is not a strictly defined language. The best reference for writing scripts is the varnishtest program itself. In the Varnish source code repository, under `bin/varnishtest/tests/`, all the regression tests for Varnish are kept. An example:: varnishtest "#1029" server s1 { rxreq expect req.url == "/bar" txresp -gzipbody {[bar]} rxreq expect req.url == "/foo" txresp -body {

FOOBARF

} } -start varnish v1 -vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; if (bereq.url == "/foo") { set beresp.ttl = 0s; } else { set beresp.ttl = 10m; } } } -start client c1 { txreq -url "/bar" -hdr "Accept-Encoding: gzip" rxresp gunzip expect resp.bodylen == 5 txreq -url "/foo" -hdr "Accept-Encoding: gzip" rxresp expect resp.bodylen == 21 } -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 definition to the VCL specified (-vcl+backend). Finally it starts the c1-client, which is a single client sending two requests. SEE ALSO ======== * varnishtest source code repository with tests * :ref:`varnishhist(1)` * :ref:`varnishlog(1)` * :ref:`varnishncsa(1)` * :ref:`varnishstat(1)` * :ref:`varnishtop(1)` * :ref:`vcl(7)` HISTORY ======= The varnishtest program was developed by Poul-Henning Kamp in cooperation with Varnish Software AS. This manual page was originally written by Stig Sandbeck Mathisen and updated by Kristian Lyngstøl . COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2007-2015 Varnish Software AS varnish-4.1.1/doc/html/_sources/reference/index.txt0000644000201500234410000000177112652366773017274 00000000000000.. _reference-index: %%%%%%%%%%%%%%%%%%%%%%%%%%%% The Varnish Reference Manual %%%%%%%%%%%%%%%%%%%%%%%%%%%% .. toctree:: :maxdepth: 2 vcl.rst states.rst varnish-cli.rst varnishadm.rst varnishd.rst varnishhist.rst varnishlog.rst varnishncsa.rst varnishstat.rst varnishtest.rst varnishtop.rst vsm.rst vmod.rst vmod_std.generated.rst vmod_directors.generated.rst directors.rst varnish-counters.rst vsl.rst vsl-query.rst .. todo:: The programs: . varnishd manual page . varnishstat . - counters explained . common filtering options for shmlog tools . varnishlog .. . varnishtop .. . varnishncsa .. . varnishhist .. The CLI: . connections: -T -S -M . varnishadm . CLI commands and what they do . - vcl.load . - stop . - start . - ... VCL language . The functions: . - vcl_recv . - vcl_miss . --- . The things you can do . - set . - unset . - esi . - rollback Varnishtest . syntax etc. Shared Memory . internals . Log records Libvarnishapi . function descriptions varnish-4.1.1/doc/html/_sources/reference/states.txt0000644000201500234410000000235612652366773017470 00000000000000.. _reference-states: ========================= Varnish Processing States ========================= ------------ Introduction ------------ Varnish processing of client and backend requests is implemented as state machines. Whenever a state is entered, a C function is called, which in turn calls the appropriate Varnish core code functions to process the request or response at this stage. For most states, core code also calls into a state-specific function compiled from VCL, a VCL subroutine (see :ref:`vcl-built-in-subs` ). As a general guideline, core code aims to prepare objects accessible from VCL with good defaults for the most common cases before calling into the respective VCL subroutine. These can then be modified from VCL where necessary. The following graphs attempt to provide an overview over the processing states, their transitions and the most relevant functions in core code. They represent a compromise between usefulness for core/VMOD developers and administrators and are intended to serve as the reference basis for derivative work, such as more VCL-centric views. ----------- Client Side ----------- .. image:: ../../graphviz/cache_req_fsm.svg ------------ Backend Side ------------ .. image:: ../../graphviz/cache_fetch.svg varnish-4.1.1/doc/html/_sources/glossary/0000755000201500234410000000000012652366773015403 500000000000000varnish-4.1.1/doc/html/_sources/glossary/index.txt0000644000201500234410000000677512652366773017212 00000000000000 .. _glossary: Varnish Glossary ================ .. glossary:: :sorted: .. This file will be sorted automagically during formatting, so we keep the source in subject order to make sure we cover all bases. .. comment: "components of varnish --------------------------------" varnishd (NB: with 'd') This is the actual Varnish cache program. There is only one program, but when you run it, you will get *two* processes: The "master" and the "worker" (or "child"). master (process) One of the two processes in the varnishd program. The master process is a manager/nanny process which handles configuration, parameters, compilation of :term:VCL etc. but it does never get near the actual HTTP traffic. worker (process) The worker process is started and configured by the master process. This is the process that does all the work you actually want varnish to do. If the worker dies, the master will try start it again, to keep your website alive. backend The HTTP server varnishd is caching for. This can be any sort of device that handles HTTP requests, including, but not limited to: a webserver, a CMS, a load-balancer another varnishd, etc. client The program which sends varnishd an HTTP request, typically a browser, but do not forget to think about spiders, robots script-kiddies and criminals. varnishstat Program which presents varnish statistics counters. varnishlog Program which presents varnish transaction log in native format. varnishtop Program which gives real-time "top-X" list view of transaction log. varnishncsa Program which presents varnish transaction log in "NCSA" format. varnishhist Eye-candy program showing response time histogram in 1980s ASCII-art style. varnishtest Program to test varnishd's behaviour with, simulates backend and client according to test-scripts. .. comment: "components of traffic ---------------------------------" header An HTTP protocol header, like "Accept-Encoding:". request What the client sends to varnishd and varnishd sends to the backend. response What the backend returns to varnishd and varnishd returns to the client. When the response is stored in varnishd's cache, we call it an object. backend response The response specifically served from a backend to varnishd. The backend response may be manipulated in vcl_backend_response. body The bytes that make up the contents of the object, varnishd does not care if they are in HTML, XML, JPEG or even EBCDIC, to varnishd they are just bytes. object The (possibly) cached version of a backend response. varnishd receives a response from the backend and creates an object, from which it may deliver cached responses to clients. If the object is created as a result of a request which is passed, it will not be stored for caching. .. comment: "configuration of varnishd -----------------------------" VCL Varnish Configuration Language, a small specialized language for instructing Varnish how to behave. .. comment: "actions in VCL ----------------------------------------" hit An object Varnish delivers from cache. miss An object Varnish fetches from the backend before it is served to the client. The object may or may not be put in the cache, that depends. pass An object Varnish does not try to cache, but simply fetches from the backend and hands to the client. pipe Varnish just moves the bytes between client and backend, it does not try to understand what they mean. varnish-4.1.1/doc/html/_sources/users-guide/0000755000201500234410000000000012652366773015774 500000000000000varnish-4.1.1/doc/html/_sources/users-guide/run_security.txt0000644000201500234410000001724412652366773021220 00000000000000.. _run_security: Security first ============== If you are the only person involved in running Varnish, or if all the people involved are trusted to the same degree, you can skip this chapter. We have protected Varnish as well as we can from anything which can come in through an HTTP socket. If parts of your web infrastructure are outsourced or otherwise partitioned along administrative lines, you need to think about security. Varnish provides four levels of authority, roughly related to how and where control comes into Varnish: * The command line arguments, * The CLI interface, * VCL programs, and * HTTP requests. Command line arguments ---------------------- The top level security decisions is decided and defined when starting Varnish in the form of command line arguments, we use this strategy in order to make them invulnerable to subsequent manipulation. The important decisions to make are: #. Who should have access to the Command Line Interface? #. Which parameters can they change? #. Will inline-C code be allowed? #. If/how VMODs will be restricted? #. How child processes will be jailed? CLI interface access ^^^^^^^^^^^^^^^^^^^^ The command line interface can be accessed in three ways. `varnishd` can be told to listen and offer CLI connections on a TCP socket. You can bind the socket to pretty much anything the kernel will accept:: -T 127.0.0.1:631 -T localhost:9999 -T 192.168.1.1:34 -T '[fe80::1]:8082' The default is ``-T localhost:0`` which will pick a random port number, which `varnishadm(8)` can learn from the shared memory. By using a "localhost" address, you restrict CLI access to the local machine. You can also bind the CLI port to an IP address reachable across the net, and let other machines connect directly. This gives you no secrecy, i.e. the CLI commands will go across the network as ASCII text with no encryption, but the -S/PSK authentication requires the remote end to know the shared secret. Alternatively you can bind the CLI port to a 'localhost' address, and give remote users access via a secure connection to the local machine, using ssh/VPN or similar. If you use `ssh` you can restrict which commands each user can execute to just `varnishadm`, or even use a wrapper scripts around `varnishadm` to 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. .. XXX:Maybe a sample command here with a brief explanation? benc The connection in this case is also without encryption, but the remote end must still authenticate using -S/PSK. Finally, if you run varnishd with the '-d' option, you get a CLI command on stdin/stdout, but since you started the process, it would be hard to prevent you getting CLI access, wouldn't it ? CLI interface authentication ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ By default the CLI interface is protected with a simple, yet powerful "Pre Shared Key" authentication method, which do not provide secrecy (ie: The CLI commands and responses are not encrypted). The way -S/PSK works is really simple: During startup a file is created with a random content and the file is only accessible to the user who started `varnishd` (or the superuser). To authenticate and use a CLI connection, you need to know the contents of that file, in order to answer the cryptographic challenge `varnishd` issues, see :ref:`ref_psk_auth`. `varnishadm` uses all of this to restrict access, it will only function, provided it can read the secret file. If you want to allow other users, local or remote, to be able to access CLI connections, you must create your own secret file and make it possible for (only!) these users to read it. A good way to create the secret file is:: dd if=/dev/random of=/etc/varnish_secret count=1 When you start `varnishd`, you specify the filename with '-S', and it goes without saying that the `varnishd` master process needs to be able to read the file too. You can change the contents of the secret file while `varnishd` runs, it is read every time a CLI connection is authenticated. On the local system, `varnishadm` can retrieve the filename from shared memory, but on remote systems, you need to give `varnishadm` a copy of the secret file, with the -S argument. If you want to disable -S/PSK authentication, specify '-S' with an empty argument to varnishd:: varnishd [...] -S "" [...] Parameters ^^^^^^^^^^ Parameters can be set from the command line, and made "read-only" (using '-r') so they cannot subsequently be modified from the CLI interface. Pretty much any parameter can be used to totally mess up your HTTP service, but a few can do more damage than others: :ref:`ref_param_cc_command` Execute arbitrary programs :ref:`ref_param_vcc_allow_inline_c` Allow inline C in VCL, which would any C code from VCL to be executed by Varnish. Furthermore you may want to look at and lock down: :ref:`ref_param_syslog_cli_traffic` Log all CLI commands to `syslog(8)`, so you know what goes on. :ref:`ref_param_vcc_unsafe_path` Restrict VCL/VMODS to :ref:`ref_param_vcl_dir` and :ref:`ref_param_vmod_dir` :ref:`ref_param_vmod_dir` The directory where Varnish will will look for modules. This could potentially be used to load rouge modules into Varnish. The CLI interface ----------------- The CLI interface in Varnish is very powerful, if you have access to the CLI interface, you can do almost anything to the Varnish process. As described above, some of the damage can be limited by restricting certain parameters, but that will only protect the local filesystem, and operating system, it will not protect your HTTP service. We do not currently have a way to restrict specific CLI commands to specific CLI connections. One way to get such an effect is to "wrap" all CLI access in pre-approved scripts which use `varnishadm(1)` to submit the sanitized CLI commands, and restrict a remote user to only those scripts, for instance using sshd(8)'s configuration. VCL programs ------------ There are two "dangerous" mechanisms available in VCL code: VMODs and inline-C. Both of these mechanisms allow execution of arbitrary code and will thus allow a person to get access to the machine, with the privileges of the child process. If `varnishd` is started as root/superuser, we sandbox the child process, using whatever facilities are available on the operating system, but if `varnishd` is not started as root/superuser, this is not possible. No, don't ask me why you have to be superuser to lower the privilege of a child process... Inline-C is disabled by default starting with Varnish version 4, so unless you enable it, you don't have to worry about it. The parameters mentioned above can restrict the loading of VMODs to only be loaded from a designated directory, restricting VCL wranglers to a pre-approved subset of VMODs. If you do that, we are confident that your local system cannot be compromised from VCL code. HTTP requests ------------- We have gone to great lengths to make Varnish resistant to anything coming in through the socket where HTTP requests are received, and you should, generally speaking, not need to protect it any further. The caveat is that since VCL is a programming language which lets you decide exactly what to do with HTTP requests, you can also decide to do stupid and potentially dangerous things with them, including opening yourself up to various kinds of attacks and subversive activities. 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 :ref:`vcl_syntax_acl`. varnish-4.1.1/doc/html/_sources/users-guide/run_cli.txt0000644000201500234410000001216212652366773020112 00000000000000.. _run_cli: CLI - bossing Varnish around ============================ Once `varnishd` is started, you can control it using the command line interface. The easiest way to do this, is using `varnishadm` on the same machine as `varnishd` is running:: varnishadm help If you want to run `varnishadm` from a remote system, you can do it two ways. You can SSH into the `varnishd` computer and run `varnishadm`:: ssh $http_front_end varnishadm help But you can also configure `varnishd` to accept remote CLI connections (using the '-T' and '-S' arguments):: varnishd -T :6082 -S /etc/varnish_secret And then on the remote system run `varnishadm`:: varnishadm -T $http_front_end -S /etc/copy_of_varnish_secret help but as you can see, SSH is much more convenient. If you run `varnishadm` without arguments, it will read CLI commands from `stdin`, if you give it arguments, it will treat those as the single CLI command to execute. The CLI always returns a status code to tell how it went: '200' means OK, anything else means there were some kind of trouble. `varnishadm` will exit with status 1 and print the status code on standard error if it is not 200. What can you do with the CLI ---------------------------- The CLI gives you almost total control over `varnishd` some of the more important tasks you can perform are: * load/use/discard VCL programs * ban (invalidate) cache content * change parameters * start/stop worker process We will discuss each of these briefly below. Load, use and discard VCL programs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ All caching and policy decisions are made by VCL programs. You can have multiple VCL programs loaded, but one of them is designated the "active" VCL program, and this is where all new requests start out. To load new VCL program:: varnish> vcl.load some_name some_filename Loading will read the VCL program from the file, and compile it. If the compilation fails, you will get an error messages:: .../mask is not numeric. ('input' Line 4 Pos 17) "192.168.2.0/24x", ----------------#################- Running VCC-compiler failed, exit 1 VCL compilation failed If compilation succeeds, the VCL program is loaded, and you can now make it the active VCL, whenever you feel like it:: varnish> vcl.use some_name If you find out that was a really bad idea, you can switch back to the previous VCL program again:: varnish> vcl.use old_name The switch is instantaneous, all new requests will start using the VCL you activated right away. The requests currently being processed complete using whatever VCL they started with. It is good idea to design an emergency-VCL before you need it, and always have it loaded, so you can switch to it with a single vcl.use command. .. XXX:Should above have a clearer admonition like a NOTE:? benc Ban cache content ^^^^^^^^^^^^^^^^^ Varnish offers "purges" to remove things from cache, provided that you know exactly what they are. But sometimes it is useful to be able to throw things out of cache without having an exact list of what to throw out. Imagine for instance that the company logo changed and now you need Varnish to stop serving the old logo out of the cache:: varnish> ban req.url ~ "logo.*[.]png" should do that, and yes, that is a regular expression. We call this "banning" because the objects are still in the cache, but they are banned from delivery. Instead of checking each and every cached object right away, we test each object against the regular expression only if and when an HTTP request asks for it. Banning stuff is much cheaper than restarting Varnish to get rid of wronly cached content. .. In addition to handling such special occasions, banning can be used .. in many creative ways to keep the cache up to date, more about .. that in: (TODO: xref) Change parameters ^^^^^^^^^^^^^^^^^ Parameters can be set on the command line with the '-p' argument, but they can also be examined and changed on the fly from the CLI:: varnish> param.show prefer_ipv6 200 prefer_ipv6 off [bool] Default is off Prefer IPv6 address when connecting to backends which have both IPv4 and IPv6 addresses. varnish> param.set prefer_ipv6 true 200 In general it is not a good idea to modify parameters unless you have a good reason, such as performance tuning or security configuration. Most parameters will take effect instantly, or with a natural delay of some duration, .. XXX: Natural delay of some duration sounds vague. benc but a few of them requires you to restart the child process before they take effect. This is always noted in the description of the parameter. Starting and stopping the worker process ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In general you should just leave the worker process running, but if you need to stop and/or start it, the obvious commands work:: varnish> stop and:: varnish> start If you start `varnishd` with the '-d' (debugging) argument, you will always need to start the child process explicitly. Should the child process die, the master process will automatically restart it, but you can disable that with the 'auto_restart' parameter. varnish-4.1.1/doc/html/_sources/users-guide/params.txt0000644000201500234410000000210612652366773017737 00000000000000 Parameters ---------- Varnish Cache comes with a set of parameters that affects behaviour and performance. Most of these parameters can be set on the Varnish command line (through `varnishadm`) using the ``param.set`` keyword. Some parameters can, for security purposes be read only using the '-r' command line switch to `varnishd`. We don't recommend that you tweak parameters unless you're sure of what you're doing. We've worked hard to make the defaults sane and Varnish should be able to handle most workloads with the default settings. For a complete listing of all the parameters and a short descriptions type ``param.show`` in the CLI. To inspect a certain parameter and get a somewhat longer description on what it does and what the default is type ``param.show`` and the name of the parameter, like this:: varnish> param.show shortlived 200 shortlived 10.000000 [s] Default is 10.0 Objects created with TTL shorter than this are always put in transient storage. varnish-4.1.1/doc/html/_sources/users-guide/vcl-example-acls.txt0000644000201500234410000000103612652366773021612 00000000000000 ACLs ~~~~ You create a named access control list with the ``acl`` keyword. You can match the IP address of the client against an ACL with the match operator.:: # Who is allowed to purge.... acl local { "localhost"; "192.168.1.0"/24; /* and everyone on the local network */ ! "192.168.1.23"; /* except for the dialin router */ } sub vcl_recv { if (req.method == "PURGE") { if (client.ip ~ local) { return(purge); } else { return(synth(403, "Access denied.")); } } } varnish-4.1.1/doc/html/_sources/users-guide/vcl-example-websockets.txt0000644000201500234410000000050312652366773023037 00000000000000 Adding WebSockets support ------------------------- WebSockets is a technology for creating a bidirectional stream-based channel over HTTP. To run WebSockets through Varnish you need to pipe it as follows:: sub vcl_recv { if (req.http.upgrade ~ "(?i)websocket") { return (pipe); } } varnish-4.1.1/doc/html/_sources/users-guide/vcl-examples.txt0000644000201500234410000000040612652366773021055 00000000000000 VCL Examples ------------ These are a short collection of examples that showcase some of the capabilities of the VCL language. .. toctree:: vcl-example-manipulating-headers vcl-example-manipulating-responses vcl-example-acls vcl-example-websockets varnish-4.1.1/doc/html/_sources/users-guide/operation-logging.txt0000644000201500234410000000510512652366773022102 00000000000000.. _users-guide-logging: Logging in Varnish ------------------ One of the really nice features in Varnish is the way logging works. Instead of logging to a normal log file Varnish logs to a shared memory segment, called the VSL - the Varnish Shared Log. When the end of the segment is reached we start over, overwriting old data. This is much, much faster than logging to a file and it doesn't require disk space. Besides it gives you much, much more information when you need it. The flip side is that if you forget to have a program actually write the logs to disk they will be overwritten. `varnishlog` is one of the programs you can use to look at what Varnish is logging. `varnishlog` gives you the raw logs, everything that is written to the logs. There are other clients that can access the logs as well, we'll show you these later. In the terminal window you started Varnish now type ``varnishlog -g raw`` and press enter. You'll see lines like these scrolling slowly by.:: 0 CLI - Rd ping 0 CLI - Wr 200 19 PONG 1273698726 1.0 These is the Varnish master process checking up on the caching process to see that everything is OK. Now go to the browser and reload the page displaying your web app. .. XXX:Doesn't this require a setup of a running varnishd and a web application being cached? benc You'll see lines like these.:: 11 SessOpen c 127.0.0.1 58912 :8080 0.0.0.0 8080 1273698726.933590 14 11 ReqStart c 127.0.0.1 58912 11 ReqMethod c GET 11 ReqURL c / 11 ReqProtocol c HTTP/1.1 11 ReqHeader c Host: localhost:8080 11 ReqHeader c Connection: keep-alive The first column is an arbitrary number, it identifies the transaction. Lines with the same number are coming from the same transaction. The second column is the *tag* of the log message. All log entries are tagged with a tag indicating what sort of activity is being logged. The third column tell us whether this is is data coming from or going to the client ('c'), or the backend ('b'). The forth column is the data being logged. Now, you can filter quite a bit with `varnishlog`. The basic options we think you want to know are: '-b' 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' Same as '-b' but for client side traffic. '-g request' Group transactions by request. '-q query' Only list transactions matching this query. .. XXX:Maybe a couple of sample commands here? benc For more information on this topic please see :ref:`varnishlog(1)`. varnish-4.1.1/doc/html/_sources/users-guide/vcl-inline-c.txt0000644000201500234410000000136212652366773020737 00000000000000 Using inline C to extend Varnish --------------------------------- (Here there be dragons. Big and mean ones.) You can use *inline C* to extend Varnish. Please note that you can seriously mess up Varnish this way. The C code runs within the Varnish Cache process so if your code generates a segfault the cache will crash. One of the first uses of inline C was logging to `syslog`.:: # The include statements must be outside the subroutines. C{ #include }C sub vcl_something { C{ syslog(LOG_INFO, "Something happened at VCL line XX."); }C } To use inline C you need to enable it with the ``vcc_allow_inline_c`` parameter. varnish-4.1.1/doc/html/_sources/users-guide/esi.txt0000644000201500234410000000602312652366773017236 00000000000000.. _users-guide-esi: Content composition with Edge Side Includes ------------------------------------------- Varnish can create web pages by assembling different pages, called `fragments`, together into one page. These `fragments` can have individual cache policies. If you have a web site with a list showing the five most popular articles on your site, this list can probably be cached as a `fragment` and included in all the other pages. .. XXX:What other pages? benc Used properly this strategy can dramatically increase your hit rate and reduce the load on your servers. In Varnish we've only so far implemented a small subset of ESI. As of version 2.1 we have three ESI statements:: esi:include esi:remove Content substitution based on variables and cookies is not implemented but is on the roadmap. At least if you look at the roadmap from a certain angle. During a full moon. Varnish will not process ESI instructions in HTML comments. Example: esi:include ~~~~~~~~~~~~~~~~~~~~ Lets see an example how this could be used. This simple cgi script outputs the date:: #!/bin/sh echo 'Content-type: text/html' echo '' date "+%Y-%m-%d %H:%M" Now, lets have an HTML file that has an ESI include statement:: The time is: at this very moment. For ESI to work you need to activate ESI processing in VCL, like this:: sub vcl_backend_response { if (bereq.url == "/test.html") { set beresp.do_esi = true; // Do ESI processing set beresp.ttl = 24 h; // Sets the TTL on the HTML above } elseif (bereq.url == "/cgi-bin/date.cgi") { set beresp.ttl = 1m; // Sets a one minute TTL on // the included object } } Example: esi:remove and ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The `` and `` constructs can be used to present appropriate content whether or not ESI is available, for example you can include content when ESI is available or link to it when it is not. ESI processors will remove the start ("") when the page is processed, while still processing the contents. If the page is not processed, it will remain intact, becoming a HTML/XML comment tag. ESI processors will remove `` tags and all content contained in them, allowing you to only render the content when the page is not being ESI-processed. For example:: The license Doing ESI on JSON and other non-XML'ish content ----------------------------------------------- Please note that Varnish will peek at the included content. If it doesn't start with a "<" Varnish assumes you didn't really mean to include it and disregard it. You can alter this behaviour by setting the 'esi_syntax' parameter (see ref:`ref-varnishd`). varnish-4.1.1/doc/html/_sources/users-guide/vcl-example-manipulating-headers.txt0000644000201500234410000000113112652366773024765 00000000000000 Manipulating request headers in VCL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lets say we want to remove the cookie for all objects in the `/images` directory of our web server:: sub vcl_recv { if (req.url ~ "^/images") { unset req.http.cookie; } } Now, when the request is handled to the backend server there will be no cookie header. The interesting line is the one with the if-statement. It matches the URL, taken from the request object, and matches it against the regular expression. Note the match operator. If it matches the Cookie: header of the request is unset (deleted). varnish-4.1.1/doc/html/_sources/users-guide/operation-statistics.txt0000644000201500234410000000357212652366773022654 00000000000000.. _users-guide-statistics: Statistics ---------- Varnish comes with a couple of nifty and very useful statistics generating tools that generates statistics in real time by constantly updating and presenting a specific dataset by aggregating and analyzing logdata from the shared memory logs. .. XXX:Heavy rewrite above. benc varnishtop ~~~~~~~~~~ The :ref:`varnishtop(1)` utility reads the shared memory logs and presents a continuously updated list of the most commonly occurring log entries. With suitable filtering using the -I, -i, -X and -x options, it can be used to display a ranking of requested documents, clients, user agents, or any other information which is recorded in the log. ``varnishtop -i ReqURL`` will show you what URLs are being asked for by the client. ``varnishtop -i BereqURL`` will show you what your backend is being asked the most. ``varnishtop -I ReqHeader:Accept-Encoding`` will show the most popular Accept-Encoding header the client are sending you. varnishhist ~~~~~~~~~~~ The :ref:`varnishhist(1)` utility reads :ref:`varnishd(1)` shared memory logs and 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 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 ("#"). varnishstat ~~~~~~~~~~~ Varnish has lots of counters. We count misses, hits, information about the storage, threads created, deleted objects. Just about everything. :ref:`varnishstat(1)` will dump these counters. This is useful when tuning Varnish. There are programs that can poll :ref:`varnishstat(1)` 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. varnish-4.1.1/doc/html/_sources/users-guide/storage-backends.txt0000644000201500234410000001173112652366773021674 00000000000000.. _guide-storage: Storage backends ---------------- Intro ~~~~~ Varnish has pluggable storage backends. It can store data in various backends which can have different performance characteristics. The default configuration is to use the malloc backend with a limited size. For a serious Varnish deployment you probably would want to adjust the storage settings. malloc ~~~~~~ syntax: malloc[,size] Malloc is a memory based backend. Each object will be allocated from memory. If your system runs low on memory swap will be used. Be aware that the size limitation only limits the actual storage and that the approximately 1k of memory per object, used for various internal structures, is included in the actual storage as well. .. XXX:This seems to contradict the last paragraph in "sizing-your-cache". benc The size parameter specifies the maximum amount of memory `varnishd` will allocate. The size is assumed to be in bytes, unless followed by one of the following suffixes: K, k The size is expressed in kibibytes. M, m The size is expressed in mebibytes. G, g The size is expressed in gibibytes. T, t The size is expressed in tebibytes. The default size is unlimited. malloc's performance is bound to memory speed so it is very fast. If the dataset is bigger than available memory performance will depend on the operating systems ability to page effectively. file ~~~~ syntax: file[,path[,size[,granularity]]] The file backend stores objects in memory backed by an unlinked file on disk with `mmap`. The 'path' parameter specifies either the path to the backing file or the path to a directory in which `varnishd` will create the backing file. The default is `/tmp`. The size parameter specifies the size of the backing file. The size is assumed to be in bytes, unless followed by one of the following suffixes: K, k The size is expressed in kibibytes. M, m The size is expressed in mebibytes. G, g The size is expressed in gibibytes. T, t The size is expressed in tebibytes. If 'path' points to an existing file and no size is specified, the size of the existing file will be used. If 'path' does not point to an existing file it is an error to not specify the size. If the backing file already exists, it will be truncated or expanded to the specified size. Note that if `varnishd` has to create or expand the file, it will not pre-allocate the added space, leading to fragmentation, which may adversely impact performance on rotating hard drives. Pre-creating the storage file using `dd(1)` will reduce fragmentation to a minimum. .. XXX:1? benc The 'granularity' parameter specifies the granularity of allocation. All allocations are rounded up to this size. The granularity is is assumed to be expressed in bytes, unless followed by one of the suffixes described for size. The default granularity is the VM page size. The size should be reduced if you have many small objects. File performance is typically limited to the write speed of the device, and depending on use, the seek time. persistent (experimental) ~~~~~~~~~~~~~~~~~~~~~~~~~ syntax: persistent,path,size {experimental} Persistent storage. Varnish will store objects in a file in a manner that will secure the survival of *most* of the objects in the event of a planned or unplanned shutdown of Varnish. The 'path' parameter specifies the path to the backing file. If the file doesn't exist Varnish will create it. The 'size' parameter specifies the size of the backing file. The size is expressed in bytes, unless followed by one of the following suffixes: K, k The size is expressed in kibibytes. M, m The size is expressed in mebibytes. G, g The size is expressed in gibibytes. T, t The size is expressed in tebibytes. Varnish will split the file into logical *silos* and write to the silos in the manner of a circular buffer. Only one silo will be kept open at any given point in time. Full silos are *sealed*. When Varnish starts after a shutdown it will discard the content of any silo that isn't sealed. Note that taking persistent silos offline and at the same time using bans can cause problems. This is due to the fact that bans added while the silo was offline will not be applied to the silo when it reenters the cache. Consequently enabling previously banned objects to reappear. Transient Storage ----------------- If you name any of your storage backend "Transient" it will be used for transient (short lived) objects. This includes the temporary objects created when returning a synthetic object. By default Varnish would use an unlimited malloc backend for this. .. XXX: Is this another paramater? In that case handled in the same manner as above? benc Varnish will consider an object short lived if the TTL is below the parameter 'shortlived'. .. XXX: I am generally missing samples of setting all of these parameters, maybe one sample per section or a couple of examples here with a brief explanation to also work as a summary? benc varnish-4.1.1/doc/html/_sources/users-guide/report.txt0000644000201500234410000000046312652366773017773 00000000000000.. _users_report: Reporting and statistics ======================== This section covers how to find out what Varnish is doing, from the detailed per HTTP request blow-by-blow logrecords to the global summary statistics counters. .. toctree:: :maxdepth: 2 operation-logging operation-statistics varnish-4.1.1/doc/html/_sources/users-guide/sizing-your-cache.txt0000644000201500234410000000226312652366773022020 00000000000000 Sizing your cache ----------------- Deciding on cache size can be a tricky task. A few things to consider: * How big is your *hot* data set. For a portal or news site that would be the size of the front page with all the stuff on it, and the size of all the pages and objects linked from the first page. * How expensive is it to generate an object? Sometimes it makes sense to only cache images a little while or not to cache them at all if they are cheap to serve from the backend and you have a limited amount of memory. * Watch the `n_lru_nuked` counter with :ref:`varnishstat(1)` or some other tool. If you have a lot of LRU activity then your cache is evicting objects due to space constraints and you should consider increasing the size of the cache. 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 overhead of about 1KB per object. So, if you have lots of small objects in your cache the overhead might be significant. .. XXX:This seems to contradict the last paragraph in "storage-backends". benc varnish-4.1.1/doc/html/_sources/users-guide/vcl-syntax.txt0000644000201500234410000000530312652366773020566 00000000000000VCL Syntax ---------- VCL has inherited a lot from C and it reads much like simple C or Perl. Blocks are delimited by curly braces, statements end with semicolons, and comments may be written as in C, C++ or Perl according to your own preferences. Note that VCL doesn't contain any loops or jump statements. This section provides an outline of the more important parts of the syntax. For a full documentation of VCL syntax please see :ref:`vcl(7)` in the reference. Strings ~~~~~~~ Basic strings are enclosed in " ... ", and may not contain newlines. Backslash is not special, so for instance in `regsub()` you do not need to do the "count-the-backslashes" polka:: regsub("barf", "(b)(a)(r)(f)", "\4\3\2p") -> "frap" Long strings are enclosed in {" ... "}. They may contain any character including ", newline and other control characters except for the NUL (0x00) character. If you really want NUL characters in a string there is a VMOD that makes it possible to create such strings. .. _vcl_syntax_acl: Access control lists (ACLs) ~~~~~~~~~~~~~~~~~~~~~~~~~~~ An ACL declaration creates and initializes a named access control list which can later be used to match client addresses:: acl local { "localhost"; // myself "192.0.2.0"/24; // and everyone on the local network ! "192.0.2.23"; // except for the dialin router } If an ACL entry specifies a host name which Varnish is unable to resolve, it will match any address it is compared to. Consequently, if it is preceded by a negation mark, it will reject any address it is compared to, which may not be what you intended. If the entry is enclosed in parentheses, however, it will simply be ignored. To match an IP address against an ACL, simply use the match operator:: if (client.ip ~ local) { return (pipe); } Operators ~~~~~~~~~ The following operators are available in VCL. See the examples further down for, uhm, examples. = Assignment operator. == Comparison. ~ Match. Can either be used with regular expressions or ACLs. ! Negation. && Logical *and* || Logical *or* Subroutines ~~~~~~~~~~~ A subroutine is used to group code for legibility or reusability:: sub pipe_if_local { if (client.ip ~ local) { return (pipe); } } Subroutines in VCL do not take arguments, nor do they return values. To call a subroutine, use the call keyword followed by the subroutine's name:: call pipe_if_local; Varnish has quite a few built in subroutines that are called for each transaction as it flows through Varnish. These builtin subroutines are all named `vcl_*`. Your own subroutines cannot start their name with `vcl\_`. .. XXX:looks as bit funky as red text? benc varnish-4.1.1/doc/html/_sources/users-guide/intro.txt0000644000201500234410000001123112652366773017606 00000000000000.. _users_intro: The Big Varnish Picture ======================= In this section we will cover answers to the questions: - What is in this package called "Varnish"? - what are all the different bits and pieces named? - Will you need a hex-wrench for assembly? The two main parts of Varnish are the two processes in the `varnishd` program. The first process is called "the manager", and its job is to talk to you, the administrator, and make the things you ask for happen. The second process is called "the worker" or just "the child" and this is the process which does all the actual work with your HTTP traffic. When you start `varnishd`, you start the manager process, and once it is done handling all the command line flags, it will start the child process for you. Should the child process die, the manager will start it again for you, automatically and right away. The main reason for this division of labor is security: The manager process will typically run with "root" permissions, in order to open TCP socket port 80, but it starts the child process with minimal permissions, as a defensive measure. The manager process is interactive, it offers a CLI -- Command Line 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 you need to change something very fundamental. The CLI can be safely accessed remotely, using a simple and flexible PSK -- Pre Shared Key, access control scheme, so it is easy to integrate Varnish into your operations and management infrastructure or tie it to your CMS. All this is covered in :ref:`users_running`. Things like, how the child process should deal with the HTTP requests, what to cache, which headers to remove etc, is all specified using a small programming language called VCL -- Varnish Configuration Language. The manager process will compile the VCL program and check it for errors, .. XXX:What does manager do after compile and error-check? Maybe a short description of further handling when no errors as well as when errors? benc but it is the child process which runs the VCL program, for each and every HTTP request which comes in. Because the VCL is compiled to C code, and the C code is compiled to machine instructions, even very complex VCL programs execute in a few microseconds, without impacting performance at all. And don't fret if you are not really a programmer, VCL is very simple to do simple things with:: sub vcl_recv { # Remove the cookie header to enable caching unset req.http.cookie; } The CLI interface allows you to compile and load new VCL programs at any time, and you can switch between the loaded VCL programs instantly, without restarting the child process and without missing a single HTTP request. VCL code can be extended using external modules, called VMODs or even by inline C-code if you are brave, so in terms of what Varnish can do for your HTTP traffic, there really is no limit. :ref:`users_vcl` describes VCL and what it can do in great detail. Varnish uses a segment of shared memory to report and log its activities and status. For each HTTP request, a number of very detailed records will be appended to the log memory segment. Other processes can subscribe to log-records, filter them, and format them, for instance as Apache/NCSA style log records. Another segment in shared memory is used for statistics counters, this allows real-time, down to microsecond resolution monitoring of cache hit-rate, resource usage and specific performance indicating metrics. Varnish comes with a number of tools which reports from shared memory, `varnishlog`, `varnishstats`, `varnishncsa` etc, and with an API library so you can write your own tools, should you need that. :ref:`users_report` explains how all that work. Presumably the reason for your interest in Varnish, is that you want your website to work better. There are many aspects of performance tuning a website, from relatively simple policy decisions about what to cache, to designing a geographically diverse multilevel CDNs using ESI and automatic failover. .. XXX:CDNs or CDN? benc :ref:`users_performance` will take you through the possibilities and facilities Varnish offers. Finally, Murphys Law must be referenced here: Things will go wrong, and more likely than not, they will do so at zero-zero-dark O'clock. Most likely during a hurricane, when your phone battery is flat and your wife had prepared a intimate evening to celebrate your anniversary. Yes, we've all been there, haven't we? When things go wrong :ref:`users_trouble` will hopefully be of some help. varnish-4.1.1/doc/html/_sources/users-guide/vcl-actions.txt0000644000201500234410000000236412652366773020704 00000000000000.. _user-guide-vcl_actions: actions ~~~~~~~ The most common actions to return are these: .. XXX:Maybe a bit more explanation here what is an action and how it is returned? benc *pass* When you return pass the request and subsequent response will be passed to and from the backend server. It won't be cached. `pass` can be returned from `vcl_recv`. *hash* When you return hash from `vcl_recv` you tell Varnish to deliver content from cache even if the request othervise indicates that the request should be passed. *pipe* .. XXX:What is pipe? benc Pipe can be returned from `vcl_recv` as well. Pipe short circuits the client and the backend connections and Varnish will just sit there and shuffle bytes back and forth. Varnish will not look at the data being send back and forth - so your logs will be incomplete. *deliver* Deliver the object to the client. Usually returned from `vcl_backend_response`. *restart* Restart processing of the request. You can restart the processing of the whole transaction. Changes to the `req` object are retained. *retry* Retry the request against the backend. This can be returned from `vcl_backend_response` or `vcl_backend_error` if you don't like the response that the backend delivered. varnish-4.1.1/doc/html/_sources/users-guide/vcl-backends.txt0000644000201500234410000001447612652366773021025 00000000000000.. _users-guide-backend_servers: Backend servers --------------- 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 backends. Start your favorite text editor and open the relevant VCL file. Somewhere in the top there will be a section that looks a bit like this.:: # backend default { # .host = "127.0.0.1"; # .port = "8080"; # } We remove the comment markings in this text stanza making the it look like.:: backend default { .host = "127.0.0.1"; .port = "8080"; } Now, this piece of configuration defines a backend in Varnish called *default*. When Varnish needs to get content from this backend it will connect to port 8080 on localhost (127.0.0.1). Varnish can have several backends defined you can even join several backends together into clusters of backends for load balancing purposes. Multiple backends ----------------- At some point you might need Varnish to cache content from several servers. You might want Varnish to map all the URL into one single host or not. There are lot of options. Lets say we need to introduce a Java application into out PHP web site. Lets say our Java application should handle URL beginning with `/java/`. We manage to get the thing up and running on port 8000. Now, lets have a look at the `default.vcl`.:: backend default { .host = "127.0.0.1"; .port = "8080"; } We add a new backend.:: backend java { .host = "127.0.0.1"; .port = "8000"; } Now we need tell Varnish where to send the difference URL. Lets look at `vcl_recv`.:: sub vcl_recv { if (req.url ~ "^/java/") { set req.backend_hint = java; } else { set req.backend_hint = default; } } 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.http.User-agent ~ /mobile/) ..`` should do the trick. Backends and virtual hosts in Varnish ------------------------------------- Varnish fully supports virtual hosts. They might however work in a somewhat counter-intuitive fashion since they are never declared explicitly. You set up the routing of incoming HTTP requests in `vcl_recv`. If you want this routing to be done on the basis of virtual hosts you just need to inspect `req.http.host`. You can have something like this:: sub vcl_recv { if (req.http.host ~ "foo.com") { set req.backend_hint = foo; } elsif (req.http.host ~ "bar.com") { set req.backend_hint = bar; } } Note that the first regular expressions will match "foo.com", "www.foo.com", "zoop.foo.com" and any other host ending in "foo.com". In this example this is intentional but you might want it to be a bit more tight, maybe relying on the ``==`` operator in stead, like this:: sub vcl_recv { if (req.http.host == "foo.com" || req.http.host == "www.foo.com") { set req.backend_hint = foo; } } .. _users-guide-advanced_backend_servers-directors: Directors --------- You can also group several backend into a group of backends. These groups are called directors. This will give you increased performance and resilience. You can define several backends and group them together in a director. This requires you to load a VMOD, a Varnish module, and then to call certain actions in `vcl_init`.:: import directors; # load the directors backend server1 { .host = "192.168.0.10"; } backend server2 { .host = "192.168.0.10"; } sub vcl_init { new bar = directors.round_robin(); bar.add_backend(server1); bar.add_backend(server2); } sub vcl_recv { # send all traffic to the bar director: set req.backend_hint = bar.backend(); } This director is a round-robin director. This means the director will distribute the incoming requests on a round-robin basis. There is also a *random* director which distributes requests in a, you guessed it, random fashion. If that is not enough, you can also write your own director (see :ref:`ref-writing-a-director`). But what if one of your servers goes down? Can Varnish direct all the requests to the healthy server? Sure it can. This is where the Health Checks come into play. .. _users-guide-advanced_backend_servers-health: Health checks ------------- Lets set up a director with two backends and health checks. First let us define the backends:: backend server1 { .host = "server1.example.com"; .probe = { .url = "/"; .timeout = 1s; .interval = 5s; .window = 5; .threshold = 3; } } backend server2 { .host = "server2.example.com"; .probe = { .url = "/"; .timeout = 1s; .interval = 5s; .window = 5; .threshold = 3; } } What is new here is the ``probe``. In this example Varnish will check the health of each backend every 5 seconds, timing out after 1 second. Each poll will send a GET request to /. If 3 out of the last 5 polls succeeded the backend is considered healthy, otherwise it will be marked as sick. Refer to the :ref:`reference-vcl_probes` section in the :ref:`vcl(7)` documentation for more information. Now we define the 'director':: import directors; sub vcl_init { new vdir = directors.round_robin(); vdir.add_backend(server1); vdir.add_backend(server2); } You use this `vdir` director as a backend_hint for requests, just like you would with a simple backend. Varnish will not send traffic to hosts that are marked as unhealthy. Varnish can also serve stale content if all the backends are down. See :ref:`users-guide-handling_misbehaving_servers` for more information on how to enable this. Please note that Varnish will keep health probes running for all loaded VCLs. Varnish will coalesce probes that seem identical - so be careful not to change the probe config if you do a lot of VCL loading. Unloading the VCL will discard the probes. For more information on how to do this please see ref:`reference-vcl-director`. varnish-4.1.1/doc/html/_sources/users-guide/running.txt0000644000201500234410000000070012652366773020132 00000000000000.. _users_running: Starting and running Varnish ============================ This section covers starting, running, and stopping Varnish, command line flags and options, and communicating with the running Varnish processes, configuring storage and sockets and, and about securing and protecting Varnish against attacks. .. toctree:: :maxdepth: 2 run_security command-line run_cli storage-backends params sizing-your-cache varnish-4.1.1/doc/html/_sources/users-guide/devicedetection.txt0000644000201500234410000002160012652366773021612 00000000000000.. _users-guide-devicedetect: Device detection ~~~~~~~~~~~~~~~~ Device detection is figuring out what kind of content to serve to a client based on the User-Agent string supplied in a request. Use cases for this are for example to send size reduced files to mobile clients with small screens and on high latency networks, or to provide a streaming video codec that the client understands. There are a couple of typical strategies to use for this type of scenario: 1) Redirect to another URL. 2) Use a different backend for the special client. 3) Change the backend request so that the backend sends tailored content. To perhaps make the strategies easier to understand, we, in this context, assume that the `req.http.X-UA-Device` header is present and unique per client class. Setting this header can be as simple as:: sub vcl_recv { if (req.http.User-Agent ~ "(?i)iphone" { set req.http.X-UA-Device = "mobile-iphone"; } } There are different commercial and free offerings in doing grouping and identifying clients in further detail. For a basic and community based regular expression set, see https://github.com/varnishcache/varnish-devicedetect/. Serve the different content on the same URL ------------------------------------------- The tricks involved are: 1. Detect the client (pretty simple, just include `devicedetect.vcl` and call it). 2. Figure out how to signal the backend the client class. This includes for example setting a header, changing a header or even changing the backend request URL. 3. Modify any response from the backend to add missing 'Vary' headers, so Varnish' internal handling of this kicks in. 4. Modify output sent to the client so any caches outside our control don't serve the wrong content. All this needs to be done while still making sure that we only get one cached object per URL per device class. Example 1: Send HTTP header to backend '''''''''''''''''''''''''''''''''''''' The basic case is that Varnish adds the 'X-UA-Device' HTTP header on the backend requests, and the backend mentions in the response 'Vary' header that the content is dependant on this header. Everything works out of the box from Varnish' perspective. .. 071-example1-start VCL:: sub vcl_recv { # call some detection engine that set req.http.X-UA-Device } # req.http.X-UA-Device is copied by Varnish into bereq.http.X-UA-Device # so, this is a bit counterintuitive. The backend creates content based on # the normalized User-Agent, but we use Vary on X-UA-Device so Varnish will # use the same cached object for all U-As that map to the same X-UA-Device. # # If the backend does not mention in Vary that it has crafted special # content based on the User-Agent (==X-UA-Device), add it. # If your backend does set Vary: User-Agent, you may have to remove that here. sub vcl_backend_response { if (bereq.http.X-UA-Device) { if (!beresp.http.Vary) { # no Vary at all set beresp.http.Vary = "X-UA-Device"; } elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device"; } } # comment this out if you don't want the client to know your # classification set beresp.http.X-UA-Device = bereq.http.X-UA-Device; } # to keep any caches in the wild from serving wrong content to client #2 # behind them, we need to transform the Vary on the way out. sub vcl_deliver { if ((req.http.X-UA-Device) && (resp.http.Vary)) { set resp.http.Vary = regsub(resp.http.Vary, "X-UA-Device", "User-Agent"); } } .. 071-example1-end Example 2: Normalize the User-Agent string '''''''''''''''''''''''''''''''''''''''''' Another way of signalling the device type is to override or normalize the 'User-Agent' header sent to the backend. For example:: User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; nb-no; HTC Desire Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 becomes:: User-Agent: mobile-android when seen by the backend. This works if you don't need the original header for anything on the backend. A possible use for this is for CGI scripts where only a small set of predefined headers are (by default) available for the script. .. 072-example2-start VCL:: sub vcl_recv { # call some detection engine that set req.http.X-UA-Device } # override the header before it is sent to the backend sub vcl_miss { if (req.http.X-UA-Device) { set req.http.User-Agent = req.http.X-UA-Device; } } sub vcl_pass { if (req.http.X-UA-Device) { set req.http.User-Agent = req.http.X-UA-Device; } } # standard Vary handling code from previous examples. sub vcl_backend_response { if (bereq.http.X-UA-Device) { if (!beresp.http.Vary) { # no Vary at all set beresp.http.Vary = "X-UA-Device"; } elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device"; } } set beresp.http.X-UA-Device = bereq.http.X-UA-Device; } sub vcl_deliver { if ((req.http.X-UA-Device) && (resp.http.Vary)) { set resp.http.Vary = regsub(resp.http.Vary, "X-UA-Device", "User-Agent"); } } .. 072-example2-end Example 3: Add the device class as a GET query parameter '''''''''''''''''''''''''''''''''''''''''''''''''''''''' If everything else fails, you can add the device type as a GET argument. http://example.com/article/1234.html --> http://example.com/article/1234.html?devicetype=mobile-iphone The client itself does not see this classification, only the backend request is changed. .. 073-example3-start VCL:: sub vcl_recv { # call some detection engine that set req.http.X-UA-Device } sub append_ua { if ((req.http.X-UA-Device) && (req.method == "GET")) { # if there are existing GET arguments; if (req.url ~ "\?") { set req.http.X-get-devicetype = "&devicetype=" + req.http.X-UA-Device; } else { set req.http.X-get-devicetype = "?devicetype=" + req.http.X-UA-Device; } set req.url = req.url + req.http.X-get-devicetype; unset req.http.X-get-devicetype; } } # do this after vcl_hash, so all Vary-ants can be purged in one go. (avoid ban()ing) sub vcl_miss { call append_ua; } sub vcl_pass { call append_ua; } # Handle redirects, otherwise standard Vary handling code from previous # examples. sub vcl_backend_response { if (bereq.http.X-UA-Device) { if (!beresp.http.Vary) { # no Vary at all set beresp.http.Vary = "X-UA-Device"; } elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device"; } # if the backend returns a redirect (think missing trailing slash), # we will potentially show the extra address to the client. we # don't want that. if the backend reorders the get parameters, you # may need to be smarter here. (? and & ordering) if (beresp.status == 301 || beresp.status == 302 || beresp.status == 303) { set beresp.http.location = regsub(beresp.http.location, "[?&]devicetype=.*$", ""); } } set beresp.http.X-UA-Device = bereq.http.X-UA-Device; } sub vcl_deliver { if ((req.http.X-UA-Device) && (resp.http.Vary)) { set resp.http.Vary = regsub(resp.http.Vary, "X-UA-Device", "User-Agent"); } } .. 073-example3-end Different backend for mobile clients ------------------------------------ If you have a different backend that serves pages for mobile clients, or any special needs in VCL, you can use the 'X-UA-Device' header like this:: backend mobile { .host = "10.0.0.1"; .port = "80"; } sub vcl_recv { # call some detection engine if (req.http.X-UA-Device ~ "^mobile" || req.http.X-UA-device ~ "^tablet") { set req.backend_hint = mobile; } } sub vcl_hash { if (req.http.X-UA-Device) { hash_data(req.http.X-UA-Device); } } Redirecting mobile clients -------------------------- If you want to redirect mobile clients you can use the following snippet. .. 065-redir-mobile-start VCL:: sub vcl_recv { # call some detection engine if (req.http.X-UA-Device ~ "^mobile" || req.http.X-UA-device ~ "^tablet") { return(synth(750, "Moved Temporarily")); } } sub vcl_synth { if (obj.status == 750) { set obj.http.Location = "http://m.example.com" + req.url; set obj.status = 302; return(deliver); } } .. 065-redir-mobile-end varnish-4.1.1/doc/html/_sources/users-guide/vcl.txt0000644000201500234410000000313012652366773017236 00000000000000 .. _users_vcl: VCL - Varnish Configuration Language ------------------------------------ This section covers how to tell Varnish how to handle your HTTP traffic, using the Varnish Configuration Language (VCL). Varnish has a great configuration system. Most other systems use configuration directives, where you basically turn on and off lots of switches. We have instead chosen to use a domain specific language called VCL for this. Every inbound request flows through Varnish and you can influence how the request is being handled by altering the VCL code. You can direct certain requests to particular backends, you can alter the requests and the responses or have Varnish take various actions depending on arbitrary properties of the request or the response. This makes Varnish an extremely powerful HTTP processor, not just for caching. Varnish translates VCL into binary code which is then executed when requests arrive. The performance impact of VCL is negligible. The VCL files are organized into subroutines. The different subroutines are executed at different times. One is executed when we get the request, another when files are fetched from the backend server. If you don't call an action in your subroutine and it reaches the end Varnish will execute some built-in VCL code. You will see this VCL code commented out in the file `builtin.vcl` that ships with Varnish Cache. .. _users-guide-vcl_fetch_actions: .. toctree:: :maxdepth: 1 vcl-syntax vcl-built-in-subs vcl-variables vcl-actions vcl-backends vcl-hashing vcl-grace vcl-inline-c vcl-examples devicedetection varnish-4.1.1/doc/html/_sources/users-guide/troubleshooting.txt0000644000201500234410000001113112652366773021701 00000000000000.. _users_trouble: Troubleshooting Varnish ======================= Sometimes Varnish misbehaves or rather behaves the way you told it to behave but not necessarily the way you want it to behave. In order for you to understand whats going on there are a couple of places you can check. :ref:`varnishlog(1)`, `/var/log/syslog`, `/var/log/messages` are all good places where Varnish might leave clues of whats going on. This section will guide you through basic troubleshooting in Varnish. When Varnish won't start ------------------------ Sometimes Varnish wont start. There is a plethora of possible reasons why Varnish wont start on your machine. We've seen everything from wrong 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:: # varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1: 2000 -a 0.0.0.0:8080 -d Notice the '-d' parameter. It will give you some more information on what is going on. Let us see how Varnish will react when something else is listening on its port.:: # varnishd -n foo -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:8080 -d storage_malloc: max size 1024 MB. Using old SHMFILE Platform: Linux,2.6.32-21-generic,i686,-smalloc,-hcritbit 200 193 ----------------------------- Varnish Cache CLI. ----------------------------- Type 'help' for command list. Type 'quit' to close CLI session. Type 'start' to launch worker process. Now Varnish is running but only the master process is running, in debug mode the cache does not start. Now you're on the console. You can instruct the master process to start the cache by issuing "start".:: start bind(): Address already in use 300 22 Could not open sockets And here we have our problem. Something else is bound to the HTTP port of Varnish. If this doesn't help try ``strace`` or ``truss`` or come find us on IRC. Varnish is crashing - panics ---------------------------- When Varnish goes bust the child processes crashes. Most of the crashes are caught by one of the many consistency checks we have included in the Varnish source code. When Varnish hits one of these the caching process will crash itself in a controlled manner, leaving a nice stack trace with the mother process. You can inspect any panic messages by typing ``panic.show`` in the CLI.:: panic.show Last panic at: Tue, 15 Mar 2011 13:09:05 GMT Assert error in ESI_Deliver(), cache_esi_deliver.c line 354: Condition(i == Z_OK || i == Z_STREAM_END) not true. thread = (cache-worker) ident = Linux,2.6.32-28-generic,x86_64,-sfile,-smalloc,-hcritbit,epoll Backtrace: 0x42cbe8: pan_ic+b8 0x41f778: ESI_Deliver+438 0x42f838: RES_WriteObj+248 0x416a70: cnt_deliver+230 0x4178fd: CNT_Session+31d (..) The crash might be due to misconfiguration or a bug. If you suspect it is a bug you can use the output in a bug report, see the "Trouble Tickets" section in the Introduction chapter above. Varnish is crashing - segfaults ------------------------------- Sometimes a bug escapes the consistency checks and Varnish gets hit with a segmentation error. When this happens with the child process it is logged, the core is dumped and the child process starts up again. A core dumped is usually due to a bug in Varnish. However, in order to debug a segfault the developers need you to provide a fair bit of data. * Make sure you have Varnish installed with debugging symbols. * Make sure core dumps are allowed in the parent shell. (``ulimit -c unlimited``) Once you have the core you open it with `gdb` and issue the command ``bt`` to get a stack trace of the thread that caused the segfault. Varnish gives me Guru meditation -------------------------------- First find the relevant log entries in :ref:`varnishlog(1)`. That will probably give you a clue. Since :ref:`varnishlog(1)` logs a lot of data it might be hard to track the entries down. You can set :ref:`varnishlog(1)` to log all your 503 errors by issuing the following command:: $ varnishlog -q 'RespStatus == 503' -g request If the error happened just a short time ago the transaction might still be in the shared memory log segment. To get :ref:`varnishlog(1)` to process the whole shared memory log just add the '-d' parameter:: $ varnishlog -d -q 'RespStatus == 503' -g request Please see the :ref:`vsl-query(7)` and :ref:`varnishlog(1)` man pages for elaborations on further filtering capabilities and explanation of the various options. Varnish doesn't cache --------------------- See :ref:`users-guide-increasing_your_hitrate`. varnish-4.1.1/doc/html/_sources/users-guide/vcl-built-in-subs.txt0000644000201500234410000002572512652366773021747 00000000000000.. _vcl-built-in-subs: ==================== Built in subroutines ==================== Various built-in subroutines are called during processing of client- and backend requests as well as upon ``vcl.load`` and ``vcl.discard``. See :ref:`reference-states` for a defailed graphical overview of the states and how they relate to core code functions and VCL subroutines. ----------- client side ----------- .. _vcl_recv: vcl_recv ~~~~~~~~ Called at the beginning of a request, after the complete request has been received and parsed, after a `restart` or as the result of an ESI include. Its purpose is to decide whether or not to serve the request, possibly modify it and decide on how to process it further. A backend hint may be set as a default for the backend processing side. The `vcl_recv` subroutine may terminate with calling ``return()`` on one of the following keywords: ``hash`` Continue processing the object as a potential candidate for caching. Passes the control over to :ref:`vcl_hash`. ``pass`` Switch to pass mode. Control will eventually pass to :ref:`vcl_pass`. ``pipe`` Switch to pipe mode. Control will eventually pass to :ref:`vcl_pipe`. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. ``purge`` Purge the object and it's variants. Control passes through vcl_hash to vcl_purge. .. _vcl_pipe: vcl_pipe ~~~~~~~~ Called upon entering pipe mode. In this mode, the request is passed on to the backend, and any further data from both the client and backend is passed on unaltered until either end closes the connection. Basically, Varnish will degrade into a simple TCP proxy, shuffling bytes back and forth. For a connection in pipe mode, no other VCL subroutine will ever get called after `vcl_pipe`. The `vcl_pipe` subroutine may terminate with calling ``return()`` with one of the following keywords: ``pipe`` Proceed with pipe mode. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. .. _vcl_pass: vcl_pass ~~~~~~~~ Called upon entering pass mode. In this mode, the request is passed 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: ``fetch`` Proceed with pass mode - initiate a backend request. ``restart`` Restart the transaction. Increases the restart counter. If the number of restarts is higher than *max_restarts* Varnish emits a guru meditation error. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. .. _vcl_hit: vcl_hit ~~~~~~~ Called when a cache lookup is successful. The object being hit may be stale: It can have a zero or negative `ttl` with only `grace` or `keep` time left. The `vcl_hit` subroutine may terminate with calling ``return()`` with one of the following keywords: ``deliver`` Deliver the object. If it is stale, a background fetch to refresh it is triggered. ``miss`` Synchronously refresh the object from the backend despite the cache hit. Control will eventually pass to :ref:`vcl_miss`. ``pass`` Switch to pass mode. Control will eventually pass to :ref:`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 error. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. ``fetch`` (deprecated) same as ``miss``. Will get removed in a future version, triggers a VCL_Error log message. .. _vcl_miss: vcl_miss ~~~~~~~~ Called after a cache lookup if the requested document was not found in the cache or if :ref:`vcl_hit` returned ``fetch``. Its purpose is to decide whether or not to attempt to retrieve the document from the backend. A backend hint may be set as a default for the backend processing side. The `vcl_miss` subroutine may terminate with calling ``return()`` with one of the following keywords: ``fetch`` Retrieve the requested object from the backend. Control will eventually pass to `vcl_backend_fetch`. ``pass`` Switch to pass mode. Control will eventually pass to :ref:`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 error. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. .. XXX: #1603 hit should not go to miss .. _vcl_hash: vcl_hash ~~~~~~~~ Called after `vcl_recv` to create a hash value for the request. This is used as a key to look up the object in Varnish. The `vcl_hash` subroutine may only terminate with calling ``return(lookup)``: ``lookup`` Look up the object in cache. Control passes to :ref:`vcl_purge` when coming from a ``purge`` return in `vcl_recv`. Otherwise control passes to :ref:`vcl_hit`, :ref:`vcl_miss` or :ref:`vcl_pass` if the cache lookup result was a hit, a miss or hit on a hit-for-pass object (object with ``obj.uncacheable == true``), respectively. .. _vcl_purge: vcl_purge ~~~~~~~~~ Called after the purge has been executed and all its variants have been evited. The `vcl_purge` subroutine may terminate with calling ``return()`` with one of the following keywords: ``restart`` Restart the transaction. Increases the restart counter. If the number of restarts is higher than *max_restarts* Varnish emits a guru meditation error. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. .. _vcl_deliver: vcl_deliver ~~~~~~~~~~~ Called before any object except a `vcl_synth` result is delivered to the client. The `vcl_deliver` subroutine may terminate with calling ``return()`` with one of the following keywords: ``deliver`` 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 error. ``synth(status code, reason)`` Transition to :ref:`vcl_synth` with ``resp.status`` and ``resp.reason`` being preset to the arguments of ``synth()``. .. _vcl_synth: vcl_synth ~~~~~~~~~ Called to deliver a synthetic object. A synthetic object is generated in VCL, not fetched from the backend. Its body may be contructed using the ``synthetic()`` function. A `vcl_synth` defined object never enters the cache, contrary to a :ref:`vcl_backend_error` defined object, which may end up in cache. The subroutine may terminate with calling ``return()`` with one of the following keywords: ``deliver`` Directly deliver the object defined by `vcl_synth` to the client without calling `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 error. ------------ Backend Side ------------ .. _vcl_backend_fetch: vcl_backend_fetch ~~~~~~~~~~~~~~~~~ Called before sending the backend request. In this subroutine you typically alter the request before it gets to the backend. The `vcl_backend_fetch` subroutine may terminate with calling ``return()`` with one of the following keywords: ``fetch`` Fetch the object from the backend. ``abandon`` Abandon the backend request. Unless the backend request was a background fetch, control is passed to :ref:`vcl_synth` on the client side with ``resp.status`` preset to 503. .. _vcl_backend_response: vcl_backend_response ~~~~~~~~~~~~~~~~~~~~ Called after the response headers have been successfully retrieved from the backend. For a 304 response, varnish core code amends ``beresp`` before calling `vcl_backend_response`: * If the gzip status changed, ``Content-Encoding`` is unset and any ``Etag`` is weakened * Any headers not present in the 304 response are copied from the existing cache object. ``Content-Length`` is copied if present in the existing cache object and discarded otherwise. * The status gets set to 200. `beresp.was_304` marks that this conditional response processing has happened. Note: Backend conditional requests are independend of client conditional requests, so clients may receive 304 responses no matter if a backend request was conditional. The `vcl_backend_response` subroutine may terminate with calling ``return()`` with one of the following keywords: ``deliver`` For a 304 response, create an updated cache object. Otherwise, fetch the object body from the backend and initiate delivery to any waiting client requests, possibly in parallel (streaming). ``abandon`` Abandon the backend request. Unless the backend request was a background fetch, control is passed to :ref:`vcl_synth` on the client side with ``resp.status`` preset to 503. ``retry`` Retry the backend transaction. Increases the `retries` counter. If the number of retries is higher than *max_retries*, control will be passed to :ref:`vcl_backend_error`. .. _vcl_backend_error: vcl_backend_error ~~~~~~~~~~~~~~~~~ This subroutine is called if we fail the backend fetch or if *max_retries* has been exceeded. A synthetic object is generated in VCL, whose body may be contructed using the ``synthetic()`` function. The `vcl_backend_error` subroutine may terminate with calling ``return()`` with one of the following keywords: ``deliver`` Deliver and possibly cache the object defined in `vcl_backend_error` **as if it was fetched from the backend**, also referred to as a "backend synth". ``retry`` Retry the backend transaction. Increases the `retries` counter. If the number of retries is higher than *max_retries*, :ref:`vcl_synth` on the client side is called with ``resp.status`` preset to 503. ---------------------- vcl.load / vcl.discard ---------------------- .. _vcl_init: vcl_init ~~~~~~~~ Called when VCL is loaded, before any requests pass through it. Typically used to initialize VMODs. The `vcl_init` subroutine may terminate with calling ``return()`` with one of the following keywords: ``ok`` Normal return, VCL continues loading. ``fail`` Abort loading of this VCL. .. _vcl_fini: vcl_fini ~~~~~~~~ Called when VCL is discarded only after all requests have exited the VCL. Typically used to clean up VMODs. The `vcl_fini` subroutine may terminate with calling ``return()`` with one of the following keywords: ``ok`` Normal return, VCL will be discarded. varnish-4.1.1/doc/html/_sources/users-guide/purging.txt0000644000201500234410000001300712652366773020131 00000000000000.. _users-guide-purging: Purging and banning ------------------- One of the most effective ways of increasing your hit ratio is to increase the time-to-live (ttl) of your objects. But, as you're aware of, in this twitterific day of age, serving content that is outdated is 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, lets look at HTTP purging. HTTP Purging ~~~~~~~~~~~~ A *purge* is what happens when you pick out an object from the cache and discard it along with its variants. Usually a purge is invoked through HTTP with the method `PURGE`. An HTTP purge is similar to an HTTP GET request, except that the *method* is `PURGE`. Actually you can call the method whatever you'd like, but most people refer to this as purging. Squid, for example, supports the same mechanism. In order to support purging in Varnish you need the following VCL in place:: acl purge { "localhost"; "192.168.55.0"/24; } sub vcl_recv { # allow PURGE from localhost and 192.168.55... if (req.method == "PURGE") { if (!client.ip ~ purge) { return(synth(405,"Not allowed.")); } return (purge); } } As you can see we have used a new action - return(purge). This ends execution of vcl_recv and jumps to vcl_hash. This is just like we handle a regular request. When vcl_hash calls return(lookup) varnish will purge the object and then call vcl_purge. Here you have the option of adding any particular actions you want Varnish to take once it has purge the object. So for example.com to invalidate their front page they would call out to Varnish like this:: PURGE / HTTP/1.0 Host: example.com And Varnish would then discard the front page. This will remove all variants as defined by Vary. Bans ~~~~ There is another way to invalidate content: Bans. You can think of bans as a sort of a filter on objects already in the cache. You ``ban`` certain content from being served from your cache. You can ban content based on any metadata we have. A ban will only work on objects already in the cache, it does not prevent new content from entering the cache or being served. Support for bans is built into Varnish and available in the CLI interface. To ban every png object belonging on example.com, issue the following command:: ban req.http.host == "example.com" && req.url ~ "\\.png$" 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*. Bans that only match against `obj.*` are also processed by a background worker threads called the `ban lurker`. The `ban lurker` will walk the heap and try to match objects and will evict the matching objects. How aggressive the `ban lurker` is can be controlled by the parameter 'ban_lurker_sleep'. The `ban lurker` can be disabled by setting 'ban_lurker_sleep' to 0. .. XXX: sample here? benc Bans that are older than the oldest objects in the cache are discarded without evaluation. If you have a lot of objects with long TTL, that are seldom accessed, you might accumulate a lot of bans. This might impact CPU usage and thereby performance. You can also add bans to Varnish via HTTP. Doing so requires a bit of VCL:: sub vcl_recv { if (req.method == "BAN") { # Same ACL check as above: if (!client.ip ~ purge) { return(synth(403, "Not allowed.")); } ban("req.http.host == " + req.http.host + " && req.url == " + req.url); # Throw a synthetic page so the # request won't go to the backend. return(synth(200, "Ban added")); } } This VCL stanza enables Varnish to handle a `HTTP BAN` method, adding a ban on the URL, including the host part. The `ban lurker` can help you keep the ban list at a manageable size, so we recommend that you avoid using `req.*` in your bans, as the request object is not available in the `ban lurker` thread. You can use the following template to write `ban lurker` friendly bans:: sub vcl_backend_response { set beresp.http.url = bereq.url; } sub vcl_deliver { unset resp.http.url; # Optional } sub vcl_recv { if (req.method == "PURGE") { if (client.ip !~ purge) { return(synth(403, "Not allowed")); } ban("obj.http.url ~ " + req.url); # Assumes req.url is a regex. This might be a bit too simple } } To inspect the current ban list, issue the ``ban.list`` command in the CLI. This will produce a status of all current bans:: 0xb75096d0 1318329475.377475 10 obj.http.url ~ test 0xb7509610 1318329470.785875 20G obj.http.url ~ test The ban list contains the ID of the ban, the timestamp when the ban entered the ban list. A count of the objects that has reached this point in the ban list, optionally postfixed with a 'G' for "Gone", if the ban is no longer valid. Finally, the ban expression is listed. The ban can be marked as "Gone" if it is a duplicate ban, but is still kept in the list for optimization purposes. 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 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 some other means. varnish-4.1.1/doc/html/_sources/users-guide/command-line.txt0000644000201500234410000000554012652366773021024 00000000000000.. _users-guide-command-line: Important command line arguments -------------------------------- There a two command line arguments you have to set when starting Varnish, these are: * what TCP port to serve HTTP from, and * where the backend server can be contacted. If you have installed Varnish through using a provided operating system bound package, you will find the startup options here: * Debian, Ubuntu: `/etc/default/varnish` * Red Hat, Centos: `/etc/sysconfig/varnish` * FreeBSD: `/etc/rc.conf` (See also: /usr/local/etc/rc.d/varnishd) '-a' *listen_address* ^^^^^^^^^^^^^^^^^^^^^ The '-a' argument defines what address Varnish should listen to, and service HTTP requests from. 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 to open and service as many of them as possible, but if none of them can be opened, `varnishd` will not start. Here are some examples:: -a :80 -a localhost:80 -a 192.168.1.100:8080 -a '[fe80::1]:80' -a '0.0.0.0:8080,[::]:8081' .. XXX:brief explanation of some of the more complex examples perhaps? benc If your webserver runs on the same machine, you will have to move it to another port number first. '-f' *VCL-file* or '-b' *backend* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Varnish needs to know where to find the HTTP server it is caching for. You can either specify it with the '-b' argument, or you can put it in your own VCL file, specified with the '-f' argument. Using '-b' is a quick way to get started:: -b localhost:81 -b thatotherserver.example.com:80 -b 192.168.1.2:80 Notice that if you specify a name, it can at most resolve to one IPv4 *and* one IPv6 address. If you go with '-f', you can start with a VCL file containing just:: backend default { .host = "localhost:81"; } which is exactly what '-b' does. .. XXX:What happens if I start with -b and then have the backend defined in my VCL? benc In both cases the built-in VCL code is appended. Other options ^^^^^^^^^^^^^ Varnish comes with an abundance of useful command line arguments. We recommend that you study them but not necessary use them all, but to get started, the above will be sufficient. By default Varnish will use 100 megabytes of malloc(3) storage for caching objects, if you want to cache more than that, you should look at the '-s' argument. .. XXX: 3? benc If you run a really big site, you may want to tune the number of worker threads and other parameters with the '-p' argument, but we generally advice not to do that unless you need to. Before you go into production, you may also want to revisit the chapter :ref:`run_security` to see if you need to partition administrative privileges. For a complete list of the command line parameters please see :ref:`ref-varnishd-options`. varnish-4.1.1/doc/html/_sources/users-guide/increasing-your-hitrate.txt0000644000201500234410000003407312652366773023240 00000000000000.. _users-guide-increasing_your_hitrate: Achieving a high hitrate ------------------------ Now that Varnish is up and running you can access your web application through Varnish. Unless your application is specifically written to work behind a web accelerator you'll probably need to do some changes to either the configuration or the application in order to get a high hitrate in Varnish. Varnish will not cache your data unless it's absolutely sure it is safe to do so. So, for you to understand how Varnish decides if and how to cache a page, we'll guide you through a couple of tools that you should find useful to understand what is happening in your Varnish setup. Note that you need a tool to see the HTTP headers that fly between Varnish and the backend. On the Varnish server, the easiest way to do this is to use :ref:`varnishlog(1)` and :ref:`varnishtop(1)` but sometimes a client-side tool makes sense. Here are the ones we commonly use. Tool: varnishtop ~~~~~~~~~~~~~~~~ You can use varnishtop to identify what URLs are hitting the backend the most. ``varnishtop -i BereqURL`` is an essential command, showing you the top requests Varnish is sending to the backend. You can see some other examples of :ref:`varnishtop(1)` usage in :ref:`users-guide-statistics`. Tool: varnishlog ~~~~~~~~~~~~~~~~ When you have identified an URL which is frequently sent to the backend you can use :ref:`varnishlog(1)` to have a look at the request. ``varnishlog -q 'ReqURL ~ "^/foo/bar"'`` will show you the requests coming from the client matching `/foo/bar`. For more information on how :ref:`varnishlog(1)` works please see :ref:`users-guide-logging` or then man page. For extended diagnostics headers, see https://www.varnish-cache.org/trac/wiki/VCLExampleHitMissHeader Tool: lwp-request ~~~~~~~~~~~~~~~~~ `lwp-request` is tool that is a part of The World-Wide Web library for Perl. It's a couple of really basic programs that can execute an HTTP request and show you the result. We mostly use the two programs, ``GET`` and ``HEAD``. vg.no was the first site to use Varnish and the people running Varnish there are quite clueful. So it's interesting to look at their HTTP Headers. Let's send a GET request for their home page:: $ GET -H 'Host: www.vg.no' -Used http://vg.no/ GET http://vg.no/ Host: www.vg.no User-Agent: lwp-request/5.834 libwww-perl/5.834 200 OK Cache-Control: must-revalidate Refresh: 600 Title: VG Nett - Forsiden - VG Nett X-Age: 463 X-Cache: HIT X-Rick-Would-Never: Let you down X-VG-Jobb: http://www.finn.no/finn/job/fulltime/result?keyword=vg+multimedia Merk:HeaderNinja X-VG-Korken: http://www.youtube.com/watch?v=Fcj8CnD5188 X-VG-WebCache: joanie X-VG-WebServer: leon OK. Lets look at what ``GET`` does. ``GET`` usually sends off HTTP 0.9 requests, which lack the 'Host' header. So we add a 'Host' header with the '-H' option. '-U' print request headers, '-s' prints response status, '-e' prints response headers and '-d' discards the actual content. We don't really care about the content, only the headers. As you can see, VG adds quite a bit of information in their headers. Some of the headers, like the 'X-Rick-Would-Never' are specific to vg.no and their somewhat odd sense of humour. Others, like the 'X-VG-Webcache' are for debugging purposes. So, to check whether a site sets cookies for a specific URL, just do:: GET -Used http://example.com/ |grep ^Set-Cookie .. XXX:Missing explanation and sample for HEAD here. benc Tool: Live HTTP Headers ~~~~~~~~~~~~~~~~~~~~~~~ There is also a plugin for Firefox called `Live HTTP Headers`. This plugin can show you what headers are being sent and received. `Live HTTP Headers` can be found at https://addons.mozilla.org/en-US/firefox/addon/3829/ or by googling "Live HTTP Headers". The role of HTTP Headers ~~~~~~~~~~~~~~~~~~~~~~~~ Along with each HTTP request and response comes a bunch of headers carrying metadata. Varnish will look at these headers to determine if it is appropriate to cache the contents and how long Varnish can keep the content cached. Please note that when Varnish considers these headers Varnish actually considers itself *part of* the actual webserver. The rationale being that both are under your control. The term *surrogate origin cache* is not really well defined by the IETF or RFC 2616 so the various ways Varnish works might differ from your expectations. Let's take a look at the important headers you should be aware of: .. _users-guide-cookies: Cookies ------- Varnish will, in the default configuration, not cache an object coming from the backend with a 'Set-Cookie' header present. Also, if the client sends a Cookie header, Varnish will bypass the cache and go directly to the backend. This can be overly conservative. A lot of sites use Google Analytics (GA) to analyze their traffic. GA sets a cookie to track you. This cookie is used by the client side javascript and is therefore of no interest to the server. Cookies from the client ~~~~~~~~~~~~~~~~~~~~~~~ For a lot of web applications it makes sense to completely disregard the cookies unless you are accessing a special part of the web site. This VCL snippet in `vcl_recv` will disregard cookies unless you are accessing `/admin/`:: if (!(req.url ~ "^/admin/")) { unset req.http.Cookie; } Quite simple. If, however, you need to do something more complicated, like removing one out of several cookies, things get difficult. Unfortunately Varnish doesn't have good tools for manipulating the Cookies. We have to use regular expressions to do the work. If you are familiar with regular expressions you'll understand whats going on. If you aren't we recommend that you either pick up a book on the subject, read through the *pcrepattern* man page, or read through one of many online guides. Lets use the Varnish Software (VS) web as an example here. Very simplified the setup VS uses can be described as a Drupal-based backend with a Varnish cache in front. VS uses some cookies for Google Analytics tracking and similar tools. The cookies are all set and used by Javascript. Varnish and Drupal doesn't need to see those cookies and since Varnish will cease caching of pages when the client sends cookies Varnish will discard these unnecessary cookies in VCL. In the following VCL we discard all cookies that start with an underscore:: # Remove has_js and Google Analytics __* cookies. set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(_[_a-z]+|has_js)=[^;]*", ""); # Remove a ";" prefix, if present. set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", ""); Lets look at an example where we remove everything except the cookies named "COOKIE1" and "COOKIE2" and you can marvel at the "beauty" of it:: sub vcl_recv { if (req.http.Cookie) { set req.http.Cookie = ";" + req.http.Cookie; set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";"); set req.http.Cookie = regsuball(req.http.Cookie, ";(COOKIE1|COOKIE2)=", "; \1="); set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", ""); set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", ""); if (req.http.Cookie == "") { unset req.http.Cookie; } } } A somewhat simpler example that can accomplish almost the same functionality can be found below. Instead of filtering out "other" cookies it instead picks out "the one" cookie that is needed, copies it to another header and then copies it back to the request, deleting the original cookie header. .. XXX:Verify correctness of request above! benc :: sub vcl_recv { # save the original cookie header so we can mangle it set req.http.X-Varnish-PHP_SID = req.http.Cookie; # using a capturing sub pattern, extract the continuous string of # alphanumerics that immediately follows "PHPSESSID=" set req.http.X-Varnish-PHP_SID = regsuball(req.http.X-Varnish-PHP_SID, ";? ?PHPSESSID=([a-zA-Z0-9]+)( |;| ;).*","\1"); set req.http.Cookie = req.X-Varnish-PHP_SID; unset req.X-Varnish-PHP_SID; } There are other scary examples of what can be done in VCL in the Varnish Cache Wiki. .. XXX:Missing link here. Cookies coming from the backend ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If your backend server sets a cookie using the 'Set-Cookie' header Varnish will not cache the page when using the default configuration. A `hit-for-pass` object (see :ref:`user-guide-vcl_actions`) is created. So, if the backend server acts silly and sets unwanted cookies just unset the 'Set-Cookie' header and all should be fine. Cache-Control ~~~~~~~~~~~~~ The 'Cache-Control' header instructs caches how to handle the content. Varnish cares about the *max-age* parameter and uses it to calculate the TTL for an object. So make sure you issue a 'Cache-Control' header with a max-age header. You can have a look at what Varnish Software's Drupal server issues:: $ GET -Used http://www.varnish-software.com/|grep ^Cache-Control Cache-Control: public, max-age=600 Age ~~~ Varnish adds an 'Age' header to indicate how long the object has been kept inside Varnish. You can grep out 'Age' from :ref:`varnishlog(1)` with ``varnishlog -I RespHeader:^Age``. Pragma ~~~~~~ An HTTP 1.0 server might send the header ``Pragma: nocache``. Varnish ignores this header. You could easily add support for this header in VCL. In `vcl_backend_response`:: if (beresp.http.Pragma ~ "nocache") { set beresp.uncacheable = true; set beresp.ttl = 120s; # how long not to cache this url. } Authorization ~~~~~~~~~~~~~ If Varnish sees an 'Authorization' header it will pass the request. If this is not what you want you can unset the header. Overriding the time-to-live (TTL) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Sometimes your backend will misbehave. It might, depending on your setup, be easier to override the TTL in Varnish then to fix your somewhat cumbersome backend. You need VCL to identify the objects you want and then you set the 'beresp.ttl' to whatever you want:: sub vcl_backend_response { if (bereq.url ~ "^/legacy_broken_cms/") { set beresp.ttl = 5d; } } This example will set the TTL to 5 days for the old legacy stuff on your site. Forcing caching for certain requests and certain responses ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Since you still might have this cumbersome backend that isn't very friendly to work with you might want to override more stuff in Varnish. We recommend that you rely as much as you can on the default caching rules. It is perfectly easy to force Varnish to lookup an object in the cache but it isn't really recommended. Normalizing your namespace ~~~~~~~~~~~~~~~~~~~~~~~~~~ Some sites are accessed via lots of hostnames. http://www.varnish-software.com/, http://varnish-software.com/ and http://varnishsoftware.com/ all point at the same site. Since Varnish doesn't know they are the same, Varnish will cache different versions of every page for every hostname. You can mitigate this in your web server configuration by setting up redirects or by using the following VCL:: if (req.http.host ~ "(?i)^(www.)?varnish-?software.com") { set req.http.host = "varnish-software.com"; } .. _users-guide-vary: HTTP Vary --------- *HTTP Vary is not a trivial concept. It is by far the most misunderstood HTTP header.* A lot of the response headers tell the client something about the HTTP object being delivered. Clients can request different variants of a HTTP object, based on their preference. Their preferences might cover stuff like encoding or language. When a client prefers UK English this is indicated through ``Accept-Language: en-uk``. Caches need to keep these different variants apart and this is done through the HTTP response header 'Vary'. When a backend server issues a ``Vary: Accept-Language`` it tells Varnish that its needs to cache a separate version for every different Accept-Language that is coming from the clients. If two clients say they accept the languages "en-us, en-uk" and "da, de" respectively, Varnish will cache and serve two different versions of the page if the backend indicated that Varnish needs to vary on the 'Accept-Language' header. Please note that the headers that 'Vary' refer to need to match *exactly* for there to be a match. So Varnish will keep two copies of a page if one of them was created for "en-us, en-uk" and the other for "en-us,en-uk". Just the lack of a whitespace will force Varnish to cache another version. To achieve a high hitrate whilst using Vary is there therefore crucial to normalize the headers the backends varies on. Remember, just a difference in casing can force different cache entries. The following VCL code will normalize the 'Accept-Language' header to either "en", "de" or "fr", in this order of precedence:: if (req.http.Accept-Language) { if (req.http.Accept-Language ~ "en") { set req.http.Accept-Language = "en"; } elsif (req.http.Accept-Language ~ "de") { set req.http.Accept-Language = "de"; } elsif (req.http.Accept-Language ~ "fr") { set req.http.Accept-Language = "fr"; } else { # unknown language. Remove the accept-language header and # use the backend default. unset req.http.Accept-Language } } Vary parse errors ~~~~~~~~~~~~~~~~~ Varnish will return a "503 internal server error" page when it fails to parse the 'Vary' header, or if any of the client headers listed in the Vary header exceeds the limit of 65k characters. An 'SLT_Error' log entry is added in these cases. Pitfall - Vary: User-Agent ~~~~~~~~~~~~~~~~~~~~~~~~~~ Some applications or application servers send ``Vary: User-Agent`` along with their content. This instructs Varnish to cache a separate copy for every variation of 'User-Agent' there is and there are plenty. Even a single patchlevel of the same browser will generate at least 10 different 'User-Agent' headers based just on what operating system they are running. So if you *really* need to vary based on 'User-Agent' be sure to normalize the header or your hit rate will suffer badly. Use the above code as a template. varnish-4.1.1/doc/html/_sources/users-guide/vcl-grace.txt0000644000201500234410000000450312652366773020322 00000000000000.. _users-guide-handling_misbehaving_servers: Misbehaving servers ------------------- A key feature of Varnish is its ability to shield you from misbehaving web- and application servers. Grace mode ~~~~~~~~~~ When several clients are requesting the same page Varnish will send one request to the backend and place the others on hold while fetching one copy from the backend. In some products this is called request coalescing and Varnish does this automatically. If you are serving thousands of hits per second the queue of waiting requests can get huge. There are two potential problems - one is a thundering herd problem - suddenly releasing a thousand threads to serve content might send the load sky high. Secondly - nobody likes to wait. To deal with this we can instruct Varnish to keep the objects in cache beyond their TTL and to serve the waiting requests somewhat stale content. So, in order to serve stale content we must first have some content to serve. So to make Varnish keep all objects for 2 minutes beyond their TTL use the following VCL:: sub vcl_backend_response { set beresp.grace = 2m; } Now Varnish will be allowed to serve objects that are up to two minutes out of date. When it does it will also schedule a refresh of the object. This will happen asynchronously and the moment the new object is in it will replace the one we've already got. You can influence how this logic works by adding code in vcl_hit. The default looks like this:: 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, deliver it // Automatically triggers a background fetch return (deliver); } // fetch & deliver once we get the result return (fetch); } The grace logic is pretty obvious here. If you have enabled :ref:`users-guide-advanced_backend_servers-health` you can check if the backend is sick and only serve graced object then. Replace the second if-clause with something like this:: if (!std.healthy(req.backend_hint) && (obj.ttl + obj.grace > 0s)) { return (deliver); } else { return (fetch); } So, to sum up, grace mode solves two problems: * it serves stale content to avoid request pile-up. * it serves stale content if you allow it. varnish-4.1.1/doc/html/_sources/users-guide/vcl-hashing.txt0000644000201500234410000000315612652366773020665 00000000000000Hashing ------- Internally, when Varnish stores content in the cache it stores the object together with a hash key to find the object again. In the default setup this key is calculated based on the content of the *Host* header or the IP address of the server and the URL. Behold the `default vcl`:: sub vcl_hash { hash_data(req.url); if (req.http.host) { hash_data(req.http.host); } else { hash_data(server.ip); } return (lookup); } As you can see it first checks in `req.url` then `req.http.host` if it exists. It is worth pointing out that Varnish doesn't lowercase the hostname or the URL before hashing it so in theory having "Varnish.org/" and "varnish.org/" would result in different cache entries. Browsers however, tend to lowercase hostnames. You can change what goes into the hash. This way you can make Varnish serve up different content to different clients based on arbitrary criteria. Let's say you want to serve pages in different languages to your users based on where their IP address is located. You would need some Vmod to get a country code and then put it into the hash. It might look like this. In `vcl_recv`:: set req.http.X-Country-Code = geoip.lookup(client.ip); And then add a `vcl_hash`:: sub vcl_hash { hash_data(req.http.X-Country-Code); } As the default VCL will take care of adding the host and URL to the hash we don't have to do anything else. Be careful calling ``return (lookup)`` as this will abort the execution of the default VCL and Varnish can end up returning data based on more or less random inputs. varnish-4.1.1/doc/html/_sources/users-guide/compression.txt0000644000201500234410000000760512652366773021026 00000000000000.. _users-guide-compression: Compression ----------- In Varnish 3.0 we introduced native support for compression, using gzip encoding. *Before* 3.0, Varnish would never compress objects. In Varnish 4.0 compression defaults to "on", meaning that it tries to be smart and do the sensible thing. If you don't want Varnish tampering with the encoding you can disable compression all together by setting the parameter `http_gzip_support` to false. Please see man :ref:`varnishd(1)` for details. Default behaviour ~~~~~~~~~~~~~~~~~ The default behaviour is active when the `http_gzip_support` parameter is set to "on" and neither `beresp.do_gzip` nor `beresp.do_gunzip` are used in VCL. Unless returning from `vcl_recv` with `pipe` or `pass`, Varnish modifies `req.http.Accept-Encoding`: if the client supports gzip `req.http.Accept-Encoding` is set to "gzip", otherwise the header is removed. Unless the request is a `pass`, Varnish sets `bereq.http.Accept-Encoding` to "gzip" before `vcl_backend_fetch` runs, so the header can be changed in VCL. If the server responds with gzip'ed content it will be stored in memory in its compressed form and `Accept-Encoding` will be added to the `Vary` header. To clients supporting gzip, compressed content is delivered unmodified. For clients not supporting gzip, compressed content gets decompressed on the fly while delivering it. The `Content-Encoding` response header gets removed and any `Etag` gets weakened (by prepending "W/"). For Vary Lookups, `Accept-Encoding` is ignored. Compressing content if backends don't ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can tell Varnish to compress content before storing it in cache in `vcl_backend_response` by setting `beresp.do_gzip` to "true", like this:: sub vcl_backend_response { if (beresp.http.content-type ~ "text") { set beresp.do_gzip = true; } } With `beresp.do_gzip` set to "true", Varnish will make the following changes to the headers of the resulting object before inserting it in the cache: * set `obj.http.Content-Encoding` to "gzip" * add "Accept-Encoding" to `obj.http.Vary`, unless already present * weaken any `Etag` (by prepending "W/") Generally, Varnish doesn't use much CPU so it might make more sense to have Varnish spend CPU cycles compressing content than doing it in your web- or application servers, which are more likely to be CPU-bound. Please make sure that you don't try to compress content that is uncompressable, like JPG, GIF and MP3 files. You'll only waste CPU cycles. Uncompressing content before entering the cache ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can also uncompress content before storing it in cache by setting `beresp.do_gunzip` to "true". One use case for this feature is to work around badly configured backends uselessly compressing already compressed content like JPG images (but fixing the misbehaving backend is always the better option). With `beresp.do_gunzip` set to "true", Varnish will make the following changes to the headers of the resulting object before inserting it in the cache: * remove `obj.http.Content-Encoding` * weaken any `Etag` (by prepending "W/") .. XXX pending closing #940: remove any "Accept-Encoding" from `obj.http.Vary` GZIP and ESI ~~~~~~~~~~~~ If you are using Edge Side Includes (ESI) you'll be happy to note that ESI and GZIP work together really well. Varnish will magically decompress the content to do the ESI-processing, then recompress it for efficient storage and delivery. Turning off gzip support ~~~~~~~~~~~~~~~~~~~~~~~~ When the `http_gzip_support` parameter is set to "off", Varnish does not do any of the header alterations documented above, handles `Vary: Accept-Encoding` like it would for any other `Vary` value and ignores `beresp.do_gzip` and `beresp.do_gunzip`. A random outburst ~~~~~~~~~~~~~~~~~ Poul-Henning Kamp has written :ref:`phk_gzip` which talks a bit more about how the implementation works. varnish-4.1.1/doc/html/_sources/users-guide/vcl-variables.txt0000644000201500234410000000175312652366773021215 00000000000000 Request and response VCL objects ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. XXX: refactored headline. benc In VCL, there several important objects that you need to be aware of. These objects can be accessed and manipulated using VCL. *req* The request object. When Varnish has received the request the `req` object is created and populated. Most of the work you do in `vcl_recv` you do on or with the `req` object. *bereq* The backend request object. Varnish contructs this before sending it to the backend. It is based on the `req` object. .. XXX:in what way? benc *beresp* The backend response object. It contains the headers of the object coming from the backend. If you want to modify the response coming from the server you modify this object in `vcl_backend_response`. *resp* The HTTP response right before it is delivered to the client. It is typically modified in `vcl_deliver`. *obj* The object as it is stored in cache. Read only. .. XXX:What object? the current request? benc varnish-4.1.1/doc/html/_sources/users-guide/performance.txt0000644000201500234410000000207112652366773020756 00000000000000.. _users_performance: Varnish and Website Performance =============================== This section focuses on how to tune the performance of your Varnish server, and how to tune the performance of your website using Varnish. The section is split in three subsections. The first subsection deals with the various tools and functions of Varnish that you should be aware of. The next subsection focuses on the how to purge content out of your cache. Purging of content is essential in a performance context because it allows you to extend the *time-to-live* (TTL) of your cached objects. Having a long TTL allows Varnish to keep the content in cache longer, meaning Varnish will make fewer requests to your relativly slower backend. The final subsection deals with compression of web content. Varnish can gzip content when fetching it from the backend and then deliver it compressed. This will reduce the time it takes to download the content thereby increasing the performance of your website. .. toctree:: :maxdepth: 2 increasing-your-hitrate purging compression varnish-4.1.1/doc/html/_sources/users-guide/vcl-example-manipulating-responses.txt0000644000201500234410000000066612652366773025407 00000000000000 Altering the backend response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here we override the TTL of a object coming from the backend if it matches certain criteria:: sub vcl_backend_response { if (bereq.url ~ "\.(png|gif|jpg)$") { unset beresp.http.set-cookie; set beresp.ttl = 1h; } } We also remove any Set-Cookie headers in order to avoid a `hit-for-pass` object to be created. See :ref:`user-guide-vcl_actions`. varnish-4.1.1/doc/html/_sources/users-guide/index.txt0000644000201500234410000000316612652366773017572 00000000000000.. _users-guide-index: The Varnish Users Guide ======================= The Varnish documentation consists of three main documents: * :ref:`tutorial-index` explains the basics and gets you started with Varnish. * :ref:`users-guide-index` (this document), explains how Varnish works and how you can use it to improve your website. * :ref:`reference-index` contains hard facts and is useful for looking up specific questions. After :ref:`users_intro`, this Users Guide is organized in sections following the major interfaces to Varnish as a service: :ref:`users_running` is about getting Varnish configured, with respect to storage, sockets, security and how you can control and communicate with Varnish once it is running. :ref:`users_vcl` is about getting Varnish to handle the HTTP requests the way you want, what to cache, how to cache it, modifying HTTP headers etc. etc. :ref:`users_report` explains how you can monitor what Varnish does, from a transactional level to aggregating statistics. :ref:`users_performance` is about tuning your website with Varnish. :ref:`users_trouble` is for locating and fixing common issues with Varnish. .. toctree:: :maxdepth: 2 intro running vcl report performance esi troubleshooting .. customizing (which is a non ideal title) .. No longer used: configuration command_line VCL backend_servers logging sizing_your_cache statistics increasing_your_hitrate cookies vary hashing purging compression esi websockets devicedetection handling_misbehaving_servers advanced_topics troubleshooting varnish-4.1.1/doc/html/_sources/whats-new/0000755000201500234410000000000012652366773015455 500000000000000varnish-4.1.1/doc/html/_sources/whats-new/changes.txt0000644000201500234410000001245412652366773017554 00000000000000.. _whatsnew_changes: Changes in Varnish 4.1 ====================== Varnish 4.1 is the continuation of the new streaming architecture seen in Varnish 4.0. Proactive security features =========================== New in 4.1 is support for different kinds of privilege separation methods, collectively described as jails. On most systems, the Varnish parent process will now drop effective privileges to normal user mode when not doing operations needing special access. The Varnish worker child should now be run as a separate `vcache` user. ``varnishlog``, ``varnishncsa`` and other Varnish shared log utilities now must be run in a context with `varnish` group membership. Warm and cold VCL configurations ================================ Traditionally Varnish have had the concept of active and inactive loaded VCLs. Any loaded VCL lead to state being kept, and a separate set of health checks (if configured) were being run against the backends. To avoid the extra state and backend polling, a loaded VCL is now either warm or cold. Runtime state (incl. backend counters) and health checks are not present for cold VCLs. A warm VCL will automatically be set to cold after `vcl_cooldown` seconds. Output from `vcl.list`:: varnish> vcl.list 200 available auto/warm 0 boot available auto/warm 0 62f5275f-a937-4df9-9fbb-c12336bdfdb8 A single VCL's state can be changed with the `vcl.state` call in ``varnishadm``:: vcl.state Force the state of the specified configuration. State is any of auto, warm or cold values. Example:: varnish> vcl.state 62f5275f-a937-4df9-9fbb-c12336bdfdb8 cold 200 varnish> vcl.list 200 available auto/warm 0 boot available auto/cold 0 62f5275f-a937-4df9-9fbb-c12336bdfdb8 VMOD writers should read up on the new vcl_event system to release unnecessary state when a VCL is transitioned to cold (see :ref:`ref-vmod-event-functions`). PROXY protocol support ====================== Socket support for PROXY protocol connections has been added. PROXY defines a short preamble on the TCP connection where (usually) a SSL/TLS terminating proxy can signal the real client address. The ``-a`` startup argument syntax has been expanded to allow for this:: $ varnishd -f /etc/varnish/default.vcl -a :6081 -a 127.0.0.1:6086,PROXY Both PROXY1 and PROXY2 protocols are supported on the resulting listening socket. For connections coming in over a PROXY socket, ``client.ip`` and ``server.ip`` will contain the addresses given to Varnish in the PROXY header/preamble (the "real" IPs). The new VCL variables ``remote.ip`` and ``local.ip`` contains the local TCP connection endpoints. On non-PROXY connections these will be identical to ``client.ip`` and ``server.ip``. An expected pattern following this is `if (std.port(local.ip) == 80) { }` in ``vcl_recv`` to see if traffic came in over the HTTP listening socket (so a client redirect to HTTPS can be served). VMOD backends ============= Before Varnish 4.1, backends could only be declared in native VCL. Varnish 4.0 moved directors from VCL to VMODs, and VMODs can now also create backends. It is possible to both create the same backends than VCL but dynamically, or create backends that don't necessarily speak HTTP/1 over TCP to fetch resources. More details in the :ref:`ref-writing-a-director` documentation. Backend connection timeout ========================== Backend connections will now be closed by Varnish after `backend_idle_timeout` seconds of inactivity. Previously they were kept around forever and the backend servers would close the connection without Varnish noticing it. On the next traffic spike needing these extra backend connections, the request would fail, perhaps multiple times, before a working backend connection was found/created. Protocol support ================ Support for HTTP/0.9 on the client side has been retired. More modules available ====================== Varnish has an ecosystem for third-party modules (vmods). New since the last release, these are worth knowing about: libvmod-saintmode: Saint mode ("inferred health probes from traffic") was taken out of Varnish core in 4.0, and is now back as a separate vmod. This is useful for detecting failing backends before the health probes pick it up. libvmod-xkey: Secondary hash keys for cache objects, based on the hashtwo vmod written by Varnish Software. Allows for arbitrary grouping of objects to be purged in one go, avoiding use of ban invalidation. Also known as Cache Keys or Surrogate Key support. libvmod-rtstatus: Real time statistics dashboard. Passing data between ESI requests ================================= A new `req_top` identifier is available in VCL, which is a reference to `req` in the top-level ESI request. This is useful to pass data back and forth between the main ESI request and any ESI sub-requests it leads to. Other noteworthy small changes ============================== * Varnish will now use the ``stale-while-revalidate`` defined in RFC5861 to set object grace time. * -smalloc storage is now recommended over -sfile on Linux systems. * New VCL variable ``beresp.was_304`` has been introduced in ``vcl_backend_response``. Will be set to ``true`` if the response from the backend was a positive result of a conditional fetch (``304 Not Modified``). varnish-4.1.1/doc/html/_sources/whats-new/upgrading.txt0000644000201500234410000000365612652366773020130 00000000000000.. _whatsnew_upgrade41: %%%%%%%%%%%%%%%%%%%%%%%% Upgrading to Varnish 4.1 %%%%%%%%%%%%%%%%%%%%%%%% Changes to VCL ============== Data type conversion functions now take a fallback ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Data type conversion functions in the std vmod now takes an additional argument *fallback*, which is returned if the conversion does not succeed. Version statement is kept ~~~~~~~~~~~~~~~~~~~~~~~~~ The VCL syntax has not chanced significantly, and as such the Varnish 4.0 version marker is kept for Varnish 4.1. One of the initial lines in a Varnish 4.1 VCL should read:: vcl 4.0; Remote address accessors ~~~~~~~~~~~~~~~~~~~~~~~~ New in 4.1 is the `local.ip` and `remote.ip` representing the (local) TCP connection endpoints. With PROXY listeners the `server.ip` and `client.ip` are set from the PROXY preamble. On normal HTTP listeners the behaviour is unchanged. Management interface ==================== The management interface enabled with ``-M`` previously supported the telnet protocol. Support for telnet control sequences have been retired. Replacement clients like netcat or (preferred) ``varnishadm`` should be used instead. Runtime users and groups ======================== With the new jail support, an additional runtime user (`vcache`) should be used for the Varnish worker child process. Additionally, the ``varnishlog``, ``varnishncsa`` and other Varnish shared log utilities must now be run in a context with `varnish` group membership. Changes to parameters ===================== `vcl_cooldown` is new, and decides how long time a VCL is kept warm after being replaced as the active VCL. The following parameters have been retired: * `group` (security revamp) * `group_cc` (security revamp) * `listen_address` (security revamp) * `pool_vbc` * `timeout_req` - merged with `timeout_idle`. * `user` (security revamp) Minor changes of default values on `workspace_session` and `vsl_mask`. varnish-4.1.1/doc/html/_sources/whats-new/upgrade-4.0.txt0000644000201500234410000001567612652366773020103 00000000000000.. _whatsnew_upgrading: %%%%%%%%%%%%%%%%%%%%%%%% Upgrading to Varnish 4.0 %%%%%%%%%%%%%%%%%%%%%%%% Changes to VCL ============== The backend fetch parts of VCL have changed in Varnish 4. We've tried to compile a list of changes needed to upgrade here. 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:: vcl 4.0; req.request is now req.method ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To align better with RFC naming, `req.request` has been renamed to `req.method`. vcl_fetch is now vcl_backend_response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Directors have been moved to the vmod_directors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To make directors (backend selection logic) easier to extend, the directors are now defined in loadable VMODs. Setting a backend for future fetches in `vcl_recv` is now done as follows:: sub vcl_init { new cluster1 = directors.round_robin(); cluster1.add_backend(b1, 1.0); cluster1.add_backend(b2, 1.0); } sub vcl_recv { set req.backend_hint = cluster1.backend(); } Note the extra `.backend()` needed after the director name. Use the hash director as a client director ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Since the client director was already a special case of the hash director, it has been removed, and you should use the hash director directly:: sub vcl_init { new h = directors.hash(); h.add_backend(b1, 1); h.add_backend(b2, 1); } sub vcl_recv { set req.backend_hint = h.backend(client.identity); } vcl_error is now vcl_backend_error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To make a distinction between internally generated errors and VCL synthetic responses, `vcl_backend_error` will be called when varnish encounters an error when trying to fetch an object. error() is now synth() ~~~~~~~~~~~~~~~~~~~~~~ And you must explicitly return it:: return (synth(999, "Response")); Synthetic responses in vcl_synth ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Setting headers on synthetic response bodies made in vcl_synth are now done on resp.http instead of obj.http. The synthetic keyword is now a function:: if (resp.status == 799) { set resp.status = 200; set resp.http.Content-Type = "text/plain; charset=utf-8"; synthetic("You are " + client.ip); return (deliver); } obj in vcl_error replaced by beresp in vcl_backend_error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To better represent a the context in which it is called, you should now use `beresp.*` vcl_backend_error, where you used to use `obj.*` in `vcl_error`. hit_for_pass objects are created using beresp.uncacheable ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Example:: sub vcl_backend_response { if (beresp.http.X-No-Cache) { set beresp.uncacheable = true; set beresp.ttl = 120s; return (deliver); } } req.* not available in vcl_backend_response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ req.* used to be available in `vcl_fetch`, but after the split of functionality, you only have 'bereq.*' in `vcl_backend_response`. vcl_* reserved ~~~~~~~~~~~~~~ Any custom-made subs cannot be named 'vcl_*' anymore. This namespace is reserved for builtin subs. req.backend.healthy replaced by std.healthy(req.backend_hint) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Remember to import the std module if you're not doing so already. client.port, and server.port replaced by respectively std.port(client.ip) and std.port(server.ip) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `client.ip` and `server.ip` are now proper data types, which renders as an IP address by default. You need to use the `std.port()` function to get the port number. Invalidation with purge ~~~~~~~~~~~~~~~~~~~~~~~ Cache invalidation with purges is now done via `return(purge)` from `vcl_recv`. The `purge;` keyword has been retired. obj is now read-only ~~~~~~~~~~~~~~~~~~~~ `obj` is now read-only. `obj.last_use` has been retired. Some return values have been replaced ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Apart from the new `synth` return value described above, the following has changed: - `vcl_recv` must now return `hash` instead of `lookup` - `vcl_hash` must now return `lookup` instead of `hash` - `vcl_pass` must now return `fetch` instead of `pass` Backend restarts are now retry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In 3.0 it was possible to do `return(restart)` after noticing that the backend response was wrong, to change to a different backend. This is now called `return(retry)`, and jumps back up to `vcl_backend_fetch`. This only influences the backend fetch thread, client-side handling is not affected. default/builtin VCL changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The VCL code that is appended to user-configured VCL automatically is now called the builtin VCL. (previously default.vcl) The builtin VCL now honors Cache-Control: no-cache (and friends) to indicate uncacheable content from the backend. The `remove` keyword is gone ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Replaced by `unset`. X-Forwarded-For is now set before vcl_recv ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In many cases, people unintentionally removed X-Forwarded-For when implementing their own vcl_recv. Therefore it has been moved to before vcl_recv, so if you don't want an IP added to it, you should remove it in vcl_recv. Changes to existing parameters ============================== session_linger ~~~~~~~~~~~~~~ `session_linger` has been renamed to `timeout_linger` and it is in seconds now (previously was milliseconds). sess_timeout ~~~~~~~~~~~~ `sess_timeout` has been renamed to `timeout_idle`. sess_workspace ~~~~~~~~~~~~~~ In 3.0 it was often necessary to increase `sess_workspace` if a lot of VMODs, complex header operations or ESI were in use. This is no longer necessary, because ESI scratch space happens elsewhere in 4.0. If you are using a lot of VMODs, you may need to increase either `workspace_backend` and `workspace_client` based on where your VMOD is doing its work. thread_pool_purge_delay ~~~~~~~~~~~~~~~~~~~~~~~ `thread_pool_purge_delay` has been renamed to `thread_pool_destroy_delay` and it is in seconds now (previously was milliseconds). thread_pool_add_delay and thread_pool_fail_delay ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ They are in seconds now (previously were milliseconds). New parameters since 3.0 ======================== vcc_allow_inline_c ~~~~~~~~~~~~~~~~~~ You can now completely disable inline C in your VCL, and it is disabled by default. Other changes ============= New log filtering ~~~~~~~~~~~~~~~~~ The logging framework has a new filtering language, which means that the -m switch has been replaced with a new -q switch. See :ref:`vsl-query(7)` for more information about the new query language. varnish-4.1.1/doc/html/_sources/whats-new/index.txt0000644000201500234410000000107412652366773017247 00000000000000.. _whats-new-index: %%%%%%%%%%%%%%%%%%%%%%%%%% What's new in Varnish 4.1 %%%%%%%%%%%%%%%%%%%%%%%%%% This section describes the changes that have been made for Varnish 4.1. The first subsection describes overarching changes that have gone into Varnish 4.0, while the second subsection describes changes you need to make to your current configuration if you come from Varnish 3.x. The text also considers changes in behaviour that you need to be aware of and take into consideration when upgrading. .. toctree:: :maxdepth: 2 changes upgrading upgrade-4.0 varnish-4.1.1/doc/html/_sources/installation/0000755000201500234410000000000012652366773016241 500000000000000varnish-4.1.1/doc/html/_sources/installation/bugs.txt0000644000201500234410000001366212652366773017672 00000000000000%%%%%%%%%%%%%% Reporting bugs %%%%%%%%%%%%%% Varnish can be a tricky beast to debug, having potentially thousands of threads crowding into a few data structures makes for *interesting* core dumps. Actually, let me rephrase that without irony: You tire of the "no, not thread 438 either, lets look at 439 then..." routine really fast. So if you run into a bug, it is important that you spend a little bit of time collecting the right information, to help us fix the bug. The most valuable information you can give us, is **always** how to trigger and reproduce the problem. If you can tell us that, we rarely need anything else to solve it.The caveat being, that we do not have a way to simulate high levels of real-life web-traffic, so telling us to "have 10.000 clients hit at once" does not really allow us to reproduce. To report a bug please follow the suggested procedure described in the "Trouble Tickets" section of the documentation (above). Roughly we categorize bugs in to three kinds of bugs (described below) with Varnish. The information we need to debug them depends on what kind of bug we are facing. Varnish crashes =============== Plain and simple: **boom** Varnish is split over two processes, the manager and the child. The child does all the work, and the manager hangs around to resurrect it if it crashes. Therefore, the first thing to do if you see a Varnish crash, is to examine your syslogs to see if it has happened before. (One site is rumoured to have had Varnish restarting every 10 minutes and *still* provide better service than their CMS system.) When it crashes, which is highly unlikely to begin with, Varnish will spew out a crash dump that looks something like:: Child (32619) died signal=6 (core dumped) Child (32619) Panic message: Assert error in ccf_panic(), cache_cli.c line 153: Condition(!strcmp("", "You asked for it")) not true. errno = 9 (Bad file descriptor) thread = (cache-main) ident = FreeBSD,9.0-CURRENT,amd64,-sfile,-hcritbit,kqueue Backtrace: 0x42bce1: pan_ic+171 0x4196af: ccf_panic+4f 0x8006b3ef2: _end+80013339a 0x8006b4307: _end+8001337af 0x8006b8b76: _end+80013801e 0x8006b8d84: _end+80013822c 0x8006b51c1: _end+800134669 0x4193f6: CLI_Run+86 0x429f8b: child_main+14b 0x43ef68: start_child+3f8 [...] If you can get that information to us, we are usually able to see exactly where things went haywire, and that speeds up bugfixing a lot. There will be a lot more information in the crash dump besides this, and before sending it all to us, you should obscure any sensitive/secret data/cookies/passwords/ip# etc. Please make sure to keep context when you do so, ie: do not change all the IP# to "X.X.X.X", but change each IP# to something unique, otherwise we are likely to be more confused than informed. The most important line is the "Panic Message", which comes in two general forms: "Missing errorhandling code in ..." This is a situation where we can conceive Varnish ending up, which we have not (yet) written the padded-box error handling code for. The most likely cause here, is that you need a larger workspace for HTTP headers and Cookies. Please try that before reporting a bug. "Assert error in ..." This is something bad that should never happen, and a bug report is almost certainly in order. As always, if in doubt ask us on IRC before opening the ticket. .. (TODO: in the ws-size note above, mention which params to tweak) In your syslog it may all be joined into one single line, but if you can reproduce the crash, do so while running :ref:`varnishd(1)` manually: ``varnishd -d |& tee /tmp/_catch_bug`` That will get you the entire panic message into a file. (Remember to type ``start`` to launch the worker process, that is not automatic when ``-d`` is used.) Varnish goes on vacation ======================== This kind of bug is nasty to debug, because usually people tend to kill the process and send us an email saying "Varnish hung, I restarted it" which gives us only about 1.01 bit of usable debug information to work with. What we need here is all the information you can squeeze out of your operating system **before** you kill the Varnish process. One of the most valuable bits of information, is if all Varnish' threads are waiting for something or if one of them is spinning furiously on some futile condition. Commands like ``top -H`` or ``ps -Haxlw`` or ``ps -efH`` should be able to figure that out. .. XXX:Maybe a short description of what valuable information the various commands above generates? /benc If one or more threads are spinning, use ``strace`` or ``ktrace`` or ``truss`` (or whatever else your OS provides) to get a trace of which system calls the Varnish process issues. Be aware that this may generate a lot of very repetitive data, usually one second worth of data is more than enough. Also, run :ref:`varnishlog(1)` for a second, and collect the output for us, and if :ref:`varnishstat(1)` shows any activity, capture that also. When you have done this, kill the Varnish *child* process, and let the *master* process restart it. Remember to tell us if that does or does not work. If it does not, kill all Varnish processes, and start from scratch. If that does not work either, tell us, that means that we have wedged your kernel. Varnish does something wrong ============================ These are the easy bugs: usually all we need from you is the relevant transactions recorded with :ref:`varnishlog(1)` and your explanation of what is wrong about what Varnish does. Be aware, that often Varnish does exactly what you asked it to, rather than what you intended it to do. If it sounds like a bug that would have tripped up everybody else, take a moment to read through your VCL and see if it really does what you think it does. You can also try setting the ``vcl_trace`` parameter, that will generate log records with like and character number for each statement executed in your VCL program. .. XXX:Example of the command perhaps? benc varnish-4.1.1/doc/html/_sources/installation/help.txt0000644000201500234410000001014612652366773017654 00000000000000%%%%%%%%%%%% Getting help %%%%%%%%%%%% Getting hold of the gang behind Varnish is pretty straight forward, we try to help out as much as time permits and have tried to streamline this process as much as possible. But before you grab hold of us, spend a moment composing your thoughts and formulate your question. From our perspective there is nothing as pointless as simply telling us "Varnish does not work for me" with no further information. This does not give us any relevant information to use when trying to figure out whats wrong. And before you even do that, do a couple of searches to see if your question is already answered, if it has been, you will get your answer much faster that way. IRC Channel =========== The most immediate way to get hold of us is to join our IRC channel: `#varnish on server irc.linpro.no` The main timezone of the channel is Europe work hours. If you can explain your problem in a few clear sentences, without too much copy&paste, IRC is a good way to try to get help. If you do need to paste log files, VCL and so on, please use a pastebin_ service. If the channel is all quiet, try again some time later, we do have lives, families and jobs to deal with also. You are more than welcome to just hang out, and while we don't mind the occasional intrusion from the real world into our flow, we try and keep it mostly on topic, and please don't paste random links unless they are *really* spectacular and intelligent. Mailing Lists ============= Subscribing or unsubscribing to our mailing lists is handled through mailman_. If you are going to use Varnish, subscribing to our `varnish-announce` mailing list is a very good idea. The typical pattern is that people spend some time getting Varnish running, and then more or less forget about it. Therefore the announce list is a good way to be reminded about new releases, bugs or potential (security) vulnerabilities. The `varnish-misc` mailing list is for general banter, questions, suggestions, ideas and so on. If you are new to Varnish it may pay off to subscribe to it, simply to have an ear to the telegraph-pole and potentially learn some smart tricks. This is also a good place to ask for help with more complex issues, that may require file-chunks, references to files and/or long explanations. Make sure to pick a good subject line, and if the subject of the thread changes, please change the subject to match, some of us deal with hundreds of emails per day, after spam-filters, and we need all the help we can get to pick the interesting ones. The `varnish-dev` mailing list is used by the developers and is usually quite focused on source-code and such. Everybody on the `-dev` list is also on `-misc`, so cross-posting only serves to annoy those people. We also maintain a community wiki_ for Varnish, there you will find information on planned events, meetings, current backlog, trouble tickets , and links to resources and documentation. .. XXX: we should introduce the wiki (if we care about it) before .. we start referring to it (below). Make a wiki chapter? Trouble Tickets =============== Please do not open a trouble ticket, unless you have spotted an actual bug in Varnish. Ask on IRC first if you are in doubt. The reason for this policy, is to avoid bugs being drowned in a pile of other `issues`, feature suggestions for future releases, and double postings of calls for help from people who forgot to check back on already opened Tickets. .. XXX: Not sure what you want with the last sentence above. benc We instead track suggestions and feature ideas in our `"Future_Feature" wiki page`_, and through user support via email and IRC. Commercial Support ================== The following companies offer commercial Varnish support, and are listed here for your convenience. If you want your company listed here, drop an email to phk@FreeBSD.org. Varnish Software sales@varnish-software.com UPLEX info@uplex.de .. _mailman: https://www.varnish-cache.org/lists/mailman/listinfo .. _pastebin: https://gist.github.com/ .. _"Future_Feature" wiki page: https://www.varnish-cache.org/trac/wiki/Future_Feature .. _wiki: https://www.varnish-cache.org/trac varnish-4.1.1/doc/html/_sources/installation/prerequisites.txt0000644000201500234410000000110512652366773021623 00000000000000Prerequisites ============= In order for you to install Varnish you must have the following: * A recent, preferably server grade, computer. * A fairly modern and 64 bit version of either - Linux - FreeBSD, or - Solaris (x86 only). * Root access. Varnish can be installed on other UNIX systems as well, but it is not extensively or systematically tested by us on other systems than the above. Varnish is, from time to time, said to work on: * 32 bit versions of the before-mentioned systems, * OS X, * NetBSD, * OpenBSD, and * Windows with Cygwin. varnish-4.1.1/doc/html/_sources/installation/install.txt0000644000201500234410000001136612652366773020377 00000000000000.. _install-doc: Installing Varnish ================== .. no section heading here. With open source software, you can choose to install binary packages or compile it yourself from source code. To install a package or compile from source is a matter of personal taste. If you don't know which method to choose, we recommend that you read this whole section and then choose the method you feel most comfortable with. Source or packages? ------------------- Installing Varnish on most relevant operating systems can usually be done with with the specific systems package manager, typical examples being: FreeBSD ------- Binary package: ``pkg_add -r varnish`` From source: ``cd /usr/ports/varnish && make install clean`` Red Hat / CentOS ---------------- We try to keep the latest version available as prebuilt RPMs (el5 and el6) on `repo.varnish-cache.org `_. See the online `Red Hat installation instructions `_ for more information. Varnish is included in the `EPEL `_ repository, however due to incompatible syntax changes in newer versions of Varnish, only older versions are available. We therefore recommend that you install the latest version directly from our repository, as described above. Debian/Ubuntu ------------- Varnish is distributed with both Debian and Ubuntu. In order to get Varnish up and running type ``sudo apt-get install varnish``. Please note that this might not be the latest version of Varnish. If you need a later version of Varnish, please follow the online installation instructions for `Debian `_ or `Ubuntu `_. Compiling Varnish from source ============================= If there are no binary packages available for your system, or if you want to compile Varnish from source for other reasons, follow these steps: Download the appropriate release tarball, which you can find on http://repo.varnish-cache.org/source/ . Alternatively, if you want to hack on Varnish, you should clone our git repository by doing. ``git clone git://git.varnish-cache.org/varnish-cache`` Build dependencies on Debian / Ubuntu -------------------------------------- In order to build Varnish from source you need a number of packages installed. On a Debian or Ubuntu system these are: .. grep-dctrl -n -sBuild-Depends -r ^ ../../../../varnish-cache-debian/control | tr -d '\n' | awk -F,\ '{ for (i = 0; ++i <= NF;) { sub (/ .*/, "", $i); print "* `" $i "`"; }}' | egrep -v '(debhelper)' * `automake` * `autotools-dev` * `libedit-dev` * `libjemalloc-dev` * `libncurses-dev` * `libpcre3-dev` * `libtool` * `pkg-config` * `python-docutils` * `python-sphinx` * `graphviz` Build dependencies on Red Hat / CentOS -------------------------------------- To build Varnish on a Red Hat or CentOS system you need the following packages installed: .. gawk '/^BuildRequires/ {print "* `" $2 "`"}' ../../../redhat/varnish.spec | sort | uniq | egrep -v '(systemd)' * `autoconf` * `automake` * `jemalloc-devel` * `libedit-devel` * `libtool` * `ncurses-devel` * `pcre-devel` * `pkgconfig` * `python-docutils` * `python-sphinx` * `graphviz` Compiling Varnish ----------------- The configuration will need the dependencies above satisfied. Once that is taken care of:: cd varnish-cache sh autogen.sh sh configure make The `configure` script takes some arguments, but more likely than not you can forget about that for now, almost everything in Varnish can be tweaked with run time parameters. Before you install, you may want to run the test suite, make a cup of tea while it runs, it usually takes a couple of minutes:: make check Don't worry if one or two tests fail, some of the tests are a bit too timing sensitive (Please tell us which so we can fix them.) but if a lot of them fails, and in particular if the `b00000.vtc` test fails, something is horribly wrong, and you will get nowhere without figuring out what. Installing ---------- And finally, the true test of a brave heart: ``sudo make install`` Varnish will now be installed in ``/usr/local``. The ``varnishd`` binary is in `/usr/local/sbin/varnishd`. To make sure that the necessary links and caches of the most recent shared libraries are found, run ``sudo ldconfig``. Next steps ========== After successful installation you are ready to proceed to the :ref:`tutorial-index`. This tutorial is written for installations from binary packages. In practice, it means that some configurations are not in place for installations from source code. For example, instead of calling ``service varnish start``, you start the varnish daemon manually by typing:: varnishd -a :6081 -T localhost:6082 -b localhost:8080 varnish-4.1.1/doc/html/_sources/installation/platformnotes.txt0000644000201500234410000000452512652366773021625 00000000000000 Platform specific notes ------------------------ On some platforms it is necessary to adjust the operating system before running Varnish on it. The systems and steps known to us are described in this section. Transparent hugepages on Redhat Enterprise Linux 6 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On RHEL6 Transparent Hugepage kernel support is enabled by default. This is known to cause sporadic crashes of Varnish. It is recommended to disable transparent hugepages on affected systems. This can be done with ``echo "never" > /sys/kernel/mm/redhat_transparent_hugepage/enabled`` (runtime) and changes to `/etc/sysctl.conf` (persisted.) On Debian/Ubuntu systems running 3.2 kernels the default value is "madvise" and does not need to be changed. OpenVZ ~~~~~~ It is possible, but not recommended for high performance, to run Varnish on virtualised hardware. Reduced disk and network -performance will reduce the performance a bit so make sure your system has good IO performance. If you are running on 64bit OpenVZ (or Parallels VPS), you must reduce the maximum stack size before starting Varnish. The default allocates too much memory per thread, which will make Varnish fail as soon as the number of threads (traffic) increases. Reduce the maximum stack size by adding ``ulimit -s 256`` before starting Varnish in the init script. TCP keep-alive configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On some Solaris, FreeBSD and OS X systems, Varnish is not able to set the TCP keep-alive values per socket, and therefore the *tcp_keepalive_* Varnish runtime parameters are not available. On these platforms it can be beneficial to tune the system wide values for these in order to more reliably detect remote close for sessions spending long time on waitinglists. This will help free up resources faster. Systems that does not support TCP keep-alive values per socket include: - Solaris releases prior to version 11 - FreeBSD releases prior to version 9.1 - OS X releases prior to Mountain Lion On platforms with the necessary socket options the defaults are set to: - `tcp_keepalive_time` = 600 seconds - `tcp_keepalive_probes` = 5 - `tcp_keepalive_intvl` = 5 seconds Note that Varnish will only apply these run-time parameters so long as they are less than the system default value. .. XXX:Maybe a sample-command of using/setting/changing these values? benc varnish-4.1.1/doc/html/_sources/installation/index.txt0000644000201500234410000000066112652366773020034 00000000000000.. _install-index: Varnish Installation ==================== This section covers installation prerequisites, a step-by-step installation procedure, how and where to get help, and how to report bugs. It also contains a set of platform specific notes to aid you when installing Varnish on certain platforms. .. XXX: rewrite the last paragraph. .. toctree:: prerequisites.rst install.rst help.rst bugs.rst platformnotes.rst varnish-4.1.1/doc/html/_sources/index.txt0000644000201500234410000000453512652366773015337 00000000000000 Varnish Administrator Documentation =================================== Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. Varnish Cache is really, really fast. It typically speeds up delivery with a factor of 300 - 1000x, depending on your architecture. To get started with Varnish-Cache we recommend that you read the installation guide :ref:`install-index`. Once you have Varnish up and running we recommend that you go through our tutorial - :ref:`tutorial-index`, and finally the :ref:`users-guide-index`. If you need to find out how to use a specific Varnish tool, the :ref:`reference-index` contains detailed documentation over the tools. Changes from previous versions are located in the :ref:`whats-new-index` chapter. In closing, we have :ref:`phk`, a collection of blog posts from Poul-Henning Kamp related to Varnish and HTTP. Conventions used in this manual include: ``service varnish restart`` A command you can run, or a shortkey you can press. Used either in the terminal or after starting one of the tools. `/usr/local/`, `varnishadm`, `sess_timeout` A utility, Varnish configurable parameter or path. https://www.varnish-cache.org/ A hyperlink. Longer listings like example command output and VCL look like this:: $ /opt/varnish/sbin/varnishd -V varnishd (varnish-trunk revision 199de9b) Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2015 Varnish Software AS .. For maintainers: .. * always write Varnish with a capital V: Varnish, Varnish Cache. .. * Write Varnish tools as their executable name: `varnishd`, `varnishadm`. .. * if part of a command actually runable by the reader, use double backticks: .. ``varnishd -f foo.c`` .. * wrap lines at 80 characters, ident with 4 spaces. No tabs, please. .. We use the following header indicators .. For titles: .. H1 .. %%%%% .. Title .. %%%%% .. H2 - H5 .. ====================== .. ---------------------- .. ~~~~~~~~~~~~~~~~~~~~~~ .. ...................... .. toctree:: :maxdepth: 1 installation/index.rst tutorial/index.rst users-guide/index.rst reference/index.rst whats-new/index.rst phk/index.rst glossary/index.rst Indices and tables ------------------ * :ref:`genindex` * :ref:`search` varnish-4.1.1/doc/html/_sources/tutorial/0000755000201500234410000000000012652366773015403 500000000000000varnish-4.1.1/doc/html/_sources/tutorial/peculiarities.txt0000644000201500234410000000302712652366773020730 00000000000000 Peculiarities ------------- There are a couple of things that are different with Varnish Cache, as opposed to other programs. One thing you've already seen - VCL. In this section we provide a very quick tour of other peculiarities you need to know about to get the most out of Varnish. Configuration ~~~~~~~~~~~~~ The Varnish Configuration is written in VCL. When Varnish is ran this configuration is transformed into C code and then fed into a C compiler, loaded and executed. .. XXX:Ran sounds strange above, maybe "is running" "is started" "executes"? benc So, as opposed to switching various settings on or off, you write polices on how the incoming traffic should be handled. varnishadm ~~~~~~~~~~ Varnish Cache has an admin console. You can connect it it through the :ref:`varnishadm(1)` command. In order to connect the user needs to be able to read `/etc/varnish/secret` in order to authenticate. Once you've started the console you can do quite a few operations on Varnish, like stopping and starting the cache process, load VCL, adjust the built in load balancer and invalidate cached content. It has a built in command "help" which will give you some hints on what it does. .. XXX:sample of the command here. benc varnishlog ~~~~~~~~~~ Varnish does not log to disk. Instead it logs to a chunk of memory. It is actually streaming the logs. At any time you'll be able to connect to the stream and see what is going on. Varnish logs quite a bit of information. You can have a look at the logstream with the command :ref:`varnishlog(1)`. varnish-4.1.1/doc/html/_sources/tutorial/starting_varnish.txt0000644000201500234410000000462412652366773021457 00000000000000.. _tutorial-starting_varnish: Starting Varnish ---------------- This tutorial will assume that you are running Varnish on Ubuntu, Debian, Red Hat Enterprise Linux or CentOS. Those of you running on other platforms might have to do some mental translation exercises in order to follow this. Since you're on a "weird" platform you're probably used to it. :-) Make sure you have Varnish successfully installed (following one of the procedures described in "Installing Varnish" above. When properly installed you start Varnish with ``service varnish start``. This will start Varnish if it isn't already running. .. XXX:What does it do if it is already running? benc Now you have Varnish running. Let us make sure that it works properly. Use your browser to go to http://127.0.0.1:6081/ (Replace the IP address with the IP for the machine that runs Varnish) The default configuration will try to forward requests to a web application running on the same machine as Varnish was installed on. Varnish expects the web application to be exposed over http on port 8080. If there is no web application being served up on that location Varnish will issue an error. Varnish Cache is very conservative about telling the world what is wrong so whenever something is amiss it will issue the same generic "Error 503 Service Unavailable". You might have a web application running on some other port or some other machine. Let's edit the configuration and make it point to something that actually works. Fire up your favorite editor and edit `/etc/varnish/default.vcl`. Most of it is commented out but there is some text that is not. It will probably look like this:: vcl 4.0; backend default { .host = "127.0.0.1"; .port = "8080"; } We'll change it and make it point to something that works. Hopefully http://www.varnish-cache.org/ is up. Let's use that. Replace the text with:: vcl 4.0; backend default { .host = "www.varnish-cache.org"; .port = "80"; } Now issue ``service varnish reload`` to make Varnish reload it's configuration. If that succeeded visit http://127.0.0.1:6081/ in your browser and you should see some directory listing. It works! The reason you're not seeing the Varnish official website is because your client isn't sending the appropriate `Host` header in the request and it ends up showing a listing of the default webfolder on the machine usually serving up http://www.varnish-cache.org/ . varnish-4.1.1/doc/html/_sources/tutorial/backend_servers.txt0000644000201500234410000000277612652366773021240 00000000000000.. _tutorial-backend_servers: Backend servers --------------- Varnish has a concept of `backend` or origin servers. A backend server is the server providing the content Varnish will accelerate via the cache. Our first task is to tell Varnish where it can find its content. Start 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`. If you've been following the tutorial there is probably a section of the configuration that looks like this:: vcl 4.0; backend default { .host = "www.varnish-cache.org"; .port = "80"; } This means we set up a backend in Varnish that fetches content from 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 server. We've already bound Varnish to the public port 80 on the server so now we need to tie it to the origin. For this example, let's pretend the origin server is running on localhost, port 8080.:: vcl 4.0; backend default { .host = "127.0.0.1"; .port = "8080"; } Varnish can have several backends defined and can even join several backends together into clusters of backends for load balancing purposes, having Varnish pick one backend based on different algorithms. Next, let's have a look at some of what makes Varnish unique and what you can do with it. varnish-4.1.1/doc/html/_sources/tutorial/introduction.txt0000644000201500234410000000674212652366773020616 00000000000000.. _tutorial-intro: The fundamentals of web proxy caching with Varnish -------------------------------------------------- Varnish is a caching HTTP reverse proxy. It receives requests from clients and tries to answer them from the cache. If Varnish cannot answer the request from the cache it will forward the request to the backend, fetch the response, store it in the cache and deliver it to the client. When Varnish has a cached response ready it is typically delivered in a matter of microseconds, two orders of magnitude faster than your typical backend server, so you want to make sure to have Varnish answer as many of the requests as possible directly from the cache. Varnish decides whether it can store the content or not based on the response it gets back from the backend. The backend can instruct Varnish to cache the content with the HTTP response header `Cache-Control`. There are a few conditions where Varnish will not cache, the most common one being the use of cookies. Since cookies indicates a client-specific web object, Varnish will by default not cache it. This behaviour as most of Varnish functionality can be changed using policies written in the Varnish Configuration Language (VCL). See :ref:`users-guide-index` for more information on how to do that. Performance ~~~~~~~~~~~ Varnish has a modern architecture and is written with performance in mind. It is usually bound by the speed of the network, effectively turning performance into a non-issue. You get to focus on how your web applications work and you can allow yourself, to some degree, to care less about performance and scalability. .. XXX:Not totally sure what the last sentence above means. benc Flexibility ~~~~~~~~~~~ One of the key features of Varnish Cache, in addition to its performance, is the flexibility of its configuration language, VCL. VCL enables you to write policies on how incoming requests should be handled. In such a policy you can decide what content you want to serve, from where you want to get the content and how the request or response should be altered. Supported platforms -------------------- Varnish is written to run on modern versions of Linux and FreeBSD and the best experience is had on those platforms. Thanks to our contributors it also runs on NetBSD, OpenBSD, OS X and various Solaris-descendants like Oracle Solaris, OmniOS and SmartOS. About the Varnish development process ------------------------------------- Varnish is a community driven project. The development is overseen by the Varnish Governing Board which currently consists of Poul-Henning Kamp (Architect), Rogier Mulhuijzen (Fastly) and Lasse Karstensen (Varnish Software). Please see https://www.varnish-cache.org/trac/wiki/Contributing as a starting point if you would like to contribute to Varnish. Getting in touch ---------------- You can get in touch with us through many channels. For real time chat you can reach us on IRC through the server irc.linpro.net on the #varnish and #varnish-hacking channels. There are two mailing lists available: one for user questions and one for development discussions. See https://www.varnish-cache.org/lists for information and signup. There is also a web forum on the same site. Now that you have a vague idea on what Varnish Cache is, let's see if we can get it up and running. .. XXX:The above three paragraphs are repetitive this is already handled in previous chapters. The only new information is Governing Board which could be moved to the introduction and the paragraphs scrapped. benc varnish-4.1.1/doc/html/_sources/tutorial/now_what.txt0000644000201500234410000000047012652366773017713 00000000000000 ========= Now what? ========= You've read through the tutorial. You should have Varnish up and running. You should know about the logs and you should have a rough idea of what VCL is. Next, you might want to have a look at :ref:`users-guide-index`, where we go through the features of Varnish in more detail. varnish-4.1.1/doc/html/_sources/tutorial/putting_varnish_on_port_80.txt0000644000201500234410000000221412652366773023356 00000000000000 Put Varnish on port 80 ---------------------- Until now we've been running with Varnish on a high port which is great for testing purposes. Let's now put Varnish on the default HTTP port 80. First we stop varnish: ``service varnish stop`` Now we need to edit the configuration file that starts Varnish. Debian/Ubuntu ~~~~~~~~~~~~~ On Debian/Ubuntu this is `/etc/default/varnish`. In the file you'll find some text that looks like this:: DAEMON_OPTS="-a :6081 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -s malloc,256m" Change it to:: DAEMON_OPTS="-a :80 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -s malloc,256m" Red Hat Enterprise Linux / CentOS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On Red Hat/CentOS you can find a similar configuration file in `/etc/sysconfig/varnish`. Restarting Varnish again ------------------------ Once the change is done, restart Varnish: ``service varnish start``. Now everyone accessing your site will be accessing through Varnish. varnish-4.1.1/doc/html/_sources/tutorial/index.txt0000644000201500234410000000111412652366773017170 00000000000000.. _tutorial-index: The Varnish Tutorial ==================== This section covers the Varnish basics in a tutorial form. It will cover what Varnish is and how it works. It also covers how to get Varnish up and running. After this section you probably would want to continue with the users guide (:ref:`users-guide-index`). If you're reading this on the web note the "Next topic" and "Previous topic" links on the right side of each page. .. toctree:: :maxdepth: 1 introduction starting_varnish putting_varnish_on_port_80 backend_servers peculiarities.rst now_what varnish-4.1.1/doc/html/reference/0000755000201500234410000000000012652366773013654 500000000000000varnish-4.1.1/doc/html/reference/varnishlog.html0000644000201500234410000003410512652366773016641 00000000000000 varnishlog — Varnish version 4.1.1 documentation

varnishlog¶

Display Varnish logs¶

Manual section:1

SYNOPSIS¶

varnishlog [-a] [-A] [-b] [-c] [-C] [-d] [-D] [-g <session|request|vxid|raw>] [-h] [-i taglist] [-I <[taglist:]regex>] [-k num] [-L limit] [-n name] [-N filename] [-P file] [-q query] [-r filename] [-t <seconds|off>] [-T seconds] [-v] [-V] [-w filename] [-x taglist] [-X <[taglist:]regex>]

OPTIONS¶

The following options are available:

-a When writing output to a file with the -w option, append to it rather than overwrite it.
-A When writing output to a file with the -w option, output data in ascii format.
-b Only display transactions and log records coming from backend communication.
-c Only display transactions and log records coming from client communication.
-C Do all regular expression and string matching caseless.
-d Start processing log records at the head of the log instead of the tail.
-D Daemonize.
-g <session|request|vxid|raw>
 The grouping of the log records. The default is to group by vxid.
-h Print program usage and exit
-i taglist

Include log records of these tags in output. Taglist is a comma-separated list of tag globs. Multiple -i options may be given.

If a tag include option is the first of any tag selection options, all tags are first marked excluded.

-I <[taglist:]regex>
 

Include by regex matching. Output only records matching taglist and regular expression. Applies to any tag if taglist is absent.

If a tag include option is the first of any tag selection options, all tags are first marked excluded.

-k num Process this number of matching log transactions before exiting.
-L limit Sets the upper limit of incomplete transactions kept before the oldest transaction is force completed. A warning record is synthesized when this happens. This setting keeps an upper bound on the memory usage of running queries. Defaults to 1000 transactions.
-n name Specify the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.
-N filename Specify the filename of a stale VSM instance. When using this option the abandonment checking is disabled.
-P file Write the process' PID to the specified file.
-q query Specifies the VSL query to use.
-r filename Read log in binary file format from this file. The file can be created with varnishlog -w filename.
-t <seconds|off>
 Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this many seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. Defaults to 5 seconds.
-T seconds Sets the transaction timeout in seconds. This defines the maximum number of seconds elapsed between a Begin tag and the End tag. If the timeout expires, a warning record is synthesized and the transaction is force completed. Defaults to 120 seconds.
-v Use verbose output on record set printing, giving the VXID on every log line. Without this option, the VXID will only be given on the header of that transaction.
-V Print version information and exit.
-w filename Redirect output to file. The file will be overwritten unless the -a option was specified. If the application receives a SIGHUP in daemon mode the file will be reopened allowing the old one to be rotated away. The file can then be read by varnishlog and other tools with the -r option, unless the -A option was specified. This option is required when running in daemon mode.
-x taglist Exclude log records of these tags in output. Taglist is a comma-separated list of tag globs. Multiple -x options may be given.
-X <[taglist:]regex>
 Exclude by regex matching. Do not output records matching taglist and regular expression. Applies to any tag if taglist is absent.

SIGNALS¶

  • SIGHUP

    Rotate the log file (see -w option)

  • SIGUSR1

    Flush any outstanding transactions

HISTORY¶

The varnishlog utility was developed by Poul-Henning Kamp <phk@phk.freebsd.dk> in cooperation with Verdens Gang AS and Varnish Software AS. This manual page was initially written by Dag-Erling Smørgrav, and later updated by Per Buer and Martin Blix Grydeland.

Table Of Contents

Previous topic

varnishhist

Next topic

varnishncsa

This Page

varnish-4.1.1/doc/html/reference/directors.html0000644000201500234410000003565312652366773016474 00000000000000 Writing a Director — Varnish version 4.1.1 documentation

Writing a Director¶

Varnish already provides a set of general-purpose directors, and since Varnish 4, it is bundled in the built-in vmod_directors. Writing a director boils down to writing a VMOD, using the proper data structures and APIs. Not only can you write your own director if none of the built-ins fit your needs, but since Varnish 4.1 you can even write your own backends.

Backends can be categorized as such:

  • static: native backends declared in VCL
  • dynamic: native backends created by VMODs
  • custom: backends created and fully managed by VMODs

Backends vs Directors¶

The intuitive classification for backend and director is an endpoint for the former and a cluster for the latter, but the actual implementation is a bit more subtle. VMODs can accept backend arguments and return backends in VCL (see VCL and C data types), but the underlying C type is struct director. Under the hood director is a generic concept, and a backend is a kind of director.

The line between the two is somewhat blurry at this point, let's look at some code instead:

struct director {
        unsigned                magic;
#define DIRECTOR_MAGIC          0x3336351d
        const char              *name;
        char                    *vcl_name;
        vdi_http1pipe_f         *http1pipe;
        vdi_healthy_f           *healthy;
        vdi_resolve_f           *resolve;
        vdi_gethdrs_f           *gethdrs;
        vdi_getbody_f           *getbody;
        vdi_getip_f             *getip;
        vdi_finish_f            *finish;
        vdi_panic_f             *panic;
        void                    *priv;
        const void              *priv2;
};

A director can be summed up as:

  • a name (used for panics)
  • a VCL name
  • a set of operations
  • the associated state

The difference between a cluster director and a backend director is mainly The functions they will implement.

Cluster Directors¶

As in vmod_directors, you can write directors that will group backends sharing the same role, and pick them according to a strategy. If you need more than the built-in strategies (round-robin, hash, ...), even though they can be stacked, it is always possible to write your own.

In this case you simply need to implement the resolve function for the director. Directors are walked until a leaf director is found. A leaf director doesn't have a resolve function and is used to actually make the backend request, just like the backends you declare in VCL.

Dynamic Backends¶

If you want to speak HTTP/1 over TCP, but for some reason VCL does not fit the bill, you can instead reuse the whole backend facility. It allows you for instance to add and remove backends on-demand without the need to reload your VCL. You can then leverage your provisioning system.

Consider the following snippet:

backend default {
    .host = "localhost";
}

The VCL compiler turns this declaration into a struct vrt_backend. When the VCL is loaded, Varnish calls VRT_new_backend in order to create the director. Varnish doesn't expose its data structure for actual backends, only the director abstraction and dynamic backends are built just like static backends, one struct at a time. You can get rid of the struct vrt_backend as soon as you have the struct director.

A (dynamic) backend can't exceed its VCL's lifespan, because native backends are owned by VCLs. Though a dynamic backend can't outlive its VCL, it can be deleted any time with VRT_delete_backend. The VCL will delete the remaining backends once discarded, you don't need to take care of it.

Consider using an object to manipulate dynamic backends. They are tied to the VCL life cycle and make a handy data structure to keep track of backends and objects have a VCL name you can reuse for the director. It is also true for cluster directors that may reference native backends.

Finally, Varnish will take care of event propagation for all native backends, but dynamic backends can only be created when the VCL is warm. If your backends are created by an independent thread (basically outside of VCL scope) you must subscribe to VCL events and watch for VCL state (see Event functions). Varnish will panic if you try to create a backend on a cold VCL, and VRT_new_backend will return NULL if the VCL is cooling. You are also encouraged to comply with the VCL Temperature in general.

Health Probes¶

It is possible in a VCL program to query the health of a director (see BOOL healthy(BACKEND)). A director can report its health if it implements the healthy function, it is otherwise always considered healthy.

Unless you are making a dynamic backend, you need to take care of the health probes yourselves. For cluster directors, being healthy typically means having at least one healthy underlying backend or director.

For dynamic backends, it is just a matter of assigning the probe field in the struct vrt_backend. Once the director is created, the probe definition too is no longer needed. It is then Varnish that will take care of the health probe and disable the feature on a cold VCL (see Event functions).

Instead of initializing your own probe definition, you can get a VCL_PROBE directly built from VCL (see VCL and C data types).

What's the difference ?

Custom Backends¶

If you want to implement a custom backend, have a look at how Varnish implements native backends. It is the canonical implementation, and though it provides other services like connection pooling or statistics, it is essentially a director which state is a struct backend. Varnish native backends currently speak HTTP/1 over TCP, and as such, you need to make your own custom backend if you want Varnish to do otherwise such as connect over UDP or UNIX-domain sockets or speak a different protocol.

If you want to leverage probes declarations in VCL, which have the advantage of being reusable since they are only specifications, you can. However, you need to implement the whole probing infrastructure from scratch.

You may also consider making your custom backend compliant with regards to the VCL state (see Event functions).

Data structure considerations¶

When you are creating a custom backend, you may want to provide the semantics of the native backends. In this case, instead of repeating the redundant fields between data structures, you can use the macros VRT_BACKEND_FIELDS and VRT_BACKEND_PROBE_FIELDS to declare them all at once. This is the little dance Varnish uses to copy data between the struct vrt_backend and its internal data structure for example.

The copy can be automated with the macros VRT_BACKEND_HANDLE and VRT_BACKEND_PROBE_HANDLE. You can look at how they can be used in the Varnish code base.

Table Of Contents

Previous topic

vmod_directors

Next topic

varnish-counters

This Page

varnish-4.1.1/doc/html/reference/varnishd.html0000644000201500234410000023442212652366773016307 00000000000000 varnishd — Varnish version 4.1.1 documentation

varnishd¶

HTTP accelerator daemon¶

Manual section:1

SYNOPSIS¶

varnishd [-a address[:port][,PROTO]] [-b host[:port]] [-C] [-d] [-F] [-f config] [-h type[,options]] [-i identity] [-j jail[,jailoptions]] [-l vsl[,vsm]] [-M address:port] [-n name] [-P file] [-p param=value] [-r param[,param...]] [-S secret-file] [-s [name=]kind[,options]] [-T address[:port]] [-t TTL] [-V] [-W waiter]

DESCRIPTION¶

The varnishd daemon accepts HTTP requests from clients, passes them on to a backend server and caches the returned documents to better satisfy future requests for the same document.

OPTIONS¶

-a <address[:port][,PROTO]>
 Listen for client requests on the specified address and port. The address can be a host 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, port 80 (http) is used. An additional protocol type can be set for the listening socket with PROTO. Valid protocol types are: HTTP/1 (default), and PROXY. Multiple listening addresses can be specified by using multiple -a arguments.
-b <host[:port]>
 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 to compile with the -f option.
-d Enables debugging mode: The parent process runs in the foreground with a CLI connection on stdin/stdout, and the child process must be started explicitly with a CLI command. Terminating the parent process will also terminate the child.
-F Do not fork, run in the foreground.
-f config

Use the specified VCL configuration file instead of the builtin default. See VCL for details on VCL syntax.

When neither a -f nor a -b argument are given, varnishd will not start the worker process but process cli commands.

-h <type[,options]>
 Specifies the hash algorithm. See Hash Algorithm Options for a list of supported algorithms.
-i identity Specify the identity of the Varnish server. This can be accessed using server.identity from VCL.
-j <jail[,jailoptions]>
 Specify the jailing technology to use.
-l <vsl[,vsm]> Specifies size of shmlog file. vsl is the space for the VSL records [80M] and vsm is the space for stats counters [1M]. Scaling suffixes like 'K' and 'M' can be used up to (G)igabytes. Default is 81 Megabytes.
-M <address:port>
 Connect to this port and offer the command line 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.
-n name Specify the name for this instance. Amongst other things, this name is used to construct the name of the directory in which varnishd keeps temporary files and persistent state. If the specified name begins with a forward slash, it is interpreted as the absolute path to the directory which should be used for this purpose.
-P file Write the PID of the process to the specified file.
-p <param=value>
 Set the parameter specified by param to the specified value, see List of Parameters for details. This option can be used multiple times to specify multiple parameters.
-r <param[,param...]>
 Make the listed parameters read only. This gives the system administrator a way to limit what the Varnish CLI can do. Consider making parameters such as cc_command, vcc_allow_inline_c and vmod_dir read only as these can potentially be used to escalate privileges from the CLI.
-S file Path to a file containing a secret used for authorizing access to the management port. If not provided a new secret will be drawn from the system PRNG.
-s <[name=]type[,options]>
 

Use the specified storage backend, see Storage Backend Options.

This option can be used multiple times to specify multiple storage files. Names are referenced in logs, VCL, statistics, etc.

-T <address[:port]>
 Offer a management interface on the specified address and port. See Management Interface for a list of management commands.
-t TTL Specifies the default time to live (TTL) for cached objects. This is a shortcut for specifying the default_ttl run-time parameter.
-V Display the version number and exit.
-W waiter Specifies the waiter type to use.

Hash Algorithm Options¶

The following hash algorithms are available:

-h critbit self-scaling tree structure. The default hash algorithm in Varnish Cache 2.1 and onwards. In comparison to a more traditional B tree the critbit tree is almost completely lockless. Do not change this unless you are certain what you're doing.
-h simple_list A simple doubly-linked list. Not recommended for production use.
-h <classic[,buckets]>
 A standard hash table. The hash key is the CRC32 of the object's URL modulo the size of the hash table. Each table entry points to a list of elements which share the same hash key. The buckets parameter specifies the number of entries in the hash table. The default is 16383.

Storage Backend Options¶

The following storage types are available:

-s <malloc[,size]>
 malloc is a memory based backend.
-s <file,path[,size[,granularity]]>
 

The file backend stores data in a file on disk. The file will be accessed using mmap.

The path is mandatory. If path points to a directory, a temporary file will be created in that directory and immediately unlinked. If path points to a non-existing file, the file will be created.

If size is omitted, and path points to an existing file with a size greater than zero, the size of that file will be used. If not, an error is reported.

Granularity sets the allocation block size. Defaults to the system page size or the filesystem block size, whichever is larger.

-s <persistent,path,size>
 Persistent storage. Varnish will store objects in a file in a manner that will secure the survival of most of the objects in the event of a planned or unplanned shutdown of Varnish. The persistent storage backend has multiple issues with it and will likely be removed from a future version of Varnish.

Jail Options¶

Varnish jails are a generalization over various platform specific methods to reduce the privileges of varnish processes. They may have specific options. Available jails are:

-j solaris Reduce privileges(5) for varnishd and sub-process to the minimally required set. Only available on platforms which have the setppriv(2) call.
-j <unix[,user=`user`][,ccgroup=`group`]>
 

Default on all other platforms if varnishd is either started with an effective uid of 0 ("as root") or as user varnish.

With the unix jail technology activated, varnish will switch to an alternative user for subprocesses and change the effective uid of the master process whenever possible.

The optional user argument specifies which alternative user to use. It defaults to varnish

The optional ccgroup argument specifies a group to add to varnish subprocesses requiring access to a c-compiler. There is no default.

-j none last resort jail choice: With jail technology none, varnish will run all processes with the privileges it was started with.

Management Interface¶

If the -T option was specified, varnishd will offer a command-line management interface on the specified address and port. The recommended way of connecting to the command-line management interface is through varnishadm(1).

The commands available are documented in varnish(7).

RUN TIME PARAMETERS¶

Run Time Parameter Flags¶

Runtime parameters are marked with shorthand flags to avoid repeating the same text over and over in the table below. The meaning of the flags are:

  • experimental

    We have no solid information about good/bad/optimal values for this parameter. Feedback with experience and observations are most welcome.

  • delayed

    This parameter can be changed on the fly, but will not take effect immediately.

  • restart

    The worker process must be stopped and restarted, before this parameter takes effect.

  • reload

    The VCL programs must be reloaded for this parameter to take effect.

  • experimental

    We're not really sure about this parameter, tell us what you find.

  • wizard

    Do not touch unless you really know what you're doing.

  • only_root

    Only works if varnishd is running as root.

Default Value Exceptions on 32 bit Systems¶

Be aware that on 32 bit systems, certain default values are reduced relative to the values listed below, in order to conserve VM space:

  • workspace_client: 16k
  • thread_pool_workspace: 16k
  • http_resp_size: 8k
  • http_req_size: 12k
  • gzip_stack_buffer: 4k
  • thread_pool_stack: 64k

List of Parameters¶

This text is produced from the same text you will find in the CLI if you use the param.show command:

accept_filter¶
  • Units: bool
  • Default: off
  • Flags: must_restart

Enable kernel accept-filters (if available in the kernel).

acceptor_sleep_decay¶
  • Default: 0.9
  • Minimum: 0
  • Maximum: 1
  • Flags: experimental

If we run out of resources, such as file descriptors or worker threads, the acceptor will sleep between accepts. This parameter (multiplicatively) reduce the sleep duration for each successful accept. (ie: 0.9 = reduce by 10%)

acceptor_sleep_incr¶
  • Units: seconds
  • Default: 0.000
  • Minimum: 0.000
  • Maximum: 1.000
  • Flags: experimental

If we run out of resources, such as file descriptors or worker threads, the acceptor will sleep between accepts. This parameter control how much longer we sleep, each time we fail to accept a new connection.

acceptor_sleep_max¶
  • Units: seconds
  • Default: 0.050
  • Minimum: 0.000
  • Maximum: 10.000
  • Flags: experimental

If we run out of resources, such as file descriptors or worker threads, the acceptor will sleep between accepts. This parameter limits how long it can sleep between attempts to accept new connections.

auto_restart¶
  • Units: bool
  • Default: on

Automatically restart the child/worker process if it dies.

backend_idle_timeout¶
  • Units: seconds
  • Default: 60.000
  • Minimum: 1.000

Timeout before we close unused backend connections.

ban_dups¶
  • Units: bool
  • Default: on

Eliminate older identical bans when a new ban is added. This saves CPU cycles by not comparing objects to identical bans. This is a waste of time if you have many bans which are never identical.

ban_lurker_age¶
  • Units: seconds
  • Default: 60.000
  • Minimum: 0.000

The ban lurker will ignore bans until they are this old. When a ban is added, the active traffic will be tested against it as part of object lookup. This parameter holds the ban-lurker off, until the rush is over.

ban_lurker_batch¶
  • Default: 1000
  • Minimum: 1

The ban lurker sleeps ${ban_lurker_sleep} after examining this many objects. Use this to pace the ban-lurker if it eats too many resources.

ban_lurker_sleep¶
  • Units: seconds
  • Default: 0.010
  • Minimum: 0.000

How long the ban lurker sleeps after examining ${ban_lurker_batch} objects. Use this to pace the ban-lurker if it eats too many resources. A value of zero will disable the ban lurker entirely.

between_bytes_timeout¶
  • Units: seconds
  • Default: 60.000
  • Minimum: 0.000

We only wait for this many seconds between bytes received from the backend before giving up the fetch. A value of zero means never give up. VCL values, per backend or per backend request take precedence. This parameter does not apply to pipe'ed requests.

cc_command¶
  • Default: "exec gcc -std=gnu99 -g -O2 -Wall -Werror -Wno-error=unused-result t-Werror t-Wall t-Wno-format-y2k t-W t-Wstrict-prototypes t-Wmissing-prototypes t-Wpointer-arith t-Wreturn-type t-Wcast-qual t-Wwrite-strings t-Wswitch t-Wshadow t-Wunused-parameter t-Wcast-align t-Wchar-subscripts t-Wnested-externs t-Wextra t-Wno-sign-compare -fstack-protector -Wno-pointer-sign -Wno-address -Wno-missing-field-initializers -pthread -fpic -shared -Wl,-x -o %o %s"
  • Flags: must_reload

Command used for compiling the C source code to a dlopen(3) loadable object. Any occurrence of %s in the string will be replaced with the source file name, and %o will be replaced with the output file name.

cli_buffer¶
  • Units: bytes
  • Default: 8k
  • Minimum: 4k

Size of buffer for CLI command input. You may need to increase this if you have big VCL files and use the vcl.inline CLI command. NB: Must be specified with -p to have effect.

cli_limit¶
  • Units: bytes
  • Default: 48k
  • Minimum: 128b
  • Maximum: 99999999b

Maximum size of CLI response. If the response exceeds this limit, the response code will be 201 instead of 200 and the last line will indicate the truncation.

cli_timeout¶
  • Units: seconds
  • Default: 60.000
  • Minimum: 0.000

Timeout for the childs replies to CLI requests from the mgt_param.

clock_skew¶
  • Units: seconds
  • Default: 10
  • Minimum: 0

How much clockskew we are willing to accept between the backend and our own clock.

connect_timeout¶
  • Units: seconds
  • Default: 3.500
  • Minimum: 0.000

Default connection timeout for backend connections. We only try to connect to the backend for this many seconds before giving up. VCL can override this default value for each backend and backend request.

critbit_cooloff¶
  • Units: seconds
  • Default: 180.000
  • Minimum: 60.000
  • Maximum: 254.000
  • Flags: wizard

How long the critbit hasher keeps deleted objheads on the cooloff list.

debug¶
  • Default: none

Enable/Disable various kinds of debugging.

none
Disable all debugging

Use +/- prefix to set/reset individual bits:

req_state
VSL Request state engine
workspace
VSL Workspace operations
waiter
VSL Waiter internals
waitinglist
VSL Waitinglist events
syncvsl
Make VSL synchronous
hashedge
Edge cases in Hash
vclrel
Rapid VCL release
lurker
VSL Ban lurker
esi_chop
Chop ESI fetch to bits
flush_head
Flush after http1 head
vtc_mode
Varnishtest Mode
witness
Emit WITNESS lock records
vsm_keep
Keep the VSM file on restart
default_grace¶
  • Units: seconds
  • Default: 10.000
  • Minimum: 0.000
  • Flags: obj_sticky

Default grace period. We will deliver an object this long after it has expired, provided another thread is attempting to get a new copy.

default_keep¶
  • Units: seconds
  • Default: 0.000
  • Minimum: 0.000
  • Flags: obj_sticky

Default keep period. We will keep a useless object around this long, making it available for conditional backend fetches. That means that the object will be removed from the cache at the end of ttl+grace+keep.

default_ttl¶
  • Units: seconds
  • Default: 120.000
  • Minimum: 0.000
  • Flags: obj_sticky

The TTL assigned to objects if neither the backend nor the VCL code assigns one.

feature¶
  • Default: none

Enable/Disable various minor features.

none
Disable all features.

Use +/- prefix to enable/disable individual feature:

short_panic
Short panic message.
wait_silo
Wait for persistent silo.
no_coredump
No coredumps.
esi_ignore_https
Treat HTTPS as HTTP in ESI:includes
esi_disable_xml_check
Don't check of body looks like XML
esi_ignore_other_elements
Ignore non-esi XML-elements
esi_remove_bom
Remove UTF-8 BOM
fetch_chunksize¶
  • Units: bytes
  • Default: 16k
  • Minimum: 4k
  • Flags: experimental

The default chunksize used by fetcher. This should be bigger than the majority of objects with short TTLs. Internal limits in the storage_file module makes increases above 128kb a dubious idea.

fetch_maxchunksize¶
  • Units: bytes
  • Default: 0.25G
  • Minimum: 64k
  • Flags: experimental

The maximum chunksize we attempt to allocate from storage. Making this too large may cause delays and storage fragmentation.

first_byte_timeout¶
  • Units: seconds
  • Default: 60.000
  • Minimum: 0.000

Default timeout for receiving first byte from backend. We only wait for this many seconds for the first byte before giving up. A value of 0 means it will never time out. VCL can override this default value for each backend and backend request. This parameter does not apply to pipe.

gzip_buffer¶
  • Units: bytes
  • Default: 32k
  • Minimum: 2k
  • Flags: experimental

Size of malloc buffer used for gzip processing. These buffers are used for in-transit data, for instance gunzip'ed data being sent to a client.Making this space to small results in more overhead, writes to sockets etc, making it too big is probably just a waste of memory.

gzip_level¶
  • Default: 6
  • Minimum: 0
  • Maximum: 9

Gzip compression level: 0=debug, 1=fast, 9=best

gzip_memlevel¶
  • Default: 8
  • Minimum: 1
  • Maximum: 9

Gzip memory level 1=slow/least, 9=fast/most compression. Memory impact is 1=1k, 2=2k, ... 9=256k.

http_gzip_support¶
  • Units: bool
  • Default: on
Enable gzip support. When enabled Varnish request compressed objects from the backend and store them compressed. If a client does not support gzip encoding Varnish will uncompress compressed objects on demand. Varnish will also rewrite the Accept-Encoding header of clients indicating support for gzip to:
Accept-Encoding: gzip

Clients that do not support gzip will have their Accept-Encoding header removed. For more information on how gzip is implemented please see the chapter on gzip in the Varnish reference.

http_max_hdr¶
  • Units: header lines
  • Default: 64
  • Minimum: 32
  • Maximum: 65535

Maximum number of HTTP header lines we allow in {req|resp|bereq|beresp}.http (obj.http is autosized to the exact number of headers). Cheap, ~20 bytes, in terms of workspace memory. Note that the first line occupies five header lines.

http_range_support¶
  • Units: bool
  • Default: on

Enable support for HTTP Range headers.

http_req_hdr_len¶
  • Units: bytes
  • Default: 8k
  • Minimum: 40b

Maximum length of any HTTP client request header we will allow. The limit is inclusive its continuation lines.

http_req_size¶
  • Units: bytes
  • Default: 32k
  • Minimum: 0.25k

Maximum number of bytes of HTTP client request we will deal with. This is a limit on all bytes up to the double blank line which ends the HTTP request. The memory for the request is allocated from the client workspace (param: workspace_client) and this parameter limits how much of that the request is allowed to take up.

http_resp_hdr_len¶
  • Units: bytes
  • Default: 8k
  • Minimum: 40b

Maximum length of any HTTP backend response header we will allow. The limit is inclusive its continuation lines.

http_resp_size¶
  • Units: bytes
  • Default: 32k
  • Minimum: 0.25k

Maximum number of bytes of HTTP backend response we will deal with. This is a limit on all bytes up to the double blank line which ends the HTTP request. The memory for the request is allocated from the backend workspace (param: workspace_backend) and this parameter limits how much of that the request is allowed to take up.

idle_send_timeout¶
  • Units: seconds
  • Default: 60.000
  • Minimum: 0.000
  • Flags: delayed

Time to wait with no data sent. If no data has been transmitted in this many seconds the session is closed. See setsockopt(2) under SO_SNDTIMEO for more information.

listen_depth¶
  • Units: connections
  • Default: 1024
  • Minimum: 0
  • Flags: must_restart

Listen queue depth.

lru_interval¶
  • Units: seconds
  • Default: 2.000
  • Minimum: 0.000
  • Flags: experimental

Grace period before object moves on LRU list. Objects are only moved to the front of the LRU list if they have not been moved there already inside this timeout period. This reduces the amount of lock operations necessary for LRU list access.

max_esi_depth¶
  • Units: levels
  • Default: 5
  • Minimum: 0

Maximum depth of esi:include processing.

max_restarts¶
  • Units: restarts
  • Default: 4
  • Minimum: 0

Upper limit on how many times a request can restart. Be aware that restarts are likely to cause a hit against the backend, so don't increase thoughtlessly.

max_retries¶
  • Units: retries
  • Default: 4
  • Minimum: 0

Upper limit on how many times a backend fetch can retry.

nuke_limit¶
  • Units: allocations
  • Default: 50
  • Minimum: 0
  • Flags: experimental

Maximum number of objects we attempt to nuke in order to make space for a object body.

pcre_match_limit¶
  • Default: 10000
  • Minimum: 1

The limit for the number of calls to the internal match() function in pcre_exec().

(See: PCRE_EXTRA_MATCH_LIMIT in pcre docs.)

This parameter limits how much CPU time regular expression matching can soak up.

pcre_match_limit_recursion¶
  • Default: 20
  • Minimum: 1

The recursion depth-limit for the internal match() function in a pcre_exec().

(See: PCRE_EXTRA_MATCH_LIMIT_RECURSION in pcre docs.)

This puts an upper limit on the amount of stack used by PCRE for certain classes of regular expressions.

We have set the default value low in order to prevent crashes, at the cost of possible regexp matching failures.

Matching failures will show up in the log as VCL_Error messages with regexp errors -27 or -21.

Testcase r01576 can be useful when tuning this parameter.

ping_interval¶
  • Units: seconds
  • Default: 3
  • Minimum: 0
  • Flags: must_restart

Interval between pings from parent to child. Zero will disable pinging entirely, which makes it possible to attach a debugger to the child.

pipe_timeout¶
  • Units: seconds
  • Default: 60.000
  • Minimum: 0.000

Idle timeout for PIPE sessions. If nothing have been received in either direction for this many seconds, the session is closed.

pool_req¶
  • Default: 10,100,10

Parameters for per worker pool request memory pool. The three numbers are:

min_pool
minimum size of free pool.
max_pool
maximum size of free pool.
max_age
max age of free element.
pool_sess¶
  • Default: 10,100,10

Parameters for per worker pool session memory pool. The three numbers are:

min_pool
minimum size of free pool.
max_pool
maximum size of free pool.
max_age
max age of free element.
pool_vbo¶
  • Default: 10,100,10

Parameters for backend object fetch memory pool. The three numbers are:

min_pool
minimum size of free pool.
max_pool
maximum size of free pool.
max_age
max age of free element.
prefer_ipv6¶
  • Units: bool
  • Default: off

Prefer IPv6 address when connecting to backends which have both IPv4 and IPv6 addresses.

rush_exponent¶
  • Units: requests per request
  • Default: 3
  • Minimum: 2
  • Flags: experimental

How many parked request we start for each completed request on the object. NB: Even with the implict delay of delivery, this parameter controls an exponential increase in number of worker threads.

send_timeout¶
  • Units: seconds
  • Default: 600.000
  • Minimum: 0.000
  • Flags: delayed

Send timeout for client connections. If the HTTP response hasn't been transmitted in this many seconds the session is closed. See setsockopt(2) under SO_SNDTIMEO for more information.

session_max¶
  • Units: sessions
  • Default: 100000
  • Minimum: 1000

Maximum number of sessions we will allocate from one pool before just dropping connections. This is mostly an anti-DoS measure, and setting it plenty high should not hurt, as long as you have the memory for it.

shm_reclen¶
  • Units: bytes
  • Default: 255b
  • Minimum: 16b
  • Maximum: 4084

Old name for vsl_reclen, use that instead.

shortlived¶
  • Units: seconds
  • Default: 10.000
  • Minimum: 0.000

Objects created with (ttl+grace+keep) shorter than this are always put in transient storage.

sigsegv_handler¶
  • Units: bool
  • Default: on
  • Flags: must_restart

Install a signal handler which tries to dump debug information on segmentation faults, bus errors and abort signals.

syslog_cli_traffic¶
  • Units: bool
  • Default: on

Log all CLI traffic to syslog(LOG_INFO).

tcp_keepalive_intvl¶
  • Units: seconds
  • Default: 75.000
  • Minimum: 1.000
  • Maximum: 100.000
  • Flags: experimental

The number of seconds between TCP keep-alive probes.

tcp_keepalive_probes¶
  • Units: probes
  • Default: 9
  • Minimum: 1
  • Maximum: 100
  • Flags: experimental

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.

tcp_keepalive_time¶
  • Units: seconds
  • Default: 7200.000
  • Minimum: 1.000
  • Maximum: 7200.000
  • Flags: experimental

The number of seconds a connection needs to be idle before TCP begins sending out keep-alive probes.

thread_pool_add_delay¶
  • Units: seconds
  • Default: 0.000
  • Minimum: 0.000
  • Flags: experimental

Wait at least this long after creating a thread.

Some (buggy) systems may need a short (sub-second) delay between creating threads. Set this to a few milliseconds if you see the 'threads_failed' counter grow too much.

Setting this too high results in insuffient worker threads.

thread_pool_destroy_delay¶
  • Units: seconds
  • Default: 1.000
  • Minimum: 0.010
  • Flags: delayed, experimental

Wait this long after destroying a thread.

This controls the decay of thread pools when idle(-ish).

thread_pool_fail_delay¶
  • Units: seconds
  • Default: 0.200
  • Minimum: 0.010
  • Flags: experimental

Wait at least this long after a failed thread creation before trying to create another thread.

Failure to create a worker thread is often a sign that the end is near, because the process is running out of some resource. This delay tries to not rush the end on needlessly.

If thread creation failures are a problem, check that thread_pool_max is not too high.

It may also help to increase thread_pool_timeout and thread_pool_min, to reduce the rate at which treads are destroyed and later recreated.

thread_pool_max¶
  • Units: threads
  • Default: 5000
  • Minimum: 100
  • Flags: delayed

The maximum number of worker threads in each pool.

Do not set this higher than you have to, since excess worker threads soak up RAM and CPU and generally just get in the way of getting work done.

thread_pool_min¶
  • Units: threads
  • Default: 100
  • Maximum: 5000
  • Flags: delayed

The minimum number of worker threads in each pool.

Increasing this may help ramp up faster from low load situations or when threads have expired.

Minimum is 10 threads.

thread_pool_stack¶
  • Units: bytes
  • Default: 48k
  • Minimum: 16k
  • Flags: experimental

Worker thread stack size. This will likely be rounded up to a multiple of 4k (or whatever the page_size might be) by the kernel.

thread_pool_timeout¶
  • Units: seconds
  • Default: 300.000
  • Minimum: 10.000
  • Flags: delayed, experimental

Thread idle threshold.

Threads in excess of thread_pool_min, which have been idle for at least this long, will be destroyed.

thread_pools¶
  • Units: pools
  • Default: 2
  • Minimum: 1
  • Flags: delayed, experimental

Number of worker thread pools.

Increasing number of worker pools decreases lock contention.

Too many pools waste CPU and RAM resources, and more than one pool for each CPU is probably detrimal to performance.

Can be increased on the fly, but decreases require a restart to take effect.

thread_queue_limit¶
  • Default: 20
  • Minimum: 0
  • Flags: experimental

Permitted queue length per thread-pool.

This sets the number of requests we will queue, waiting for an available thread. Above this limit sessions will be dropped instead of queued.

thread_stats_rate¶
  • Units: requests
  • Default: 10
  • Minimum: 0
  • Flags: experimental

Worker threads accumulate statistics, and dump these into the global stats counters if the lock is free when they finish a job (request/fetch etc.) This parameters defines the maximum number of jobs a worker thread may handle, before it is forced to dump its accumulated stats into the global counters.

timeout_idle¶
  • Units: seconds
  • Default: 5.000
  • Minimum: 0.000

Idle timeout for client connections. A connection is considered idle, until we have received the full request headers.

timeout_linger¶
  • Units: seconds
  • Default: 0.050
  • Minimum: 0.000
  • Flags: experimental

How long the worker thread lingers on an idle session before handing it over to the waiter. When sessions are reused, as much as half of all reuses happen within the first 100 msec of the previous request completing. Setting this too high results in worker threads not doing anything for their keep, setting it too low just means that more sessions take a detour around the waiter.

vcc_allow_inline_c¶
  • Units: bool
  • Default: off

Allow inline C code in VCL.

vcc_err_unref¶
  • Units: bool
  • Default: on

Unreferenced VCL objects result in error.

vcc_unsafe_path¶
  • Units: bool
  • Default: on

Allow '/' in vmod & include paths. Allow 'import ... from ...'.

vcl_cooldown¶
  • Units: seconds
  • Default: 600.000
  • Minimum: 0.000

How long a VCL is kept warm after being replaced as the active VCL (granularity approximately 30 seconds).

vcl_dir¶
  • Default: /opt/varnish/etc/varnish

Directory (or colon separated list of directories) from which relative VCL filenames (vcl.load and include) are to be found.

vmod_dir¶
  • Default: /opt/varnish/lib/varnish/vmods

Directory (or colon separated list of directories) where VMODs are to be found.

vsl_buffer¶
  • Units: bytes
  • Default: 4k
  • Minimum: 267

Bytes of (req-/backend-)workspace dedicated to buffering VSL records. Setting this too high costs memory, setting it too low will cause more VSL flushes and likely increase lock-contention on the VSL mutex.

The minimum tracks the vsl_reclen parameter + 12 bytes.

vsl_mask¶
  • Default: -VCL_trace,-WorkThread,-Hash,-VfpAcct

Mask individual VSL messages from being logged.

default
Set default value

Use +/- prefix in front of VSL tag name, to mask/unmask individual VSL messages.

vsl_reclen¶
  • Units: bytes
  • Default: 255b
  • Minimum: 16b
  • Maximum: 4084b

Maximum number of bytes in SHM log record.

The maximum tracks the vsl_buffer parameter - 12 bytes.

vsl_space¶
  • Units: bytes
  • Default: 80M
  • Minimum: 1M
  • Flags: must_restart

The amount of space to allocate for the VSL fifo buffer in the VSM memory segment. If you make this too small, varnish{ncsa|log} etc will not be able to keep up. Making it too large just costs memory resources.

vsm_space¶
  • Units: bytes
  • Default: 1M
  • Minimum: 1M
  • Flags: must_restart

The amount of space to allocate for stats counters in the VSM memory segment. If you make this too small, some counters will be invisible. Making it too large just costs memory resources.

workspace_backend¶
  • Units: bytes
  • Default: 64k
  • Minimum: 1k
  • Flags: delayed

Bytes of HTTP protocol workspace for backend HTTP req/resp. If larger than 4k, use a multiple of 4k for VM efficiency.

workspace_client¶
  • Units: bytes
  • Default: 64k
  • Minimum: 9k
  • Flags: delayed

Bytes of HTTP protocol workspace for clients HTTP req/resp. If larger than 4k, use a multiple of 4k for VM efficiency.

workspace_session¶
  • Units: bytes
  • Default: 0.50k
  • Minimum: 0.25k
  • Flags: delayed

Allocation size for session structure and workspace. The workspace is primarily used for TCP connection addresses. If larger than 4k, use a multiple of 4k for VM efficiency.

workspace_thread¶
  • Units: bytes
  • Default: 2k
  • Minimum: 0.25k
  • Maximum: 8k
  • Flags: delayed

Bytes of auxiliary workspace per thread. This workspace is used for certain temporary data structures during the operation of a worker thread. One use is for the io-vectors for writing requests and responses to sockets, having too little space will result in more writev(2) system calls, having too much just wastes the space.

EXIT CODES¶

Varnish and bundled tools will, in most cases, exit with one of the following codes

  • 0 OK
  • 1 Some error which could be system-dependent and/or transient
  • 2 Serious configuration / parameter error - retrying with the same configuration / parameters is most likely useless

The varnishd master process may also OR its exit code

  • with 0x20 when the varnishd child process died,
  • with 0x40 when the varnishd child process was terminated by a signal and
  • with 0x80 when a core was dumped.

HISTORY¶

The varnishd daemon was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software.

This manual page was written by Dag-Erling Smørgrav with updates by Stig Sandbeck Mathisen <ssm@debian.org>, Nils Goroll and others.

Table Of Contents

Previous topic

varnishadm

Next topic

varnishhist

This Page

varnish-4.1.1/doc/html/reference/varnishtest.html0000644000201500234410000002725512652366773017047 00000000000000 varnishtest — Varnish version 4.1.1 documentation

varnishtest¶

Test program for Varnish¶

Manual section:1

SYNOPSIS¶

varnishtest [-hikLlqvW] [-b size] [-D name=val] [-j jobs] [-n iter] [-t duration] file [file ...]

DESCRIPTION¶

The varnishtest program is a script driven program used to test the Varnish Cache.

The varnishtest program, when started and given one or more script files, can create a number of threads representing backends, some threads representing clients, and a varnishd process. This is then used to simulate a transaction to provoke a specific behavior.

The following options are available:

-b size Set internal buffer size (default: 512K)

-D name=val Define macro for use in scripts

-h Show help
-i Find varnishd in build tree
-j jobs Run this many tests in parallel
-k Continue on test failure
-L Always leave temporary vtc.*
-l Leave temporary vtc.* if test fails
-n iterations Run tests this many times
-q Quiet mode: report only failures
-t duration Time tests out after this long
-v Verbose mode: always report test log
-W Enable the witness facility for locking

file File to use as a script

Macro definitions that can be overridden.

varnishd Path to varnishd to use [varnishd]

If TMPDIR is set in the environment, varnishtest creates temporary vtc.* directories for each test in $TMPDIR, otherwise in /tmp.

SCRIPTS¶

The script language used for Varnishtest is not a strictly defined language. The best reference for writing scripts is the varnishtest program itself. In the Varnish source code repository, under bin/varnishtest/tests/, all the regression tests for Varnish are kept.

An example:

varnishtest "#1029"

server s1 {
        rxreq
        expect req.url == "/bar"
        txresp -gzipbody {[bar]}

        rxreq
        expect req.url == "/foo"
        txresp -body {<h1>FOO<esi:include src="/bar"/>BARF</h1>}

} -start

varnish v1 -vcl+backend {
        sub vcl_backend_response {
                set beresp.do_esi = true;
                if (bereq.url == "/foo") {
                        set beresp.ttl = 0s;
                } else {
                        set beresp.ttl = 10m;
                }
        }
} -start

client c1 {
        txreq -url "/bar" -hdr "Accept-Encoding: gzip"
        rxresp
        gunzip
        expect resp.bodylen == 5

        txreq -url "/foo" -hdr "Accept-Encoding: gzip"
        rxresp
        expect resp.bodylen == 21
} -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 definition to the VCL specified (-vcl+backend). Finally it starts the c1-client, which is a single client sending two requests.

SEE ALSO¶

HISTORY¶

The varnishtest program was developed by Poul-Henning Kamp <phk@phk.freebsd.dk> in cooperation with Varnish Software AS. This manual page was originally written by Stig Sandbeck Mathisen <ssm@linpro.no> and updated by Kristian Lyngstøl <kristian@varnish-cache.org>.

Table Of Contents

Previous topic

varnishstat

Next topic

varnishtop

This Page

varnish-4.1.1/doc/html/reference/vcl.html0000644000201500234410000012172612652366773015257 00000000000000 VCL — Varnish version 4.1.1 documentation

VCL¶

Varnish Configuration Language¶

Manual section:7

DESCRIPTION¶

The VCL language is a small domain-specific language designed to be used to describe request handling and document caching policies for Varnish Cache.

When a new configuration is loaded, the varnishd management process translates the VCL code to C and compiles it to a shared object which is then loaded into the server process.

This document focuses on the syntax of the VCL language. For a full description of syntax and semantics, with ample examples, please see the online documentation at https://www.varnish-cache.org/docs/ .

Starting with Varnish 4.0, each VCL file must start by declaring its version with a special "vcl 4.0;" marker at the top of the file.

Operators¶

The following operators are available in VCL:

=
Assignment operator.
==
Comparison.
~
Match. Can either be used with regular expressions or ACLs.
!
Negation.
&&
Logical and.
||
Logical or.

Conditionals¶

VCL has if and else statements. Nested logic can be implemented with the elseif statement (elsif/elif/else if are equivalent).

Note that there are no loops or iterators of any kind in VCL.

Strings, booleans, time, duration and integers¶

These are the data types in Varnish. You can set or unset these.

Example:

set req.http.User-Agent = "unknown";
unset req.http.Range;
Strings¶

Basic strings are enclosed in double quotes (" ... "), and may not contain newlines. Long strings are enclosed in {" ... "}. They may contain any character including single double quotes ("), newline and other control characters except for the NUL (0x00) character.

Booleans¶

Booleans can be either true or false.

Time¶

VCL has time. The function now returns a time. A duration can be added to a time to make another time. In string context they return a formatted string.

Durations¶

Durations are defined by a number and a designation. The number can be a real so 1.5w is allowed.

ms
milliseconds
s
seconds
m
minutes
h
hours
d
days
w
weeks
y
years

Integers¶

Certain fields are integers, used as expected. In string context they return a string.

Real numbers¶

VCL understands real numbers. As with integers, when used in a string context they will return a string.

Regular Expressions¶

Varnish uses Perl-compatible regular expressions (PCRE). For a complete description please see the pcre(3) man page.

To send flags to the PCRE engine, such as to do case insensitive matching, add the flag within parens following a question mark, like this:

# If host is NOT example dot com..
if (req.http.host !~ "(?i)example.com$") {
    ...
}

Include statement¶

To include a VCL file in another file use the include keyword:

include "foo.vcl";

Import statement¶

The import statement is used to load Varnish Modules (VMODs.)

Example:

import std;
sub vcl_recv {
    std.log("foo");
}

Comments¶

Single lines of VCL can be commented out using // or #. Multi-line blocks can be commented out with /* block /*.

Example:

sub vcl_recv {
    // Single line of out-commented VCL.
    # Another way of commenting out a single line.
    /*
        Multi-line block of commented-out VCL.
    */
}

Backend definition¶

A backend declaration creates and initialises a named backend object. A declaration start with the keyword backend followed by the name of the backend. The actual declaration is in curly brackets, in a key/value fashion.:

backend name {
    .attribute = "value";
}

The only mandatory attribute is host. The attributes will inherit their defaults from the global parameters. The following attributes are available:

host (mandatory)
The host to be used. IP address or a hostname that resolves to a single IP address.
port
The port on the backend that Varnish should connect to.
host_header
A host header to add.
connect_timeout
Timeout for connections.
first_byte_timeout
Timeout for first byte.
between_bytes_timeout
Timeout between bytes.
probe
Attach a probe to the backend. See Probes
max_connections
Maximum number of open connections towards this backend. If Varnish reaches the maximum Varnish it will start failing connections.

Backends can be used with directors. Please see the vmod_directors man page for more information.

Probes¶

Probes will query the backend for status on a regular basis and mark the backend as down it they fail. A probe is defined as this:

probe name {
    .attribute = "value";
}

There are no mandatory options. These are the options you can set:

url
The URL to query. Defaults to "/".
request
Specify a full HTTP request using multiple strings. .request will have \r\n automatically inserted after every string. If specified, .request will take precedence over .url.
expected_response
The expected HTTP response code. Defaults to 200.
timeout
The timeout for the probe. Default is 2s.
interval
How often the probe is run. Default is 5s.
initial
How many of the polls in .window are considered good when Varnish starts. Defaults to the value of threshold - 1. In this case, the backend starts as sick and requires one single poll to be considered healthy.
window
How many of the latest polls we examine to determine backend health. Defaults to 8.
threshold
How many of the polls in .window must have succeeded for us to consider the backend healthy. Defaults to 3.

Access Control List (ACL)¶

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

acl localnetwork {
    "localhost";    # myself
    "192.0.2.0"/24; # and everyone on the local network
    ! "192.0.2.23"; # except for the dial-in router
}

If an ACL entry specifies a host name which Varnish is unable to resolve, it will match any address it is compared to. Consequently, if it is preceded by a negation mark, it will reject any address it is compared to, which may not be what you intended. If the entry is enclosed in parentheses, however, it will simply be ignored.

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

if (client.ip ~ localnetwork) {
    return (pipe);
}

VCL objects¶

A VCL object can be instantiated with the new keyword:

sub vcl_init {
    new b = directors.round_robin()
    b.add_backend(node1);
}

This is only available in vcl_init.

Subroutines¶

A subroutine is used to group code for legibility or reusability:

sub pipe_if_local {
    if (client.ip ~ localnetwork) {
        return (pipe);
    }
}

Subroutines in VCL do not take arguments, nor do they return values. The built in subroutines all have names beginning with vcl_, which is reserved.

To call a subroutine, use the call keyword followed by the subroutine's name:

sub vcl_recv {
    call pipe_if_local;
}
Return statements¶

The ongoing vcl_* subroutine execution ends when a return(action) statement is made.

The action specifies how execution should proceed. The context defines which actions are available.

Multiple subroutines¶

If multiple subroutines with the name of one of the built-in ones are defined, they are concatenated in the order in which they appear in the source.

The built-in VCL distributed with Varnish will be implicitly concatenated when the VCL is compiled.

Variables¶

In VCL you have access to certain variable objects. These contain requests and responses currently being worked on. What variables are available depends on context.

bereq¶

bereq

Type: HTTP

Readable from: backend

The entire backend request HTTP data structure

bereq.backend

Type: BACKEND

Readable from: vcl_pipe, backend

Writable from: vcl_pipe, backend

This is the backend or director we attempt to fetch from.

bereq.between_bytes_timeout

Type: DURATION

Readable from: backend

Writable from: backend

The time in seconds to wait between each received byte from the backend. Not available in pipe mode.

bereq.connect_timeout

Type: DURATION

Readable from: vcl_pipe, backend

Writable from: vcl_pipe, backend

The time in seconds to wait for a backend connection.

bereq.first_byte_timeout

Type: DURATION

Readable from: backend

Writable from: backend

The time in seconds to wait for the first byte from the backend. Not available in pipe mode.

bereq.http.

Type: HEADER

Readable from: vcl_pipe, backend

Writable from: vcl_pipe, backend

The corresponding HTTP header.

bereq.method

Type: STRING

Readable from: vcl_pipe, backend

Writable from: vcl_pipe, backend

The request type (e.g. "GET", "HEAD").

bereq.proto

Type: STRING

Readable from: vcl_pipe, backend

Writable from: vcl_pipe, backend

The HTTP protocol version used to talk to the server.

bereq.retries

Type: INT

Readable from: backend

A count of how many times this request has been retried.

bereq.uncacheable

Type: BOOL

Readable from: backend

Indicates whether this request is uncacheable due to a pass in the client side or a hit on an existing uncacheable object (aka hit-for-pass).

bereq.url

Type: STRING

Readable from: vcl_pipe, backend

Writable from: vcl_pipe, backend

The requested URL.

bereq.xid

Type: STRING

Readable from: backend

Unique ID of this request.

beresp¶

beresp

Type: HTTP

Readable from: vcl_backend_response, vcl_backend_error

The entire backend response HTTP data structure

beresp.age

Type: DURATION

Readable from: vcl_backend_response, vcl_backend_error

The age of the object.

beresp.backend

Type: BACKEND

Readable from: vcl_backend_response, vcl_backend_error

This is the backend we fetched from. If bereq.backend was set to a director, this will be the backend selected by the director.

beresp.backend.ip

Type: IP

Readable from: vcl_backend_response, vcl_backend_error

IP of the backend this response was fetched from.

beresp.backend.name

Type: STRING

Readable from: vcl_backend_response, vcl_backend_error

Name of the backend this response was fetched from.

beresp.do_esi

Type: BOOL

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

Boolean. ESI-process the object after fetching it. Defaults to false. Set it to true to parse the object for ESI directives. Will only be honored if req.esi is true.

beresp.do_gunzip

Type: BOOL

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

Boolean. Unzip the object before storing it in the cache. Defaults to false.

beresp.do_gzip

Type: BOOL

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

Boolean. Gzip the object before storing it. Defaults to false. When http_gzip_support is on Varnish will request already compressed content from the backend and as such compression in Varnish is not needed.

beresp.do_stream

Type: BOOL

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

Deliver the object to the client directly without fetching the whole object into varnish. If this request is pass'ed it will not be stored in memory.

beresp.grace

Type: DURATION

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

Set to a period to enable grace.

beresp.http.

Type: HEADER

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

The corresponding HTTP header.

beresp.keep

Type: DURATION

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

Set to a period to enable conditional backend requests.

The keep time is cache lifetime in addition to the ttl.

Objects with ttl expired but with keep time left may be used to issue conditional (If-Modified-Since / If-None-Match) requests to the backend to refresh them.

beresp.proto

Type: STRING

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

The HTTP protocol version used the backend replied with.

beresp.reason

Type: STRING

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

The HTTP status message returned by the server.

beresp.status

Type: INT

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

The HTTP status code returned by the server.

beresp.storage_hint

Type: STRING

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

Hint to Varnish that you want to save this object to a particular storage backend.

beresp.ttl

Type: DURATION

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

The object's remaining time to live, in seconds.

beresp.uncacheable

Type: BOOL

Readable from: vcl_backend_response, vcl_backend_error

Writable from: vcl_backend_response, vcl_backend_error

Inherited from bereq.uncacheable, see there.

Setting this variable makes the object uncacheable, which may get stored as a hit-for-pass object in the cache.

Clearing the variable has no effect and will log the warning "Ignoring attempt to reset beresp.uncacheable".

beresp.was_304

Type: BOOL

Readable from: vcl_backend_response, vcl_backend_error

Boolean. If this is a successful 304 response to a backend conditional request refreshing an existing cache object.

client¶

client.identity

Type: STRING

Readable from: client

Writable from: client

Identification of the client, used to load balance in the client director.

client.ip

Type: IP

Readable from: client

The client's IP address.

local¶

local.ip

Type: IP

Readable from: client

The IP address of the local end of the TCP connection.

now¶

now

Type: TIME

Readable from: all

The current time, in seconds since the epoch. When used in string context it returns a formatted string.

obj¶

obj.age

Type: DURATION

Readable from: vcl_hit

The age of the object.

obj.grace

Type: DURATION

Readable from: vcl_hit

The object's remaining grace period in seconds.

obj.hits

Type: INT

Readable from: vcl_hit, vcl_deliver

The count of cache-hits on this object. A value of 0 indicates a cache miss.

obj.http.

Type: HEADER

Readable from: vcl_hit

The corresponding HTTP header.

obj.keep

Type: DURATION

Readable from: vcl_hit

The object's remaining keep period in seconds.

obj.proto

Type: STRING

Readable from: vcl_hit

The HTTP protocol version used when the object was retrieved.

obj.reason

Type: STRING

Readable from: vcl_hit

The HTTP status message returned by the server.

obj.status

Type: INT

Readable from: vcl_hit

The HTTP status code returned by the server.

obj.ttl

Type: DURATION

Readable from: vcl_hit

The object's remaining time to live, in seconds.

obj.uncacheable

Type: BOOL

Readable from: vcl_deliver

Whether the object is uncacheable (pass or hit-for-pass).

remote¶

remote.ip

Type: IP

Readable from: client

The IP address of the other end of the TCP connection. This can either be the clients IP, or the outgoing IP of a proxy server.

req¶

req

Type: HTTP

Readable from: client

The entire request HTTP data structure

req.backend_hint

Type: BACKEND

Readable from: client

Writable from: client

Set bereq.backend to this if we attempt to fetch.

req.can_gzip

Type: BOOL

Readable from: client

Does the client accept the gzip transfer encoding.

req.esi

Type: BOOL

Readable from: client

Writable from: client

Boolean. Set to false to disable ESI processing regardless of any value in beresp.do_esi. Defaults to true. This variable is subject to change in future versions, you should avoid using it.

req.esi_level

Type: INT

Readable from: client

A count of how many levels of ESI requests we're currently at.

req.hash_always_miss

Type: BOOL

Readable from: vcl_recv

Writable from: vcl_recv

Force a cache miss for this request. If set to true Varnish will disregard any existing objects and always (re)fetch from the backend.

req.hash_ignore_busy

Type: BOOL

Readable from: vcl_recv

Writable from: vcl_recv

Ignore any busy object during cache lookup. You would want to do this if you have two server looking up content from each other to avoid potential deadlocks.

req.http.

Type: HEADER

Readable from: client

Writable from: client

The corresponding HTTP header.

req.method

Type: STRING

Readable from: client

Writable from: client

The request type (e.g. "GET", "HEAD").

req.proto

Type: STRING

Readable from: client

Writable from: client

The HTTP protocol version used by the client.

req.restarts

Type: INT

Readable from: client

A count of how many times this request has been restarted.

req.ttl

Type: DURATION

Readable from: client

Writable from: client

req.url

Type: STRING

Readable from: client

Writable from: client

The requested URL.

req.xid

Type: STRING

Readable from: client

Unique ID of this request.

req_top¶

req_top.http.

Type: HEADER

Readable from: client

HTTP headers of the top-level request in a tree of ESI requests. Identical to req.http. in non-ESI requests.

req_top.method

Type: STRING

Readable from: client

The request method of the top-level request in a tree of ESI requests. (e.g. "GET", "HEAD"). Identical to req.method in non-ESI requests.

req_top.proto

Type: STRING

Readable from: client

HTTP protocol version of the top-level request in a tree of ESI requests. Identical to req.proto in non-ESI requests.

req_top.url

Type: STRING

Readable from: client

The requested URL of the top-level request in a tree of ESI requests. Identical to req.url in non-ESI requests.

resp¶

resp

Type: HTTP

Readable from: vcl_deliver, vcl_synth

The entire response HTTP data structure.

resp.http.

Type: HEADER

Readable from: vcl_deliver, vcl_synth

Writable from: vcl_deliver, vcl_synth

The corresponding HTTP header.

resp.is_streaming

Type: BOOL

Readable from: vcl_deliver, vcl_synth

Returns true when the response will be streamed from the backend.

resp.proto

Type: STRING

Readable from: vcl_deliver, vcl_synth

Writable from: vcl_deliver, vcl_synth

The HTTP protocol version to use for the response.

resp.reason

Type: STRING

Readable from: vcl_deliver, vcl_synth

Writable from: vcl_deliver, vcl_synth

The HTTP status message that will be returned.

resp.status

Type: INT

Readable from: vcl_deliver, vcl_synth

Writable from: vcl_deliver, vcl_synth

The HTTP status code that will be returned.

Assigning a HTTP standardized code to resp.status will also set resp.reason to the corresponding status message.

server¶

server.hostname

Type: STRING

Readable from: all

The host name of the server.

server.identity

Type: STRING

Readable from: all

The identity of the server, as set by the -i parameter. If the -i parameter is not passed to varnishd, server.identity will be set to the name of the instance, as specified by the -n parameter.

server.ip

Type: IP

Readable from: client

The IP address of the socket on which the client connection was received.

storage¶

storage.<name>.free_space

Type: BYTES

Readable from: client, backend

Free space available in the named stevedore. Only available for the malloc stevedore.

storage.<name>.used_space

Type: BYTES

Readable from: client, backend

Used space in the named stevedore. Only available for the malloc stevedore.

storage.<name>.happy

Type: BOOL

Readable from: client, backend

Health status for the named stevedore. Not available in any of the current stevedores.

Functions¶

The following built-in functions are available:

ban(expression)
Invalidates all objects in cache that match the expression with the ban mechanism.
hash_data(input)
Adds an input to the hash input. In the built-in VCL hash_data() is called on the host and URL of the request. Available in vcl_hash.
rollback()
Restore req HTTP headers to their original state. This function is deprecated. Use std.rollback() instead.
synthetic(STRING)
Prepare a synthetic response body containing the STRING. Available in vcl_synth and vcl_backend_error.
regsub(str, regex, sub)
Returns a copy of str with the first occurrence of the regular expression regex replaced with sub. Within sub, \0 (which can also be spelled \&) is replaced with the entire matched string, and \n is replaced with the contents of subgroup n in the matched string.
regsuball(str, regex, sub)
As regsub() but this replaces all occurrences.

For converting or casting VCL values between data types use the functions available in the std VMOD.

EXAMPLES¶

For examples, please see the online documentation.

HISTORY¶

VCL was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Redpill Linpro and Varnish Software. This manual page is written by Per Buer, Poul-Henning Kamp, Martin Blix Grydeland, Kristian Lyngstøl, Lasse Karstensen and possibly others.

varnish-4.1.1/doc/html/reference/index.html0000644000201500234410000002432412652366773015576 00000000000000 The Varnish Reference Manual — Varnish version 4.1.1 documentation varnish-4.1.1/doc/html/reference/vmod.html0000644000201500234410000006717712652366773015451 00000000000000 VMOD - Varnish Modules — Varnish version 4.1.1 documentation

VMOD - Varnish Modules¶

For all you can do in VCL, there are things you can not do. Look an IP number up in a database file for instance. VCL provides for inline C code, and there you can do everything, but it is not a convenient or even readable way to solve such problems.

This is where VMODs come into the picture: A VMOD is a shared library with some C functions which can be called from VCL code.

For instance:

import std;

sub vcl_deliver {
        set resp.http.foo = std.toupper(req.url);
}

The "std" vmod is one you get with Varnish, it will always be there and we will put "boutique" functions in it, such as the "toupper" function shown above. The full contents of the "std" module is documented in vmod_std(3).

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 can find contributed VMODs etc. This explanation will use the "std" VMOD as example, having a Varnish source tree handy may be a good idea.

VMOD Directory¶

The VMOD directory is an up-to-date compilation of maintained extensions written for Varnish Cache:

The vmod.vcc file¶

The interface between your VMOD and the VCL compiler ("VCC") and the VCL runtime ("VRT") is defined in the vmod.vcc file which a python script called "vmodtool.py" turns into thaumaturgically challenged C data structures that does all the hard work.

The std VMODs vmod.vcc file looks somewhat like this:

$Module std 3
$Event event_function
$Function STRING toupper(STRING_LIST)
$Function STRING tolower(STRING_LIST)
$Function VOID set_ip_tos(INT)

The first line gives the name of the module and the manual section where the documentation will reside.

The second line specifies an optional "Event" function, which will be called whenever a VCL program which imports this VMOD is loaded or transitions to any of the warm, active, cold or discarded states. More on this below.

The next three lines define three functions in the VMOD, along with the types of the arguments, and that is probably where the hardest bit of writing a VMOD is to be found, so we will talk about that at length in a moment.

Notice that the third function returns VOID, that makes it a "procedure" in VCL lingo, meaning that it cannot be used in expressions, right side of assignments and such. Instead it can be used as a primary action, something functions which return a value can not:

sub vcl_recv {
        std.set_ip_tos(32);
}

Running vmodtool.py on the vmod.vcc file, produces a "vcc_if.c" and "vcc_if.h" files, which you must use to build your shared library file.

Forget about vcc_if.c everywhere but your Makefile, you will never need to care about its contents, and you should certainly never modify it, that voids your warranty instantly.

But vcc_if.h is important for you, it contains the prototypes for the functions you want to export to VCL.

For the std VMOD, the compiled vcc_if.h file looks like this:

struct vmod_priv;

VCL_STRING vmod_toupper(VRT_CTX, const char *, ...);
VCL_STRING vmod_tolower(VRT_CTX, const char *, ...);
VCL_VOID vmod_set_ip_tos(VRT_CTX, VCL_INT);

vmod_event_f event_function;

Those are your C prototypes. Notice the vmod_ prefix on the function names.

VCL and C data types¶

VCL data types are targeted at the job, so for instance, we have data types like "DURATION" and "HEADER", but they all have some kind of C language representation. Here is a description of them.

All but the PRIV and STRING_LIST types have typedefs: VCL_INT, VCL_REAL, etc.

BACKEND

C-type: const struct director *

A type for backend and director implementations. See Writing a Director.

BLOB

C-type: const struct vmod_priv *

An opaque type to pass random bits of memory between VMOD functions.

BOOL

C-type: unsigned

Zero means false, anything else means true.

BYTES

C-type: double

Unit: bytes.

A storage space, as in 1024 bytes.

DURATION

C-type: double

Unit: seconds.

A time interval, as in 25 seconds.

ENUM

C-type: const char *

TODO

HEADER

C-type: const struct gethdr_s *

These are VCL compiler generated constants referencing a particular header in a particular HTTP entity, for instance req.http.cookie or beresp.http.last-modified. By passing a reference to the header, the VMOD code can both read and write the header in question.

If the header was passed as STRING, the VMOD code only sees the value, but not where it came from.

HTTP

C-type: struct http *

TODO

INT

C-type: long

A (long) integer as we know and love them.

IP

C-type: const struct suckaddr *

This is an opaque type, see the include/vsa.h file for which primitives we support on this type.

PRIV_CALL
See Private Pointers below.
PRIV_TASK
See Private Pointers below.
PRIV_TOP
See Private Pointers below.
PRIV_VCL
See Private Pointers below.
PROBE

C-type: const struct vrt_backend_probe *

A named standalone backend probe definition.

REAL

C-type: double

A floating point value.

STRING

C-type: const char *

A NUL-terminated text-string.

Can be NULL to indicate a nonexistent string, for instance in:

mymod.foo(req.http.foobar);

If there were no "foobar" HTTP header, the vmod_foo() function would be passed a NULL pointer as argument.

When used as a return value, the producing function is responsible for arranging memory management. Either by freeing the string later by whatever means available or by using storage allocated from the client or backend workspaces.

STRING_LIST

C-type: const char *, ...

A multi-component text-string. We try very hard to avoid doing text-processing in Varnish, and this is one way we to avoid that, by not editing separate pieces of a string together to one string, unless we have to.

Consider this contrived example:

set req.http.foo = std.toupper(req.http.foo + req.http.bar);

The usual way to do this, would be be to allocate memory for the concatenated string, then pass that to toupper() which in turn would return another freshly allocated string with the modified result. Remember: strings in VCL are const, we cannot just modify the string in place.

What we do instead, is declare that toupper() takes a "STRING_LIST" as argument. This makes the C function implementing toupper() a vararg function (see the prototype above) and responsible for considering all the const char * arguments it finds, until the magic marker "vrt_magic_string_end" is encountered.

Bear in mind that the individual strings in a STRING_LIST can be NULL, as described under STRING, that is why we do not use NULL as the terminator.

Right now we only support STRING_LIST being the last argument to a function, we may relax that at a latter time.

If you don't want to bother with STRING_LIST, just use STRING and make sure your workspace_client and workspace_backend params are big enough.

TIME

C-type: double

Unit: seconds since UNIX epoch.

An absolute time, as in 1284401161.

VOID

C-type: void

Can only be used for return-value, which makes the function a VCL procedure.

Private Pointers¶

It is often useful for library functions to maintain local state, this can be anything from a precompiled regexp to open file descriptors and vast data structures.

The VCL compiler supports the following private pointers:

  • PRIV_CALL "per call" private pointers are useful to cache/store state relative to the specific call or its arguments, for instance a compiled regular expression specific to a regsub() statement or a simply caching the last output of some expensive lookup.
  • PRIV_TASK "per task" private pointers are useful for state that applies to calls for either a specific request or a backend request. For instance this can be the result of a parsed cookie specific to a client. Note that PRIV_TASK contexts are separate for the client side and the backend side, so use in vcl_backend_* will yield a different private pointer from the one used on the client side.
  • PRIV_TOP "per top-request" private pointers live for the duration of one request and all its ESI-includes. They are only defined for the client side. When used from backend VCL subs, a NULL pointer will be passed.
  • PRIV_VCL "per vcl" private pointers are useful for such global state that applies to all calls in this VCL, for instance flags that determine if regular expressions are case-sensitive in this vmod or similar. The PRIV_VCL object is the same object that is passed to the VMOD's event function.

The way it works in the vmod code, is that a struct vmod_priv * is passed to the functions where one of the PRIV_* argument types is specified.

This structure contains three members:

typedef void vmod_priv_free_f(void *);
struct vmod_priv {
        void                    *priv;
        int                     len;
        vmod_priv_free_f        *free;
};

The "priv" element can be used for whatever the vmod code wants to use it for, it defaults to a NULL pointer.

The "len" element is used primarily for BLOBs to indicate its size.

The "free" element defaults to NULL, and it is the modules responsibility to set it to a suitable function, which can clean up whatever the "priv" pointer points to.

When a VCL program is discarded, all private pointers are checked to see if both the "priv" and "free" elements are non-NULL, and if they are, the "free" function will be called with the "priv" pointer as the only argument.

In the common case where a private data structure is allocated with malloc would look like this:

if (priv->priv == NULL) {
        priv->priv = calloc(sizeof(struct myfoo), 1);
        AN(priv->priv);
        priv->free = free;      /* free(3) */
        mystate = priv->priv;
        mystate->foo = 21;
        ...
} else {
        mystate = priv->priv;
}
if (foo > 25) {
        ...
}

The per-call vmod_privs are freed before the per-vcl vmod_priv.

Event functions¶

VMODs can have an "event" function which is called when a VCL which imports the VMOD is loaded, made active, or discarded. This corresponds to the VCL_EVENT_LOAD, and VCL_EVENT_DISCARD events, respectively. In addition, this function will be called when the VCL temperature is changed to cold or warm, corresponding to the VCL_EVENT_COLD and VCL_EVENT_WARM events.

The first argument to the event function is a VRT context.

The second argument is the vmod_priv specific to this particular VCL, and if necessary, a VCL specific VMOD "fini" function can be attached to its "free" hook.

The third argument is the event.

If the VMOD has private global state, which includes any sockets or files opened, any memory allocated to global or private variables in the C-code etc, it is the VMODs own responsibility to track how many VCLs were loaded or discarded and free this global state when the count reaches zero.

VMOD writers are strongly encouraged to release all per-VCL resources for a given VCL when it emits a VCL_EVENT_COLD event. You will get a chance to reacquire the resources before the VCL becomes active again and be notified first with a VCL_EVENT_WARM event. Unless a user decides that a given VCL should always be warm, an inactive VMOD will eventually become cold and should manage resources accordingly.

An event function must return zero upon success. It is only possible to fail an initialization with the VCL_EVENT_LOAD or VCL_EVENT_WARM events. Should such a failure happen, a VCL_EVENT_DISCARD or VCL_EVENT_COLD event will be sent to the VMODs that succeeded to put them back in a cold state. The VMOD that failed will not receive this event, and therefore must not be left half-initialized should a failure occur.

If your VMOD is running an asynchronous background job you can hold a reference to the VCL to prevent it from going cold too soon and get the same guarantees as backends with ongoing requests for instance. For that, you must acquire the reference by calling VRT_ref_vcl when you receive a VCL_EVENT_WARM and later calling VRT_rel_vcl once the background job is over. Receiving a VCL_EVENT_COLD is your cue to terminate any background job bound to a VCL.

You can find an example of VCL references in vmod-debug:

priv_vcl->vclref = VRT_ref_vcl(ctx, "vmod-debug");
...
VRT_rel_vcl(&ctx, &priv_vcl->vclref);

In this simplified version, you can see that you need at least a VCL-bound data structure like a PRIV_VCL or a VMOD object to keep track of the reference and later release it. You also have to provide a description, it will be printed to the user if they try to warm up a cooling VCL:

$ varnishadm vcl.list
available  auto/cooling       0 vcl1
active     auto/warm          0 vcl2

$ varnishadm vcl.state vcl1 warm
Command failed with error code 300
Failed <vcl.state vcl1 auto>
Message:
        VCL vcl1 is waiting for:
        - vmod-debug

In the case where properly releasing resources may take some time, you can opt for an asynchronous worker, either by spawning a thread and tracking it, or by using Varnish's worker pools.

There is also a VCL_EVENT_USE event. Please note that this event is now deprecated and may be removed in a future release. A warm VCL should be ready to use so no additional task should be postponed at use time.

When to lock, and when not to lock¶

Varnish is heavily multithreaded, so by default VMODs must implement their own locking to protect shared resources.

When a VCL is loaded or unloaded, the event and priv->free are run sequentially all in a single thread, and there is guaranteed to be no other activity related to this particular VCL, nor are there init/fini activity in any other VCL or VMOD at this time.

That means that the VMOD init, and any object init/fini functions are already serialized in sensible order, and won't need any locking, unless they access VMOD specific global state, shared with other VCLs.

Traffic in other VCLs which also import this VMOD, will be happening while housekeeping is going on.

Updating VMODs¶

A compiled VMOD is a shared library file which Varnish dlopen(3)'s using flags RTLD_NOW | RTLD_LOCAL.

As a general rule, once a file is opened with dlopen(3) you should never modify it, but it is safe to rename it and put a new file under the name it had, which is how most tools installs and updates shared libraries.

However, when you call dlopen(3) with the same filename multiple times it will give you the same single copy of the shared library file, without checking if it was updated in the meantime.

This is obviously an oversight in the design of the dlopen(3) library function, but back in the late 1980s nobody could imagine why a program would ever want to have multiple different versions of the same shared library mapped at the same time.

Varnish does that, and therefore you must restart the worker process before Varnish will discover an updated VMOD.

If you want to test a new version of a VMOD, while being able to instantly switch back to the old version, you will have to install each version with a distinct filename or in a distinct subdirectory and use import foo from "..."; to reference it in your VCL.

We're not happy about this, but have found no sensible workarounds.

varnish-4.1.1/doc/html/reference/vsl-query.html0000644000201500234410000004251712652366773016442 00000000000000 vsl-query — Varnish version 4.1.1 documentation

vsl-query¶

Varnish VSL Query Expressions¶

Manual section:7

OVERVIEW¶

The Varnish VSL Query Expressions extracts transactions from the Varnish shared memory log, and perform queries on the transactions before reporting matches.

A transaction is a set of log lines that belongs together, e.g. a client request or a backend request. The API monitors the log, and collects all log records that make up a transaction before reporting on that transaction. Transactions can also be grouped, meaning backend transactions are reported together with the client transaction that initiated it.

A query is run on a group of transactions. A query expression is true if there is a log record within the group that satisfies the condition. It is false only if none of the log records satisfies the condition. Query expressions can be combined using boolean functions.

GROUPING¶

When grouping transactions, there is a hierarchy structure showing which transaction initiated what. The level increases by one on 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. Request restart transactions don't get their level increased to make it predictable.

Levels start counting at 1, except when using raw where it will always be 0.

The grouping modes are:

  • Session

    All transactions initiated by a client connection are reported together. Client connections are open ended when using HTTP keep-alives, so it is undefined when the session will be reported. If the transaction timeout period is exceeded an incomplete session will be reported. Non-transactional data (VXID == 0) is not reported.

  • Request

    Transactions are grouped by request, where the set will include the request itself as well as any backend requests or ESI-subrequests. Session data and non-transactional data (VXID == 0) is not reported.

  • VXID

    Transactions are not grouped, so each VXID is reported in it's entirety. Sessions, requests, ESI-requests and backend requests are all reported individually. Non-transactional data is not reported (VXID == 0). This is the default.

  • Raw

    Every log record will make up a transaction of it's own. All data, including non-transactional data will be reported.

Transaction Hierarchy¶

Example transaction hierarchy using request grouping mode

Lvl 1: Client request (cache miss)
  Lvl 2: Backend request
  Lvl 2: ESI subrequest (cache miss)
    Lvl 3: Backend request
    Lvl 3: Backend request (VCL restart)
    Lvl 3: ESI subrequest (cache miss)
      Lvl 4: Backend request
  Lvl 2: ESI subrequest (cache hit)

MEMORY USAGE¶

The API will use pointers to shared memory log data as long as possible to keep memory usage at a minimum. But as the shared memory log is a ring buffer, data will get overwritten eventually, so the API creates local copies of referenced log data when varnishd comes close to overwriting still unreported content.

This process avoids loss of log data in many scenarios, but it is not failsafe: Overruns where varnishd "overtakes" the log reader process in the ring buffer can still happen when API clients cannot keep up reading and/or copying, for instance due to output blocking.

Though being unrelated to grouping in principle, copying of log data is particularly relevant for session grouping together with long lasting client connections - for this grouping, the logging API client process is likely to consume relevant amounts of memory. As the vxid grouping also logs (potentially long lasting) sessions, it is also likely to require memory for copies of log entries, but far less than session grouping.

QUERY LANGUAGE¶

A query expression consists of record selection criteria, and optionally an operator and a value to match against the selected records.

<record selection criteria> <operator> <operand>

Record selection criteria¶

The record selection criteria determines what kind records from the transaction group the expression applies to. Syntax:

{level}taglist:record-prefix[field]

Taglist is mandatory, the other components are optional.

The level limits the expression to a transaction at that level. If left unspecified, the expression is applied to transactions at all levels. Level is a positive integer or zero. If level is followed by a '+' character, it expresses greater than or equal. If level is followed by a '-', it expresses less than or equal.

The taglist is a comma-separated list of VSL record tags that this expression should be checked against. Each list element can be a tag name or a tag glob. Globs allow a '*' either in the beginning of the name or at the end, and will select all tags that match either the prefix or subscript. A single '*' will select all tags.

The record prefix will further limit the matches to those records that has this prefix as it's first part of the record content followed by a colon. The part of the log record matched against will then be limited to what follows the prefix and colon. This is useful when matching against specific HTTP headers. The record prefix matching is done case insensitive.

The field will, if present, treat the log record as a white space separated list of fields, and only the nth part of the record will be matched against. Fields start counting at 1.

An expression using only a record selection criteria will be true if there is any record in the transaction group that is selected by the criteria.

Operators¶

The following matching operators are available:

  • == != < <= > >=

    Numerical comparison. The record contents will be converted to either an integer or a float before comparison, depending on the type of the operand.

  • eq ne

    String comparison. 'eq' tests string equality, 'ne' tests for not equality.

  • ~ !~

    Regular expression matching. '~' is a positive match, '!~' is a non-match.

Operand¶

The operand is the value the selected records will be matched against.

An operand can be quoted or unquoted. Quotes can be either single or double quotes, and for quoted operands a backslash can be used to escape the quotes.

Unquoted operands can only consist of the following characters:

a-z A-Z 0-9 + - _ . *

The following types of operands are available:

  • Integer

    A number without any fractional part, valid for the numerical comparison operators. The integer type is used when the operand does not contain any period (.) characters.

  • Float

    A number with a fractional part, valid for the numerical comparison operators. The float type is used when the operand does contain a period (.) character.

  • String

    A sequence of characters, valid for the string equality operators.

  • Regular expression

    A PCRE regular expression. Valid for the regular expression operators.

Boolean functions¶

Query expressions can be linked together using boolean functions. The following are available, in decreasing precedence:

  • not <expr>

    Inverts the result of <expr>

  • <expr1> and <expr2>

    True only if both expr1 and expr2 are true

  • <expr1> or <expr2>

    True if either of expr1 or expr2 is true

Expressions can be grouped using parenthesis.

QUERY EXPRESSION EXAMPLES¶

  • Transaction group contains a request URL that equals to "/foo"

    ReqURL eq "/foo"
  • Transaction group contains a request cookie header

    ReqHeader:cookie
  • Transaction group doesn't contain a request cookie header

    not ReqHeader:cookie
  • Client request where internal handling took more than 800ms.:

    Timestamp:Process[2] > 0.8
  • Transaction group contains a request user-agent header that contains "iPod" and the request delivery time exceeds 1 second

    ReqHeader:user-agent ~ "iPod" and Timestamp:Resp[2] > 1.
  • Transaction group contains a backend response status larger than or equal to 500

    BerespStatus >= 500
    
  • Transaction group contains a request response status of 304, but where the request did not contain an if-modified-since header

    ReqStatus == 304 and not ReqHeader:if-modified-since
  • Transactions that have had backend failures or long delivery time on their ESI subrequests. (Assumes request grouping mode).

    BerespStatus >= 500 or {2+}Timestamp:Process[2] > 1.

HISTORY¶

This document was written by Martin Blix Grydeland.

varnish-4.1.1/doc/html/reference/states.html0000644000201500234410000001420012652366773015762 00000000000000 Varnish Processing States — Varnish version 4.1.1 documentation

Varnish Processing States¶

Introduction¶

Varnish processing of client and backend requests is implemented as state machines. Whenever a state is entered, a C function is called, which in turn calls the appropriate Varnish core code functions to process the request or response at this stage. For most states, core code also calls into a state-specific function compiled from VCL, a VCL subroutine (see Built in subroutines ).

As a general guideline, core code aims to prepare objects accessible from VCL with good defaults for the most common cases before calling into the respective VCL subroutine. These can then be modified from VCL where necessary.

The following graphs attempt to provide an overview over the processing states, their transitions and the most relevant functions in core code. They represent a compromise between usefulness for core/VMOD developers and administrators and are intended to serve as the reference basis for derivative work, such as more VCL-centric views.

Client Side¶

Backend Side¶

Table Of Contents

Previous topic

VCL

Next topic

varnish-cli

This Page

varnish-4.1.1/doc/html/reference/varnishadm.html0000644000201500234410000002261212652366773016621 00000000000000 varnishadm — Varnish version 4.1.1 documentation

varnishadm¶

Control a running Varnish instance¶

Manual section:1

SYNOPSIS¶

varnishadm [-n ident] [-t timeout] [-S secretfile] [-T [address]:port] [command [...]]

DESCRIPTION¶

The varnishadm utility establishes a CLI connection to varnishd either using -n name or using the -T and -S arguments. If -n name is given the location of the secret file and the address:port is looked up in shared memory. If neither is given varnishadm will look for an instance without a given name.

If a command is given, the command and arguments are sent over the CLI connection and the result returned on stdout.

If no command argument is given varnishadm will pass commands and replies between the CLI socket and stdin/stdout.

OPTIONS¶

-n ident Connect to the instance of varnishd with this name.
-S secretfile Specify the authentication secret file. This should be the same -S argument as was given to varnishd. Only processes which can read the contents of this file, will be able to authenticate the CLI connection.
-t timeout Wait no longer than this many seconds for an operation to finish.
-T <address:port>
 Connect to the management interface at the specified address and port.

The syntax and operation of the actual CLI interface is described in the varnish-cli manual page. Parameters are described in varnishd manual page.

Additionally, a summary of commands can be obtained by issuing the help command, and a summary of parameters can be obtained by issuing the param.show command.

EXIT STATUS¶

If a command is given, the exit status of the varnishadm utility is zero if the command succeeded, and non-zero otherwise.

EXAMPLES¶

Some ways you can use varnishadm:

varnishadm -T localhost:999 -S /var/db/secret vcl.use foo
echo vcl.use foo | varnishadm -T localhost:999 -S /var/db/secret
echo vcl.use foo | ssh vhost varnishadm -T localhost:999 -S /var/db/secret

AUTHORS¶

The varnishadm utility and this manual page were written by Cecilie Fritzvold. This man page has later been modified by Per Buer, Federico G. Schwindt and Lasse Karstensen.

Table Of Contents

Previous topic

varnish-cli

Next topic

varnishd

This Page

varnish-4.1.1/doc/html/reference/varnishncsa.html0000644000201500234410000003355312652366773017012 00000000000000 varnishncsa — Varnish version 4.1.1 documentation

varnishncsa¶

Display Varnish logs in Apache / NCSA combined log format¶

Manual section:1

SYNOPSIS¶

varnishncsa [-a] [-C] [-d] [-D] [-F format] [-f formatfile] [-g <request|vxid>] [-h] [-n name] [-N filename] [-P file] [-q query] [-r filename] [-t <seconds|off>] [-V] [-w filename]

DESCRIPTION¶

The varnishncsa utility reads varnishd(1) shared memory logs and presents them in the Apache / NCSA "combined" log format.

Each log line produced is based on a single Request type transaction gathered from the shared memory log. The Request transaction is then scanned for the relevant parts in order to output one log line. To filter the log lines produced, use the query language to select the applicable transactions. Non-request transactions are ignored.

The following options are available:

-a When writing output to a file, append to it rather than overwrite it.
-C Do all regular expression and string matching caseless.
-d Start processing log records at the head of the log instead of the tail.
-D Daemonize.
-F format Set the output log format string.
-f formatfile Read output format from a file. Will read a single line from the specified file, and use that line as the format.
-g <request|vxid>
 The grouping of the log records. The default is to group by vxid.
-h Print program usage and exit
-n name Specify the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.
-N filename Specify the filename of a stale VSM instance. When using this option the abandonment checking is disabled.
-P file Write the process' PID to the specified file.
-q query Specifies the VSL query to use.
-r filename Read log in binary file format from this file. The file can be created with varnishlog -w filename.
-t <seconds|off>
 Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this many seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. Defaults to 5 seconds.
-V Print version information and exit.
-w filename Redirect output to file. The file will be overwritten unless the -a option was specified. If the application receives a SIGHUP in daemon mode the file will be reopened allowing the old one to be rotated away. This option is required when running in daemon mode.

FORMAT¶

Specify the log format used. If no format is specified the default log format is used.

The default log format is:

%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i"

Escape sequences \n and \t are supported.

Supported formatters are:

%b
Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent.
%D
Time taken to serve the request, in microseconds.
%H
The request protocol. Defaults to HTTP/1.0 if not known.
%h
Remote host. Defaults to '-' if not known.
%I
Total bytes received from client.
%{X}i
The contents of request header X.
%l
Remote logname (always '-')
%m
Request method. Defaults to '-' if not known.
%{X}o
The contents of response header X.
%O
Total bytes sent to client.
%q
The query string, if no query string exists, an empty string.
%r
The first line of the request. Synthesized from other fields, so it may not be the request verbatim.
%s
Status sent to the client
%t
Time when the request was received, in HTTP date/time format.
%{X}t
Time when the request was received, in the format specified by X. The time specification format is the same as for strftime(3).
%T
Time taken to serve the request, in seconds.
%U
The request URL without any query string. Defaults to '-' if not known.
%u
Remote user from auth
%{X}x

Extended variables. Supported variables are:

Varnish:time_firstbyte
Time from when the request processing starts until the first byte is sent to the client.
Varnish:hitmiss
Whether the request was a cache hit or miss. Pipe and pass are considered misses.
Varnish:handling
How the request was handled, whether it was a cache hit, miss, pass, pipe or synth.
VCL_Log:key
Output value set by std.log("key:value") in VCL.

SIGNALS¶

SIGHUP
Rotate the log file (see -w option)
SIGUSR1
Flush any outstanding transactions

HISTORY¶

The varnishncsa utility was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS. This manual page was initially written by Dag-Erling Smørgrav <des@des.no>, and later updated by Martin Blix Grydeland.

Table Of Contents

Previous topic

varnishlog

Next topic

varnishstat

This Page

varnish-4.1.1/doc/html/reference/vsm.html0000644000201500234410000002174512652366773015300 00000000000000 VSM: Shared Memory Logging and Statistics — Varnish version 4.1.1 documentation

VSM: Shared Memory Logging and Statistics¶

Varnish uses shared memory to export parameters, logging and statistics, because it is faster and much more efficient than regular files.

"Varnish Shared Memory" or VSM, is the overall mechanism, which manages a number of allocated "chunks" inside the same shared memory file.

Each Chunk is just a slap of memory, which has a three-part name (class, type, ident) and a length.

The Class indicates what type of data is stored in the chunk, for instance "Arg" for command line arguments useful for establishing an CLI connection to the varnishd, "Stat" for statistics counters (VSC) and "Log" for log records (VSL).

The type and ident name parts are mostly used with stats counters, where they identify dynamic counters, such as:

SMA.Transient.c_bytes

The size of the VSM is a parameter, but changes only take effect when the child process is restarted.

Shared memory trickery¶

Shared memory is faster than regular files, but it is also slightly tricky in ways a regular logfile is not.

When you open a file in "append" mode, the operating system guarantees that whatever you write will not overwrite existing data in the file. The neat result of this is that multiple processes or threads writing to the same file does not even need to know about each other, it all works just as you would expect.

With a shared memory log, we get no such help from the kernel, the writers need to make sure they do not stomp on each other, and they need to make it possible and safe for the readers to access the data.

The "CS101" way to deal with that, is to introduce locks, and much time is spent examining the relative merits of the many kinds of locks available.

Inside the varnishd (worker) process, we use mutexes to guarantee consistency, both with respect to allocations, log entries and stats counters.

We do not want a varnishncsa trying to push data through a stalled ssh connection to stall the delivery of content, so readers like that are purely read-only, they do not get to affect the varnishd process and that means no locks for them.

Instead we use "stable storage" concepts, to make sure the view seen by the readers is consistent at all times.

As long as you only add stuff, that is trivial, but taking away stuff, such as when a backend is taken out of the configuration, we need to give the readers a chance to discover this, a "cooling off" period.

The Varnish way:¶

If varnishd starts, and finds a locked shared memory file, it will exit with a message about using different -n arguments if you want multiple instances of varnishd.

Otherwise, it will create a new shared memory file each time it starts a child process, since that marks a clean break in operation anyway.

To the extent possible, old shared memory files are marked as abandoned by setting the alloc_seq field to zero, which should be monitored by all readers of the VSM.

Processes subscribing to VSM files for a long time, should notice if the VSM file goes "silent" and check that the file has not been renamed due to a child restart.

Chunks inside the shared memory file form a linked list, and whenever that list changes, the alloc_seq field changes.

The linked list and other metadata in the VSM file, works with offsets relative to the start address of where the VSM file is memory mapped, so it need not be mapped at any particular address.

When new chunks are allocated, for instance when a new backend is added, they are appended to the list, no matter where they are located in the VSM file.

When a chunk is freed, it will be taken out of the linked list of allocations, its length will be set to zero and alloc_seq will be changed to indicate a change of layout. For the next 60 seconds the chunk will not be touched or reused, giving other subscribers a chance to discover the deallocation.

The include file <vapi/vsm.h> provides the supported API for accessing VSM files.

Table Of Contents

Previous topic

varnishtop

Next topic

VMOD - Varnish Modules

This Page

varnish-4.1.1/doc/html/reference/vsl.html0000644000201500234410000006323512652366773015277 00000000000000 VSL — Varnish version 4.1.1 documentation

VSL¶

Varnish Shared Memory Logging¶

Manual section:7

OVERVIEW¶

This document describes the format and content of all the Varnish shared memory logging tags. These tags are used by the varnishlog(1), varnishtop(1), etc. logging tools supplied with Varnish.

VSL tags¶

Backend - Backend selected

Logged when a connection is selected for handling a backend request.

The format is:

%d %s %s
|  |  |
|  |  +- Backend display name
|  +---- VCL name
+------- Connection file descriptor
BackendClose - Backend connection closed

Logged when a backend connection is closed.

The format is:

%d %s [ %s ]
|  |    |
|  |    +- Optional reason
|  +------ Backend display name
+--------- Connection file descriptor
BackendOpen - Backend connection opened

Logged when a new backend connection is opened.

The format is:

%d %s %s %s %s %s
|  |  |  |  |  |
|  |  |  |  |  +- Local port
|  |  |  |  +---- Local address
|  |  |  +------- Remote port
|  |  +---------- Remote address
|  +------------- Backend display name
+---------------- Connection file descriptor
BackendReuse - Backend connection put up for reuse

Logged when a backend connection is put up for reuse by a later connection.

The format is:

%d %s
|  |
|  +- Backend display name
+---- Connection file descriptor
Backend_health - Backend health check

The result of a backend health probe.

The format is:

%s %s %s %u %u %u %f %f %s
|  |  |  |  |  |  |  |  |
|  |  |  |  |  |  |  |  +- Probe HTTP response
|  |  |  |  |  |  |  +---- Average response time
|  |  |  |  |  |  +------- Response time
|  |  |  |  |  +---------- Probe window size
|  |  |  |  +------------- Probe threshold level
|  |  |  +---------------- Number of good probes in window
|  |  +------------------- Probe window bits
|  +---------------------- Status message
+------------------------- Backend name
Begin - Marks the start of a VXID

The first record of a VXID transaction.

The format is:

%s %d %s
|  |  |
|  |  +- Reason
|  +---- Parent vxid
+------- Type ("sess", "req" or "bereq")
BereqAcct - Backend request accounting

Contains byte counters from backend request processing.

The format is:

%d %d %d %d %d %d
|  |  |  |  |  |
|  |  |  |  |  +- Total bytes received
|  |  |  |  +---- Body bytes received
|  |  |  +------- Header bytes received
|  |  +---------- Total bytes transmitted
|  +------------- Body bytes transmitted
+---------------- Header bytes transmitted
BereqHeader - Backend request header

HTTP header contents.

The format is:

%s: %s
|   |
|   +- Header value
+----- Header name
BereqMethod - Backend request method
The HTTP request method used.
BereqProtocol - Backend request protocol
The HTTP protocol version information.
BereqURL - Backend request URL
The HTTP request URL.
BerespHeader - Backend response header

HTTP header contents.

The format is:

%s: %s
|   |
|   +- Header value
+----- Header name
BerespProtocol - Backend response protocol
The HTTP protocol version information.
BerespReason - Backend response response
The HTTP response string received.
BerespStatus - Backend response status
The HTTP status code received.
BogoHeader - Bogus HTTP received
Contains the first 20 characters of received HTTP headers we could not make sense of. Applies to both req.http and beresp.http.
CLI - CLI communication
CLI communication between varnishd master and child process.
Debug - Debug messages
Debug messages can normally be ignored, but are sometimes helpful during trouble-shooting. Most debug messages must be explicitly enabled with parameters.
ESI_xmlerror - ESI parser error or warning message
An error or warning was generated during parsing of an ESI object. The log record describes the problem encountered.
End - Marks the end of a VXID
The last record of a VXID transaction.
Error - Error messages
Error messages are stuff you probably want to know.
ExpBan - Object evicted due to ban
Logs the VXID when an object is banned.
ExpKill - Object expiry event

Logs events related to object expiry. The events are:

EXP_Rearm
Logged when the expiry time of an object changes.
EXP_Inbox
Logged when the expiry thread picks an object from the inbox for processing.
EXP_Kill
Logged when the expiry thread kills an object from the inbox.
EXP_When
Logged when the expiry thread moves an object on the binheap.
EXP_Expired
Logged when the expiry thread expires an object.
LRU_Cand
Logged when an object is evaluated for LRU force expiry.
LRU
Logged when an object is force expired due to LRU.
LRU_Fail
Logged when no suitable candidate object is found for LRU force expiry.

The format is:

EXP_Rearm p=%p E=%f e=%f f=0x%x
EXP_Inbox p=%p e=%f f=0x%x
EXP_Kill p=%p e=%f f=0x%x
EXP_When p=%p e=%f f=0x%x
EXP_Expired x=%u t=%f
LRU_Cand p=%p f=0x%x r=%d
LRU x=%u
LRU_Fail

Legend:
p=%p         Objcore pointer
t=%f         Remaining TTL (s)
e=%f         Expiry time (unix epoch)
E=%f         Old expiry time (unix epoch)
f=0x%x       Objcore flags
r=%d         Objcore refcount
x=%u         Object VXID
FetchError - Error while fetching object
Logs the error message of a failed fetch operation.
Fetch_Body - Body fetched from backend

Ready to fetch body from backend.

The format is:

%d (%s) %s
|   |    |
|   |    +---- 'stream' or '-'
|   +--------- Text description of body fetch mode
+------------- Body fetch mode
Gzip - G(un)zip performed on object

A Gzip record is emitted for each instance of gzip or gunzip work performed. Worst case, an ESI transaction stored in gzip'ed objects but delivered gunziped, will run into many of these.

The format is:

%c %c %c %d %d %d %d %d
|  |  |  |  |  |  |  |
|  |  |  |  |  |  |  +- Bit length of compressed data
|  |  |  |  |  |  +---- Bit location of 'last' bit
|  |  |  |  |  +------- Bit location of first deflate block
|  |  |  |  +---------- Bytes output
|  |  |  +------------- Bytes input
|  |  +---------------- 'E': ESI, '-': Plain object
|  +------------------- 'F': Fetch, 'D': Deliver
+---------------------- 'G': Gzip, 'U': Gunzip, 'u': Gunzip-test

Examples:

U F E 182 159 80 80 1392
G F E 159 173 80 1304 1314
Hash - Value added to hash

This value was added to the object lookup hash.

NB: This log record is masked by default.

Hit - Hit object in cache
Object looked up in cache. Shows the VXID of the object.
HitPass - Hit for pass object in cache.
Hit-for-pass object looked up in cache. Shows the VXID of the hit-for-pass object.
HttpGarbage - Unparseable HTTP request
Logs the content of unparseable HTTP requests.
Length - Size of object body
Logs the size of a fetch object body.
Link - Links to a child VXID

Links this VXID to any child VXID it initiates.

The format is:

%s %d %s
|  |  |
|  |  +- Reason
|  +---- Child vxid
+------- Child type ("req" or "bereq")
LostHeader - Failed attempt to set HTTP header
Logs the header name of a failed HTTP header operation due to resource exhaustion or configured limits.
ObjHeader - Object header

HTTP header contents.

The format is:

%s: %s
|   |
|   +- Header value
+----- Header name
ObjProtocol - Object protocol
The HTTP protocol version information.
ObjReason - Object response
The HTTP response string received.
ObjStatus - Object status
The HTTP status code received.
PipeAcct - Pipe byte counts

Contains byte counters for pipe sessions.

The format is:

%d %d %d %d
|  |  |  |
|  |  |  +------- Piped bytes to client
|  |  +---------- Piped bytes from client
|  +------------- Backend request headers
+---------------- Client request headers
Proxy - PROXY protocol information

PROXY protocol information.

The format is:

%d %s %d %s %d [key value]...
|  |  |  |  |  |
|  |  |  |  |  +- optional information
|  |  |  |  +- server port
|  |  |  +- server ip
|  |  +- client port
|  +- client ip
+---- PROXY protocol version
ProxyGarbage - Unparseable PROXY request
A PROXY protocol header was unparseable.
ReqAcct - Request handling byte counts

Contains byte counts for the request handling. ESI sub-request counts are also added to their parent request. The body bytes count does not include transmission (ie: chunked encoding) overhead. The format is:

%d %d %d %d %d %d
|  |  |  |  |  |
|  |  |  |  |  +- Total bytes transmitted
|  |  |  |  +---- Body bytes transmitted
|  |  |  +------- Header bytes transmitted
|  |  +---------- Total bytes received
|  +------------- Body bytes received
+---------------- Header bytes received
ReqHeader - Client request header

HTTP header contents.

The format is:

%s: %s
|   |
|   +- Header value
+----- Header name
ReqMethod - Client request method
The HTTP request method used.
ReqProtocol - Client request protocol
The HTTP protocol version information.
ReqStart - Client request start

Start of request processing. Logs the client IP address and port number.

The format is:

%s %s
|  |
|  +- Client Port number
+---- Client IP4/6 address
ReqURL - Client request URL
The HTTP request URL.
RespHeader - Client response header

HTTP header contents.

The format is:

%s: %s
|   |
|   +- Header value
+----- Header name
RespProtocol - Client response protocol
The HTTP protocol version information.
RespReason - Client response response
The HTTP response string received.
RespStatus - Client response status
The HTTP status code received.
SessClose - Client connection closed

SessionClose is the last record for any client connection.

The format is:

%s %f
|  |
|  +- How long the session was open
+---- Why the connection closed
SessOpen - Client connection opened

The first record for a client connection, with the socket-endpoints of the connection.

The format is:

%s %d %s %s %s %d
|  |  |  |  |  |
|  |  |  |  |  +- File descriptor number
|  |  |  |  +---- Local TCP port ('-' if !$log_local_addr)
|  |  |  +------- Local IPv4/6 address ('-' if !$log_local_addr)
|  |  +---------- Listen socket (-a argument)
|  +------------- Remote TCP port
+---------------- Remote IPv4/6 address
Storage - Where object is stored

Type and name of the storage backend the object is stored in.

The format is:

%s %s
|  |
|  +- Name of storage backend
+---- Type ("malloc", "file", "persistent" etc.)
TTL - TTL set on object

A TTL record is emitted whenever the ttl, grace or keep values for an object is set.

The format is:

%s %d %d %d %d [ %d %d %u %u ]
|  |  |  |  |    |  |  |  |
|  |  |  |  |    |  |  |  +- Max-Age from Cache-Control header
|  |  |  |  |    |  |  +---- Expires header
|  |  |  |  |    |  +------- Date header
|  |  |  |  |    +---------- Age (incl Age: header value)
|  |  |  |  +--------------- Reference time for TTL
|  |  |  +------------------ Keep
|  |  +--------------------- Grace
|  +------------------------ TTL
+--------------------------- "RFC" or "VCL"

The last four fields are only present in "RFC" headers.

Examples:

RFC 60 10 -1 1312966109 1312966109 1312966109 0 60
VCL 120 10 0 1312966111
Timestamp - Timing information

Contains timing information for the Varnish worker threads.

Time stamps are issued by Varnish on certain events, and show the absolute time of the event, the time spent since the start of the work unit, and the time spent since the last timestamp was logged. See vsl(7) for information about the individual timestamps.

The format is:

%s: %f %f %f
|   |  |  |
|   |  |  +- Time since last timestamp
|   |  +---- Time since start of work unit
|   +------- Absolute time of event
+----------- Event label
VCL_Error - VCL execution error message
Logs error messages generated during VCL execution.
VCL_Log - Log statement from VCL
User generated log messages insert from VCL through std.log()
VCL_acl - VCL ACL check results
Logs VCL ACL evaluation results.
VCL_call - VCL method called
Logs the VCL method name when a VCL method is called.
VCL_return - VCL method return value
Logs the VCL method terminating statement.
VCL_trace - VCL trace data

Logs VCL execution trace data.

The format is:

%u %u.%u
|  |  |
|  |  +- VCL program line position
|  +---- VCL program line number
+------- VCL trace point index

NB: This log record is masked by default.

VSL - VSL API warnings and error message
Warnings and error messages genererated by the VSL API while reading the shared memory log.
VfpAcct - Fetch filter accounting

Contains name of VFP and statistics.

The format is:

%s %d %d
|  |  |
|  |  +- Total bytes produced
|  +---- Number of calls made
+------- Name of filter

NB: This log record is masked by default.

Witness - Lock order witness records
Diagnostic recording of locking order.
WorkThread - Logs thread start/stop events

Logs worker thread creation and termination events.

The format is:

%p %s
|  |
|  +- [start|end]
+---- Worker struct pointer

NB: This log record is masked by default.

TIMESTAMPS¶

Timestamps are inserted in the log on completing certain events during the worker thread's task handling. The timestamps has a label showing which event was completed. The reported fields show the absolute time of the event, the time spent since the start of the task and the time spent since the last timestamp was logged.

The timestamps logged automatically by Varnish are inserted after completing events that are expected to have delays (e.g. network IO or spending time on a waitinglist). Timestamps can also be inserted from VCL using the std.timestamp() method. If one is doing time consuming tasks in the VCL configuration, it's a good idea to log a timestamp after completing that task. This keeps the timing information in subsequent timestamps from including the time spent on the VCL event.

Request handling timestamps¶

Start
The start of request processing (first byte received or restart).
Req
Complete client request received.
ReqBody
Client request body processed (discarded, cached or passed to the backend).
Waitinglist
Came off waitinglist.
Fetch
Fetch processing finished (completely fetched or ready for streaming).
Process
Processing finished, ready to deliver the client response.
Resp
Delivery of response to the client finished.
Restart
Client request is being restarted.

Pipe handling timestamps¶

Pipe
Opened a pipe to the backend and forwarded the request.
PipeSess
The pipe session has finished.

Backend fetch timestamps¶

Start
Start of the backend fetch processing.
Bereq
Backend request sent.
Beresp
Backend response headers received.
BerespBody
Backend response body received.
Retry
Backend request is being retried.
Error
Backend request failed to vcl_backend_error.

HISTORY¶

This document was initially written by Poul-Henning Kamp, and later updated by Martin Blix Grydeland.

Table Of Contents

Previous topic

varnish-counters

Next topic

vsl-query

This Page

varnish-4.1.1/doc/html/reference/varnishstat.html0000644000201500234410000003272312652366773017037 00000000000000 varnishstat — Varnish version 4.1.1 documentation

varnishstat¶

Varnish Cache statistics¶

Manual section:1

SYNOPSIS¶

varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-t seconds|<off>] [-V]

DESCRIPTION¶

The varnishstat utility displays statistics from a running varnishd(1) instance.

OPTIONS¶

The following options are available:

-1 Instead of presenting a continuously updated display, print the statistics to stdout.
-f Field inclusion glob. A field glob consists of three parts, type, ident and name, where ident is optional. Each part can contain a '*' character at the end to match a prefix. Use backslash to escape characters. If the argument starts with '^' it is used as an exclusion glob. Multiple -f arguments may be given, and they will be applied in order.
-l Lists the available fields to use with the -f option.
-n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.
-N Specify a the filename of a stale VSM instance. When using this option the abandonment checking is disabled.
-t seconds|<off>
Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this any seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinitely for the Varnish instance to appear. Defaults to 5 seconds.
-V Display the version number and exit.
-x Displays the result as XML.
-j Displays the result as JSON.

CURSES MODE¶

When neither -1, -j or -x options are given, the application starts up in curses mode. This shows a continuously updated view of the counter values, along with their description.

The top area shows process uptime information.

The center area shows a list of counter values.

The bottom area shows the description of the currently selected counter.

Columns¶

The following columns are displayed, from left to right:

Name
The name of the counter
Current
The current value of the counter.
Change
The average per second change over the last update interval.
Average
The average value of this counter over the runtime of the Varnish daemon, or a period if the counter can't be averaged.
Avg_10
The moving average over the last 10 update intervals.
Avg_100
The moving average over the last 100 update intervals.
Avg_1000
The moving average over the last 1000 update intervals.

Key bindings¶

The following keys control the interactive display:

<UP>
Navigate the counter list one line up.
<DOWN>
Navigate the counter list one line down.
<PAGEUP> or <b>
Navigate the counter list one page up.
<PAGEDOWN> or <SPACE>
Navigate the counter list one page down.
<d>
Toggle between showing and hiding unseen counters. Unseen counters are those that has been zero for the entire runtime of varnishstat. Defaults to hide unseen counters.
<e>
Toggle scaling of values.
<g>
Go to the top of the counter list.
<G>
Go to the bottom of the counter list.
<v>
Cycle through the verbosity levels. Defaults to only showing informational counters.
<q>
Quit.
<CTRL+T>
Sample now.

XML Output¶

When using the -x option, the output is:

<varnishstat timestamp="YYYY-MM-DDTHH:mm:SS">
  <stat>
    <type>FIELD TYPE</type>
    <ident>FIELD IDENT</ident>
    <name>FIELD NAME</name>
    <value>FIELD VALUE</value>
    <flag>FIELD SEMANTICS</flag>
    <format>FIELD DISPLAY FORMAT</format>
    <description>FIELD DESCRIPTION</description>
  </stat>
  [..]
</varnishstat>

JSON OUTPUT¶

With -j the output format is:

{
  "timestamp": "YYYY-MM-DDTHH:mm:SS",
  "FIELD NAME": {
    "description": "FIELD DESCRIPTION",
    "type": "FIELD TYPE", "ident": "FIELD IDENT", "flag": "FIELD SEMANTICS", "format": "FIELD DISPLAY FORMAT",
    "value": FIELD VALUE
  },
  "FIELD2 NAME": {
    "description": "FIELD2 DESCRIPTION",
    "type": "FIELD2 TYPE", "ident": "FIELD2 IDENT", "flag": "FIELD2 SEMANTICS", "format": "FIELD2 DISPLAY FORMAT",
    "value": FIELD2 VALUE
  },
  [..]
}

Type and ident are optional. Timestamp is the time when the report was generated by varnishstat.

Repeated output with -1, -x or -j will have a single empty line (\n) between each block of output.

AUTHORS¶

This manual page was written by Dag-Erling Smørgrav, Per Buer, Lasse Karstensen and Martin Blix Grydeland.

Table Of Contents

Previous topic

varnishncsa

Next topic

varnishtest

This Page

varnish-4.1.1/doc/html/reference/varnishhist.html0000644000201500234410000002624312652366773017033 00000000000000 varnishhist — Varnish version 4.1.1 documentation

varnishhist¶

Varnish request histogram¶

Manual section:1

SYNOPSIS¶

varnishhist [-C] [-d] [-g <request|vxid>] [-h] [-L limit] [-n name] [-N filename] [-p period] [-P <size|responsetime|tag:field_num:min:max>] [-q query] [-r filename] [-t <seconds|off>] [-T seconds] [-V]

DESCRIPTION¶

The varnishhist utility reads varnishd(1) shared memory logs and 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 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:

-C Do all regular expression and string matching caseless.
-d Start processing log records at the head of the log instead of the tail.
-g <request|vxid>
 The grouping of the log records. The default is to group by vxid.
-h Print program usage and exit
-L limit Sets the upper limit of incomplete transactions kept before the oldest transaction is force completed. A warning record is synthesized when this happens. This setting keeps an upper bound on the memory usage of running queries. Defaults to 1000 transactions.
-n name Specify the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.
-N filename Specify the filename of a stale VSM instance. When using this option the abandonment checking is disabled.
-p period Specified the number of seconds between screen refreshes. Default is 1 second, and can be changed at runtime by pressing the [1-9] keys.
-P <size|responsetime|tag:field_num:min:max>
 Either specify "size" or "responsetime" profile or create a new one. Define the tag we'll look for, and the field number of the value we are interested in. min and max are the boundaries of the graph (these are power of tens).
-q query Specifies the VSL query to use.
-r filename Read log in binary file format from this file. The file can be created with varnishlog -w filename.
-t <seconds|off>
 Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this many seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. Defaults to 5 seconds.
-T seconds Sets the transaction timeout in seconds. This defines the maximum number of seconds elapsed between a Begin tag and the End tag. If the timeout expires, a warning record is synthesized and the transaction is force completed. Defaults to 120 seconds.
-V Print version information and exit.

HISTORY¶

The varnishhist 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.

Table Of Contents

Previous topic

varnishd

Next topic

varnishlog

This Page

varnish-4.1.1/doc/html/reference/varnish-counters.html0000644000201500234410000006550512652366773020007 00000000000000 varnish-counters — Varnish version 4.1.1 documentation

varnish-counters¶

Varnish counter field definitions¶

Manual section:7

COUNTER LEVELS¶

INFO – Informational counters
Counters giving runtime information
DIAG – Diagnostic counters
Counters giving diagnostic information
DEBUG – Debug counters
Counters giving Varnish internals debug information

MAIN COUNTERS (MAIN.*)¶

uptime – How long the child process has been running. (INFO)
Child process uptime
sess_conn – Count of sessions successfully accepted (INFO)
Sessions accepted
sess_drop – Count of sessions silently dropped due to lack of worker thread. (INFO)
Sessions dropped
sess_fail – Count of failures to accept TCP connection. Either the client changed its mind, or the kernel ran out of some resource like file descriptors. (INFO)
Session accept failures
client_req_400 – 400 means we couldn't make sense of the request, it was malformed in some drastic way. (INFO)
Client requests received, subject to 400 errors
client_req_417 – 417 means that something went wrong with an Expect: header. (INFO)
Client requests received, subject to 417 errors
client_req – The count of parseable client requests seen. (INFO)
Good client requests received
cache_hit – Count of cache hits. A cache hit indicates that an object has been delivered to a client without fetching it from a backend server. (INFO)
Cache hits
cache_hitpass – Count of hits for pass A cache hit for pass indicates that Varnish is going to pass the request to the backend and this decision has been cached in it self. This counts how many times the cached decision is being used. (INFO)
Cache hits for pass
cache_miss – Count of misses A cache miss indicates the object was fetched from the backend before delivering it to the backend. (INFO)
Cache misses
backend_conn – How many backend connections have successfully been established. (INFO)
Backend conn. success
backend_unhealthy – (INFO)
Backend conn. not attempted
backend_busy – (INFO)
Backend conn. too many
backend_fail – (INFO)
Backend conn. failures
backend_reuse – Count of backend connection reuses This counter is increased whenever we reuse a recycled connection. (INFO)
Backend conn. reuses
backend_recycle – Count of backend connection recycles This counter is increased whenever we have a keep-alive connection that is put back into the pool of connections. It has not yet been used, but it might be, unless the backend closes it. (INFO)
Backend conn. recycles
backend_retry – (INFO)
Backend conn. retry
fetch_head – beresp with no body because the request is HEAD. (INFO)
Fetch no body (HEAD)
fetch_length – beresp.body with Content-Length. (INFO)
Fetch with Length
fetch_chunked – beresp.body with Chunked. (INFO)
Fetch chunked
fetch_eof – beresp.body with EOF. (INFO)
Fetch EOF
fetch_bad – beresp.body length/fetch could not be determined. (INFO)
Fetch bad T-E
fetch_none – beresp.body empty (INFO)
Fetch no body
fetch_1xx – beresp with no body because of 1XX response. (INFO)
Fetch no body (1xx)
fetch_204 – beresp with no body because of 204 response. (INFO)
Fetch no body (204)
fetch_304 – beresp with no body because of 304 response. (INFO)
Fetch no body (304)
fetch_failed – beresp fetch failed. (INFO)
Fetch failed (all causes)
fetch_no_thread – beresp fetch failed, no thread available. (INFO)
Fetch failed (no thread)
pools – Number of thread pools. See also parameter thread_pools. NB: Presently pools cannot be removed once created. (INFO)
Number of thread pools
threads – Number of threads in all pools. See also parameters thread_pools, thread_pool_min and thread_pool_max. (INFO)
Total number of threads
threads_limited – Number of times more threads were needed, but limit was reached in a thread pool. See also parameter thread_pool_max. (INFO)
Threads hit max
threads_created – Total number of threads created in all pools. (INFO)
Threads created
threads_destroyed – Total number of threads destroyed in all pools. (INFO)
Threads destroyed
threads_failed – Number of times creating a thread failed. See VSL::Debug for diagnostics. See also parameter thread_fail_delay. (INFO)
Thread creation failed
thread_queue_len – Length of session queue waiting for threads. NB: Only updates once per second. See also parameter queue_max. (INFO)
Length of session queue
busy_sleep – Number of requests sent to sleep without a worker thread because they found a busy object. (INFO)
Number of requests sent to sleep on busy objhdr
busy_wakeup – Number of requests taken of the busy object sleep list and and rescheduled. (INFO)
Number of requests woken after sleep on busy objhdr
busy_killed – Number of requests killed from the busy object sleep list due to lack of resources. (INFO)
Number of requests killed after sleep on busy objhdr
sess_queued – Number of times session was queued waiting for a thread. See also parameter queue_max. (INFO)
Sessions queued for thread
sess_dropped – Number of times session was dropped because the queue were too long already. See also parameter queue_max. (INFO)
Sessions dropped for thread
n_object – Number of object structs made (INFO)
object structs made
n_vampireobject – Number of unresurrected objects (DIAG)
unresurrected objects
n_objectcore – Number of objectcore structs made (INFO)
objectcore structs made
n_objecthead – Number of objecthead structs made (INFO)
objecthead structs made
n_waitinglist – Number of waitinglist structs made (DEBUG)
waitinglist structs made
n_backend – Number of backends known to us. (INFO)
Number of backends
n_expired – Number of objects that expired from cache because of old age. (INFO)
Number of expired objects
n_lru_nuked – How many objects have been forcefully evicted from storage to make room for a new object. (INFO)
Number of LRU nuked objects
n_lru_moved – Number of move operations done on the LRU list. (DIAG)
Number of LRU moved objects
losthdr – (INFO)
HTTP header overflows
s_sess – (INFO)
Total sessions seen
s_req – (INFO)
Total requests seen
s_pipe – (INFO)
Total pipe sessions seen
s_pass – (INFO)
Total pass-ed requests seen
s_fetch – (INFO)
Total backend fetches initiated
s_synth – (INFO)
Total synthethic responses made
s_req_hdrbytes – Total request header bytes received (INFO)
Request header bytes
s_req_bodybytes – Total request body bytes received (INFO)
Request body bytes
s_resp_hdrbytes – Total response header bytes transmitted (INFO)
Response header bytes
s_resp_bodybytes – Total response body bytes transmitted (INFO)
Response body bytes
s_pipe_hdrbytes – Total request bytes received for piped sessions (INFO)
Pipe request header bytes
s_pipe_in – Total number of bytes forwarded from clients in pipe sessions (INFO)
Piped bytes from client
s_pipe_out – Total number of bytes forwarded to clients in pipe sessions (INFO)
Piped bytes to client
sess_closed – (INFO)
Session Closed
sess_closed_err – Total number of sessions closed with errors. See sc_* diag counters for detailed breakdown (INFO)
Session Closed with error
sess_readahead – (INFO)
Session Read Ahead
sess_herd – (DIAG)
Session herd
sc_rem_close – Number of session closes with REM_CLOSE (Client Closed) (DIAG)
Session OK REM_CLOSE
sc_req_close – Number of session closes with REQ_CLOSE (Client requested close) (DIAG)
Session OK REQ_CLOSE
sc_req_http10 – Number of session closes with Error REQ_HTTP10 (Proto < HTTP/1.1) (DIAG)
Session Err REQ_HTTP10
sc_rx_bad – Number of session closes with Error RX_BAD (Received bad req/resp) (DIAG)
Session Err RX_BAD
sc_rx_body – Number of session closes with Error RX_BODY (Failure receiving req.body) (DIAG)
Session Err RX_BODY
sc_rx_junk – Number of session closes with Error RX_JUNK (Received junk data) (DIAG)
Session Err RX_JUNK
sc_rx_overflow – Number of session closes with Error RX_OVERFLOW (Received buffer overflow) (DIAG)
Session Err RX_OVERFLOW
sc_rx_timeout – Number of session closes with Error RX_TIMEOUT (Receive timeout) (DIAG)
Session Err RX_TIMEOUT
sc_tx_pipe – Number of session closes with TX_PIPE (Piped transaction) (DIAG)
Session OK TX_PIPE
sc_tx_error – Number of session closes with Error TX_ERROR (Error transaction) (DIAG)
Session Err TX_ERROR
sc_tx_eof – Number of session closes with TX_EOF (EOF transmission) (DIAG)
Session OK TX_EOF
sc_resp_close – Number of session closes with RESP_CLOSE (Backend/VCL requested close) (DIAG)
Session OK RESP_CLOSE
sc_overload – Number of session closes with Error OVERLOAD (Out of some resource) (DIAG)
Session Err OVERLOAD
sc_pipe_overflow – Number of session closes with Error PIPE_OVERFLOW (Session pipe overflow) (DIAG)
Session Err PIPE_OVERFLOW
sc_range_short – Number of session closes with Error RANGE_SHORT (Insufficient data for range) (DIAG)
Session Err RANGE_SHORT
shm_records – (DIAG)
SHM records
shm_writes – (DIAG)
SHM writes
shm_flushes – (DIAG)
SHM flushes due to overflow
shm_cont – (DIAG)
SHM MTX contention
shm_cycles – (DIAG)
SHM cycles through buffer
backend_req – (INFO)
Backend requests made
n_vcl – (INFO)
Number of loaded VCLs in total
n_vcl_avail – (DIAG)
Number of VCLs available
n_vcl_discard – (DIAG)
Number of discarded VCLs
bans – Number of all bans in system, including bans superseded by newer bans and bans already checked by the ban-lurker. (INFO)
Count of bans
bans_completed – Number of bans which are no longer active, either because they got checked by the ban-lurker or superseded by newer identical bans. (DIAG)
Number of bans marked 'completed'
bans_obj – Number of bans which use obj.* variables. These bans can possibly be washed by the ban-lurker. (DIAG)
Number of bans using obj.*
bans_req – Number of bans which use req.* variables. These bans can not be washed by the ban-lurker. (DIAG)
Number of bans using req.*
bans_added – Counter of bans added to ban list. (DIAG)
Bans added
bans_deleted – Counter of bans deleted from ban list. (DIAG)
Bans deleted
bans_tested – Count of how many bans and objects have been tested against each other during hash lookup. (DIAG)
Bans tested against objects (lookup)
bans_obj_killed – Number of objects killed by bans during object lookup. (DIAG)
Objects killed by bans (lookup)
bans_lurker_tested – Count of how many bans and objects have been tested against each other by the ban-lurker. (DIAG)
Bans tested against objects (lurker)
bans_tests_tested – Count of how many tests and objects have been tested against each other during lookup. 'ban req.url == foo && req.http.host == bar' counts as one in 'bans_tested' and as two in 'bans_tests_tested' (DIAG)
Ban tests tested against objects (lookup)
bans_lurker_tests_tested – Count of how many tests and objects have been tested against each other by the ban-lurker. 'ban req.url == foo && req.http.host == bar' counts as one in 'bans_tested' and as two in 'bans_tests_tested' (DIAG)
Ban tests tested against objects (lurker)
bans_lurker_obj_killed – Number of objects killed by ban-lurker. (DIAG)
Objects killed by bans (lurker)
bans_dups – Count of bans replaced by later identical bans. (DIAG)
Bans superseded by other bans
bans_lurker_contention – Number of times the ban-lurker had to wait for lookups. (DIAG)
Lurker gave way for lookup
bans_persisted_bytes – Number of bytes used by the persisted ban lists. (DIAG)
Bytes used by the persisted ban lists
bans_persisted_fragmentation – Number of extra bytes accumulated through dropped and completed bans in the persistent ban lists. (DIAG)
Extra bytes in persisted ban lists due to fragmentation
n_purges – (INFO)
Number of purge operations executed
n_obj_purged – (INFO)
Number of purged objects
exp_mailed – Number of objects mailed to expiry thread for handling. (DIAG)
Number of objects mailed to expiry thread
exp_received – Number of objects received by expiry thread for handling. (DIAG)
Number of objects received by expiry thread
hcb_nolock – (DEBUG)
HCB Lookups without lock
hcb_lock – (DEBUG)
HCB Lookups with lock
hcb_insert – (DEBUG)
HCB Inserts
esi_errors – (DIAG)
ESI parse errors (unlock)
esi_warnings – (DIAG)
ESI parse warnings (unlock)
vmods – (INFO)
Loaded VMODs
n_gzip – (INFO)
Gzip operations
n_gunzip – (INFO)
Gunzip operations
vsm_free – Number of bytes free in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DIAG)
Free VSM space
vsm_used – Number of bytes used in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DIAG)
Used VSM space
vsm_cooling – Number of bytes which will soon (max 1 minute) be freed in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DEBUG)
Cooling VSM space
vsm_overflow – Number of bytes which does not fit in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DIAG)
Overflow VSM space
vsm_overflowed – Total number of bytes which did not fit in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DIAG)
Overflowed VSM space

MANAGEMENT PROCESS COUNTERS (MGT.*)¶

uptime – Uptime in seconds of the management process (INFO)
Management process uptime
child_start – Number of times the child process has been started (DIAG)
Child process started
child_exit – Number of times the child process has been cleanly stopped (DIAG)
Child process normal exit
child_stop – Number of times the child process has exited with an unexpected return code (DIAG)
Child process unexpected exit
child_died – Number of times the child process has died due to signals (DIAG)
Child process died (signal)
child_dump – Number of times the child process has produced core dumps (DIAG)
Child process core dumped
child_panic – Number of times the management process has caught a child panic (DIAG)
Child process panic

PER MEMORY POOL COUNTERS (MEMPOOL.*)¶

live – (DEBUG)
In use
pool – (DEBUG)
In Pool
sz_wanted – (DEBUG)
Size requested
sz_actual – (DEBUG)
Size allocated
allocs – (DEBUG)
Allocations
frees – (DEBUG)
Frees
recycle – (DEBUG)
Recycled from pool
timeout – (DEBUG)
Timed out from pool
toosmall – (DEBUG)
Too small to recycle
surplus – (DEBUG)
Too many for pool
randry – (DEBUG)
Pool ran dry

PER MALLOC STORAGE COUNTERS (SMA.*)¶

c_req – Number of times the storage has been asked to provide a storage segment. (INFO)
Allocator requests
c_fail – Number of times the storage has failed to provide a storage segment. (INFO)
Allocator failures
c_bytes – Number of total bytes allocated by this storage. (INFO)
Bytes allocated
c_freed – Number of total bytes returned to this storage. (INFO)
Bytes freed
g_alloc – Number of storage allocations outstanding. (INFO)
Allocations outstanding
g_bytes – Number of bytes allocated from the storage. (INFO)
Bytes outstanding
g_space – Number of bytes left in the storage. (INFO)
Bytes available

PER FILE STORAGE COUNTERS (SMF.*)¶

c_req – Number of times the storage has been asked to provide a storage segment. (INFO)
Allocator requests
c_fail – Number of times the storage has failed to provide a storage segment. (INFO)
Allocator failures
c_bytes – Number of total bytes allocated by this storage. (INFO)
Bytes allocated
c_freed – Number of total bytes returned to this storage. (INFO)
Bytes freed
g_alloc – Number of storage allocations outstanding. (INFO)
Allocations outstanding
g_bytes – Number of bytes allocated from the storage. (INFO)
Bytes outstanding
g_space – Number of bytes left in the storage. (INFO)
Bytes available
g_smf – (INFO)
N struct smf
g_smf_frag – (INFO)
N small free smf
g_smf_large – (INFO)
N large free smf

PER BACKEND COUNTERS (VBE.*)¶

happy – (INFO)
Happy health probes
bereq_hdrbytes – Total backend request header bytes sent (INFO)
Request header bytes
bereq_bodybytes – Total backend request body bytes sent (INFO)
Request body bytes
beresp_hdrbytes – Total backend response header bytes received (INFO)
Response header bytes
beresp_bodybytes – Total backend response body bytes received (INFO)
Response body bytes
pipe_hdrbytes – Total request bytes sent for piped sessions (INFO)
Pipe request header bytes
pipe_out – Total number of bytes forwarded to backend in pipe sessions (INFO)
Piped bytes to backend
pipe_in – Total number of bytes forwarded from backend in pipe sessions (INFO)
Piped bytes from backend
conn – (INFO)
Concurrent connections to backend
req – (INFO)
Backend requests sent

LOCK COUNTERS (LCK.*)¶

creat – (DEBUG)
Created locks
destroy – (DEBUG)
Destroyed locks
locks – (DEBUG)
Lock Operations

AUTHORS¶

This man page was written by Lasse Karstensen, using content from vsc2rst written by Tollef Fog Heen.

varnish-4.1.1/doc/html/reference/vmod_std.generated.html0000644000201500234410000006403112652366773020242 00000000000000 vmod_std — Varnish version 4.1.1 documentation

vmod_std¶

Varnish Standard Module¶

Manual section:3

SYNOPSIS¶

import std [from "path"] ;

DESCRIPTION¶

vmod_std contains basic functions which are part and parcel of Varnish, but which for reasons of architecture fit better in a VMOD.

One particular class of functions in vmod_std is the conversions functions which all have the form:

TYPE type(STRING, TYPE)

These functions attempt to convert STRING to the TYPE, and if that fails, they return the second argument, which must have the given TYPE.

CONTENTS¶

STRING toupper(STRING_LIST)¶

Prototype
STRING toupper(STRING_LIST s)
Description
Converts the string s to uppercase.
Example
set beresp.http.scream = std.toupper("yes!");

STRING tolower(STRING_LIST)¶

Prototype
STRING tolower(STRING_LIST s)
Description
Converts the string s to lowercase.
Example
set beresp.http.nice = std.tolower("VerY");

VOID set_ip_tos(INT)¶

Prototype
VOID set_ip_tos(INT tos)
Description
Sets the IP type-of-service (TOS) field for the current session to tos. Please note that the TOS field is not removed by the end of the request so probably want to set it on every request should you utilize it.
Example
if (req.url ~ "^/slow/") {
std.set_ip_tos(0);
}

REAL random(REAL, REAL)¶

Prototype
REAL random(REAL lo, REAL hi)
Description
Returns a random real number between lo and hi.
Example
set beresp.http.random-number = std.random(1, 100);

VOID log(STRING_LIST)¶

Prototype
VOID log(STRING_LIST s)
Description
Logs the string s to the shared memory log, using VSL tag SLT_VCL_Log.
Example
std.log("Something fishy is going on with the vhost " + req.http.host);

VOID syslog(INT, STRING_LIST)¶

Prototype
VOID syslog(INT priority, STRING_LIST s)
Description
Logs the string s to syslog tagged with priority. priority is formed by ORing the facility and level values. See your system's syslog.h file for possible values.
Example

std.syslog(9, "Something is wrong");

This will send a message to syslog using LOG_USER | LOG_ALERT.

STRING fileread(PRIV_CALL, STRING)¶

Prototype
STRING fileread(PRIV_CALL, STRING)
Description
Reads a file and returns a string with the content. Please note that it is not recommended to send variables to this function the caching in the function doesn't take this into account. Also, files are not re-read.
Example
set beresp.http.served-by = std.fileread("/etc/hostname");

VOID collect(HEADER)¶

Prototype
VOID collect(HEADER hdr)
Description

Collapses multiple hdr headers into one long header.

Care should be taken when collapsing headers. In particular collapsing Set-Cookie will lead to unexpected results on the browser side.

Example
std.collect(req.http.cookie);

DURATION duration(STRING, DURATION)¶

Prototype
DURATION duration(STRING s, DURATION fallback)
Description
Converts the string s to seconds. s must be quantified with ms (milliseconds), s (seconds), m (minutes), h (hours), d (days), w (weeks) or y (years) units. If conversion fails, fallback will be returned.
Example
set beresp.ttl = std.duration("1w", 3600s);

INT integer(STRING, INT)¶

Prototype
INT integer(STRING s, INT fallback)
Description
Converts the string s to an integer. If conversion fails, fallback will be returned.
Example
if (std.integer(req.http.foo, 0) > 5) {
...
}

IP ip(STRING, IP)¶

Prototype
IP ip(STRING s, IP fallback)
Description
Converts the string s to the first IP number returned by the system library function getaddrinfo(3). If conversion fails, fallback will be returned.
Example
if (std.ip(req.http.X-forwarded-for, "0.0.0.0") ~ my_acl) {
...
}

REAL real(STRING, REAL)¶

Prototype
REAL real(STRING s, REAL fallback)
Description
Converts the string s to a real. If conversion fails, fallback will be returned.
Example
if (std.real(req.http.foo, 0.0) > 5.5) {
...
}

INT real2integer(REAL, INT)¶

Prototype
INT real2integer(REAL r, INT fallback)
Description
Converts the real r to an integer. If conversion fails, fallback will be returned.
Example
set req.http.integer = std.real2integer(1140618699.00, 0);

TIME real2time(REAL, TIME)¶

Prototype
TIME real2time(REAL r, TIME fallback)
Description
Converts the real r to a time. If conversion fails, fallback will be returned.
Example
set req.http.time = std.real2time(1140618699.00, now);

INT time2integer(TIME, INT)¶

Prototype
INT time2integer(TIME t, INT fallback)
Description
Converts the time t to a integer. If conversion fails, fallback will be returned.
Example
set req.http.int = std.time2integer(now, 0);

REAL time2real(TIME, REAL)¶

Prototype
REAL time2real(TIME t, REAL fallback)
Description
Converts the time t to a real. If conversion fails, fallback will be returned.
Example
set req.http.real = std.time2real(now, 1.0);

BOOL healthy(BACKEND)¶

Prototype
BOOL healthy(BACKEND be)
Description
Returns true if the backend be is healthy.

INT port(IP)¶

Prototype
INT port(IP ip)
Description
Returns the port number of the IP address ip.

VOID rollback(HTTP)¶

Prototype
VOID rollback(HTTP h)
Description
Restores the h HTTP headers to their original state.
Example
std.rollback(bereq);

VOID timestamp(STRING)¶

Prototype
VOID timestamp(STRING s)
Description
Introduces a timestamp in the log with the current time, using the string s as the label. This is useful to time the execution of lengthy VCL procedures, and makes the timestamps inserted automatically by Varnish more accurate.
Example
std.timestamp("curl-request");

STRING querysort(STRING)¶

Prototype
STRING querysort(STRING)
Description
Sorts the query string for cache normalization purposes.
Example
set req.url = std.querysort(req.url);

VOID cache_req_body(BYTES)¶

Prototype
VOID cache_req_body(BYTES size)
Description

Cache the req.body if it is smaller than size.

Caching the req.body makes it possible to retry pass operations (POST, PUT).

Example

std.cache_req_body(1KB);

This will cache the req.body if its size is smaller than 1KB.

STRING strstr(STRING, STRING)¶

Prototype
STRING strstr(STRING s1, STRING s2)
Description

Returns a string beginning at the first occurrence of the string s2 in the string s1, or an empty string if s2 is not found.

Note that the comparison is case sensitive.

Example
if (std.strstr(req.url, req.http.restrict)) {
...
}

This will check if the content of req.http.restrict occurs anywhere in req.url.

TIME time(STRING, TIME)¶

Prototype
TIME time(STRING s, TIME fallback)
Description

Converts the string s to a time. If conversion fails, fallback will be returned.

Supported formats:

"Sun, 06 Nov 1994 08:49:37 GMT"
"Sunday, 06-Nov-94 08:49:37 GMT"
"Sun Nov 6 08:49:37 1994"
"1994-11-06T08:49:37"
"784111777.00"
"784111777"
Example
if (std.time(resp.http.last-modified, now) < now - 1w) {
...
}

SEE ALSO¶

HISTORY¶

The Varnish standard module was released along with Varnish Cache 3.0. This manual page was written by Per Buer with help from Martin Blix Grydeland.

varnish-4.1.1/doc/html/reference/varnish-cli.html0000644000201500234410000004416012652366773016706 00000000000000 varnish-cli — Varnish version 4.1.1 documentation

varnish-cli¶

Varnish Command Line Interface¶

Manual section:7

DESCRIPTION¶

Varnish as a command line interface (CLI) which can control and change most of the operational parameters and the configuration of Varnish, without interrupting the running service.

The CLI can be used for the following tasks:

configuration
You can upload, change and delete VCL files from the CLI.
parameters
You can inspect and change the various parameters Varnish has available through the CLI. The individual parameters are documented in the varnishd(1) man page.
bans
Bans are filters that are applied to keep Varnish from serving stale content. When you issue a ban Varnish will not serve any banned object from cache, but rather re-fetch it from its backend servers.
process management
You can stop and start the cache (child) process though the CLI. You can also retrieve the latest stack trace if the child process has crashed.

If you invoke varnishd(1) with -T, -M or -d the CLI will be available. In debug mode (-d) the CLI will be in the foreground, with -T you can connect to it with varnishadm or telnet and with -M varnishd will connect back to a listening service pushing the CLI to that service. Please see varnishd for details.

Syntax¶

Commands are usually terminated with a newline. Long command can be entered using sh style here documents. The format of here-documents is:

<< word
     here document
word

word can be any continuous string chosen to make sure it doesn't appear naturally in the following here document.

When using the here document style of input there are no restrictions on length. When using newline-terminated commands maximum length is limited by the varnishd parameter cli_buffer.

When commands are newline terminated they get tokenized before parsing so if you have significant spaces enclose your strings in double quotes. Within the quotes you can escape characters with \. The n, r and t get translated to newlines, carriage returns and tabs. Double quotes themselves can be escaped with a backslash.

To enter characters in octals use the \nnn syntax. Hexadecimals can be entered with the \xnn syntax.

Commands¶

help [<command>]
Show command/protocol help.
ping [<timestamp>]
Keep connection alive.
auth <response>
Authenticate.
quit
Close connection.
banner
Print welcome banner.
status
Check status of Varnish cache process.
start
Start the Varnish cache process.
stop
Stop the Varnish cache process.
vcl.load <configname> <filename> [auto|cold|warm]
Compile and load the VCL file under the name provided.
vcl.inline <configname> <quoted_VCLstring> [auto|cold|warm]
Compile and load the VCL data under the name provided.
vcl.use <configname>
Switch to the named configuration immediately.
vcl.discard <configname>
Unload the named configuration (when possible).
vcl.list
List all loaded configuration.
vcl.show [-v] <configname>
Display the source code for the specified configuration.
vcl.state <configname> <state>
Force the state of the specified configuration. State is any of auto, warm or cold values.
param.show [-l] [<param>]
Show parameters and their values.
param.set <param> <value>
Set parameter value.
panic.show
Return the last panic, if any.
panic.clear [-z]
Clear the last panic, if any. -z will clear related varnishstat counter(s).
storage.list
List storage devices.
backend.list [-p] [<backend_expression>]
List backends.
backend.set_health <backend_expression> <state>
Set health status on the backends. State is any of auto, healthy or sick values.
ban <field> <operator> <arg> [&& <field> <oper> <arg> ...]
Mark obsolete all objects where all the conditions match.
ban.list
List the active bans.

Backend Expression¶

A backend expression can be a backend name or a combination of backend name, IP address and port in "name(IP address:port)" format. All fields are optional. If no exact matching backend is found, partial matching will be attempted based on the provided name, IP address and port fields.

Examples:

backend.list def*
backend.set_health default sick
backend.set_health def* healthy
backend.set_health * auto

Ban Expressions¶

A ban expression consists of one or more conditions. A condition consists of a field, an operator, and an argument. Conditions can be ANDed together with "&&".

A field can be any of the variables from VCL, for instance req.url, req.http.host or obj.http.set-cookie.

Operators are "==" for direct comparison, "~" for a regular expression match, and ">" or "<" for size comparisons. Prepending an operator with "!" negates the expression.

The argument could be a quoted string, a regexp, or an integer. Integers can have "KB", "MB", "GB" or "TB" appended for size related fields.

VCL Temperature¶

A VCL program goes through several states related to the different commands: it can be loaded, used, and later discarded. You can load several VCL programs and switch at any time from one to another. There is only one active VCL, but the previous active VCL will be maintained active until all its transactions are over.

Over time, if you often refresh your VCL and keep the previous versions around, resource consumption will increase, you can't escape that. However, most of the time you want only one to pay the price only for the active VCL and keep older VCLs in case you'd need to rollback to a previous version.

The VCL temperature allows you to minimize the footprint of inactive VCLs. Once a VCL becomes cold, Varnish will release all the resources that can be be later reacquired. You can manually set the temperature of a VCL or let varnish automatically handle it.

Scripting¶

If you are going to write a script that talks CLI to varnishd, the include/cli.h contains the relevant magic numbers.

One particular magic number to know, is that the line with the status 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.

How -S/PSK Authentication Works¶

If the -S secret-file is given as argument to varnishd, all network CLI connections must authenticate, by proving they know the contents of that file.

The file is read at the time the auth command is issued and the contents is not cached in varnishd, so it is possible to update the file on the fly.

Use the unix file permissions to control access to the file.

An authenticated session looks like this:

critter phk> telnet localhost 1234
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
107 59
ixslvvxrgkjptxmcgnnsdxsvdmvfympg

Authentication required.

auth 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a
200 193
-----------------------------
Varnish HTTP accelerator CLI.
-----------------------------
Type 'help' for command list.
Type 'quit' to close CLI session.
Type 'start' to launch worker process.

The CLI status of 107 indicates that authentication is necessary. The first 32 characters of the response text is the challenge "ixsl...mpg". The challenge is randomly generated for each CLI connection, and changes each time a 107 is emitted.

The most recently emitted challenge must be used for calculating the authenticator "455c...c89a".

The authenticator is calculated by applying the SHA256 function to the following byte sequence:

  • Challenge string
  • Newline (0x0a) character.
  • Contents of the secret file
  • Challenge string
  • Newline (0x0a) character.

and dumping the resulting digest in lower-case hex.

In the above example, the secret file contained foon and thus:

critter phk> cat > _
ixslvvxrgkjptxmcgnnsdxsvdmvfympg
foo
ixslvvxrgkjptxmcgnnsdxsvdmvfympg
^D
critter phk> hexdump -C _
00000000  69 78 73 6c 76 76 78 72  67 6b 6a 70 74 78 6d 63  |ixslvvxrgkjptxmc|
00000010  67 6e 6e 73 64 78 73 76  64 6d 76 66 79 6d 70 67  |gnnsdxsvdmvfympg|
00000020  0a 66 6f 6f 0a 69 78 73  6c 76 76 78 72 67 6b 6a  |.foo.ixslvvxrgkj|
00000030  70 74 78 6d 63 67 6e 6e  73 64 78 73 76 64 6d 76  |ptxmcgnnsdxsvdmv|
00000040  66 79 6d 70 67 0a                                 |fympg.|
00000046
critter phk> sha256 _
SHA256 (_) = 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a
critter phk> openssl dgst -sha256 < _
455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a

The sourcefile lib/libvarnish/cli_auth.c contains a useful function which calculates the response, given an open filedescriptor to the secret file, and the challenge string.

EXAMPLES¶

Simple example: All requests where req.url exactly matches the string /news are banned from the cache:

req.url == "/news"

Example: Ban all documents where the serving host is "example.com" or "www.example.com", and where the Set-Cookie header received from the backend contains "USERID=1663":

req.http.host ~ "^(?i)(www\.)example.com$" && obj.http.set-cookie ~ "USERID=1663"

AUTHORS¶

This manual page was originally written by Per Buer and later modified by Federico G. Schwindt, Dridi Boukelmoune, Lasse Karstensen and Poul-Henning Kamp.

varnish-4.1.1/doc/html/reference/varnishtop.html0000644000201500234410000003376312652366773016673 00000000000000 varnishtop — Varnish version 4.1.1 documentation

varnishtop¶

Varnish log entry ranking¶

Manual section:1

SYNOPSIS¶

varnishtop [-1] [-b] [-c] [-C] [-d] [-f] [-g <session|request|vxid|raw>] [-h] [-i taglist] [-I <[taglist:]regex>] [-L limit] [-n name] [-N filename] [-p period] [-q query] [-r filename] [-t <seconds|off>] [-T seconds] [-x taglist] [-X <[taglist:]regex>] [-V]

DESCRIPTION¶

The varnishtop utility reads varnishd shared memory logs and presents a continuously updated list of the most commonly occurring log entries. With suitable filtering using the -I, -i, -X and -x options, it can be used to display a ranking of requested documents, clients, user agents, or any other information which is recorded in the log.

The following options are available:

-1 Instead of a continuously updated display, print the statistics once and exit. Implies -d.
-b Only display transactions and log records coming from backend communication.
-c Only display transactions and log records coming from client communication.
-C Do all regular expression and string matching caseless.
-d Start processing log records at the head of the log instead of the tail.
-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.
-g <session|request|vxid|raw>
 The grouping of the log records. The default is to group by vxid.
-h Print program usage and exit
-i taglist

Include log records of these tags in output. Taglist is a comma-separated list of tag globs. Multiple -i options may be given.

If a tag include option is the first of any tag selection options, all tags are first marked excluded.

-I <[taglist:]regex>
 

Include by regex matching. Output only records matching taglist and regular expression. Applies to any tag if taglist is absent.

If a tag include option is the first of any tag selection options, all tags are first marked excluded.

-L limit Sets the upper limit of incomplete transactions kept before the oldest transaction is force completed. A warning record is synthesized when this happens. This setting keeps an upper bound on the memory usage of running queries. Defaults to 1000 transactions.
-n name Specify the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.
-N filename Specify the filename of a stale VSM instance. When using this option the abandonment checking is disabled.
-p 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.
-q query Specifies the VSL query to use.
-r filename Read log in binary file format from this file. The file can be created with varnishlog -w filename.
-t <seconds|off>
 Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this many seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. Defaults to 5 seconds.
-T seconds Sets the transaction timeout in seconds. This defines the maximum number of seconds elapsed between a Begin tag and the End tag. If the timeout expires, a warning record is synthesized and the transaction is force completed. Defaults to 120 seconds.
-x taglist Exclude log records of these tags in output. Taglist is a comma-separated list of tag globs. Multiple -x options may be given.
-X <[taglist:]regex>
 Exclude by regex matching. Do not output records matching taglist and regular expression. Applies to any tag if taglist is absent.
-V Print version information and exit.

EXAMPLES¶

The following example displays a continuously updated list of the most frequently requested URLs:

varnishtop -i ReqURL

The following example displays a continuously updated list of the most commonly used user agents:

varnishtop -C -I ReqHeader:User-Agent

HISTORY¶

The varnishtop utility was originally developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS, and later substantially rewritten by Dag-Erling Smørgrav. This manual page was written by Dag-Erling Smørgrav, and later updated by Martin Blix Grydeland.

Table Of Contents

Previous topic

varnishtest

Next topic

VSM: Shared Memory Logging and Statistics

This Page

varnish-4.1.1/doc/html/reference/vmod_directors.generated.html0000644000201500234410000004574212652366773021456 00000000000000 vmod_directors — Varnish version 4.1.1 documentation

vmod_directors¶

Varnish Directors Module¶

Manual section:3

SYNOPSIS¶

import directors [from "path"] ;

DESCRIPTION¶

vmod_directors enables backend load balancing in Varnish.

The module implements a set of basic load balancing techniques, and also serves as an example on how one could extend the load balancing capabilities of Varnish.

To enable load balancing you must import this vmod (directors).

Then you define your backends. Once you have the backends declared you can add them to a director. This happens in executed VCL code. If you want to emulate the previous behavior of Varnish 3.0 you can just initialize the directors in vcl_init, like this:

sub vcl_init {
    new vdir = directors.round_robin();
    vdir.add_backend(backend1);
    vdir.add_backend(backend2);
}

As you can see there is nothing keeping you from manipulating the directors elsewhere in VCL. So, you could have VCL code that would add more backends to a director when a certain URL is called.

Note that directors can use other directors as backends.

Object round_robin¶

Description

Create a round robin director.

This director will pick backends in a round robin fashion.

Example
new vdir = directors.round_robin();

VOID round_robin.add_backend(BACKEND)¶

Prototype
VOID round_robin.add_backend(BACKEND)
Description
Add a backend to the round-robin director.
Example
vdir.add_backend(backend1); vdir.add_backend(backend2);

VOID round_robin.remove_backend(BACKEND)¶

Prototype
VOID round_robin.remove_backend(BACKEND)
Description
Remove a backend from the round-robin director.
Example
vdir.remove_backend(backend1); vdir.remove_backend(backend2);

BACKEND round_robin.backend()¶

Prototype
BACKEND round_robin.backend()
Description
Pick a backend from the director.
Example
set req.backend_hint = vdir.backend();

Object fallback¶

Description

Create a fallback director.

A fallback director will try each of the added backends in turn, and return the first one that is healthy.

Example
new vdir = directors.fallback();

VOID fallback.add_backend(BACKEND)¶

Prototype
VOID fallback.add_backend(BACKEND)
Description

Add a backend to the director.

Note that the order in which this is done matters for the fallback director.

Example
vdir.add_backend(backend1); vdir.add_backend(backend2);

VOID fallback.remove_backend(BACKEND)¶

Prototype
VOID fallback.remove_backend(BACKEND)
Description
Remove a backend from the director.
Example
vdir.remove_backend(backend1); vdir.remove_backend(backend2);

BACKEND fallback.backend()¶

Prototype
BACKEND fallback.backend()
Description
Pick a backend from the director.
Example
set req.backend_hint = vdir.backend();

Object random¶

Description

Create a random backend director.

The random director distributes load over the backends using a weighted random probability distribution.

Example
new vdir = directors.random();

VOID random.add_backend(BACKEND, REAL)¶

Prototype
VOID random.add_backend(BACKEND, REAL)
Description

Add a backend to the director with a given weight.

Each backend backend will receive approximately 100 * (weight / (sum(all_added_weights))) per cent of the traffic sent to this director.

Example
# 2/3 to backend1, 1/3 to backend2. vdir.add_backend(backend1, 10.0); vdir.add_backend(backend2, 5.0);

VOID random.remove_backend(BACKEND)¶

Prototype
VOID random.remove_backend(BACKEND)
Description
Remove a backend from the director.
Example
vdir.remove_backend(backend1); vdir.remove_backend(backend2);

BACKEND random.backend()¶

Prototype
BACKEND random.backend()
Description
Pick a backend from the director.
Example
set req.backend_hint = vdir.backend();

Object hash¶

Description

Create a hashing backend director.

The director chooses the backend server by computing a hash/digest of the string given to .backend().

Commonly used with client.ip or a session cookie to get sticky sessions.

Example
new vdir = directors.hash();

VOID hash.add_backend(BACKEND, REAL)¶

Prototype
VOID hash.add_backend(BACKEND, REAL)
Description

Add a backend to the director with a certain weight.

Weight is used as in the random director. Recommended value is 1.0 unless you have special needs.

Example
vdir.add_backend(backend1, 1.0); vdir.add_backend(backend2, 1.0);

VOID hash.remove_backend(BACKEND)¶

Prototype
VOID hash.remove_backend(BACKEND)
Description
Remove a backend from the director.
Example
vdir.remove_backend(backend1); vdir.remove_backend(backend2);

BACKEND hash.backend(STRING_LIST)¶

Prototype
BACKEND hash.backend(STRING_LIST)
Description

Pick a backend from the backend director.

Use the string or list of strings provided to pick the backend.

Example
# pick a backend based on the cookie header from the client set req.backend_hint = vdir.backend(req.http.cookie);
varnish-4.1.1/doc/html/_images/0000755000201500234410000000000012652366773013322 500000000000000varnish-4.1.1/doc/html/_images/brinch_hansens_arrows_1.svg0000644000201500234410000007301212652366773020567 00000000000000 %3 ROOT ROOT lck_cli lck_cli ROOT->lck_cli cli_cb_before(81) lck_vbe lck_vbe ROOT->lck_vbe VBE_Delete(172) lck_exp lck_exp ROOT->lck_exp exp_thread(588) lck_backend lck_backend ROOT->lck_backend vbe_dir_finish(185) ROOT->lck_backend vbp_thread(361) lck_objhdr lck_objhdr ROOT->lck_objhdr hcb_deref(401) ROOT->lck_objhdr hcl_lookup(141) ROOT->lck_objhdr hcb_lookup(438) ROOT->lck_objhdr HSH_Unbusy(702) ROOT->lck_objhdr HSH_DerefObjCore(778) lck_ban lck_ban ROOT->lck_ban ban_lurker_getfirst(1019) lck_lru lck_lru ROOT->lck_lru EXP_NukeOne(333) lck_smp lck_smp ROOT->lck_smp smp_open(328) lck_cli->lck_vbe VRT_new_backend(100) lck_cli->lck_vbe backend_find(243) lck_cli->lck_vbe VBE_Delete(172) lck_vcl lck_vcl lck_cli->lck_vcl VCL_AddBackend(195) lck_cli->lck_vcl VCL_Load(466) lck_cli->lck_vcl ccf_config_use(617) lck_cli->lck_vcl VCL_Get(134) lck_cli->lck_vcl VCL_Rel(177) lck_cli->lck_vcl ccf_config_discard(579) lck_cli->lck_backend vbp_update_backend(158) lck_cli->lck_backend VBP_Control(525) lck_cli->lck_backend VBP_Remove(578) lck_cli->lck_ban BAN_Insert(533) lck_cli->lck_ban BAN_Insert(572) lck_cli->lck_ban BAN_TailRef(210) lck_cli->lck_ban BAN_TailDeref(225) lck_cli->lck_ban ccf_ban_list(1312) lck_cli->lck_smp debug_persistent(653) lck_backend_tcp lck_backend_tcp lck_vbe->lck_backend_tcp VBT_Rel(193) lck_wstat lck_wstat lck_exp->lck_wstat Pool_Sumstat(72) lck_backend->lck_backend_tcp VBT_Recycle(264) lck_wq lck_wq lck_backend->lck_wq Pool_Task_Any(98) lck_backend->lck_wq Pool_Task(231) lck_waiter lck_waiter lck_backend_tcp->lck_waiter vwk_enter(147) lck_objhdr->lck_exp exp_mail_it(145) lck_hcb lck_hcb lck_objhdr->lck_hcb hcb_deref(405) lck_objhdr->lck_ban BAN_CheckObject(927) lck_objhdr->lck_ban BAN_CheckObject(948) lck_objhdr->lck_lru EXP_Rearm(299) lck_objhdr->lck_wq Pool_Task(231) lck_objhdr->lck_smp smp_oc_getobj(425) lck_objhdr? lck_objhdr? lck_ban->lck_objhdr? ban_lurker_getfirst(1029) lck_lru->lck_objhdr? EXP_NukeOne(352) lck_smp->lck_ban BAN_Reload(773) lck_smp->lck_ban BAN_TailRef(210) varnish-4.1.1/doc/html/_images/cache_fetch.svg0000644000201500234410000004040412652366773016201 00000000000000 cache_fetch cluster_backend RETRY RETRY v_b_f vbf_stp_startfetch: vcl_backend_fetch{} bereq.* abandon fetch RETRY->v_b_f v_b_f_BGFETCH BGFETCH v_b_f_BGFETCH->v_b_f v_b_f_FETCH FETCH v_b_f_FETCH->v_b_f v_b_f_FETCH->v_b_f v_b_hdrs send bereq, read beresp (headers) v_b_f:fetch:s->v_b_hdrs v_b_r vbf_stp_startfetch: vcl_backend_response{} bereq.* beresp.* retry max? ok? abandon deliver 304? other? v_b_hdrs->v_b_r v_b_e vbf_stp_error: vcl_backend_error{} bereq.* beresp.* retry max? ok? abandon deliver v_b_hdrs->v_b_e v_b_r:max->v_b_e v_b_r_retry RETRY v_b_r:retry->v_b_r_retry vbf_stp_condfetch vbf_stp_condfetch: copy obj attr steal body fetch_fail? ok? v_b_r:fetch_304:s->vbf_stp_condfetch vbf_stp_fetch vbf_stp_fetch: setup VFPs fetch fetch_fail? error? ok? v_b_r:non_304:s->vbf_stp_fetch FETCH_DONE FETCH_DONE v_b_e:deliver->FETCH_DONE "backend synth" FETCH_FAIL FETCH_FAIL v_b_e:max:s->FETCH_FAIL v_b_e_retry RETRY v_b_e:retry->v_b_e_retry vbf_stp_condfetch:ok:s->FETCH_DONE vbf_stp_fetch:ok:s->FETCH_DONE error error error->FETCH_FAIL abandon abandon abandon->FETCH_FAIL varnish-4.1.1/doc/html/_images/cache_req_fsm.svg0000644000201500234410000007525312652366773016556 00000000000000 cache_req_fsm cluster_backend acceptor Request received recv cnt_recv: vcl_recv{} req.* hash purge pass pipe synth acceptor->recv ESI_REQ ESI_REQ ESI_REQ->recv RESTART RESTART restart cnt_restart: ok? max_restarts? RESTART->restart pass cnt_pass: vcl_pass{} req.* fetch synth restart recv:pass->pass pipe cnt_pipe: filter req.*->bereq.* vcl_pipe{} req.* bereq.* pipe synth recv:pipe->pipe hash cnt_recv: vcl_hash{} req.* lookup recv:hash->hash recv:purge:s->hash SYNTH SYNTH synth cnt_synth: vcl_synth{} req.* resp.* deliver restart SYNTH->synth deliver cnt_deliver: Filter obj.->resp. vcl_deliver{} req.* resp.* restart deliver synth V1D_Deliver V1D_Deliver deliver:deliver:s->V1D_Deliver deliver:deliver:s->V1D_Deliver deliver:deliver:s->V1D_Deliver DONE DONE V1D_Deliver->DONE stream stream? body stream->V1D_Deliver synth:del:s->V1D_Deliver see backend graph see backend graph BGFETCH BGFETCH FETCH FETCH FETCH_DONE FETCH_DONE FETCH->FETCH_DONE FETCH_FAIL FETCH_FAIL FETCH->FETCH_FAIL FETCH_DONE->deliver FETCH_DONE->deliver FETCH_FAIL->synth lookup2 cnt_lookup: vcl_hit{} req.* obj.* deliver miss restart synth pass lookup2:deliver:s->deliver:n lookup2:deliver:s->BGFETCH parallel if obj expired miss cnt_miss: vcl_miss{} req.* fetch synth restart pass lookup2:miss:s->miss lookup2:pass:s->pass lookup cnt_lookup: hash lookup hit? miss? hit-for-pass? busy? lookup:h:s->lookup2 lookup:busy:e->lookup:top:e (waitinglist) lookup:miss:s->miss lookup:hfp:s->pass miss:fetch:s->FETCH miss:pass:s->pass pass:fetch:s->FETCH pipe_do send bereq, copy bytes until close pipe:pipe->pipe_do pipe_do->DONE restart:ok:s->recv err_restart SYNTH restart:max:s->err_restart hash:lookup:w->lookup purge cnt_purge: vcl_purge{} req.* synth restart hash:lookup:s->purge:top:n varnish-4.1.1/doc/html/glossary/0000755000201500234410000000000012652366773013561 500000000000000varnish-4.1.1/doc/html/glossary/index.html0000644000201500234410000001700212652366773015476 00000000000000 Varnish Glossary — Varnish version 4.1.1 documentation

Varnish Glossary¶

..
This file will be sorted automagically during formatting, so we keep the source in subject order to make sure we cover all bases.
backend
The HTTP server varnishd is caching for. This can be any sort of device that handles HTTP requests, including, but not limited to: a webserver, a CMS, a load-balancer another varnishd, etc.
backend response
The response specifically served from a backend to varnishd. The backend response may be manipulated in vcl_backend_response.
body
The bytes that make up the contents of the object, varnishd does not care if they are in HTML, XML, JPEG or even EBCDIC, to varnishd they are just bytes.
client
The program which sends varnishd an HTTP request, typically a browser, but do not forget to think about spiders, robots script-kiddies and criminals.
header
An HTTP protocol header, like "Accept-Encoding:".
hit
An object Varnish delivers from cache.
master (process)
One of the two processes in the varnishd program. The master process is a manager/nanny process which handles configuration, parameters, compilation of :term:VCL etc. but it does never get near the actual HTTP traffic.
miss
An object Varnish fetches from the backend before it is served to the client. The object may or may not be put in the cache, that depends.
object
The (possibly) cached version of a backend response. varnishd receives a response from the backend and creates an object, from which it may deliver cached responses to clients. If the object is created as a result of a request which is passed, it will not be stored for caching.
pass
An object Varnish does not try to cache, but simply fetches from the backend and hands to the client.
pipe
Varnish just moves the bytes between client and backend, it does not try to understand what they mean.
request
What the client sends to varnishd and varnishd sends to the backend.
response
What the backend returns to varnishd and varnishd returns to the client. When the response is stored in varnishd's cache, we call it an object.
varnishd (NB: with 'd')
This is the actual Varnish cache program. There is only one program, but when you run it, you will get two processes: The "master" and the "worker" (or "child").
varnishhist
Eye-candy program showing response time histogram in 1980s ASCII-art style.
varnishlog
Program which presents varnish transaction log in native format.
varnishncsa
Program which presents varnish transaction log in "NCSA" format.
varnishstat
Program which presents varnish statistics counters.
varnishtest
Program to test varnishd's behaviour with, simulates backend and client according to test-scripts.
varnishtop
Program which gives real-time "top-X" list view of transaction log.
VCL
Varnish Configuration Language, a small specialized language for instructing Varnish how to behave.
worker (process)
The worker process is started and configured by the master process. This is the process that does all the work you actually want varnish to do. If the worker dies, the master will try start it again, to keep your website alive.

Previous topic

Why Sphinx and reStructuredText ?

This Page

varnish-4.1.1/doc/html/genindex.html0000644000201500234410000001621012652366773014325 00000000000000 Index — Varnish version 4.1.1 documentation
varnish-4.1.1/doc/html/users-guide/0000755000201500234410000000000012652366773014152 500000000000000varnish-4.1.1/doc/html/users-guide/vcl-syntax.html0000644000201500234410000002126512652366773017076 00000000000000 VCL Syntax — Varnish version 4.1.1 documentation

VCL Syntax¶

VCL has inherited a lot from C and it reads much like simple C or Perl.

Blocks are delimited by curly braces, statements end with semicolons, and comments may be written as in C, C++ or Perl according to your own preferences.

Note that VCL doesn't contain any loops or jump statements.

This section provides an outline of the more important parts of the syntax. For a full documentation of VCL syntax please see VCL in the reference.

Strings¶

Basic strings are enclosed in " ... ", and may not contain newlines.

Backslash is not special, so for instance in regsub() you do not need to do the "count-the-backslashes" polka:

regsub("barf", "(b)(a)(r)(f)", "\4\3\2p") -> "frap"

Long strings are enclosed in {" ... "}. They may contain any character including ", newline and other control characters except for the NUL (0x00) character. If you really want NUL characters in a string there is a VMOD that makes it possible to create such strings.

Access control lists (ACLs)¶

An ACL declaration creates and initializes a named access control list which can later be used to match client addresses:

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

If an ACL entry specifies a host name which Varnish is unable to resolve, it will match any address it is compared to. Consequently, if it is preceded by a negation mark, it will reject any address it is compared to, which may not be what you intended. If the entry is enclosed in parentheses, however, it will simply be ignored.

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

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

Operators¶

The following operators are available in VCL. See the examples further down for, uhm, examples.

=
Assignment operator.
==
Comparison.
~
Match. Can either be used with regular expressions or ACLs.
!
Negation.
&&
Logical and
||
Logical or

Subroutines¶

A subroutine is used to group code for legibility or reusability:

sub pipe_if_local {
  if (client.ip ~ local) {
    return (pipe);
  }
}

Subroutines in VCL do not take arguments, nor do they return values.

To call a subroutine, use the call keyword followed by the subroutine's name:

call pipe_if_local;

Varnish has quite a few built in subroutines that are called for each transaction as it flows through Varnish. These builtin subroutines are all named vcl_*. Your own subroutines cannot start their name with vcl_.

Table Of Contents

Previous topic

VCL - Varnish Configuration Language

Next topic

Built in subroutines

This Page

varnish-4.1.1/doc/html/users-guide/vcl-variables.html0000644000201500234410000001275612652366773017525 00000000000000 Request and response VCL objects — Varnish version 4.1.1 documentation

Request and response VCL objects¶

In VCL, there several important objects that you need to be aware of. These objects can be accessed and manipulated using VCL.

req
The request object. When Varnish has received the request the req object is created and populated. Most of the work you do in vcl_recv you do on or with the req object.
bereq
The backend request object. Varnish contructs this before sending it to the backend. It is based on the req object.
beresp
The backend response object. It contains the headers of the object coming from the backend. If you want to modify the response coming from the server you modify this object in vcl_backend_response.
resp
The HTTP response right before it is delivered to the client. It is typically modified in vcl_deliver.
obj
The object as it is stored in cache. Read only.

Previous topic

Built in subroutines

Next topic

actions

This Page

varnish-4.1.1/doc/html/users-guide/troubleshooting.html0000644000201500234410000002735512652366773020223 00000000000000 Troubleshooting Varnish — Varnish version 4.1.1 documentation

Troubleshooting Varnish¶

Sometimes Varnish misbehaves or rather behaves the way you told it to behave but not necessarily the way you want it to behave. 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 good places where Varnish might leave clues of whats going on. This section will guide you through basic troubleshooting in Varnish.

When Varnish won't start¶

Sometimes Varnish wont start. There is a plethora of possible reasons why Varnish wont start on your machine. We've seen everything from wrong 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:

# varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1: 2000  -a 0.0.0.0:8080 -d

Notice the '-d' parameter. It will give you some more information on what is going on. Let us see how Varnish will react when something else is listening on its port.:

# varnishd -n foo -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000  -a 0.0.0.0:8080 -d
storage_malloc: max size 1024 MB.
Using old SHMFILE
Platform: Linux,2.6.32-21-generic,i686,-smalloc,-hcritbit
200 193
-----------------------------
Varnish Cache CLI.
-----------------------------
Type 'help' for command list.
Type 'quit' to close CLI session.
Type 'start' to launch worker process.

Now Varnish is running but only the master process is running, in debug mode the cache does not start. Now you're on the console. You can instruct the master process to start the cache by issuing "start".:

start
bind(): Address already in use
300 22
Could not open sockets

And here we have our problem. Something else is bound to the HTTP port of Varnish. If this doesn't help try strace or truss or come find us on IRC.

Varnish is crashing - panics¶

When Varnish goes bust the child processes crashes. Most of the crashes are caught by one of the many consistency checks we have included in the Varnish source code. When Varnish hits one of these the caching process will crash itself in a controlled manner, leaving a nice stack trace with the mother process.

You can inspect any panic messages by typing panic.show in the CLI.:

panic.show
Last panic at: Tue, 15 Mar 2011 13:09:05 GMT
Assert error in ESI_Deliver(), cache_esi_deliver.c line 354:
  Condition(i == Z_OK || i == Z_STREAM_END) not true.
thread = (cache-worker)
ident = Linux,2.6.32-28-generic,x86_64,-sfile,-smalloc,-hcritbit,epoll
Backtrace:
  0x42cbe8: pan_ic+b8
  0x41f778: ESI_Deliver+438
  0x42f838: RES_WriteObj+248
  0x416a70: cnt_deliver+230
  0x4178fd: CNT_Session+31d
  (..)

The crash might be due to misconfiguration or a bug. If you suspect it is a bug you can use the output in a bug report, see the "Trouble Tickets" section in the Introduction chapter above.

Varnish is crashing - segfaults¶

Sometimes a bug escapes the consistency checks and Varnish gets hit with a segmentation error. When this happens with the child process it is logged, the core is dumped and the child process starts up again.

A core dumped is usually due to a bug in Varnish. However, in order to debug a segfault the developers need you to provide a fair bit of data.

  • Make sure you have Varnish installed with debugging symbols.
  • Make sure core dumps are allowed in the parent shell. (ulimit -c unlimited)

Once you have the core you open it with gdb and issue the command bt to get a stack trace of the thread that caused the segfault.

Varnish gives me Guru meditation¶

First find the relevant log entries in varnishlog. That will probably give you a clue. Since varnishlog logs a lot of data it might be hard to track the entries down. You can set varnishlog to log all your 503 errors by issuing the following command:

$ varnishlog -q 'RespStatus == 503' -g request

If the error happened just a short time ago the transaction might still be in the shared memory log segment. To get varnishlog to process the whole shared memory log just add the '-d' parameter:

$ varnishlog -d -q 'RespStatus == 503' -g request

Please see the vsl-query and varnishlog man pages for elaborations on further filtering capabilities and explanation of the various options.

Varnish doesn't cache¶

See Achieving a high hitrate.

varnish-4.1.1/doc/html/users-guide/increasing-your-hitrate.html0000644000201500234410000006252212652366773021543 00000000000000 Achieving a high hitrate — Varnish version 4.1.1 documentation

Achieving a high hitrate¶

Now that Varnish is up and running you can access your web application through Varnish. Unless your application is specifically written to work behind a web accelerator you'll probably need to do some changes to either the configuration or the application in order to get a high hitrate in Varnish.

Varnish will not cache your data unless it's absolutely sure it is safe to do so. So, for you to understand how Varnish decides if and how to cache a page, we'll guide you through a couple of tools that you should find useful to understand what is happening in your Varnish setup.

Note that you need a tool to see the HTTP headers that fly between Varnish and the backend. On the Varnish server, the easiest way to do this is to use varnishlog and varnishtop but sometimes a client-side tool makes sense. Here are the ones we commonly use.

Tool: varnishtop¶

You can use varnishtop to identify what URLs are hitting the backend the most. varnishtop -i BereqURL is an essential command, showing you the top requests Varnish is sending to the backend. You can see some other examples of varnishtop usage in Statistics.

Tool: varnishlog¶

When you have identified an URL which is frequently sent to the backend you can use varnishlog to have a look at the request. varnishlog -q 'ReqURL ~ "^/foo/bar"' will show you the requests coming from the client matching /foo/bar.

For more information on how varnishlog works please see Logging in Varnish or then man page.

For extended diagnostics headers, see https://www.varnish-cache.org/trac/wiki/VCLExampleHitMissHeader

Tool: lwp-request¶

lwp-request is tool that is a part of The World-Wide Web library for Perl. It's a couple of really basic programs that can execute an HTTP request and show you the result. We mostly use the two programs, GET and HEAD.

vg.no was the first site to use Varnish and the people running Varnish there are quite clueful. So it's interesting to look at their HTTP Headers. Let's send a GET request for their home page:

$ GET -H 'Host: www.vg.no' -Used http://vg.no/
GET http://vg.no/
Host: www.vg.no
User-Agent: lwp-request/5.834 libwww-perl/5.834

200 OK
Cache-Control: must-revalidate
Refresh: 600
Title: VG Nett - Forsiden - VG Nett
X-Age: 463
X-Cache: HIT
X-Rick-Would-Never: Let you down
X-VG-Jobb: http://www.finn.no/finn/job/fulltime/result?keyword=vg+multimedia Merk:HeaderNinja
X-VG-Korken: http://www.youtube.com/watch?v=Fcj8CnD5188
X-VG-WebCache: joanie
X-VG-WebServer: leon

OK. Lets look at what GET does. GET usually sends off HTTP 0.9 requests, which lack the 'Host' header. So we add a 'Host' header with the '-H' option. '-U' print request headers, '-s' prints response status, '-e' prints response headers and '-d' discards the actual content. We don't really care about the content, only the headers.

As you can see, VG adds quite a bit of information in their headers. Some of the headers, like the 'X-Rick-Would-Never' are specific to vg.no and their somewhat odd sense of humour. Others, like the 'X-VG-Webcache' are for debugging purposes.

So, to check whether a site sets cookies for a specific URL, just do:

GET -Used http://example.com/ |grep ^Set-Cookie

Tool: Live HTTP Headers¶

There is also a plugin for Firefox called Live HTTP Headers. This plugin can show you what headers are being sent and received. Live HTTP Headers can be found at https://addons.mozilla.org/en-US/firefox/addon/3829/ or by googling "Live HTTP Headers".

The role of HTTP Headers¶

Along with each HTTP request and response comes a bunch of headers carrying metadata. Varnish will look at these headers to determine if it is appropriate to cache the contents and how long Varnish can keep the content cached.

Please note that when Varnish considers these headers Varnish actually considers itself part of the actual webserver. The rationale being that both are under your control.

The term surrogate origin cache is not really well defined by the IETF or RFC 2616 so the various ways Varnish works might differ from your expectations.

Let's take a look at the important headers you should be aware of:

Cookies¶

Varnish will, in the default configuration, not cache an object coming from the backend with a 'Set-Cookie' header present. Also, if the client sends a Cookie header, Varnish will bypass the cache and go directly to the backend.

This can be overly conservative. A lot of sites use Google Analytics (GA) to analyze their traffic. GA sets a cookie to track you. This cookie is used by the client side javascript and is therefore of no interest to the server.

Cookies from the client¶

For a lot of web applications it makes sense to completely disregard the cookies unless you are accessing a special part of the web site. This VCL snippet in vcl_recv will disregard cookies unless you are accessing /admin/:

if (!(req.url ~ "^/admin/")) {
    unset req.http.Cookie;
}

Quite simple. If, however, you need to do something more complicated, like removing one out of several cookies, things get difficult. Unfortunately Varnish doesn't have good tools for manipulating the Cookies. We have to use regular expressions to do the work. If you are familiar with regular expressions you'll understand whats going on. If you aren't we recommend that you either pick up a book on the subject, read through the pcrepattern man page, or read through one of many online guides.

Lets use the Varnish Software (VS) web as an example here. Very simplified the setup VS uses can be described as a Drupal-based backend with a Varnish cache in front. VS uses some cookies for Google Analytics tracking and similar tools. The cookies are all set and used by Javascript. Varnish and Drupal doesn't need to see those cookies and since Varnish will cease caching of pages when the client sends cookies Varnish will discard these unnecessary cookies in VCL.

In the following VCL we discard all cookies that start with an underscore:

# Remove has_js and Google Analytics __* cookies.
set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(_[_a-z]+|has_js)=[^;]*", "");
# Remove a ";" prefix, if present.
set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");

Lets look at an example where we remove everything except the cookies named "COOKIE1" and "COOKIE2" and you can marvel at the "beauty" of it:

sub vcl_recv {
    if (req.http.Cookie) {
        set req.http.Cookie = ";" + req.http.Cookie;
        set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
        set req.http.Cookie = regsuball(req.http.Cookie, ";(COOKIE1|COOKIE2)=", "; \1=");
        set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
        set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");

        if (req.http.Cookie == "") {
            unset req.http.Cookie;
        }
    }
}

A somewhat simpler example that can accomplish almost the same functionality can be found below. Instead of filtering out "other" cookies it instead picks out "the one" cookie that is needed, copies it to another header and then copies it back to the request, deleting the original cookie header.

sub vcl_recv {
    # save the original cookie header so we can mangle it
    set req.http.X-Varnish-PHP_SID = req.http.Cookie;
    # using a capturing sub pattern, extract the continuous string of
    # alphanumerics that immediately follows "PHPSESSID="
    set req.http.X-Varnish-PHP_SID =
       regsuball(req.http.X-Varnish-PHP_SID, ";? ?PHPSESSID=([a-zA-Z0-9]+)( |;| ;).*","\1");
    set req.http.Cookie = req.X-Varnish-PHP_SID;
    unset req.X-Varnish-PHP_SID;
}

There are other scary examples of what can be done in VCL in the Varnish Cache Wiki.

Cookies coming from the backend¶

If your backend server sets a cookie using the 'Set-Cookie' header Varnish will not cache the page when using the default configuration. A hit-for-pass object (see actions) is created. So, if the backend server acts silly and sets unwanted cookies just unset the 'Set-Cookie' header and all should be fine.

Cache-Control¶

The 'Cache-Control' header instructs caches how to handle the content. Varnish cares about the max-age parameter and uses it to calculate the TTL for an object.

So make sure you issue a 'Cache-Control' header with a max-age header. You can have a look at what Varnish Software's Drupal server issues:

$ GET -Used http://www.varnish-software.com/|grep ^Cache-Control
Cache-Control: public, max-age=600

Age¶

Varnish adds an 'Age' header to indicate how long the object has been kept inside Varnish. You can grep out 'Age' from varnishlog with varnishlog -I RespHeader:^Age.

Pragma¶

An HTTP 1.0 server might send the header Pragma: nocache. Varnish ignores this header. You could easily add support for this header in VCL.

In vcl_backend_response:

if (beresp.http.Pragma ~ "nocache") {
    set beresp.uncacheable = true;
    set beresp.ttl = 120s; # how long not to cache this url.
}

Authorization¶

If Varnish sees an 'Authorization' header it will pass the request. If this is not what you want you can unset the header.

Overriding the time-to-live (TTL)¶

Sometimes your backend will misbehave. It might, depending on your setup, be easier to override the TTL in Varnish then to fix your somewhat cumbersome backend.

You need VCL to identify the objects you want and then you set the 'beresp.ttl' to whatever you want:

sub vcl_backend_response {
    if (bereq.url ~ "^/legacy_broken_cms/") {
        set beresp.ttl = 5d;
    }
}

This example will set the TTL to 5 days for the old legacy stuff on your site.

Forcing caching for certain requests and certain responses¶

Since you still might have this cumbersome backend that isn't very friendly to work with you might want to override more stuff in Varnish. We recommend that you rely as much as you can on the default caching rules. It is perfectly easy to force Varnish to lookup an object in the cache but it isn't really recommended.

Normalizing your namespace¶

Some sites are accessed via lots of hostnames. http://www.varnish-software.com/, http://varnish-software.com/ and http://varnishsoftware.com/ all point at the same site. Since Varnish doesn't know they are the same, Varnish will cache different versions of every page for every hostname. You can mitigate this in your web server configuration by setting up redirects or by using the following VCL:

if (req.http.host ~ "(?i)^(www.)?varnish-?software.com") {
    set req.http.host = "varnish-software.com";
}

HTTP Vary¶

HTTP Vary is not a trivial concept. It is by far the most misunderstood HTTP header.

A lot of the response headers tell the client something about the HTTP object being delivered. Clients can request different variants of a HTTP object, based on their preference. Their preferences might cover stuff like encoding or language. When a client prefers UK English this is indicated through Accept-Language: en-uk. Caches need to keep these different variants apart and this is done through the HTTP response header 'Vary'.

When a backend server issues a Vary: Accept-Language it tells Varnish that its needs to cache a separate version for every different Accept-Language that is coming from the clients.

If two clients say they accept the languages "en-us, en-uk" and "da, de" respectively, Varnish will cache and serve two different versions of the page if the backend indicated that Varnish needs to vary on the 'Accept-Language' header.

Please note that the headers that 'Vary' refer to need to match exactly for there to be a match. So Varnish will keep two copies of a page if one of them was created for "en-us, en-uk" and the other for "en-us,en-uk". Just the lack of a whitespace will force Varnish to cache another version.

To achieve a high hitrate whilst using Vary is there therefore crucial to normalize the headers the backends varies on. Remember, just a difference in casing can force different cache entries.

The following VCL code will normalize the 'Accept-Language' header to either "en", "de" or "fr", in this order of precedence:

if (req.http.Accept-Language) {
    if (req.http.Accept-Language ~ "en") {
        set req.http.Accept-Language = "en";
    } elsif (req.http.Accept-Language ~ "de") {
        set req.http.Accept-Language = "de";
    } elsif (req.http.Accept-Language ~ "fr") {
        set req.http.Accept-Language = "fr";
    } else {
        # unknown language. Remove the accept-language header and
        # use the backend default.
        unset req.http.Accept-Language
    }
}

Vary parse errors¶

Varnish will return a "503 internal server error" page when it fails to parse the 'Vary' header, or if any of the client headers listed in the Vary header exceeds the limit of 65k characters. An 'SLT_Error' log entry is added in these cases.

Pitfall - Vary: User-Agent¶

Some applications or application servers send Vary: User-Agent along with their content. This instructs Varnish to cache a separate copy for every variation of 'User-Agent' there is and there are plenty. Even a single patchlevel of the same browser will generate at least 10 different 'User-Agent' headers based just on what operating system they are running.

So if you really need to vary based on 'User-Agent' be sure to normalize the header or your hit rate will suffer badly. Use the above code as a template.

varnish-4.1.1/doc/html/users-guide/vcl.html0000644000201500234410000001634012652366773015550 00000000000000 VCL - Varnish Configuration Language — Varnish version 4.1.1 documentation

VCL - Varnish Configuration Language¶

This section covers how to tell Varnish how to handle your HTTP traffic, using the Varnish Configuration Language (VCL).

Varnish has a great configuration system. Most other systems use configuration directives, where you basically turn on and off lots of switches. We have instead chosen to use a domain specific language called VCL for this.

Every inbound request flows through Varnish and you can influence how the request is being handled by altering the VCL code. You can direct certain requests to particular backends, you can alter the requests and the responses or have Varnish take various actions depending on arbitrary properties of the request or the response. This makes Varnish an extremely powerful HTTP processor, not just for caching.

Varnish translates VCL into binary code which is then executed when requests arrive. The performance impact of VCL is negligible.

The VCL files are organized into subroutines. The different subroutines are executed at different times. One is executed when we get the request, another when files are fetched from the backend server.

If you don't call an action in your subroutine and it reaches the end Varnish will execute some built-in VCL code. You will see this VCL code commented out in the file builtin.vcl that ships with Varnish Cache.

Previous topic

Sizing your cache

Next topic

VCL Syntax

This Page

varnish-4.1.1/doc/html/users-guide/esi.html0000644000201500234410000002113212652366773015537 00000000000000 Content composition with Edge Side Includes — Varnish version 4.1.1 documentation

Content composition with Edge Side Includes¶

Varnish can create web pages by assembling different pages, called fragments, together into one page. These fragments can have individual cache policies. If you have a web site with a list showing the five most popular articles on your site, this list can probably be cached as a fragment and included in all the other pages.

Used properly this strategy can dramatically increase your hit rate and reduce the load on your servers.

In Varnish we've only so far implemented a small subset of ESI. As of version 2.1 we have three ESI statements:

esi:include
esi:remove
<!--esi ...-->

Content substitution based on variables and cookies is not implemented but is on the roadmap. At least if you look at the roadmap from a certain angle. During a full moon.

Varnish will not process ESI instructions in HTML comments.

Example: esi:include¶

Lets see an example how this could be used. This simple cgi script outputs the date:

#!/bin/sh

echo 'Content-type: text/html'
echo ''
date "+%Y-%m-%d %H:%M"

Now, lets have an HTML file that has an ESI include statement:

<HTML>
<BODY>
The time is: <esi:include src="/cgi-bin/date.cgi"/>
at this very moment.
</BODY>
</HTML>

For ESI to work you need to activate ESI processing in VCL, like this:

sub vcl_backend_response {
    if (bereq.url == "/test.html") {
       set beresp.do_esi = true; // Do ESI processing
       set beresp.ttl = 24 h;    // Sets the TTL on the HTML above
    } elseif (bereq.url == "/cgi-bin/date.cgi") {
       set beresp.ttl = 1m;      // Sets a one minute TTL on
                                 // the included object
    }
}

Example: esi:remove and <!--esi ... -->¶

The <esi:remove> and <!--esi ... --> constructs can be used to present appropriate content whether or not ESI is available, for example you can include content when ESI is available or link to it when it is not. ESI processors will remove the start ("<!--esi") and the end ("-->") when the page is processed, while still processing the contents. If the page is not processed, it will remain intact, becoming a HTML/XML comment tag. ESI processors will remove <esi:remove> tags and all content contained in them, allowing you to only render the content when the page is not being ESI-processed. For example:

<esi:remove>
  <a href="http://www.example.com/LICENSE">The license</a>
</esi:remove>
<!--esi
<p>The full text of the license:</p>
<esi:include src="http://example.com/LICENSE" />
-->

Doing ESI on JSON and other non-XML'ish content¶

Please note that Varnish will peek at the included content. If it doesn't start with a "<" Varnish assumes you didn't really mean to include it and disregard it. You can alter this behaviour by setting the 'esi_syntax' parameter (see ref:ref-varnishd).

varnish-4.1.1/doc/html/users-guide/command-line.html0000644000201500234410000002063312652366773017327 00000000000000 Important command line arguments — Varnish version 4.1.1 documentation

Important command line arguments¶

There a two command line arguments you have to set when starting Varnish, these are: * what TCP port to serve HTTP from, and * where the backend server can be contacted.

If you have installed Varnish through using a provided operating system bound package, you will find the startup options here:

  • Debian, Ubuntu: /etc/default/varnish
  • Red Hat, Centos: /etc/sysconfig/varnish
  • FreeBSD: /etc/rc.conf (See also: /usr/local/etc/rc.d/varnishd)

'-a' listen_address¶

The '-a' argument defines what address Varnish should listen to, and service HTTP requests from.

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 to open and service as many of them as possible, but if none of them can be opened, varnishd will not start.

Here are some examples:

-a :80
-a localhost:80
-a 192.168.1.100:8080
-a '[fe80::1]:80'
-a '0.0.0.0:8080,[::]:8081'

If your webserver runs on the same machine, you will have to move it to another port number first.

'-f' VCL-file or '-b' backend¶

Varnish needs to know where to find the HTTP server it is caching for. You can either specify it with the '-b' argument, or you can put it in your own VCL file, specified with the '-f' argument.

Using '-b' is a quick way to get started:

-b localhost:81
-b thatotherserver.example.com:80
-b 192.168.1.2:80

Notice that if you specify a name, it can at most resolve to one IPv4 and one IPv6 address.

If you go with '-f', you can start with a VCL file containing just:

backend default {
        .host = "localhost:81";
}

which is exactly what '-b' does.

In both cases the built-in VCL code is appended.

Other options¶

Varnish comes with an abundance of useful command line arguments. We recommend that you study them but not necessary use them all, but to get started, the above will be sufficient.

By default Varnish will use 100 megabytes of malloc(3) storage for caching objects, if you want to cache more than that, you should look at the '-s' argument.

If you run a really big site, you may want to tune the number of worker threads and other parameters with the '-p' argument, but we generally advice not to do that unless you need to.

Before you go into production, you may also want to revisit the chapter Security first to see if you need to partition administrative privileges.

For a complete list of the command line parameters please see OPTIONS.

Table Of Contents

Previous topic

Security first

Next topic

CLI - bossing Varnish around

This Page

varnish-4.1.1/doc/html/users-guide/vcl-example-websockets.html0000644000201500234410000001153312652366773021347 00000000000000 Adding WebSockets support — Varnish version 4.1.1 documentation

Adding WebSockets support¶

WebSockets is a technology for creating a bidirectional stream-based channel over HTTP.

To run WebSockets through Varnish you need to pipe it as follows:

sub vcl_recv {
    if (req.http.upgrade ~ "(?i)websocket") {
        return (pipe);
    }
}

Previous topic

ACLs

Next topic

Device detection

This Page

varnish-4.1.1/doc/html/users-guide/vcl-actions.html0000644000201500234410000001300612652366773017202 00000000000000 actions — Varnish version 4.1.1 documentation

actions¶

The most common actions to return are these:

pass
When you return pass the request and subsequent response will be passed to and from the backend server. It won't be cached. pass can be returned from vcl_recv.
hash
When you return hash from vcl_recv you tell Varnish to deliver content from cache even if the request othervise indicates that the request should be passed.

pipe

deliver
Deliver the object to the client. Usually returned from vcl_backend_response.
restart
Restart processing of the request. You can restart the processing of the whole transaction. Changes to the req object are retained.
retry
Retry the request against the backend. This can be returned from vcl_backend_response or vcl_backend_error if you don't like the response that the backend delivered.

Previous topic

Request and response VCL objects

Next topic

Backend servers

This Page

varnish-4.1.1/doc/html/users-guide/index.html0000644000201500234410000002575012652366773016100 00000000000000 The Varnish Users Guide — Varnish version 4.1.1 documentation

The Varnish Users Guide¶

The Varnish documentation consists of three main documents:

After The Big Varnish Picture, this Users Guide is organized in sections following the major interfaces to Varnish as a service:

Starting and running Varnish is about getting Varnish configured, with respect to storage, sockets, security and how you can control and communicate with Varnish once it is running.

VCL - Varnish Configuration Language is about getting Varnish to handle the HTTP requests the way you want, what to cache, how to cache it, modifying HTTP headers etc. etc.

Reporting and statistics explains how you can monitor what Varnish does, from a transactional level to aggregating statistics.

Varnish and Website Performance is about tuning your website with Varnish.

Troubleshooting Varnish is for locating and fixing common issues with Varnish.

Previous topic

Now what?

Next topic

The Big Varnish Picture

This Page

varnish-4.1.1/doc/html/users-guide/vcl-grace.html0000644000201500234410000001656312652366773016636 00000000000000 Misbehaving servers — Varnish version 4.1.1 documentation

Misbehaving servers¶

A key feature of Varnish is its ability to shield you from misbehaving web- and application servers.

Grace mode¶

When several clients are requesting the same page Varnish will send one request to the backend and place the others on hold while fetching one copy from the backend. In some products this is called request coalescing and Varnish does this automatically.

If you are serving thousands of hits per second the queue of waiting requests can get huge. There are two potential problems - one is a thundering herd problem - suddenly releasing a thousand threads to serve content might send the load sky high. Secondly - nobody likes to wait. To deal with this we can instruct Varnish to keep the objects in cache beyond their TTL and to serve the waiting requests somewhat stale content.

So, in order to serve stale content we must first have some content to serve. So to make Varnish keep all objects for 2 minutes beyond their TTL use the following VCL:

sub vcl_backend_response {
  set beresp.grace = 2m;
}

Now Varnish will be allowed to serve objects that are up to two minutes out of date. When it does it will also schedule a refresh of the object. This will happen asynchronously and the moment the new object is in it will replace the one we've already got.

You can influence how this logic works by adding code in vcl_hit. The default looks like this:

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, deliver it
       // Automatically triggers a background fetch
       return (deliver);
   }
   // fetch & deliver once we get the result
   return (fetch);
}

The grace logic is pretty obvious here. If you have enabled Health checks you can check if the backend is sick and only serve graced object then. Replace the second if-clause with something like this:

if (!std.healthy(req.backend_hint) && (obj.ttl + obj.grace > 0s)) {
      return (deliver);
} else {
      return (fetch);
}
So, to sum up, grace mode solves two problems:
  • it serves stale content to avoid request pile-up.
  • it serves stale content if you allow it.

Table Of Contents

Previous topic

Hashing

Next topic

Using inline C to extend Varnish

This Page

varnish-4.1.1/doc/html/users-guide/vcl-example-manipulating-responses.html0000644000201500234410000001230612652366773023704 00000000000000 Altering the backend response — Varnish version 4.1.1 documentation

Altering the backend response¶

Here we override the TTL of a object coming from the backend if it matches certain criteria:

sub vcl_backend_response {
   if (bereq.url ~ "\.(png|gif|jpg)$") {
     unset beresp.http.set-cookie;
     set beresp.ttl = 1h;
  }
}

We also remove any Set-Cookie headers in order to avoid a hit-for-pass object to be created. See actions.

Previous topic

Manipulating request headers in VCL

Next topic

ACLs

This Page

varnish-4.1.1/doc/html/users-guide/params.html0000644000201500234410000001325412652366773016250 00000000000000 Parameters — Varnish version 4.1.1 documentation

Parameters¶

Varnish Cache comes with a set of parameters that affects behaviour and performance. Most of these parameters can be set on the Varnish command line (through varnishadm) using the param.set keyword.

Some parameters can, for security purposes be read only using the '-r' command line switch to varnishd.

We don't recommend that you tweak parameters unless you're sure of what you're doing. We've worked hard to make the defaults sane and Varnish should be able to handle most workloads with the default settings.

For a complete listing of all the parameters and a short descriptions type param.show in the CLI. To inspect a certain parameter and get a somewhat longer description on what it does and what the default is type param.show and the name of the parameter, like this:

varnish> param.show shortlived
200
shortlived                  10.000000 [s]
                            Default is 10.0
                            Objects created with TTL shorter than this are
                            always put in transient storage.

Previous topic

Storage backends

Next topic

Sizing your cache

This Page

varnish-4.1.1/doc/html/users-guide/compression.html0000644000201500234410000002526712652366773017335 00000000000000 Compression — Varnish version 4.1.1 documentation

Compression¶

In Varnish 3.0 we introduced native support for compression, using gzip encoding. Before 3.0, Varnish would never compress objects.

In Varnish 4.0 compression defaults to "on", meaning that it tries to be smart and do the sensible thing.

If you don't want Varnish tampering with the encoding you can disable compression all together by setting the parameter http_gzip_support to false. Please see man varnishd for details.

Default behaviour¶

The default behaviour is active when the http_gzip_support parameter is set to "on" and neither beresp.do_gzip nor beresp.do_gunzip are used in VCL.

Unless returning from vcl_recv with pipe or pass, Varnish modifies req.http.Accept-Encoding: if the client supports gzip req.http.Accept-Encoding is set to "gzip", otherwise the header is removed.

Unless the request is a pass, Varnish sets bereq.http.Accept-Encoding to "gzip" before vcl_backend_fetch runs, so the header can be changed in VCL.

If the server responds with gzip'ed content it will be stored in memory in its compressed form and Accept-Encoding will be added to the Vary header.

To clients supporting gzip, compressed content is delivered unmodified.

For clients not supporting gzip, compressed content gets decompressed on the fly while delivering it. The Content-Encoding response header gets removed and any Etag gets weakened (by prepending "W/").

For Vary Lookups, Accept-Encoding is ignored.

Compressing content if backends don't¶

You can tell Varnish to compress content before storing it in cache in vcl_backend_response by setting beresp.do_gzip to "true", like this:

sub vcl_backend_response {
    if (beresp.http.content-type ~ "text") {
        set beresp.do_gzip = true;
    }
}

With beresp.do_gzip set to "true", Varnish will make the following changes to the headers of the resulting object before inserting it in the cache:

  • set obj.http.Content-Encoding to "gzip"
  • add "Accept-Encoding" to obj.http.Vary, unless already present
  • weaken any Etag (by prepending "W/")

Generally, Varnish doesn't use much CPU so it might make more sense to have Varnish spend CPU cycles compressing content than doing it in your web- or application servers, which are more likely to be CPU-bound.

Please make sure that you don't try to compress content that is uncompressable, like JPG, GIF and MP3 files. You'll only waste CPU cycles.

Uncompressing content before entering the cache¶

You can also uncompress content before storing it in cache by setting beresp.do_gunzip to "true". One use case for this feature is to work around badly configured backends uselessly compressing already compressed content like JPG images (but fixing the misbehaving backend is always the better option).

With beresp.do_gunzip set to "true", Varnish will make the following changes to the headers of the resulting object before inserting it in the cache:

  • remove obj.http.Content-Encoding
  • weaken any Etag (by prepending "W/")

GZIP and ESI¶

If you are using Edge Side Includes (ESI) you'll be happy to note that ESI and GZIP work together really well. Varnish will magically decompress the content to do the ESI-processing, then recompress it for efficient storage and delivery.

Turning off gzip support¶

When the http_gzip_support parameter is set to "off", Varnish does not do any of the header alterations documented above, handles Vary: Accept-Encoding like it would for any other Vary value and ignores beresp.do_gzip and beresp.do_gunzip.

A random outburst¶

Poul-Henning Kamp has written How GZIP, and GZIP+ESI works in Varnish which talks a bit more about how the implementation works.

varnish-4.1.1/doc/html/users-guide/vcl-example-manipulating-headers.html0000644000201500234410000001246112652366773023300 00000000000000 Manipulating request headers in VCL — Varnish version 4.1.1 documentation

Manipulating request headers in VCL¶

Lets say we want to remove the cookie for all objects in the /images directory of our web server:

sub vcl_recv {
  if (req.url ~ "^/images") {
    unset req.http.cookie;
  }
}

Now, when the request is handled to the backend server there will be no cookie header. The interesting line is the one with the if-statement. It matches the URL, taken from the request object, and matches it against the regular expression. Note the match operator. If it matches the Cookie: header of the request is unset (deleted).

Previous topic

VCL Examples

Next topic

Altering the backend response

This Page

varnish-4.1.1/doc/html/users-guide/run_security.html0000644000201500234410000003663612652366773017531 00000000000000 Security first — Varnish version 4.1.1 documentation

Security first¶

If you are the only person involved in running Varnish, or if all the people involved are trusted to the same degree, you can skip this chapter. We have protected Varnish as well as we can from anything which can come in through an HTTP socket.

If parts of your web infrastructure are outsourced or otherwise partitioned along administrative lines, you need to think about security.

Varnish provides four levels of authority, roughly related to how and where control comes into Varnish:

  • The command line arguments,
  • The CLI interface,
  • VCL programs, and
  • HTTP requests.

Command line arguments¶

The top level security decisions is decided and defined when starting Varnish in the form of command line arguments, we use this strategy in order to make them invulnerable to subsequent manipulation.

The important decisions to make are:

  1. Who should have access to the Command Line Interface?
  2. Which parameters can they change?
  3. Will inline-C code be allowed?
  4. If/how VMODs will be restricted?
  5. How child processes will be jailed?

CLI interface access¶

The command line interface can be accessed in three ways.

varnishd can be told to listen and offer CLI connections on a TCP socket. You can bind the socket to pretty much anything the kernel will accept:

-T 127.0.0.1:631
-T localhost:9999
-T 192.168.1.1:34
-T '[fe80::1]:8082'

The default is -T localhost:0 which will pick a random port number, which varnishadm(8) can learn from the shared memory.

By using a "localhost" address, you restrict CLI access to the local machine.

You can also bind the CLI port to an IP address reachable across the net, and let other machines connect directly.

This gives you no secrecy, i.e. the CLI commands will go across the network as ASCII text with no encryption, but the -S/PSK authentication requires the remote end to know the shared secret.

Alternatively you can bind the CLI port to a 'localhost' address, and give remote users access via a secure connection to the local machine, using ssh/VPN or similar.

If you use ssh you can restrict which commands each user can execute to just varnishadm, or even use a wrapper scripts around varnishadm to 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.

The connection in this case is also without encryption, but the remote end must still authenticate using -S/PSK.

Finally, if you run varnishd with the '-d' option, you get a CLI command on stdin/stdout, but since you started the process, it would be hard to prevent you getting CLI access, wouldn't it ?

CLI interface authentication¶

By default the CLI interface is protected with a simple, yet powerful "Pre Shared Key" authentication method, which do not provide secrecy (ie: The CLI commands and responses are not encrypted).

The way -S/PSK works is really simple: During startup a file is created with a random content and the file is only accessible to the user who started varnishd (or the superuser).

To authenticate and use a CLI connection, you need to know the contents of that file, in order to answer the cryptographic challenge varnishd issues, see How -S/PSK Authentication Works.

varnishadm uses all of this to restrict access, it will only function, provided it can read the secret file.

If you want to allow other users, local or remote, to be able to access CLI connections, you must create your own secret file and make it possible for (only!) these users to read it.

A good way to create the secret file is:

dd if=/dev/random of=/etc/varnish_secret count=1

When you start varnishd, you specify the filename with '-S', and it goes without saying that the varnishd master process needs to be able to read the file too.

You can change the contents of the secret file while varnishd runs, it is read every time a CLI connection is authenticated.

On the local system, varnishadm can retrieve the filename from shared memory, but on remote systems, you need to give varnishadm a copy of the secret file, with the -S argument.

If you want to disable -S/PSK authentication, specify '-S' with an empty argument to varnishd:

varnishd [...] -S "" [...]

Parameters¶

Parameters can be set from the command line, and made "read-only" (using '-r') so they cannot subsequently be modified from the CLI interface.

Pretty much any parameter can be used to totally mess up your HTTP service, but a few can do more damage than others:

cc_command
Execute arbitrary programs
vcc_allow_inline_c
Allow inline C in VCL, which would any C code from VCL to be executed by Varnish.

Furthermore you may want to look at and lock down:

syslog_cli_traffic
Log all CLI commands to syslog(8), so you know what goes on.
vcc_unsafe_path
Restrict VCL/VMODS to vcl_dir and vmod_dir
vmod_dir
The directory where Varnish will will look for modules. This could potentially be used to load rouge modules into Varnish.

The CLI interface¶

The CLI interface in Varnish is very powerful, if you have access to the CLI interface, you can do almost anything to the Varnish process.

As described above, some of the damage can be limited by restricting certain parameters, but that will only protect the local filesystem, and operating system, it will not protect your HTTP service.

We do not currently have a way to restrict specific CLI commands to specific CLI connections. One way to get such an effect is to "wrap" all CLI access in pre-approved scripts which use varnishadm(1)

to submit the sanitized CLI commands, and restrict a remote user to only those scripts, for instance using sshd(8)'s configuration.

VCL programs¶

There are two "dangerous" mechanisms available in VCL code: VMODs and inline-C.

Both of these mechanisms allow execution of arbitrary code and will thus allow a person to get access to the machine, with the privileges of the child process.

If varnishd is started as root/superuser, we sandbox the child process, using whatever facilities are available on the operating system, but if varnishd is not started as root/superuser, this is not possible. No, don't ask me why you have to be superuser to lower the privilege of a child process...

Inline-C is disabled by default starting with Varnish version 4, so unless you enable it, you don't have to worry about it.

The parameters mentioned above can restrict the loading of VMODs to only be loaded from a designated directory, restricting VCL wranglers to a pre-approved subset of VMODs.

If you do that, we are confident that your local system cannot be compromised from VCL code.

HTTP requests¶

We have gone to great lengths to make Varnish resistant to anything coming in through the socket where HTTP requests are received, and you should, generally speaking, not need to protect it any further.

The caveat is that since VCL is a programming language which lets you decide exactly what to do with HTTP requests, you can also decide to do stupid and potentially dangerous things with them, including opening yourself up to various kinds of attacks and subversive activities.

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 (ACLs).

varnish-4.1.1/doc/html/users-guide/operation-statistics.html0000644000201500234410000001750112652366773021154 00000000000000 Statistics — Varnish version 4.1.1 documentation

Statistics¶

Varnish comes with a couple of nifty and very useful statistics generating tools that generates statistics in real time by constantly updating and presenting a specific dataset by aggregating and analyzing logdata from the shared memory logs.

varnishtop¶

The varnishtop utility reads the shared memory logs and presents a continuously updated list of the most commonly occurring log entries.

With suitable filtering using the -I, -i, -X and -x options, it can be used to display a ranking of requested documents, clients, user agents, or any other information which is recorded in the log.

varnishtop -i ReqURL will show you what URLs are being asked for by the client. varnishtop -i BereqURL will show you what your backend is being asked the most. varnishtop -I ReqHeader:Accept-Encoding will show the most popular Accept-Encoding header the client are sending you.

varnishhist¶

The varnishhist utility reads varnishd shared memory logs and 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 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 ("#").

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.

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.

Table Of Contents

Previous topic

Logging in Varnish

Next topic

Varnish and Website Performance

This Page

varnish-4.1.1/doc/html/users-guide/storage-backends.html0000644000201500234410000002463412652366773020205 00000000000000 Storage backends — Varnish version 4.1.1 documentation

Storage backends¶

Intro¶

Varnish has pluggable storage backends. It can store data in various backends which can have different performance characteristics. The default configuration is to use the malloc backend with a limited size. For a serious Varnish deployment you probably would want to adjust the storage settings.

malloc¶

syntax: malloc[,size]

Malloc is a memory based backend. Each object will be allocated from memory. If your system runs low on memory swap will be used.

Be aware that the size limitation only limits the actual storage and that the approximately 1k of memory per object, used for various internal structures, is included in the actual storage as well.

The size parameter specifies the maximum amount of memory varnishd will allocate. The size is assumed to be in bytes, unless followed by one of the following suffixes:

K, k The size is expressed in kibibytes.

M, m The size is expressed in mebibytes.

G, g The size is expressed in gibibytes.

T, t The size is expressed in tebibytes.

The default size is unlimited.

malloc's performance is bound to memory speed so it is very fast. If the dataset is bigger than available memory performance will depend on the operating systems ability to page effectively.

file¶

syntax: file[,path[,size[,granularity]]]

The file backend stores objects in memory backed by an unlinked file on disk with mmap.

The 'path' parameter specifies either the path to the backing file or the path to a directory in which varnishd will create the backing file. The default is /tmp.

The size parameter specifies the size of the backing file. The size is assumed to be in bytes, unless followed by one of the following suffixes:

K, k The size is expressed in kibibytes.

M, m The size is expressed in mebibytes.

G, g The size is expressed in gibibytes.

T, t The size is expressed in tebibytes.

If 'path' points to an existing file and no size is specified, the size of the existing file will be used. If 'path' does not point to an existing file it is an error to not specify the size.

If the backing file already exists, it will be truncated or expanded to the specified size.

Note that if varnishd has to create or expand the file, it will not pre-allocate the added space, leading to fragmentation, which may adversely impact performance on rotating hard drives. Pre-creating the storage file using dd(1) will reduce fragmentation to a minimum.

The 'granularity' parameter specifies the granularity of allocation. All allocations are rounded up to this size. The granularity is is assumed to be expressed in bytes, unless followed by one of the suffixes described for size.

The default granularity is the VM page size. The size should be reduced if you have many small objects.

File performance is typically limited to the write speed of the device, and depending on use, the seek time.

persistent (experimental)¶

syntax: persistent,path,size {experimental}

Persistent storage. Varnish will store objects in a file in a manner that will secure the survival of most of the objects in the event of a planned or unplanned shutdown of Varnish.

The 'path' parameter specifies the path to the backing file. If the file doesn't exist Varnish will create it.

The 'size' parameter specifies the size of the backing file. The size is expressed in bytes, unless followed by one of the following suffixes:

K, k The size is expressed in kibibytes.

M, m The size is expressed in mebibytes.

G, g The size is expressed in gibibytes.

T, t The size is expressed in tebibytes.

Varnish will split the file into logical silos and write to the silos in the manner of a circular buffer. Only one silo will be kept open at any given point in time. Full silos are sealed. When Varnish starts after a shutdown it will discard the content of any silo that isn't sealed.

Note that taking persistent silos offline and at the same time using bans can cause problems. This is due to the fact that bans added while the silo was offline will not be applied to the silo when it reenters the cache. Consequently enabling previously banned objects to reappear.

Transient Storage¶

If you name any of your storage backend "Transient" it will be used for transient (short lived) objects. This includes the temporary objects created when returning a synthetic object. By default Varnish would use an unlimited malloc backend for this.

Varnish will consider an object short lived if the TTL is below the parameter 'shortlived'.

Table Of Contents

Previous topic

CLI - bossing Varnish around

Next topic

Parameters

This Page

varnish-4.1.1/doc/html/users-guide/performance.html0000644000201500234410000002246412652366773017271 00000000000000 Varnish and Website Performance — Varnish version 4.1.1 documentation

Varnish and Website Performance¶

This section focuses on how to tune the performance of your Varnish server, and how to tune the performance of your website using Varnish.

The section is split in three subsections. The first subsection deals with the various tools and functions of Varnish that you should be aware of. The next subsection focuses on the how to purge content out of your cache. Purging of content is essential in a performance context because it allows you to extend the time-to-live (TTL) of your cached objects. Having a long TTL allows Varnish to keep the content in cache longer, meaning Varnish will make fewer requests to your relativly slower backend.

The final subsection deals with compression of web content. Varnish can gzip content when fetching it from the backend and then deliver it compressed. This will reduce the time it takes to download the content thereby increasing the performance of your website.

Previous topic

Statistics

Next topic

Achieving a high hitrate

This Page

varnish-4.1.1/doc/html/users-guide/vcl-inline-c.html0000644000201500234410000001226212652366773017243 00000000000000 Using inline C to extend Varnish — Varnish version 4.1.1 documentation

Using inline C to extend Varnish¶

(Here there be dragons. Big and mean ones.)

You can use inline C to extend Varnish. Please note that you can seriously mess up Varnish this way. The C code runs within the Varnish Cache process so if your code generates a segfault the cache will crash.

One of the first uses of inline C was logging to syslog.:

# The include statements must be outside the subroutines.
C{
        #include <syslog.h>
}C

sub vcl_something {
        C{
                syslog(LOG_INFO, "Something happened at VCL line XX.");
        }C
}

To use inline C you need to enable it with the vcc_allow_inline_c parameter.

Previous topic

Misbehaving servers

Next topic

VCL Examples

This Page

varnish-4.1.1/doc/html/users-guide/vcl-built-in-subs.html0000644000201500234410000006607112652366773020251 00000000000000 Built in subroutines — Varnish version 4.1.1 documentation

Built in subroutines¶

Various built-in subroutines are called during processing of client- and backend requests as well as upon vcl.load and vcl.discard.

See Varnish Processing States for a defailed graphical overview of the states and how they relate to core code functions and VCL subroutines.

client side¶

vcl_recv¶

Called at the beginning of a request, after the complete request has been received and parsed, after a restart or as the result of an ESI include.

Its purpose is to decide whether or not to serve the request, possibly modify it and decide on how to process it further. A backend hint may be set as a default for the backend processing side.

The vcl_recv subroutine may terminate with calling return() on one of the following keywords:

hash
Continue processing the object as a potential candidate for caching. Passes the control over to vcl_hash.
pass
Switch to pass mode. Control will eventually pass to vcl_pass.
pipe
Switch to pipe mode. Control will eventually pass to vcl_pipe.
synth(status code, reason)
Transition to vcl_synth with resp.status and resp.reason being preset to the arguments of synth().
purge
Purge the object and it's variants. Control passes through vcl_hash to vcl_purge.

vcl_pipe¶

Called upon entering pipe mode. In this mode, the request is passed on to the backend, and any further data from both the client and backend is passed on unaltered until either end closes the connection. Basically, Varnish will degrade into a simple TCP proxy, shuffling bytes back and forth. For a connection in pipe mode, no other VCL subroutine will ever get called after vcl_pipe.

The vcl_pipe subroutine may terminate with calling return() with one of the following keywords:

pipe
Proceed with pipe mode.
synth(status code, reason)
Transition to vcl_synth with resp.status and resp.reason being preset to the arguments of synth().

vcl_pass¶

Called upon entering pass mode. In this mode, the request is passed 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:

fetch
Proceed with pass mode - initiate a backend request.
restart
Restart the transaction. Increases the restart counter. If the number of restarts is higher than max_restarts Varnish emits a guru meditation error.
synth(status code, reason)
Transition to vcl_synth with resp.status and resp.reason being preset to the arguments of synth().

vcl_hit¶

Called when a cache lookup is successful. The object being hit may be stale: It can have a zero or negative ttl with only grace or keep time left.

The vcl_hit subroutine may terminate with calling return() with one of the following keywords:

deliver
Deliver the object. If it is stale, a background fetch to refresh it is triggered.
miss
Synchronously refresh the object from the backend despite the cache hit. Control will eventually pass to vcl_miss.
pass
Switch to pass mode. Control will eventually pass to 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 error.
synth(status code, reason)
Transition to vcl_synth with resp.status and resp.reason being preset to the arguments of synth().
fetch (deprecated)
same as miss. Will get removed in a future version, triggers a VCL_Error log message.

vcl_miss¶

Called after a cache lookup if the requested document was not found in the cache or if vcl_hit returned fetch.

Its purpose is to decide whether or not to attempt to retrieve the document from the backend. A backend hint may be set as a default for the backend processing side.

The vcl_miss subroutine may terminate with calling return() with one of the following keywords:

fetch
Retrieve the requested object from the backend. Control will eventually pass to vcl_backend_fetch.
pass
Switch to pass mode. Control will eventually pass to 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 error.
synth(status code, reason)
Transition to vcl_synth with resp.status and resp.reason being preset to the arguments of synth().

vcl_hash¶

Called after vcl_recv to create a hash value for the request. This is used as a key to look up the object in Varnish.

The vcl_hash subroutine may only terminate with calling return(lookup):

lookup
Look up the object in cache. Control passes to vcl_purge when coming from a purge return in vcl_recv. Otherwise control passes to vcl_hit, vcl_miss or vcl_pass if the cache lookup result was a hit, a miss or hit on a hit-for-pass object (object with obj.uncacheable == true), respectively.

vcl_purge¶

Called after the purge has been executed and all its variants have been evited.

The vcl_purge subroutine may terminate with calling return() with one of the following keywords:

restart
Restart the transaction. Increases the restart counter. If the number of restarts is higher than max_restarts Varnish emits a guru meditation error.
synth(status code, reason)
Transition to vcl_synth with resp.status and resp.reason being preset to the arguments of synth().

vcl_deliver¶

Called before any object except a vcl_synth result is delivered to the client.

The vcl_deliver subroutine may terminate with calling return() with one of the following keywords:

deliver
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 error.
synth(status code, reason)
Transition to vcl_synth with resp.status and resp.reason being preset to the arguments of synth().

vcl_synth¶

Called to deliver a synthetic object. A synthetic object is generated in VCL, not fetched from the backend. Its body may be contructed using the synthetic() function.

A vcl_synth defined object never enters the cache, contrary to a vcl_backend_error defined object, which may end up in cache.

The subroutine may terminate with calling return() with one of the following keywords:

deliver
Directly deliver the object defined by vcl_synth to the client without calling 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 error.

Backend Side¶

vcl_backend_fetch¶

Called before sending the backend request. In this subroutine you typically alter the request before it gets to the backend.

The vcl_backend_fetch subroutine may terminate with calling return() with one of the following keywords:

fetch
Fetch the object from the backend.
abandon
Abandon the backend request. Unless the backend request was a background fetch, control is passed to vcl_synth on the client side with resp.status preset to 503.

vcl_backend_response¶

Called after the response headers have been successfully retrieved from the backend.

For a 304 response, varnish core code amends beresp before calling vcl_backend_response:

  • If the gzip status changed, Content-Encoding is unset and any Etag is weakened
  • Any headers not present in the 304 response are copied from the existing cache object. Content-Length is copied if present in the existing cache object and discarded otherwise.
  • The status gets set to 200.

beresp.was_304 marks that this conditional response processing has happened.

Note: Backend conditional requests are independend of client conditional requests, so clients may receive 304 responses no matter if a backend request was conditional.

The vcl_backend_response subroutine may terminate with calling return() with one of the following keywords:

deliver
For a 304 response, create an updated cache object. Otherwise, fetch the object body from the backend and initiate delivery to any waiting client requests, possibly in parallel (streaming).
abandon
Abandon the backend request. Unless the backend request was a background fetch, control is passed to vcl_synth on the client side with resp.status preset to 503.
retry
Retry the backend transaction. Increases the retries counter. If the number of retries is higher than max_retries, control will be passed to vcl_backend_error.

vcl_backend_error¶

This subroutine is called if we fail the backend fetch or if max_retries has been exceeded.

A synthetic object is generated in VCL, whose body may be contructed using the synthetic() function.

The vcl_backend_error subroutine may terminate with calling return() with one of the following keywords:

deliver
Deliver and possibly cache the object defined in vcl_backend_error as if it was fetched from the backend, also referred to as a "backend synth".
retry
Retry the backend transaction. Increases the retries counter. If the number of retries is higher than max_retries, vcl_synth on the client side is called with resp.status preset to 503.

vcl.load / vcl.discard¶

vcl_init¶

Called when VCL is loaded, before any requests pass through it. Typically used to initialize VMODs.

The vcl_init subroutine may terminate with calling return() with one of the following keywords:

ok
Normal return, VCL continues loading.
fail
Abort loading of this VCL.

vcl_fini¶

Called when VCL is discarded only after all requests have exited the VCL. Typically used to clean up VMODs.

The vcl_fini subroutine may terminate with calling return() with one of the following keywords:

ok
Normal return, VCL will be discarded.
varnish-4.1.1/doc/html/users-guide/operation-logging.html0000644000201500234410000001635012652366773020411 00000000000000 Logging in Varnish — Varnish version 4.1.1 documentation

Logging in Varnish¶

One of the really nice features in Varnish is the way logging works. Instead of logging to a normal log file Varnish logs to a shared memory segment, called the VSL - the Varnish Shared Log. When the end of the segment is reached we start over, overwriting old data.

This is much, much faster than logging to a file and it doesn't require disk space. Besides it gives you much, much more information when you need it.

The flip side is that if you forget to have a program actually write the logs to disk they will be overwritten.

varnishlog is one of the programs you can use to look at what Varnish is logging. varnishlog gives you the raw logs, everything that is written to the logs. There are other clients that can access the logs as well, we'll show you these later.

In the terminal window you started Varnish now type varnishlog -g raw and press enter.

You'll see lines like these scrolling slowly by.:

0 CLI            - Rd ping
0 CLI            - Wr 200 19 PONG 1273698726 1.0

These is the Varnish master process checking up on the caching process 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.:

11 SessOpen       c 127.0.0.1 58912 :8080 0.0.0.0 8080 1273698726.933590 14
11 ReqStart       c 127.0.0.1 58912
11 ReqMethod      c GET
11 ReqURL         c /
11 ReqProtocol    c HTTP/1.1
11 ReqHeader      c Host: localhost:8080
11 ReqHeader      c Connection: keep-alive

The first column is an arbitrary number, it identifies the transaction. Lines with the same number are coming from the same transaction. The second column is the tag of the log message. All log entries are tagged with a tag indicating what sort of activity is being logged.

The third column tell us whether this is is data coming from or going to the client ('c'), or the backend ('b'). The forth column is the data being logged.

Now, you can filter quite a bit with varnishlog. The basic options we think you want to know are:

'-b'
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'
Same as '-b' but for client side traffic.
'-g request'
Group transactions by request.
'-q query'
Only list transactions matching this query.

For more information on this topic please see varnishlog.

Previous topic

Reporting and statistics

Next topic

Statistics

This Page

varnish-4.1.1/doc/html/users-guide/vcl-hashing.html0000644000201500234410000001434712652366773017174 00000000000000 Hashing — Varnish version 4.1.1 documentation

Hashing¶

Internally, when Varnish stores content in the cache it stores the object together with a hash key to find the object again. In the default setup this key is calculated based on the content of the Host header or the IP address of the server and the URL.

Behold the default vcl:

sub vcl_hash {
    hash_data(req.url);
    if (req.http.host) {
        hash_data(req.http.host);
    } else {
        hash_data(server.ip);
    }
    return (lookup);
}

As you can see it first checks in req.url then req.http.host if it exists. It is worth pointing out that Varnish doesn't lowercase the hostname or the URL before hashing it so in theory having "Varnish.org/" and "varnish.org/" would result in different cache entries. Browsers however, tend to lowercase hostnames.

You can change what goes into the hash. This way you can make Varnish serve up different content to different clients based on arbitrary criteria.

Let's say you want to serve pages in different languages to your users based on where their IP address is located. You would need some Vmod to get a country code and then put it into the hash. It might look like this.

In vcl_recv:

set req.http.X-Country-Code = geoip.lookup(client.ip);

And then add a vcl_hash:

sub vcl_hash {
    hash_data(req.http.X-Country-Code);
}

As the default VCL will take care of adding the host and URL to the hash we don't have to do anything else. Be careful calling return (lookup) as this will abort the execution of the default VCL and Varnish can end up returning data based on more or less random inputs.

Previous topic

Backend servers

Next topic

Misbehaving servers

This Page

varnish-4.1.1/doc/html/users-guide/sizing-your-cache.html0000644000201500234410000001330712652366773020324 00000000000000 Sizing your cache — Varnish version 4.1.1 documentation

Sizing your cache¶

Deciding on cache size can be a tricky task. A few things to consider:

  • How big is your hot data set. For a portal or news site that would be the size of the front page with all the stuff on it, and the size of all the pages and objects linked from the first page.
  • How expensive is it to generate an object? Sometimes it makes sense to only cache images a little while or not to cache them at all if they are cheap to serve from the backend and you have a limited amount of memory.
  • Watch the n_lru_nuked counter with varnishstat or some other tool. If you have a lot of LRU activity then your cache is evicting objects due to space constraints and you should consider increasing the size of the cache.

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 overhead of about 1KB per object. So, if you have lots of small objects in your cache the overhead might be significant.

Previous topic

Parameters

Next topic

VCL - Varnish Configuration Language

This Page

varnish-4.1.1/doc/html/users-guide/devicedetection.html0000644000201500234410000003653112652366773020126 00000000000000 Device detection — Varnish version 4.1.1 documentation

Device detection¶

Device detection is figuring out what kind of content to serve to a client based on the User-Agent string supplied in a request.

Use cases for this are for example to send size reduced files to mobile clients with small screens and on high latency networks, or to provide a streaming video codec that the client understands.

There are a couple of typical strategies to use for this type of scenario: 1) Redirect to another URL. 2) Use a different backend for the special client. 3) Change the backend request so that the backend sends tailored content.

To perhaps make the strategies easier to understand, we, in this context, assume that the req.http.X-UA-Device header is present and unique per client class.

Setting this header can be as simple as:

sub vcl_recv {
    if (req.http.User-Agent ~ "(?i)iphone" {
        set req.http.X-UA-Device = "mobile-iphone";
    }
}

There are different commercial and free offerings in doing grouping and identifying clients in further detail. For a basic and community based regular expression set, see https://github.com/varnishcache/varnish-devicedetect/.

Serve the different content on the same URL¶

The tricks involved are: 1. Detect the client (pretty simple, just include devicedetect.vcl and call it). 2. Figure out how to signal the backend the client class. This includes for example setting a header, changing a header or even changing the backend request URL. 3. Modify any response from the backend to add missing 'Vary' headers, so Varnish' internal handling of this kicks in. 4. Modify output sent to the client so any caches outside our control don't serve the wrong content.

All this needs to be done while still making sure that we only get one cached object per URL per device class.

Example 1: Send HTTP header to backend¶

The basic case is that Varnish adds the 'X-UA-Device' HTTP header on the backend requests, and the backend mentions in the response 'Vary' header that the content is dependant on this header.

Everything works out of the box from Varnish' perspective.

VCL:

sub vcl_recv {
    # call some detection engine that set req.http.X-UA-Device
}
# req.http.X-UA-Device is copied by Varnish into bereq.http.X-UA-Device

# so, this is a bit counterintuitive. The backend creates content based on
# the normalized User-Agent, but we use Vary on X-UA-Device so Varnish will
# use the same cached object for all U-As that map to the same X-UA-Device.
#
# If the backend does not mention in Vary that it has crafted special
# content based on the User-Agent (==X-UA-Device), add it.
# If your backend does set Vary: User-Agent, you may have to remove that here.
sub vcl_backend_response {
    if (bereq.http.X-UA-Device) {
        if (!beresp.http.Vary) { # no Vary at all
            set beresp.http.Vary = "X-UA-Device";
        } elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
            set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
        }
    }
    # comment this out if you don't want the client to know your
    # classification
    set beresp.http.X-UA-Device = bereq.http.X-UA-Device;
}

# to keep any caches in the wild from serving wrong content to client #2
# behind them, we need to transform the Vary on the way out.
sub vcl_deliver {
    if ((req.http.X-UA-Device) && (resp.http.Vary)) {
        set resp.http.Vary = regsub(resp.http.Vary, "X-UA-Device", "User-Agent");
    }
}

Example 2: Normalize the User-Agent string¶

Another way of signalling the device type is to override or normalize the 'User-Agent' header sent to the backend.

For example:

User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; nb-no; HTC Desire Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1

becomes:

User-Agent: mobile-android

when seen by the backend.

This works if you don't need the original header for anything on the backend. A possible use for this is for CGI scripts where only a small set of predefined headers are (by default) available for the script.

VCL:

sub vcl_recv {
    # call some detection engine that set req.http.X-UA-Device
}

# override the header before it is sent to the backend
sub vcl_miss { if (req.http.X-UA-Device) { set req.http.User-Agent = req.http.X-UA-Device; } }
sub vcl_pass { if (req.http.X-UA-Device) { set req.http.User-Agent = req.http.X-UA-Device; } }

# standard Vary handling code from previous examples.
sub vcl_backend_response {
    if (bereq.http.X-UA-Device) {
        if (!beresp.http.Vary) { # no Vary at all
            set beresp.http.Vary = "X-UA-Device";
        } elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
            set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
        }
    }
    set beresp.http.X-UA-Device = bereq.http.X-UA-Device;
}
sub vcl_deliver {
    if ((req.http.X-UA-Device) && (resp.http.Vary)) {
        set resp.http.Vary = regsub(resp.http.Vary, "X-UA-Device", "User-Agent");
    }
}

Example 3: Add the device class as a GET query parameter¶

If everything else fails, you can add the device type as a GET argument.

The client itself does not see this classification, only the backend request is changed.

VCL:

sub vcl_recv {
    # call some detection engine that set req.http.X-UA-Device
}

sub append_ua {
    if ((req.http.X-UA-Device) && (req.method == "GET")) {
        # if there are existing GET arguments;
        if (req.url ~ "\?") {
            set req.http.X-get-devicetype = "&devicetype=" + req.http.X-UA-Device;
        } else {
            set req.http.X-get-devicetype = "?devicetype=" + req.http.X-UA-Device;
        }
        set req.url = req.url + req.http.X-get-devicetype;
        unset req.http.X-get-devicetype;
    }
}

# do this after vcl_hash, so all Vary-ants can be purged in one go. (avoid ban()ing)
sub vcl_miss { call append_ua; }
sub vcl_pass { call append_ua; }

# Handle redirects, otherwise standard Vary handling code from previous
# examples.
sub vcl_backend_response {
    if (bereq.http.X-UA-Device) {
        if (!beresp.http.Vary) { # no Vary at all
            set beresp.http.Vary = "X-UA-Device";
        } elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
            set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
        }

        # if the backend returns a redirect (think missing trailing slash),
        # we will potentially show the extra address to the client. we
        # don't want that.  if the backend reorders the get parameters, you
        # may need to be smarter here. (? and & ordering)

        if (beresp.status == 301 || beresp.status == 302 || beresp.status == 303) {
            set beresp.http.location = regsub(beresp.http.location, "[?&]devicetype=.*$", "");
        }
    }
    set beresp.http.X-UA-Device = bereq.http.X-UA-Device;
}
sub vcl_deliver {
    if ((req.http.X-UA-Device) && (resp.http.Vary)) {
        set resp.http.Vary = regsub(resp.http.Vary, "X-UA-Device", "User-Agent");
    }
}

Different backend for mobile clients¶

If you have a different backend that serves pages for mobile clients, or any special needs in VCL, you can use the 'X-UA-Device' header like this:

backend mobile {
    .host = "10.0.0.1";
    .port = "80";
}

sub vcl_recv {
    # call some detection engine

    if (req.http.X-UA-Device ~ "^mobile" || req.http.X-UA-device ~ "^tablet") {
        set req.backend_hint = mobile;
    }
}
sub vcl_hash {
    if (req.http.X-UA-Device) {
        hash_data(req.http.X-UA-Device);
    }
}

Redirecting mobile clients¶

If you want to redirect mobile clients you can use the following snippet.

VCL:

sub vcl_recv {
    # call some detection engine

    if (req.http.X-UA-Device ~ "^mobile" || req.http.X-UA-device ~ "^tablet") {
        return(synth(750, "Moved Temporarily"));
    }
}

sub vcl_synth {
    if (obj.status == 750) {
        set obj.http.Location = "http://m.example.com" + req.url;
        set obj.status = 302;
        return(deliver);
    }
}
varnish-4.1.1/doc/html/users-guide/vcl-examples.html0000644000201500234410000001236012652366773017362 00000000000000 VCL Examples — Varnish version 4.1.1 documentation

VCL Examples¶

These are a short collection of examples that showcase some of the capabilities of the VCL language.

Previous topic

Using inline C to extend Varnish

Next topic

Manipulating request headers in VCL

This Page

varnish-4.1.1/doc/html/users-guide/run_cli.html0000644000201500234410000002747112652366773016426 00000000000000 CLI - bossing Varnish around — Varnish version 4.1.1 documentation

CLI - bossing Varnish around¶

Once varnishd is started, you can control it using the command line interface.

The easiest way to do this, is using varnishadm on the same machine as varnishd is running:

varnishadm help

If you want to run varnishadm from a remote system, you can do it two ways.

You can SSH into the varnishd computer and run varnishadm:

ssh $http_front_end varnishadm help

But you can also configure varnishd to accept remote CLI connections (using the '-T' and '-S' arguments):

varnishd -T :6082 -S /etc/varnish_secret

And then on the remote system run varnishadm:

varnishadm -T $http_front_end -S /etc/copy_of_varnish_secret help

but as you can see, SSH is much more convenient.

If you run varnishadm without arguments, it will read CLI commands from stdin, if you give it arguments, it will treat those as the single CLI command to execute.

The CLI always returns a status code to tell how it went: '200' means OK, anything else means there were some kind of trouble.

varnishadm will exit with status 1 and print the status code on standard error if it is not 200.

What can you do with the CLI¶

The CLI gives you almost total control over varnishd some of the more important tasks you can perform are:

  • load/use/discard VCL programs
  • ban (invalidate) cache content
  • change parameters
  • start/stop worker process

We will discuss each of these briefly below.

Load, use and discard VCL programs¶

All caching and policy decisions are made by VCL programs.

You can have multiple VCL programs loaded, but one of them is designated the "active" VCL program, and this is where all new requests start out.

To load new VCL program:

varnish> vcl.load some_name some_filename

Loading will read the VCL program from the file, and compile it. If the compilation fails, you will get an error messages:

.../mask is not numeric.
('input' Line 4 Pos 17)
                "192.168.2.0/24x",
----------------#################-

Running VCC-compiler failed, exit 1
VCL compilation failed

If compilation succeeds, the VCL program is loaded, and you can now make it the active VCL, whenever you feel like it:

varnish> vcl.use some_name

If you find out that was a really bad idea, you can switch back to the previous VCL program again:

varnish> vcl.use old_name

The switch is instantaneous, all new requests will start using the VCL you activated right away. The requests currently being processed complete using whatever VCL they started with.

It is good idea to design an emergency-VCL before you need it, and always have it loaded, so you can switch to it with a single vcl.use command.

Ban cache content¶

Varnish offers "purges" to remove things from cache, provided that you know exactly what they are.

But sometimes it is useful to be able to throw things out of cache without having an exact list of what to throw out.

Imagine for instance that the company logo changed and now you need Varnish to stop serving the old logo out of the cache:

varnish> ban req.url ~ "logo.*[.]png"

should do that, and yes, that is a regular expression.

We call this "banning" because the objects are still in the cache, but they are banned from delivery.

Instead of checking each and every cached object right away, we test each object against the regular expression only if and when an HTTP request asks for it.

Banning stuff is much cheaper than restarting Varnish to get rid of wronly cached content.

Change parameters¶

Parameters can be set on the command line with the '-p' argument, but they can also be examined and changed on the fly from the CLI:

varnish> param.show prefer_ipv6
200
prefer_ipv6         off [bool]
                    Default is off
                    Prefer IPv6 address when connecting to backends
                    which have both IPv4 and IPv6 addresses.

varnish> param.set prefer_ipv6 true
200

In general it is not a good idea to modify parameters unless you have a good reason, such as performance tuning or security configuration.

Most parameters will take effect instantly, or with a natural delay of some duration,

but a few of them requires you to restart the child process before they take effect. This is always noted in the description of the parameter.

Starting and stopping the worker process¶

In general you should just leave the worker process running, but if you need to stop and/or start it, the obvious commands work:

varnish> stop

and:

varnish> start

If you start varnishd with the '-d' (debugging) argument, you will always need to start the child process explicitly.

Should the child process die, the master process will automatically restart it, but you can disable that with the 'auto_restart' parameter.

varnish-4.1.1/doc/html/users-guide/vcl-example-acls.html0000644000201500234410000001243012652366773020115 00000000000000 ACLs — Varnish version 4.1.1 documentation

ACLs¶

You create a named access control list with the acl keyword. You can match the IP address of the client against an ACL with the match operator.:

# Who is allowed to purge....
acl local {
    "localhost";
    "192.168.1.0"/24; /* and everyone on the local network */
    ! "192.168.1.23"; /* except for the dialin router */
}

sub vcl_recv {
  if (req.method == "PURGE") {
    if (client.ip ~ local) {
       return(purge);
    } else {
       return(synth(403, "Access denied."));
    }
  }
}

Previous topic

Altering the backend response

Next topic

Adding WebSockets support

This Page

varnish-4.1.1/doc/html/users-guide/running.html0000644000201500234410000001547412652366773016453 00000000000000 Starting and running Varnish — Varnish version 4.1.1 documentation

Starting and running Varnish¶

This section covers starting, running, and stopping Varnish, command line flags and options, and communicating with the running Varnish processes, configuring storage and sockets and, and about securing and protecting Varnish against attacks.

Previous topic

The Big Varnish Picture

Next topic

Security first

This Page

varnish-4.1.1/doc/html/users-guide/purging.html0000644000201500234410000002672112652366773016443 00000000000000 Purging and banning — Varnish version 4.1.1 documentation

Purging and banning¶

One of the most effective ways of increasing your hit ratio is to increase the time-to-live (ttl) of your objects. But, as you're aware of, in this twitterific day of age, serving content that is outdated is 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, lets look at HTTP purging.

HTTP Purging¶

A purge is what happens when you pick out an object from the cache and discard it along with its variants. Usually a purge is invoked through HTTP with the method PURGE.

An HTTP purge is similar to an HTTP GET request, except that the method is PURGE. Actually you can call the method whatever you'd like, but most people refer to this as purging. Squid, for example, supports the same mechanism. In order to support purging in Varnish you need the following VCL in place:

acl purge {
        "localhost";
        "192.168.55.0"/24;
}

sub vcl_recv {
        # allow PURGE from localhost and 192.168.55...

        if (req.method == "PURGE") {
                if (!client.ip ~ purge) {
                        return(synth(405,"Not allowed."));
                }
                return (purge);
        }
}

As you can see we have used a new action - return(purge). This ends execution of vcl_recv and jumps to vcl_hash. This is just like we handle a regular request. When vcl_hash calls return(lookup) varnish will purge the object and then call vcl_purge. Here you have the option of adding any particular actions you want Varnish to take once it has purge the object.

So for example.com to invalidate their front page they would call out to Varnish like this:

PURGE / HTTP/1.0
Host: example.com

And Varnish would then discard the front page. This will remove all variants as defined by Vary.

Bans¶

There is another way to invalidate content: Bans. You can think of bans as a sort of a filter on objects already in the cache. You ban certain content from being served from your cache. You can ban content based on any metadata we have. A ban will only work on objects already in the cache, it does not prevent new content from entering the cache or being served.

Support for bans is built into Varnish and available in the CLI interface. To ban every png object belonging on example.com, issue the following command:

ban req.http.host == "example.com" && req.url ~ "\\.png$"

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.

Bans that only match against obj.* are also processed by a background worker threads called the ban lurker. The ban lurker will walk the heap and try to match objects and will evict the matching objects. How aggressive the ban lurker is can be controlled by the parameter 'ban_lurker_sleep'. The ban lurker can be disabled by setting 'ban_lurker_sleep' to 0.

Bans that are older than the oldest objects in the cache are discarded without evaluation. If you have a lot of objects with long TTL, that are seldom accessed, you might accumulate a lot of bans. This might impact CPU usage and thereby performance.

You can also add bans to Varnish via HTTP. Doing so requires a bit of VCL:

sub vcl_recv {
        if (req.method == "BAN") {
                # Same ACL check as above:
                if (!client.ip ~ purge) {
                        return(synth(403, "Not allowed."));
                }
                ban("req.http.host == " + req.http.host +
                      " && req.url == " + req.url);

                # Throw a synthetic page so the
                # request won't go to the backend.
                return(synth(200, "Ban added"));
        }
}

This VCL stanza enables Varnish to handle a HTTP BAN method, adding a ban on the URL, including the host part.

The ban lurker can help you keep the ban list at a manageable size, so we recommend that you avoid using req.* in your bans, as the request object is not available in the ban lurker thread.

You can use the following template to write ban lurker friendly bans:

sub vcl_backend_response {
  set beresp.http.url = bereq.url;
}

sub vcl_deliver {
  unset resp.http.url; # Optional
}

sub vcl_recv {
  if (req.method == "PURGE") {
    if (client.ip !~ purge) {
      return(synth(403, "Not allowed"));
    }
    ban("obj.http.url ~ " + req.url); # Assumes req.url is a regex. This might be a bit too simple
  }
}

To inspect the current ban list, issue the ban.list command in the CLI. This will produce a status of all current bans:

0xb75096d0 1318329475.377475    10      obj.http.url ~ test
0xb7509610 1318329470.785875    20G     obj.http.url ~ test

The ban list contains the ID of the ban, the timestamp when the ban entered the ban list. A count of the objects that has reached this point in the ban list, optionally postfixed with a 'G' for "Gone", if the ban is no longer valid. Finally, the ban expression is listed. The ban can be marked as "Gone" if it is a duplicate ban, but is still kept in the list for optimization purposes.

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 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 some other means.

Table Of Contents

Previous topic

Achieving a high hitrate

Next topic

Compression

This Page

varnish-4.1.1/doc/html/users-guide/vcl-backends.html0000644000201500234410000003143712652366773017324 00000000000000 Backend servers — Varnish version 4.1.1 documentation

Backend servers¶

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 backends. Start your favorite text editor and open the relevant VCL file.

Somewhere in the top there will be a section that looks a bit like this.:

# backend default {
#     .host = "127.0.0.1";
#     .port = "8080";
# }

We remove the comment markings in this text stanza making the it look like.:

backend default {
    .host = "127.0.0.1";
    .port = "8080";
}

Now, this piece of configuration defines a backend in Varnish called default. When Varnish needs to get content from this backend it will connect to port 8080 on localhost (127.0.0.1).

Varnish can have several backends defined you can even join several backends together into clusters of backends for load balancing purposes.

Multiple backends¶

At some point you might need Varnish to cache content from several servers. You might want Varnish to map all the URL into one single host or not. There are lot of options.

Lets say we need to introduce a Java application into out PHP web site. Lets say our Java application should handle URL beginning with /java/.

We manage to get the thing up and running on port 8000. Now, lets have a look at the default.vcl.:

backend default {
    .host = "127.0.0.1";
    .port = "8080";
}

We add a new backend.:

backend java {
    .host = "127.0.0.1";
    .port = "8000";
}

Now we need tell Varnish where to send the difference URL. Lets look at vcl_recv.:

sub vcl_recv {
    if (req.url ~ "^/java/") {
        set req.backend_hint = java;
    } else {
        set req.backend_hint = default;
    }
}

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.http.User-agent ~ /mobile/) .. should do the trick.

Backends and virtual hosts in Varnish¶

Varnish fully supports virtual hosts. They might however work in a somewhat counter-intuitive fashion since they are never declared explicitly. You set up the routing of incoming HTTP requests in vcl_recv. If you want this routing to be done on the basis of virtual hosts you just need to inspect req.http.host.

You can have something like this:

sub vcl_recv {
    if (req.http.host ~ "foo.com") {
        set req.backend_hint = foo;
    } elsif (req.http.host ~ "bar.com") {
        set req.backend_hint = bar;
    }
}

Note that the first regular expressions will match "foo.com", "www.foo.com", "zoop.foo.com" and any other host ending in "foo.com". In this example this is intentional but you might want it to be a bit more tight, maybe relying on the == operator in stead, like this:

sub vcl_recv {
    if (req.http.host == "foo.com" || req.http.host == "www.foo.com") {
        set req.backend_hint = foo;
    }
}

Directors¶

You can also group several backend into a group of backends. These groups are called directors. This will give you increased performance and resilience.

You can define several backends and group them together in a director. This requires you to load a VMOD, a Varnish module, and then to call certain actions in vcl_init.:

import directors;    # load the directors

backend server1 {
    .host = "192.168.0.10";
}
backend server2 {
    .host = "192.168.0.10";
}

sub vcl_init {
    new bar = directors.round_robin();
    bar.add_backend(server1);
    bar.add_backend(server2);
}

sub vcl_recv {
    # send all traffic to the bar director:
    set req.backend_hint = bar.backend();
}

This director is a round-robin director. This means the director will distribute the incoming requests on a round-robin basis. There is also a random director which distributes requests in a, you guessed it, random fashion. If that is not enough, you can also write your own director (see Writing a Director).

But what if one of your servers goes down? Can Varnish direct all the requests to the healthy server? Sure it can. This is where the Health Checks come into play.

Health checks¶

Lets set up a director with two backends and health checks. First let us define the backends:

backend server1 {
    .host = "server1.example.com";
    .probe = {
        .url = "/";
        .timeout = 1s;
        .interval = 5s;
        .window = 5;
        .threshold = 3;
    }
}

backend server2 {
    .host = "server2.example.com";
    .probe = {
        .url = "/";
        .timeout = 1s;
        .interval = 5s;
        .window = 5;
        .threshold = 3;
    }
}

What is new here is the probe. In this example Varnish will check the health of each backend every 5 seconds, timing out after 1 second. Each poll will send a GET request to /. If 3 out of the last 5 polls succeeded the backend is considered healthy, otherwise it will be marked as sick.

Refer to the Probes section in the VCL documentation for more information.

Now we define the 'director':

import directors;

sub vcl_init {
    new vdir = directors.round_robin();
    vdir.add_backend(server1);
    vdir.add_backend(server2);
}

You use this vdir director as a backend_hint for requests, just like you would with a simple backend. Varnish will not send traffic to hosts that are marked as unhealthy.

Varnish can also serve stale content if all the backends are down. See Misbehaving servers for more information on how to enable this.

Please note that Varnish will keep health probes running for all loaded VCLs. Varnish will coalesce probes that seem identical - so be careful not to change the probe config if you do a lot of VCL loading. Unloading the VCL will discard the probes. For more information on how to do this please see ref:reference-vcl-director.

Table Of Contents

Previous topic

actions

Next topic

Hashing

This Page

varnish-4.1.1/doc/html/users-guide/intro.html0000644000201500234410000002264712652366773016126 00000000000000 The Big Varnish Picture — Varnish version 4.1.1 documentation

The Big Varnish Picture¶

In this section we will cover answers to the questions: - What is in this package called "Varnish"? - what are all the different bits and pieces named? - Will you need a hex-wrench for assembly?

The two main parts of Varnish are the two processes in the varnishd program. The first process is called "the manager", and its job is to talk to you, the administrator, and make the things you ask for happen.

The second process is called "the worker" or just "the child" and this is the process which does all the actual work with your HTTP traffic.

When you start varnishd, you start the manager process, and once it is done handling all the command line flags, it will start the child process for you. Should the child process die, the manager will start it again for you, automatically and right away.

The main reason for this division of labor is security: The manager process will typically run with "root" permissions, in order to open TCP socket port 80, but it starts the child process with minimal permissions, as a defensive measure.

The manager process is interactive, it offers a CLI -- Command Line 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 you need to change something very fundamental.

The CLI can be safely accessed remotely, using a simple and flexible PSK -- Pre Shared Key, access control scheme, so it is easy to integrate Varnish into your operations and management infrastructure or tie it to your CMS.

All this is covered in Starting and running Varnish.

Things like, how the child process should deal with the HTTP requests, what to cache, which headers to remove etc, is all specified using a small programming language called VCL -- Varnish Configuration Language. The manager process will compile the VCL program and check it for errors,

but it is the child process which runs the VCL program, for each and every HTTP request which comes in.

Because the VCL is compiled to C code, and the C code is compiled to machine instructions, even very complex VCL programs execute in a few microseconds, without impacting performance at all.

And don't fret if you are not really a programmer, VCL is very simple to do simple things with:

sub vcl_recv {
        # Remove the cookie header to enable caching
        unset req.http.cookie;
}

The CLI interface allows you to compile and load new VCL programs at any time, and you can switch between the loaded VCL programs instantly, without restarting the child process and without missing a single HTTP request.

VCL code can be extended using external modules, called VMODs or even by inline C-code if you are brave, so in terms of what Varnish can do for your HTTP traffic, there really is no limit.

VCL - Varnish Configuration Language describes VCL and what it can do in great detail.

Varnish uses a segment of shared memory to report and log its activities and status. For each HTTP request, a number of very detailed records will be appended to the log memory segment. Other processes can subscribe to log-records, filter them, and format them, for instance as Apache/NCSA style log records.

Another segment in shared memory is used for statistics counters, this allows real-time, down to microsecond resolution monitoring of cache hit-rate, resource usage and specific performance indicating metrics.

Varnish comes with a number of tools which reports from shared memory, varnishlog, varnishstats, varnishncsa etc, and with an API library so you can write your own tools, should you need that.

Reporting and statistics explains how all that work.

Presumably the reason for your interest in Varnish, is that you want your website to work better. There are many aspects of performance tuning a website, from relatively simple policy decisions about what to cache, to designing a geographically diverse multilevel CDNs using ESI and automatic failover.

Varnish and Website Performance will take you through the possibilities and facilities Varnish offers.

Finally, Murphys Law must be referenced here: Things will go wrong, and more likely than not, they will do so at zero-zero-dark O'clock. Most likely during a hurricane, when your phone battery is flat and your wife had prepared a intimate evening to celebrate your anniversary.

Yes, we've all been there, haven't we?

When things go wrong Troubleshooting Varnish will hopefully be of some help.

Previous topic

The Varnish Users Guide

Next topic

Starting and running Varnish

This Page

varnish-4.1.1/doc/html/users-guide/report.html0000644000201500234410000001213012652366773016270 00000000000000 Reporting and statistics — Varnish version 4.1.1 documentation

Reporting and statistics¶

This section covers how to find out what Varnish is doing, from the detailed per HTTP request blow-by-blow logrecords to the global summary statistics counters.

Previous topic

Device detection

Next topic

Logging in Varnish

This Page

varnish-4.1.1/doc/html/whats-new/0000755000201500234410000000000012652366773013633 500000000000000varnish-4.1.1/doc/html/whats-new/index.html0000644000201500234410000001601512652366773015553 00000000000000 What's new in Varnish 4.1 — Varnish version 4.1.1 documentation

What's new in Varnish 4.1¶

This section describes the changes that have been made for Varnish 4.1.

The first subsection describes overarching changes that have gone into Varnish 4.0, while the second subsection describes changes you need to make to your current configuration if you come from Varnish 3.x.

The text also considers changes in behaviour that you need to be aware of and take into consideration when upgrading.

Previous topic

vsl-query

Next topic

Changes in Varnish 4.1

This Page

varnish-4.1.1/doc/html/whats-new/upgrade-4.0.html0000644000201500234410000005140712652366773016376 00000000000000 Upgrading to Varnish 4.0 — Varnish version 4.1.1 documentation

Upgrading to Varnish 4.0¶

Changes to VCL¶

The backend fetch parts of VCL have changed in Varnish 4. We've tried to compile a list of changes needed to upgrade here.

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:

vcl 4.0;

req.request is now req.method¶

To align better with RFC naming, req.request has been renamed to req.method.

vcl_fetch is now vcl_backend_response¶

Directors have been moved to the vmod_directors¶

To make directors (backend selection logic) easier to extend, the directors are now defined in loadable VMODs.

Setting a backend for future fetches in vcl_recv is now done as follows:

sub vcl_init {
    new cluster1 = directors.round_robin();
    cluster1.add_backend(b1, 1.0);
    cluster1.add_backend(b2, 1.0);
}

sub vcl_recv {
    set req.backend_hint = cluster1.backend();
}

Note the extra .backend() needed after the director name.

Use the hash director as a client director¶

Since the client director was already a special case of the hash director, it has been removed, and you should use the hash director directly:

sub vcl_init {
    new h = directors.hash();
    h.add_backend(b1, 1);
    h.add_backend(b2, 1);
}

sub vcl_recv {
    set req.backend_hint = h.backend(client.identity);
}

vcl_error is now vcl_backend_error¶

To make a distinction between internally generated errors and VCL synthetic responses, vcl_backend_error will be called when varnish encounters an error when trying to fetch an object.

error() is now synth()¶

And you must explicitly return it:

return (synth(999, "Response"));

Synthetic responses in vcl_synth¶

Setting headers on synthetic response bodies made in vcl_synth are now done on resp.http instead of obj.http.

The synthetic keyword is now a function:

if (resp.status == 799) {
    set resp.status = 200;
    set resp.http.Content-Type = "text/plain; charset=utf-8";
    synthetic("You are " + client.ip);
    return (deliver);
}

obj in vcl_error replaced by beresp in vcl_backend_error¶

To better represent a the context in which it is called, you should now use beresp.* vcl_backend_error, where you used to use obj.* in vcl_error.

hit_for_pass objects are created using beresp.uncacheable¶

Example:

sub vcl_backend_response {
    if (beresp.http.X-No-Cache) {
        set beresp.uncacheable = true;
        set beresp.ttl = 120s;
        return (deliver);
    }
}

req.* not available in vcl_backend_response¶

req.* used to be available in vcl_fetch, but after the split of functionality, you only have 'bereq.*' in vcl_backend_response.

vcl_* reserved¶

Any custom-made subs cannot be named 'vcl_*' anymore. This namespace is reserved for builtin subs.

req.backend.healthy replaced by std.healthy(req.backend_hint)¶

Remember to import the std module if you're not doing so already.

client.port, and server.port replaced by respectively std.port(client.ip) and std.port(server.ip)¶

client.ip and server.ip are now proper data types, which renders as an IP address by default. You need to use the std.port() function to get the port number.

Invalidation with purge¶

Cache invalidation with purges is now done via return(purge) from vcl_recv. The purge; keyword has been retired.

obj is now read-only¶

obj is now read-only. obj.last_use has been retired.

Some return values have been replaced¶

Apart from the new synth return value described above, the following has changed:

  • vcl_recv must now return hash instead of lookup
  • vcl_hash must now return lookup instead of hash
  • vcl_pass must now return fetch instead of pass

Backend restarts are now retry¶

In 3.0 it was possible to do return(restart) after noticing that the backend response was wrong, to change to a different backend.

This is now called return(retry), and jumps back up to vcl_backend_fetch.

This only influences the backend fetch thread, client-side handling is not affected.

default/builtin VCL changes¶

The VCL code that is appended to user-configured VCL automatically is now called the builtin VCL. (previously default.vcl)

The builtin VCL now honors Cache-Control: no-cache (and friends) to indicate uncacheable content from the backend.

The remove keyword is gone¶

Replaced by unset.

X-Forwarded-For is now set before vcl_recv¶

In many cases, people unintentionally removed X-Forwarded-For when implementing their own vcl_recv. Therefore it has been moved to before vcl_recv, so if you don't want an IP added to it, you should remove it in vcl_recv.

Changes to existing parameters¶

session_linger¶

session_linger has been renamed to timeout_linger and it is in seconds now (previously was milliseconds).

sess_timeout¶

sess_timeout has been renamed to timeout_idle.

sess_workspace¶

In 3.0 it was often necessary to increase sess_workspace if a lot of VMODs, complex header operations or ESI were in use.

This is no longer necessary, because ESI scratch space happens elsewhere in 4.0.

If you are using a lot of VMODs, you may need to increase either workspace_backend and workspace_client based on where your VMOD is doing its work.

thread_pool_purge_delay¶

thread_pool_purge_delay has been renamed to thread_pool_destroy_delay and it is in seconds now (previously was milliseconds).

thread_pool_add_delay and thread_pool_fail_delay¶

They are in seconds now (previously were milliseconds).

New parameters since 3.0¶

vcc_allow_inline_c¶

You can now completely disable inline C in your VCL, and it is disabled by default.

Other changes¶

New log filtering¶

The logging framework has a new filtering language, which means that the -m switch has been replaced with a new -q switch. See vsl-query for more information about the new query language.

varnish-4.1.1/doc/html/whats-new/changes.html0000644000201500234410000003247712652366773016066 00000000000000 Changes in Varnish 4.1 — Varnish version 4.1.1 documentation

Changes in Varnish 4.1¶

Varnish 4.1 is the continuation of the new streaming architecture seen in Varnish 4.0.

Proactive security features¶

New in 4.1 is support for different kinds of privilege separation methods, collectively described as jails.

On most systems, the Varnish parent process will now drop effective privileges to normal user mode when not doing operations needing special access.

The Varnish worker child should now be run as a separate vcache user.

varnishlog, varnishncsa and other Varnish shared log utilities now must be run in a context with varnish group membership.

Warm and cold VCL configurations¶

Traditionally Varnish have had the concept of active and inactive loaded VCLs. Any loaded VCL lead to state being kept, and a separate set of health checks (if configured) were being run against the backends.

To avoid the extra state and backend polling, a loaded VCL is now either warm or cold. Runtime state (incl. backend counters) and health checks are not present for cold VCLs.

A warm VCL will automatically be set to cold after vcl_cooldown seconds.

Output from vcl.list:

varnish> vcl.list
200
available  auto/warm       0 boot
available  auto/warm       0 62f5275f-a937-4df9-9fbb-c12336bdfdb8

A single VCL's state can be changed with the vcl.state call in varnishadm:

vcl.state <configname> <state>
    Force the state of the specified configuration.
    State is any of auto, warm or cold values.

Example:

varnish> vcl.state 62f5275f-a937-4df9-9fbb-c12336bdfdb8 cold
200

varnish> vcl.list
200
available  auto/warm       0 boot
available  auto/cold       0 62f5275f-a937-4df9-9fbb-c12336bdfdb8

VMOD writers should read up on the new vcl_event system to release unnecessary state when a VCL is transitioned to cold (see Event functions).

PROXY protocol support¶

Socket support for PROXY protocol connections has been added. PROXY defines a short preamble on the TCP connection where (usually) a SSL/TLS terminating proxy can signal the real client address.

The -a startup argument syntax has been expanded to allow for this:

$ varnishd -f /etc/varnish/default.vcl -a :6081 -a 127.0.0.1:6086,PROXY

Both PROXY1 and PROXY2 protocols are supported on the resulting listening socket.

For connections coming in over a PROXY socket, client.ip and server.ip will contain the addresses given to Varnish in the PROXY header/preamble (the "real" IPs).

The new VCL variables remote.ip and local.ip contains the local TCP connection endpoints. On non-PROXY connections these will be identical to client.ip and server.ip.

An expected pattern following this is if (std.port(local.ip) == 80) { } in vcl_recv to see if traffic came in over the HTTP listening socket (so a client redirect to HTTPS can be served).

VMOD backends¶

Before Varnish 4.1, backends could only be declared in native VCL. Varnish 4.0 moved directors from VCL to VMODs, and VMODs can now also create backends. It is possible to both create the same backends than VCL but dynamically, or create backends that don't necessarily speak HTTP/1 over TCP to fetch resources. More details in the Writing a Director documentation.

Backend connection timeout¶

Backend connections will now be closed by Varnish after backend_idle_timeout seconds of inactivity.

Previously they were kept around forever and the backend servers would close the connection without Varnish noticing it. On the next traffic spike needing these extra backend connections, the request would fail, perhaps multiple times, before a working backend connection was found/created.

Protocol support¶

Support for HTTP/0.9 on the client side has been retired.

More modules available¶

Varnish has an ecosystem for third-party modules (vmods). New since the last release, these are worth knowing about:

libvmod-saintmode: Saint mode ("inferred health probes from traffic") was taken out of Varnish core in 4.0, and is now back as a separate vmod. This is useful for detecting failing backends before the health probes pick it up.

libvmod-xkey: Secondary hash keys for cache objects, based on the hashtwo vmod written by Varnish Software. Allows for arbitrary grouping of objects to be purged in one go, avoiding use of ban invalidation. Also known as Cache Keys or Surrogate Key support.

libvmod-rtstatus: Real time statistics dashboard.

Passing data between ESI requests¶

A new req_top identifier is available in VCL, which is a reference to req in the top-level ESI request.

This is useful to pass data back and forth between the main ESI request and any ESI sub-requests it leads to.

Other noteworthy small changes¶

  • Varnish will now use the stale-while-revalidate defined in RFC5861 to set object grace time.
  • -smalloc storage is now recommended over -sfile on Linux systems.
  • New VCL variable beresp.was_304 has been introduced in vcl_backend_response. Will be set to true if the response from the backend was a positive result of a conditional fetch (304 Not Modified).
varnish-4.1.1/doc/html/whats-new/upgrading.html0000644000201500234410000002103012652366773016415 00000000000000 Upgrading to Varnish 4.1 — Varnish version 4.1.1 documentation

Upgrading to Varnish 4.1¶

Changes to VCL¶

Data type conversion functions now take a fallback¶

Data type conversion functions in the std vmod now takes an additional argument fallback, which is returned if the conversion does not succeed.

Version statement is kept¶

The VCL syntax has not chanced significantly, and as such the Varnish 4.0 version marker is kept for Varnish 4.1.

One of the initial lines in a Varnish 4.1 VCL should read:

vcl 4.0;

Remote address accessors¶

New in 4.1 is the local.ip and remote.ip representing the (local) TCP connection endpoints.

With PROXY listeners the server.ip and client.ip are set from the PROXY preamble. On normal HTTP listeners the behaviour is unchanged.

Management interface¶

The management interface enabled with -M previously supported the telnet protocol.

Support for telnet control sequences have been retired. Replacement clients like netcat or (preferred) varnishadm should be used instead.

Runtime users and groups¶

With the new jail support, an additional runtime user (vcache) should be used for the Varnish worker child process.

Additionally, the varnishlog, varnishncsa and other Varnish shared log utilities must now be run in a context with varnish group membership.

Changes to parameters¶

vcl_cooldown is new, and decides how long time a VCL is kept warm after being replaced as the active VCL.

The following parameters have been retired:

  • group (security revamp)
  • group_cc (security revamp)
  • listen_address (security revamp)
  • pool_vbc
  • timeout_req - merged with timeout_idle.
  • user (security revamp)

Minor changes of default values on workspace_session and vsl_mask.

varnish-4.1.1/doc/html/installation/0000755000201500234410000000000012652366773014417 500000000000000varnish-4.1.1/doc/html/installation/help.html0000644000201500234410000002327012652366773016161 00000000000000 Getting help — Varnish version 4.1.1 documentation

Getting help¶

Getting hold of the gang behind Varnish is pretty straight forward, we try to help out as much as time permits and have tried to streamline this process as much as possible.

But before you grab hold of us, spend a moment composing your thoughts and formulate your question. From our perspective there is nothing as pointless as simply telling us "Varnish does not work for me" with no further information. This does not give us any relevant information to use when trying to figure out whats wrong.

And before you even do that, do a couple of searches to see if your question is already answered, if it has been, you will get your answer much faster that way.

IRC Channel¶

The most immediate way to get hold of us is to join our IRC channel:

#varnish on server irc.linpro.no

The main timezone of the channel is Europe work hours.

If you can explain your problem in a few clear sentences, without too much copy&paste, IRC is a good way to try to get help. If you do need to paste log files, VCL and so on, please use a pastebin service.

If the channel is all quiet, try again some time later, we do have lives, families and jobs to deal with also.

You are more than welcome to just hang out, and while we don't mind the occasional intrusion from the real world into our flow, we try and keep it mostly on topic, and please don't paste random links unless they are really spectacular and intelligent.

Mailing Lists¶

Subscribing or unsubscribing to our mailing lists is handled through mailman.

If you are going to use Varnish, subscribing to our varnish-announce mailing list is a very good idea. The typical pattern is that people spend some time getting Varnish running, and then more or less forget about it. Therefore the announce list is a good way to be reminded about new releases, bugs or potential (security) vulnerabilities.

The varnish-misc mailing list is for general banter, questions, suggestions, ideas and so on. If you are new to Varnish it may pay off to subscribe to it, simply to have an ear to the telegraph-pole and potentially learn some smart tricks. This is also a good place to ask for help with more complex issues, that may require file-chunks, references to files and/or long explanations.

Make sure to pick a good subject line, and if the subject of the thread changes, please change the subject to match, some of us deal with hundreds of emails per day, after spam-filters, and we need all the help we can get to pick the interesting ones.

The varnish-dev mailing list is used by the developers and is usually quite focused on source-code and such. Everybody on the -dev list is also on -misc, so cross-posting only serves to annoy those people.

We also maintain a community wiki for Varnish, there you will find information on planned events, meetings, current backlog, trouble tickets , and links to resources and documentation.

Trouble Tickets¶

Please do not open a trouble ticket, unless you have spotted an actual bug in Varnish. Ask on IRC first if you are in doubt.

The reason for this policy, is to avoid bugs being drowned in a pile of other issues, feature suggestions for future releases, and double postings of calls for help from people who forgot to check back on already opened Tickets.

We instead track suggestions and feature ideas in our "Future_Feature" wiki page, and through user support via email and IRC.

Commercial Support¶

The following companies offer commercial Varnish support, and are listed here for your convenience. If you want your company listed here, drop an email to phk@FreeBSD.org.

Table Of Contents

Previous topic

Installing Varnish

Next topic

Reporting bugs

This Page

varnish-4.1.1/doc/html/installation/index.html0000644000201500234410000001651512652366773016344 00000000000000 Varnish Installation — Varnish version 4.1.1 documentation

Previous topic

Varnish Administrator Documentation

Next topic

Prerequisites

This Page

varnish-4.1.1/doc/html/installation/bugs.html0000644000201500234410000003034112652366773016166 00000000000000 Reporting bugs — Varnish version 4.1.1 documentation

Reporting bugs¶

Varnish can be a tricky beast to debug, having potentially thousands of threads crowding into a few data structures makes for interesting core dumps.

Actually, let me rephrase that without irony: You tire of the "no, not thread 438 either, lets look at 439 then..." routine really fast.

So if you run into a bug, it is important that you spend a little bit of time collecting the right information, to help us fix the bug.

The most valuable information you can give us, is always how to trigger and reproduce the problem. If you can tell us that, we rarely need anything else to solve it.The caveat being, that we do not have a way to simulate high levels of real-life web-traffic, so telling us to "have 10.000 clients hit at once" does not really allow us to reproduce.

To report a bug please follow the suggested procedure described in the "Trouble Tickets" section of the documentation (above).

Roughly we categorize bugs in to three kinds of bugs (described below) with Varnish. The information we need to debug them depends on what kind of bug we are facing.

Varnish crashes¶

Plain and simple: boom

Varnish is split over two processes, the manager and the child. The child does all the work, and the manager hangs around to resurrect it if it crashes.

Therefore, the first thing to do if you see a Varnish crash, is to examine your syslogs to see if it has happened before. (One site is rumoured to have had Varnish restarting every 10 minutes and still provide better service than their CMS system.)

When it crashes, which is highly unlikely to begin with, Varnish will spew out a crash dump that looks something like:

Child (32619) died signal=6 (core dumped)
Child (32619) Panic message: Assert error in ccf_panic(), cache_cli.c line 153:
  Condition(!strcmp("", "You asked for it")) not true.
errno = 9 (Bad file descriptor)
thread = (cache-main)
ident = FreeBSD,9.0-CURRENT,amd64,-sfile,-hcritbit,kqueue
Backtrace:
  0x42bce1: pan_ic+171
  0x4196af: ccf_panic+4f
  0x8006b3ef2: _end+80013339a
  0x8006b4307: _end+8001337af
  0x8006b8b76: _end+80013801e
  0x8006b8d84: _end+80013822c
  0x8006b51c1: _end+800134669
  0x4193f6: CLI_Run+86
  0x429f8b: child_main+14b
  0x43ef68: start_child+3f8
[...]

If you can get that information to us, we are usually able to see exactly where things went haywire, and that speeds up bugfixing a lot.

There will be a lot more information in the crash dump besides this, and before sending it all to us, you should obscure any sensitive/secret data/cookies/passwords/ip# etc. Please make sure to keep context when you do so, ie: do not change all the IP# to "X.X.X.X", but change each IP# to something unique, otherwise we are likely to be more confused than informed.

The most important line is the "Panic Message", which comes in two general forms:

"Missing errorhandling code in ..."

This is a situation where we can conceive Varnish ending up, which we have not (yet) written the padded-box error handling code for.

The most likely cause here, is that you need a larger workspace for HTTP headers and Cookies.

Please try that before reporting a bug.

"Assert error in ..."
This is something bad that should never happen, and a bug report is almost certainly in order. As always, if in doubt ask us on IRC before opening the ticket.

In your syslog it may all be joined into one single line, but if you can reproduce the crash, do so while running varnishd manually:

varnishd -d <your other arguments> |& tee /tmp/_catch_bug

That will get you the entire panic message into a file.

(Remember to type start to launch the worker process, that is not automatic when -d is used.)

Varnish goes on vacation¶

This kind of bug is nasty to debug, because usually people tend to kill the process and send us an email saying "Varnish hung, I restarted it" which gives us only about 1.01 bit of usable debug information to work with.

What we need here is all the information you can squeeze out of your operating system before you kill the Varnish process.

One of the most valuable bits of information, is if all Varnish' threads are waiting for something or if one of them is spinning furiously on some futile condition.

Commands like top -H or ps -Haxlw or ps -efH should be able to figure that out.

If one or more threads are spinning, use strace or ktrace or truss (or whatever else your OS provides) to get a trace of which system calls the Varnish process issues. Be aware that this may generate a lot of very repetitive data, usually one second worth of data is more than enough.

Also, run varnishlog for a second, and collect the output for us, and if varnishstat shows any activity, capture that also.

When you have done this, kill the Varnish child process, and let the master process restart it. Remember to tell us if that does or does not work. If it does not, kill all Varnish processes, and start from scratch. If that does not work either, tell us, that means that we have wedged your kernel.

Varnish does something wrong¶

These are the easy bugs: usually all we need from you is the relevant transactions recorded with varnishlog and your explanation of what is wrong about what Varnish does.

Be aware, that often Varnish does exactly what you asked it to, rather than what you intended it to do. If it sounds like a bug that would have tripped up everybody else, take a moment to read through your VCL and see if it really does what you think it does.

You can also try setting the vcl_trace parameter, that will generate log records with like and character number for each statement executed in your VCL program.

Table Of Contents

Previous topic

Getting help

Next topic

Platform specific notes

This Page

varnish-4.1.1/doc/html/installation/prerequisites.html0000644000201500234410000001156112652366773020135 00000000000000 Prerequisites — Varnish version 4.1.1 documentation

Prerequisites¶

In order for you to install Varnish you must have the following:

  • A recent, preferably server grade, computer.
  • A fairly modern and 64 bit version of either - Linux - FreeBSD, or - Solaris (x86 only).
  • Root access.

Varnish can be installed on other UNIX systems as well, but it is not extensively or systematically tested by us on other systems than the above. Varnish is, from time to time, said to work on:

  • 32 bit versions of the before-mentioned systems,
  • OS X,
  • NetBSD,
  • OpenBSD, and
  • Windows with Cygwin.

Previous topic

Varnish Installation

Next topic

Installing Varnish

This Page

varnish-4.1.1/doc/html/installation/install.html0000644000201500234410000003161712652366773016703 00000000000000 Installing Varnish — Varnish version 4.1.1 documentation

Installing Varnish¶

With open source software, you can choose to install binary packages or compile it yourself from source code. To install a package or compile from source is a matter of personal taste. If you don't know which method to choose, we recommend that you read this whole section and then choose the method you feel most comfortable with.

Source or packages?¶

Installing Varnish on most relevant operating systems can usually be done with with the specific systems package manager, typical examples being:

FreeBSD¶

Binary package:
pkg_add -r varnish
From source:
cd /usr/ports/varnish && make install clean

Red Hat / CentOS¶

We try to keep the latest version available as prebuilt RPMs (el5 and el6) on repo.varnish-cache.org. See the online Red Hat installation instructions for more information.

Varnish is included in the EPEL repository, however due to incompatible syntax changes in newer versions of Varnish, only older versions are available.

We therefore recommend that you install the latest version directly from our repository, as described above.

Debian/Ubuntu¶

Varnish is distributed with both Debian and Ubuntu. In order to get Varnish up and running type sudo apt-get install varnish. Please note that this might not be the latest version of Varnish. If you need a later version of Varnish, please follow the online installation instructions for Debian or Ubuntu.

Compiling Varnish from source¶

If there are no binary packages available for your system, or if you want to compile Varnish from source for other reasons, follow these steps:

Download the appropriate release tarball, which you can find on http://repo.varnish-cache.org/source/ .

Alternatively, if you want to hack on Varnish, you should clone our git repository by doing.

git clone git://git.varnish-cache.org/varnish-cache

Build dependencies on Debian / Ubuntu¶

In order to build Varnish from source you need a number of packages installed. On a Debian or Ubuntu system these are:

  • automake
  • autotools-dev
  • libedit-dev
  • libjemalloc-dev
  • libncurses-dev
  • libpcre3-dev
  • libtool
  • pkg-config
  • python-docutils
  • python-sphinx
  • graphviz

Build dependencies on Red Hat / CentOS¶

To build Varnish on a Red Hat or CentOS system you need the following packages installed:

  • autoconf
  • automake
  • jemalloc-devel
  • libedit-devel
  • libtool
  • ncurses-devel
  • pcre-devel
  • pkgconfig
  • python-docutils
  • python-sphinx
  • graphviz

Compiling Varnish¶

The configuration will need the dependencies above satisfied. Once that is taken care of:

cd varnish-cache
sh autogen.sh
sh configure
make

The configure script takes some arguments, but more likely than not you can forget about that for now, almost everything in Varnish can be tweaked with run time parameters.

Before you install, you may want to run the test suite, make a cup of tea while it runs, it usually takes a couple of minutes:

make check

Don't worry if one or two tests fail, some of the tests are a bit too timing sensitive (Please tell us which so we can fix them.) but if a lot of them fails, and in particular if the b00000.vtc test fails, something is horribly wrong, and you will get nowhere without figuring out what.

Installing¶

And finally, the true test of a brave heart: sudo make install

Varnish will now be installed in /usr/local. The varnishd binary is in /usr/local/sbin/varnishd. To make sure that the necessary links and caches of the most recent shared libraries are found, run sudo ldconfig.

Next steps¶

After successful installation you are ready to proceed to the The Varnish Tutorial.

This tutorial is written for installations from binary packages. In practice, it means that some configurations are not in place for installations from source code. For example, instead of calling service varnish start, you start the varnish daemon manually by typing:

varnishd -a :6081 -T localhost:6082 -b localhost:8080
varnish-4.1.1/doc/html/installation/platformnotes.html0000644000201500234410000001743512652366773020134 00000000000000 Platform specific notes — Varnish version 4.1.1 documentation

Platform specific notes¶

On some platforms it is necessary to adjust the operating system before running Varnish on it. The systems and steps known to us are described in this section.

Transparent hugepages on Redhat Enterprise Linux 6¶

On RHEL6 Transparent Hugepage kernel support is enabled by default. This is known to cause sporadic crashes of Varnish.

It is recommended to disable transparent hugepages on affected systems. This can be done with echo "never" > /sys/kernel/mm/redhat_transparent_hugepage/enabled (runtime) and changes to /etc/sysctl.conf (persisted.)

On Debian/Ubuntu systems running 3.2 kernels the default value is "madvise" and does not need to be changed.

OpenVZ¶

It is possible, but not recommended for high performance, to run Varnish on virtualised hardware. Reduced disk and network -performance will reduce the performance a bit so make sure your system has good IO performance.

If you are running on 64bit OpenVZ (or Parallels VPS), you must reduce the maximum stack size before starting Varnish.

The default allocates too much memory per thread, which will make Varnish fail as soon as the number of threads (traffic) increases.

Reduce the maximum stack size by adding ulimit -s 256 before starting Varnish in the init script.

TCP keep-alive configuration¶

On some Solaris, FreeBSD and OS X systems, Varnish is not able to set the TCP keep-alive values per socket, and therefore the tcp_keepalive_ Varnish runtime parameters are not available. On these platforms it can be beneficial to tune the system wide values for these in order to more reliably detect remote close for sessions spending long time on waitinglists. This will help free up resources faster.

Systems that does not support TCP keep-alive values per socket include:

  • Solaris releases prior to version 11
  • FreeBSD releases prior to version 9.1
  • OS X releases prior to Mountain Lion

On platforms with the necessary socket options the defaults are set to:

  • tcp_keepalive_time = 600 seconds
  • tcp_keepalive_probes = 5
  • tcp_keepalive_intvl = 5 seconds

Note that Varnish will only apply these run-time parameters so long as they are less than the system default value.

Table Of Contents

Previous topic

Reporting bugs

Next topic

The Varnish Tutorial

This Page

varnish-4.1.1/doc/html/tutorial/0000755000201500234410000000000012652366773013561 500000000000000varnish-4.1.1/doc/html/tutorial/introduction.html0000644000201500234410000002205612652366773017115 00000000000000 The fundamentals of web proxy caching with Varnish — Varnish version 4.1.1 documentation

The fundamentals of web proxy caching with Varnish¶

Varnish is a caching HTTP reverse proxy. It receives requests from clients and tries to answer them from the cache. If Varnish cannot answer the request from the cache it will forward the request to the backend, fetch the response, store it in the cache and deliver it to the client.

When Varnish has a cached response ready it is typically delivered in a matter of microseconds, two orders of magnitude faster than your typical backend server, so you want to make sure to have Varnish answer as many of the requests as possible directly from the cache.

Varnish decides whether it can store the content or not based on the response it gets back from the backend. The backend can instruct Varnish to cache the content with the HTTP response header Cache-Control. There are a few conditions where Varnish will not cache, the most common one being the use of cookies. Since cookies indicates a client-specific web object, Varnish will by default not cache it.

This behaviour as most of Varnish functionality can be changed using policies written in the Varnish Configuration Language (VCL). See The Varnish Users Guide for more information on how to do that.

Performance¶

Varnish has a modern architecture and is written with performance in mind. It is usually bound by the speed of the network, effectively turning performance into a non-issue. You get to focus on how your web applications work and you can allow yourself, to some degree, to care less about performance and scalability.

Flexibility¶

One of the key features of Varnish Cache, in addition to its performance, is the flexibility of its configuration language, VCL. VCL enables you to write policies on how incoming requests should be handled.

In such a policy you can decide what content you want to serve, from where you want to get the content and how the request or response should be altered.

Supported platforms¶

Varnish is written to run on modern versions of Linux and FreeBSD and the best experience is had on those platforms. Thanks to our contributors it also runs on NetBSD, OpenBSD, OS X and various Solaris-descendants like Oracle Solaris, OmniOS and SmartOS.

About the Varnish development process¶

Varnish is a community driven project. The development is overseen by the Varnish Governing Board which currently consists of Poul-Henning Kamp (Architect), Rogier Mulhuijzen (Fastly) and Lasse Karstensen (Varnish Software).

Please see https://www.varnish-cache.org/trac/wiki/Contributing as a starting point if you would like to contribute to Varnish.

Getting in touch¶

You can get in touch with us through many channels. For real time chat you can reach us on IRC through the server irc.linpro.net on the #varnish and #varnish-hacking channels. There are two mailing lists available: one for user questions and one for development discussions. See https://www.varnish-cache.org/lists for information and signup. There is also a web forum on the same site.

Now that you have a vague idea on what Varnish Cache is, let's see if we can get it up and running.

Table Of Contents

Previous topic

The Varnish Tutorial

Next topic

Starting Varnish

This Page

varnish-4.1.1/doc/html/tutorial/index.html0000644000201500234410000001376012652366773015505 00000000000000 The Varnish Tutorial — Varnish version 4.1.1 documentation

The Varnish Tutorial¶

This section covers the Varnish basics in a tutorial form. It will cover what Varnish is and how it works. It also covers how to get Varnish up and running. After this section you probably would want to continue with the users guide (The Varnish Users Guide).

If you're reading this on the web note the "Next topic" and "Previous topic" links on the right side of each page.

Previous topic

Platform specific notes

Next topic

The fundamentals of web proxy caching with Varnish

This Page

varnish-4.1.1/doc/html/tutorial/now_what.html0000644000201500234410000001112012652366773016210 00000000000000 Now what? — Varnish version 4.1.1 documentation

Now what?¶

You've read through the tutorial. You should have Varnish up and running. You should know about the logs and you should have a rough idea of what VCL is. Next, you might want to have a look at The Varnish Users Guide, where we go through the features of Varnish in more detail.

Previous topic

Peculiarities

Next topic

The Varnish Users Guide

This Page

varnish-4.1.1/doc/html/tutorial/starting_varnish.html0000644000201500234410000001656612652366773017772 00000000000000 Starting Varnish — Varnish version 4.1.1 documentation

Starting Varnish¶

This tutorial will assume that you are running Varnish on Ubuntu, Debian, Red Hat Enterprise Linux or CentOS. Those of you running on other platforms might have to do some mental translation exercises in order to follow this. Since you're on a "weird" platform you're probably used to it. :-)

Make sure you have Varnish successfully installed (following one of the procedures described in "Installing Varnish" above.

When properly installed you start Varnish with service varnish start. This will start Varnish if it isn't already running.

Now you have Varnish running. Let us make sure that it works properly. Use your browser to go to http://127.0.0.1:6081/ (Replace the IP address with the IP for the machine that runs Varnish) The default configuration will try to forward requests to a web application running on the same machine as Varnish was installed on. Varnish expects the web application to be exposed over http on port 8080.

If there is no web application being served up on that location Varnish will issue an error. Varnish Cache is very conservative about telling the world what is wrong so whenever something is amiss it will issue the same generic "Error 503 Service Unavailable".

You might have a web application running on some other port or some other machine. Let's edit the configuration and make it point to something that actually works.

Fire up your favorite editor and edit /etc/varnish/default.vcl. Most of it is commented out but there is some text that is not. It will probably look like this:

vcl 4.0;

backend default {
    .host = "127.0.0.1";
    .port = "8080";
}

We'll change it and make it point to something that works. Hopefully http://www.varnish-cache.org/ is up. Let's use that. Replace the text with:

vcl 4.0;

backend default {
    .host = "www.varnish-cache.org";
    .port = "80";
}

Now issue service varnish reload to make Varnish reload it's configuration. If that succeeded visit http://127.0.0.1:6081/ in your browser and you should see some directory listing. It works! The reason you're not seeing the Varnish official website is because your client isn't sending the appropriate Host header in the request and it ends up showing a listing of the default webfolder on the machine usually serving up http://www.varnish-cache.org/ .

Previous topic

The fundamentals of web proxy caching with Varnish

Next topic

Put Varnish on port 80

This Page

varnish-4.1.1/doc/html/tutorial/putting_varnish_on_port_80.html0000644000201500234410000001615412652366773021671 00000000000000 Put Varnish on port 80 — Varnish version 4.1.1 documentation

Put Varnish on port 80¶

Until now we've been running with Varnish on a high port which is great for testing purposes. Let's now put Varnish on the default HTTP port 80.

First we stop varnish: service varnish stop

Now we need to edit the configuration file that starts Varnish.

Debian/Ubuntu¶

On Debian/Ubuntu this is /etc/default/varnish. In the file you'll find some text that looks like this:

DAEMON_OPTS="-a :6081 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
             -s malloc,256m"

Change it to:

DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
             -s malloc,256m"

Red Hat Enterprise Linux / CentOS¶

On Red Hat/CentOS you can find a similar configuration file in /etc/sysconfig/varnish.

Restarting Varnish again¶

Once the change is done, restart Varnish: service varnish start.

Now everyone accessing your site will be accessing through Varnish.

Table Of Contents

Previous topic

Starting Varnish

Next topic

Backend servers

This Page

varnish-4.1.1/doc/html/tutorial/peculiarities.html0000644000201500234410000001474012652366773017237 00000000000000 Peculiarities — Varnish version 4.1.1 documentation

Peculiarities¶

There are a couple of things that are different with Varnish Cache, as opposed to other programs. One thing you've already seen - VCL. In this section we provide a very quick tour of other peculiarities you need to know about to get the most out of Varnish.

Configuration¶

The Varnish Configuration is written in VCL. When Varnish is ran this configuration is transformed into C code and then fed into a C compiler, loaded and executed.

So, as opposed to switching various settings on or off, you write polices on how the incoming traffic should be handled.

varnishadm¶

Varnish Cache has an admin console. You can connect it it through the varnishadm command. In order to connect the user needs to be able to read /etc/varnish/secret in order to authenticate.

Once you've started the console you can do quite a few operations on Varnish, like stopping and starting the cache process, load VCL, adjust the built in load balancer and invalidate cached content.

It has a built in command "help" which will give you some hints on what it does.

varnishlog¶

Varnish does not log to disk. Instead it logs to a chunk of memory. It is actually streaming the logs. At any time you'll be able to connect to the stream and see what is going on. Varnish logs quite a bit of information. You can have a look at the logstream with the command varnishlog.

Table Of Contents

Previous topic

Backend servers

Next topic

Now what?

This Page

varnish-4.1.1/doc/html/tutorial/backend_servers.html0000644000201500234410000001361212652366773017532 00000000000000 Backend servers — Varnish version 4.1.1 documentation

Backend servers¶

Varnish has a concept of backend or origin servers. A backend server is the server providing the content Varnish will accelerate via the cache.

Our first task is to tell Varnish where it can find its content. Start 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.

If you've been following the tutorial there is probably a section of the configuration that looks like this:

vcl 4.0;

backend default {
    .host = "www.varnish-cache.org";
    .port = "80";
}

This means we set up a backend in Varnish that fetches content from 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 server. We've already bound Varnish to the public port 80 on the server so now we need to tie it to the origin.

For this example, let's pretend the origin server is running on localhost, port 8080.:

vcl 4.0;

backend default {
  .host = "127.0.0.1";
  .port = "8080";
}

Varnish can have several backends defined and can even join several backends together into clusters of backends for load balancing purposes, having Varnish pick one backend based on different algorithms.

Next, let's have a look at some of what makes Varnish unique and what you can do with it.

Previous topic

Put Varnish on port 80

Next topic

Peculiarities

This Page

varnish-4.1.1/doc/html/search.html0000644000201500234410000000611712652366773013776 00000000000000 Search — Varnish version 4.1.1 documentation

Search

Please activate JavaScript to enable the search functionality.

From here you can search these documents. Enter your search words into the box below and click "search". Note that the search function will automatically search for all of the words. Pages containing fewer words won't appear in the result list.

varnish-4.1.1/doc/graphviz/0000755000201500234410000000000012652366762012602 500000000000000varnish-4.1.1/doc/graphviz/Makefile.am0000644000201500234410000000256112652366721014555 00000000000000# Makefile for graphviz outputs # for an out-of-tree build, sphinx needs the output in builddir # XXX is there a better way to do this? .PHONY: link_srcdir link_srcdir: if test "x$(srcdir)" != "x$(builddir)" && \ test ! -f $(builddir)/cache_http1_fsm.svg ; then \ d=`pwd`/$(builddir) ; \ cd $(srcdir) && find . -name \*.svg -type f | \ cpio -ldmp $${d} ; \ fi dist-hook: $(MAKE) html # You can set these variables from the command line. # this is a4, letter is 8.5,11 SIZE = 8.4,11.7 EXTRA_DIST = $(srcdir)/*.dot if HAVE_DOT PDFS = \ cache_http1_fsm.pdf \ cache_req_fsm.pdf \ cache_fetch.pdf SVGS = \ cache_http1_fsm.svg \ cache_req_fsm.svg \ cache_fetch.svg CLEANFILES = \ $(PDFS) \ $(SVGS) endif pdf: $(PDFS) if ! HAVE_DOT @echo ================================================== @echo You need graphviz installed to generate pdf output @echo ================================================== @false endif html: $(SVGS) link_srcdir if ! HAVE_DOT @echo =================================================== @echo You need graphviz installed to generate html output @echo =================================================== @false endif # XXX does not fit onto a4 unless in landscape cache_fetch.pdf: cache_fetch.dot @DOT@ -Tpdf -Gsize=$(SIZE) -Grotate=90 $< >$@ %.pdf: %.dot @DOT@ -Tpdf -Gsize=$(SIZE) $< >$@ %.svg: %.dot @DOT@ -Tsvg $< >$@ varnish-4.1.1/doc/graphviz/cache_fetch.dot0000644000201500234410000000556012652366721015447 00000000000000/* * we should format labels in a readable form like * label=" * {vbf_stp_startfetch:| * {vcl_backend_fetch\{\}|bereq.*}| * {abandon| * fetch}}" * * * ... but some servers in the v-c.o build farm use old graphviz 2.26.3 * which cannot handle labels with additional whitespace properly, so * for the time being we need to fall back into dark middle ages and * use illegibly long lines * * -- slink 20141013 */ digraph cache_fetch { margin="0.5" center="1" /*** cache_fetch.c ***/ subgraph cluster_backend { style=filled color=aliceblue RETRY [shape=plaintext] v_b_f_BGFETCH [label="BGFETCH", shape=box, style=filled, color=turquoise] v_b_f_FETCH [label="FETCH", shape=box, style=filled, color=turquoise] v_b_f_BGFETCH -> v_b_f [style=bold,color=green] v_b_f_FETCH -> v_b_f [style=bold,color=blue] v_b_f_FETCH -> v_b_f [style=bold,color=red] RETRY -> v_b_f [color=purple] /* vbf_stp_startfetch() */ v_b_f [ shape=record label="{vbf_stp_startfetch:|{vcl_backend_fetch\{\}|bereq.*}|{abandon|fetch}}" ] v_b_f:fetch:s -> v_b_hdrs [style=bold] v_b_hdrs [ label="send bereq,\nread beresp (headers)"] v_b_hdrs -> v_b_r [style=bold] v_b_hdrs -> v_b_e v_b_r [ shape=record label="{vbf_stp_startfetch:|{vcl_backend_response\{\}|{bereq.*|beresp.*}}|{{retry|{max?|ok?}}|abandon|{deliver|{304?|other?}}}}" ] v_b_r:retry -> v_b_r_retry [color=purple] v_b_r:max -> v_b_e v_b_r:fetch_304:s -> vbf_stp_condfetch v_b_r:non_304:s -> vbf_stp_fetch v_b_r_retry [label="RETRY",shape=plaintext] vbf_stp_fetch [ shape=record fontcolor=grey color=grey label="{vbf_stp_fetch:|setup VFPs|fetch|{fetch_fail?|error?|ok?}}" ] vbf_stp_fetch:ok:s -> FETCH_DONE vbf_stp_condfetch [ shape=record fontcolor=grey color=grey label="{vbf_stp_condfetch:|copy obj attr|steal body|{fetch_fail?|ok?}}" ] vbf_stp_condfetch:ok:s -> FETCH_DONE error [shape=plaintext] error -> FETCH_FAIL /* vbf_stp_error */ v_b_e [ shape=record label="{vbf_stp_error:|{vcl_backend_error\{\}|{bereq.*|beresp.*}}|{{retry|{max?|ok?}}|abandon|deliver}}}" ] // v_b_e:deliver aka "backend synth" - goes into cache v_b_e:deliver -> FETCH_DONE [label="\"backend synth\""] v_b_e:retry -> v_b_e_retry [color=purple] v_b_e_retry [label="RETRY",shape=plaintext] v_b_e:max:s -> FETCH_FAIL v_b_e_retry [label="RETRY",shape=plaintext] FETCH_DONE [label="FETCH_DONE", shape=box,style=filled,color=turquoise] abandon [shape=plaintext] abandon -> FETCH_FAIL // F_STP_FAIL FETCH_FAIL [label="FETCH_FAIL", shape=box,style=filled,color=turquoise] } } varnish-4.1.1/doc/graphviz/Makefile.in0000644000201500234410000003116612652366726014576 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Makefile for graphviz outputs # for an out-of-tree build, sphinx needs the output in builddir # XXX is there a better way to do this? VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = doc/graphviz DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ # You can set these variables from the command line. # this is a4, letter is 8.5,11 SIZE = 8.4,11.7 EXTRA_DIST = $(srcdir)/*.dot @HAVE_DOT_TRUE@PDFS = \ @HAVE_DOT_TRUE@ cache_http1_fsm.pdf \ @HAVE_DOT_TRUE@ cache_req_fsm.pdf \ @HAVE_DOT_TRUE@ cache_fetch.pdf @HAVE_DOT_TRUE@SVGS = \ @HAVE_DOT_TRUE@ cache_http1_fsm.svg \ @HAVE_DOT_TRUE@ cache_req_fsm.svg \ @HAVE_DOT_TRUE@ cache_fetch.svg @HAVE_DOT_TRUE@CLEANFILES = \ @HAVE_DOT_TRUE@ $(PDFS) \ @HAVE_DOT_TRUE@ $(SVGS) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/graphviz/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign doc/graphviz/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ dist-hook distclean distclean-generic distclean-libtool \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am .PHONY: link_srcdir link_srcdir: if test "x$(srcdir)" != "x$(builddir)" && \ test ! -f $(builddir)/cache_http1_fsm.svg ; then \ d=`pwd`/$(builddir) ; \ cd $(srcdir) && find . -name \*.svg -type f | \ cpio -ldmp $${d} ; \ fi dist-hook: $(MAKE) html pdf: $(PDFS) @HAVE_DOT_FALSE@ @echo ================================================== @HAVE_DOT_FALSE@ @echo You need graphviz installed to generate pdf output @HAVE_DOT_FALSE@ @echo ================================================== @HAVE_DOT_FALSE@ @false html: $(SVGS) link_srcdir @HAVE_DOT_FALSE@ @echo =================================================== @HAVE_DOT_FALSE@ @echo You need graphviz installed to generate html output @HAVE_DOT_FALSE@ @echo =================================================== @HAVE_DOT_FALSE@ @false # XXX does not fit onto a4 unless in landscape cache_fetch.pdf: cache_fetch.dot @DOT@ -Tpdf -Gsize=$(SIZE) -Grotate=90 $< >$@ %.pdf: %.dot @DOT@ -Tpdf -Gsize=$(SIZE) $< >$@ %.svg: %.dot @DOT@ -Tsvg $< >$@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/doc/graphviz/cache_req_fsm.dot0000644000201500234410000001226012652366721016005 00000000000000/* * we should format labels in a readable form like * label="\ * {cnt_deliver:|\ * Filter obj.-\>resp.|\ * {vcl_deliver\{\}|\ * {req.*|resp.*}}|\ * {restart|deliver|synth}}" * * * ... but some servers in the v-c.o build farm use old graphviz 2.26.3 * which cannot handle labels with additional whitespace properly, so * for the time being we need to fall back into dark middle ages and * use illegibly long lines * * -- slink 20141013 */ digraph cache_req_fsm { margin="0.25" ranksep="0.5" center="1" //// XXX does this belong here? -- from cache_vcl.c /* vcl_load [label = "vcl.load",shape=plaintext] vcl_load -> init init [ shape=record label=" {VCL_Load:| {vcl_init}| {ok|fail}}" ] init:ok -> ok init:fail -> fail vcl_discard [label = "vcl.discard",shape=plaintext] vcl_discard -> fini fini [ shape=record label=" {VCL_Nuke:| {vcl_fini}| {ok}}" ] fini:ok -> ok */ acceptor [ shape=hexagon label="Request received" ] ESI_REQ [ shape=hexagon ] RESTART [shape=plaintext] ESI_REQ -> recv SYNTH [shape=plaintext] acceptor -> recv [style=bold] subgraph xcluster_deliver { /* cnt_deliver() */ deliver [ shape=record label="{cnt_deliver:|Filter obj.-\>resp.|{vcl_deliver\{\}|{req.*|resp.*}}|{restart|deliver|synth}}" ] deliver:deliver:s -> V1D_Deliver [style=bold,color=green] deliver:deliver:s -> V1D_Deliver [style=bold,color=red] deliver:deliver:s -> V1D_Deliver [style=bold,color=blue] stream [label="stream?\nbody",style=filled,color=turquoise] stream -> V1D_Deliver [style=dotted] } V1D_Deliver -> DONE /* cnt_synth() */ subgraph xcluster_synth { synth [ shape=record label="{cnt_synth:|{vcl_synth\{\}|{req.*|resp.*}}|{deliver|restart}}" ] SYNTH -> synth [color=purple] synth:del:s -> V1D_Deliver [color=purple] } subgraph cluster_backend { style=filled color=aliceblue "see backend graph" [shape=plaintext] node [shape=box, style=filled, color=turquoise] BGFETCH FETCH FETCH_DONE FETCH_FAIL } lookup2:deliver:s -> BGFETCH [label="parallel\nif obj expired", color=green] FETCH_FAIL -> synth [color=purple] FETCH_DONE -> deliver [style=bold,color=red] FETCH_DONE -> deliver [style=bold,color=blue] FETCH -> FETCH_DONE [style=dotted] FETCH -> FETCH_FAIL [style=dotted] /* cnt_lookup() */ subgraph xcluster_lookup { lookup [ shape=record color=grey fontcolor=grey label="{cnt_lookup:|hash lookup|{hit?|miss?|hit-for-pass?|busy?}}" ] lookup2 [ shape=record label="{cnt_lookup:|{vcl_hit\{\}|{req.*|obj.*}}|{deliver|miss|restart|synth|pass}}" ] } lookup:busy:e -> lookup:top:e [label="(waitinglist)", color=grey, fontcolor=grey] lookup:miss:s -> miss [style=bold,color=blue] lookup:hfp:s -> pass [style=bold,color=red] lookup:h:s -> lookup2 [style=bold,color=green] lookup2:deliver:s -> deliver:n [style=bold,color=green] lookup2:miss:s -> miss [style=bold,color=blue] // XXX should not happen // lookup2:miss:s -> pass [style=bold,color=red,label="(no busy obj)"] lookup2:pass:s -> pass [style=bold,color=red] /* cnt_miss */ subgraph xcluster_miss { miss [ shape=record label="{cnt_miss:|{vcl_miss\{\}|req.*}|{fetch|synth|restart|pass}}" ] } miss:fetch:s -> FETCH [style=bold,color=blue] miss:pass:s -> pass [style=bold,color=red] /* cnt_pass */ subgraph xcluster_pass { pass [ shape=record label="{cnt_pass:|{vcl_pass\{\}|req.*}|{fetch|synth|restart}}" ] } pass:fetch:s -> FETCH [style=bold, color=red] /* cnt_pipe */ subgraph xcluster_pipe { pipe [ shape=record label="{cnt_pipe:|filter req.*-\>bereq.*|{vcl_pipe\{\}|{req.*|bereq.*}}|{pipe|synth}}" ] pipe_do [ shape=ellipse label="send bereq,\ncopy bytes until close" ] pipe:pipe -> pipe_do [style=bold,color=orange] } pipe_do -> DONE [style=bold,color=orange] /* cnt_restart */ subgraph xcluster_restart { restart [ shape=record color=grey fontcolor=grey label="{cnt_restart:|{ok?|max_restarts?}}" ] } RESTART -> restart [color=purple] restart:ok:s -> recv restart:max:s -> err_restart [color=purple] err_restart [label="SYNTH",shape=plaintext] /* cnt_recv() */ subgraph xcluster_recv { recv [ shape=record label="{cnt_recv:|{vcl_recv\{\}|req.*}|{hash|purge|pass|pipe|synth}}" ] recv:hash -> hash [style=bold,color=green] hash [ shape=record label="{cnt_recv:|{vcl_hash\{\}|req.*}|{lookup}}" ] } recv:pipe -> pipe [style=bold,color=orange] recv:pass -> pass [style=bold,color=red] hash:lookup:w -> lookup [style=bold,color=green] hash:lookup:s -> purge:top:n [style=bold,color=purple] recv:purge:s -> hash [style=bold,color=purple] /* cnt_purge */ subgraph xcluster_purge { purge [ shape=record label="{cnt_purge:|{vcl_purge\{\}|req.*}|{synth|restart}}" ] } }varnish-4.1.1/doc/graphviz/cache_http1_fsm.dot0000644000201500234410000000142312652366721016255 00000000000000 digraph vcl_center { margin="0.5" center="1" acceptor -> http1_wait [label=S_STP_NEWREQ, align=center] hash -> CNT_Request [label="Busy object\nS_STP_WORKING\nR_STP_LOOKUP" color=blue] disembark -> hash [style=dotted, color=blue] http1_wait -> CNT_Request [label="S_STP_WORKING\nR_STP_RECV"] http1_wait -> disembark [label="Session close"] http1_wait -> disembark [label="Timeout" color=green] disembark -> waiter [style=dotted, color=green] waiter -> http1_wait [color=green] CNT_Request -> disembark [label="Busy object\nS_STP_WORKING\nR_STP_LOOKUP" color=blue] CNT_Request -> http1_cleanup http1_cleanup -> disembark [label="Session close"] http1_cleanup -> CNT_Request [label="S_STP_WORKING\nR_STP_RECV"] http1_cleanup -> http1_wait [label="S_STP_NEWREQ"] } varnish-4.1.1/man/0000755000201500234410000000000012652366773010760 500000000000000varnish-4.1.1/man/varnishadm.10000644000201500234410000000606412652366755013124 00000000000000.\" Man page generated from reStructeredText. . .TH VARNISHADM 1 "" "" "" .SH NAME varnishadm \- Control a running Varnish instance . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp varnishadm [\-n ident] [\-t timeout] [\-S secretfile] [\-T [address]:port] [command [...]] .SH DESCRIPTION .sp The \fIvarnishadm\fP utility establishes a CLI connection to varnishd either using \-n \fIname\fP or using the \-T and \-S arguments. If \-n \fIname\fP is given the location of the secret file and the address:port is looked up in shared memory. If neither is given \fIvarnishadm\fP will look for an instance without a given name. .sp If a command is given, the command and arguments are sent over the CLI connection and the result returned on stdout. .sp If no command argument is given \fIvarnishadm\fP will pass commands and replies between the CLI socket and stdin/stdout. .SH OPTIONS .INDENT 0.0 .TP .BI \-n \ ident Connect to the instance of \fIvarnishd\fP with this name. .TP .BI \-S \ secretfile Specify the authentication secret file. This should be the same \-S argument as was given to \fIvarnishd\fP. Only processes which can read the contents of this file, will be able to authenticate the CLI connection. .TP .BI \-t \ timeout Wait no longer than this many seconds for an operation to finish. .TP .BI \-T \ Connect to the management interface at the specified address and port. .UNINDENT .sp The syntax and operation of the actual CLI interface is described in the \fIvarnish\-cli(7)\fP manual page. Parameters are described in \fIvarnishd(1)\fP manual page. .sp Additionally, a summary of commands can be obtained by issuing the \fIhelp\fP command, and a summary of parameters can be obtained by issuing the \fIparam.show\fP command. .SH EXIT STATUS .sp If a command is given, the exit status of the \fIvarnishadm\fP utility is zero if the command succeeded, and non\-zero otherwise. .SH EXAMPLES .sp Some ways you can use varnishadm: .sp .nf .ft C varnishadm \-T localhost:999 \-S /var/db/secret vcl.use foo echo vcl.use foo | varnishadm \-T localhost:999 \-S /var/db/secret echo vcl.use foo | ssh vhost varnishadm \-T localhost:999 \-S /var/db/secret .ft P .fi .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fIvarnishd(1)\fP .IP \(bu 2 \fIvarnish\-cli(7)\fP .UNINDENT .SH AUTHORS .sp The \fIvarnishadm\fP utility and this manual page were written by Cecilie Fritzvold. This man page has later been modified by Per Buer, Federico G. Schwindt and Lasse Karstensen. .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/varnishncsa.10000644000201500234410000001401312652366755013300 00000000000000.\" Man page generated from reStructeredText. . .TH VARNISHNCSA 1 "" "" "" .SH NAME varnishncsa \- Display Varnish logs in Apache / NCSA combined log format . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp varnishncsa [\-a] [\-C] [\-d] [\-D] [\-F format] [\-f formatfile] [\-g ] [\-h] [\-n name] [\-N filename] [\-P file] [\-q query] [\-r filename] [\-t ] [\-V] [\-w filename] .SH DESCRIPTION .sp The varnishncsa utility reads varnishd(1) shared memory logs and presents them in the Apache / NCSA "combined" log format. .sp Each log line produced is based on a single Request type transaction gathered from the shared memory log. The Request transaction is then scanned for the relevant parts in order to output one log line. To filter the log lines produced, use the query language to select the applicable transactions. Non\-request transactions are ignored. .sp The following options are available: .INDENT 0.0 .TP .B \-a When writing output to a file, append to it rather than overwrite it. .TP .B \-C Do all regular expression and string matching caseless. .TP .B \-d Start processing log records at the head of the log instead of the tail. .TP .B \-D Daemonize. .TP .BI \-F \ format Set the output log format string. .TP .BI \-f \ formatfile Read output format from a file. Will read a single line from the specified file, and use that line as the format. .TP .BI \-g \ The grouping of the log records. The default is to group by vxid. .TP .B \-h Print program usage and exit .TP .BI \-n \ name Specify the name of the varnishd instance to get logs from. If \-n is not specified, the host name is used. .TP .BI \-N \ filename Specify the filename of a stale VSM instance. When using this option the abandonment checking is disabled. .TP .BI \-P \ file Write the process\(aq PID to the specified file. .TP .BI \-q \ query Specifies the VSL query to use. .TP .BI \-r \ filename Read log in binary file format from this file. The file can be created with \fBvarnishlog \-w filename\fP. .TP .BI \-t \ Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this many seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. Defaults to 5 seconds. .TP .B \-V Print version information and exit. .TP .BI \-w \ filename Redirect output to file. The file will be overwritten unless the \-a option was specified. If the application receives a SIGHUP in daemon mode the file will be reopened allowing the old one to be rotated away. This option is required when running in daemon mode. .UNINDENT .SH FORMAT .sp Specify the log format used. If no format is specified the default log format is used. .sp The default log format is: .sp .nf .ft C %h %l %u %t "%r" %s %b "%{Referer}i" "%{User\-agent}i" .ft P .fi .sp Escape sequences \en and \et are supported. .sp Supported formatters are: .INDENT 0.0 .TP .B %b Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a \(aq\-\(aq rather than a 0 when no bytes are sent. .TP .B %D Time taken to serve the request, in microseconds. .TP .B %H The request protocol. Defaults to HTTP/1.0 if not known. .TP .B %h Remote host. Defaults to \(aq\-\(aq if not known. .TP .B %I Total bytes received from client. .TP .B %{X}i The contents of request header X. .TP .B %l Remote logname (always \(aq\-\(aq) .TP .B %m Request method. Defaults to \(aq\-\(aq if not known. .TP .B %{X}o The contents of response header X. .TP .B %O Total bytes sent to client. .TP .B %q The query string, if no query string exists, an empty string. .TP .B %r The first line of the request. Synthesized from other fields, so it may not be the request verbatim. .TP .B %s Status sent to the client .TP .B %t Time when the request was received, in HTTP date/time format. .TP .B %{X}t Time when the request was received, in the format specified by X. The time specification format is the same as for strftime(3). .TP .B %T Time taken to serve the request, in seconds. .TP .B %U The request URL without any query string. Defaults to \(aq\-\(aq if not known. .TP .B %u Remote user from auth .TP .B %{X}x Extended variables. Supported variables are: .INDENT 7.0 .TP .B Varnish:time_firstbyte Time from when the request processing starts until the first byte is sent to the client. .TP .B Varnish:hitmiss Whether the request was a cache hit or miss. Pipe and pass are considered misses. .TP .B Varnish:handling How the request was handled, whether it was a cache hit, miss, pass, pipe or synth. .TP .B VCL_Log:key Output value set by std.log("key:value") in VCL. .UNINDENT .UNINDENT .SH SIGNALS .INDENT 0.0 .TP .B SIGHUP Rotate the log file (see \-w option) .TP .B SIGUSR1 Flush any outstanding transactions .UNINDENT .SH SEE ALSO .sp \fIvarnishd(1)\fP \fIvarnishlog(1)\fP \fIvarnishstat(1)\fP .SH HISTORY .sp The varnishncsa utility was developed by Poul\-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS. This manual page was initially written by Dag\-Erling Smørgrav <\fI\%des@des.no\fP>, and later updated by Martin Blix Grydeland. .SH COPYRIGHT .sp This document is licensed under the same licence as Varnish itself. See LICENCE for details. .INDENT 0.0 .IP \(bu 2 Copyright (c) 2006 Verdens Gang AS .IP \(bu 2 Copyright (c) 2006\-2015 Varnish Software AS .UNINDENT .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/varnishlog.10000644000201500234410000001330112652366755013134 00000000000000.\" Man page generated from reStructeredText. . .TH VARNISHLOG 1 "" "" "" .SH NAME varnishlog \- Display Varnish logs . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp varnishlog [\-a] [\-A] [\-b] [\-c] [\-C] [\-d] [\-D] [\-g ] [\-h] [\-i taglist] [\-I <[taglist:]regex>] [\-k num] [\-L limit] [\-n name] [\-N filename] [\-P file] [\-q query] [\-r filename] [\-t ] [\-T seconds] [\-v] [\-V] [\-w filename] [\-x taglist] [\-X <[taglist:]regex>] .SH OPTIONS .sp The following options are available: .INDENT 0.0 .TP .B \-a When writing output to a file with the \-w option, append to it rather than overwrite it. .TP .B \-A When writing output to a file with the \-w option, output data in ascii format. .TP .B \-b Only display transactions and log records coming from backend communication. .TP .B \-c Only display transactions and log records coming from client communication. .TP .B \-C Do all regular expression and string matching caseless. .TP .B \-d Start processing log records at the head of the log instead of the tail. .TP .B \-D Daemonize. .TP .BI \-g \ The grouping of the log records. The default is to group by vxid. .TP .B \-h Print program usage and exit .TP .BI \-i \ taglist Include log records of these tags in output. Taglist is a comma\-separated list of tag globs. Multiple \-i options may be given. .sp If a tag include option is the first of any tag selection options, all tags are first marked excluded. .TP .BI \-I \ <[taglist:]regex> Include by regex matching. Output only records matching taglist and regular expression. Applies to any tag if taglist is absent. .sp If a tag include option is the first of any tag selection options, all tags are first marked excluded. .TP .BI \-k \ num Process this number of matching log transactions before exiting. .TP .BI \-L \ limit Sets the upper limit of incomplete transactions kept before the oldest transaction is force completed. A warning record is synthesized when this happens. This setting keeps an upper bound on the memory usage of running queries. Defaults to 1000 transactions. .TP .BI \-n \ name Specify the name of the varnishd instance to get logs from. If \-n is not specified, the host name is used. .TP .BI \-N \ filename Specify the filename of a stale VSM instance. When using this option the abandonment checking is disabled. .TP .BI \-P \ file Write the process\(aq PID to the specified file. .TP .BI \-q \ query Specifies the VSL query to use. .TP .BI \-r \ filename Read log in binary file format from this file. The file can be created with \fBvarnishlog \-w filename\fP. .TP .BI \-t \ Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this many seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. Defaults to 5 seconds. .TP .BI \-T \ seconds Sets the transaction timeout in seconds. This defines the maximum number of seconds elapsed between a Begin tag and the End tag. If the timeout expires, a warning record is synthesized and the transaction is force completed. Defaults to 120 seconds. .TP .B \-v Use verbose output on record set printing, giving the VXID on every log line. Without this option, the VXID will only be given on the header of that transaction. .TP .B \-V Print version information and exit. .TP .BI \-w \ filename Redirect output to file. The file will be overwritten unless the \-a option was specified. If the application receives a SIGHUP in daemon mode the file will be reopened allowing the old one to be rotated away. The file can then be read by varnishlog and other tools with the \-r option, unless the \-A option was specified. This option is required when running in daemon mode. .TP .BI \-x \ taglist Exclude log records of these tags in output. Taglist is a comma\-separated list of tag globs. Multiple \-x options may be given. .TP .BI \-X \ <[taglist:]regex> Exclude by regex matching. Do not output records matching taglist and regular expression. Applies to any tag if taglist is absent. .UNINDENT .SH SIGNALS .INDENT 0.0 .IP \(bu 2 SIGHUP .sp Rotate the log file (see \-w option) .IP \(bu 2 SIGUSR1 .sp Flush any outstanding transactions .UNINDENT .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fIvarnishd(1)\fP .IP \(bu 2 \fIvarnishhist(1)\fP .IP \(bu 2 \fIvarnishncsa(1)\fP .IP \(bu 2 \fIvarnishstat(1)\fP .IP \(bu 2 \fIvarnishtop(1)\fP .IP \(bu 2 \fIvsl(7)\fP .IP \(bu 2 \fIvsl\-query(7)\fP .UNINDENT .SH HISTORY .sp The varnishlog utility was developed by Poul\-Henning Kamp <\fI\%phk@phk.freebsd.dk\fP> in cooperation with Verdens Gang AS and Varnish Software AS. This manual page was initially written by Dag\-Erling Smørgrav, and later updated by Per Buer and Martin Blix Grydeland. .SH COPYRIGHT .sp This document is licensed under the same licence as Varnish itself. See LICENCE for details. .INDENT 0.0 .IP \(bu 2 Copyright (c) 2006 Verdens Gang AS .IP \(bu 2 Copyright (c) 2006\-2015 Varnish Software AS .UNINDENT .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/varnishd.10000644000201500234410000012546112652366756012612 00000000000000.\" Man page generated from reStructeredText. . .TH VARNISHD 1 "" "" "" .SH NAME varnishd \- HTTP accelerator daemon . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp varnishd [\-a address[:port][,PROTO]] [\-b host[:port]] [\-C] [\-d] [\-F] [\-f config] [\-h type[,options]] [\-i identity] [\-j jail[,jailoptions]] [\-l vsl[,vsm]] [\-M address:port] [\-n name] [\-P file] [\-p param=value] [\-r param[,param...]] [\-S secret\-file] [\-s [name=]kind[,options]] [\-T address[:port]] [\-t TTL] [\-V] [\-W waiter] .SH DESCRIPTION .sp The \fIvarnishd\fP daemon accepts HTTP requests from clients, passes them on to a backend server and caches the returned documents to better satisfy future requests for the same document. .SH OPTIONS .INDENT 0.0 .TP .BI \-a \ Listen for client requests on the specified address and port. The address can be a host name ("localhost"), an IPv4 dotted\-quad ("127.0.0.1"), or an IPv6 address enclosed in square brackets ("[::1]"). If address is not specified, \fIvarnishd\fP will listen on all available IPv4 and IPv6 interfaces. If port is not specified, port 80 (http) is used. An additional protocol type can be set for the listening socket with PROTO. Valid protocol types are: HTTP/1 (default), and PROXY. Multiple listening addresses can be specified by using multiple \-a arguments. .TP .BI \-b \ Use the specified host as backend server. If port is not specified, the default is 8080. .TP .B \-C Print VCL code compiled to C language and exit. Specify the VCL file to compile with the \-f option. .TP .B \-d Enables debugging mode: The parent process runs in the foreground with a CLI connection on stdin/stdout, and the child process must be started explicitly with a CLI command. Terminating the parent process will also terminate the child. .TP .B \-F Do not fork, run in the foreground. .TP .BI \-f \ config Use the specified VCL configuration file instead of the builtin default. See \fIvcl(7)\fP for details on VCL syntax. .sp When neither a \-f nor a \-b argument are given, \fIvarnishd\fP will not start the worker process but process cli commands. .TP .BI \-h \ Specifies the hash algorithm. See \fI\%Hash Algorithm Options\fP for a list of supported algorithms. .TP .BI \-i \ identity Specify the identity of the Varnish server. This can be accessed using \fBserver.identity\fP from VCL. .TP .BI \-j \ Specify the jailing technology to use. .TP .BI \-l \ Specifies size of shmlog file. vsl is the space for the VSL records [80M] and vsm is the space for stats counters [1M]. Scaling suffixes like \(aqK\(aq and \(aqM\(aq can be used up to (G)igabytes. Default is 81 Megabytes. .TP .BI \-M \ Connect to this port and offer the command line 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. .TP .BI \-n \ name Specify the name for this instance. Amongst other things, this name is used to construct the name of the directory in which \fIvarnishd\fP keeps temporary files and persistent state. If the specified name begins with a forward slash, it is interpreted as the absolute path to the directory which should be used for this purpose. .TP .BI \-P \ file Write the PID of the process to the specified file. .TP .BI \-p \ Set the parameter specified by param to the specified value, see \fI\%List of Parameters\fP for details. This option can be used multiple times to specify multiple parameters. .TP .BI \-r \ Make the listed parameters read only. This gives the system administrator a way to limit what the Varnish CLI can do. Consider making parameters such as \fIcc_command\fP, \fIvcc_allow_inline_c\fP and \fIvmod_dir\fP read only as these can potentially be used to escalate privileges from the CLI. .TP .BI \-S \ file Path to a file containing a secret used for authorizing access to the management port. If not provided a new secret will be drawn from the system PRNG. .TP .BI \-s \ <[name=]type[,options]> Use the specified storage backend, see \fI\%Storage Backend Options\fP. .sp This option can be used multiple times to specify multiple storage files. Names are referenced in logs, VCL, statistics, etc. .TP .BI \-T \ Offer a management interface on the specified address and port. See \fI\%Management Interface\fP for a list of management commands. .TP .BI \-t \ TTL Specifies the default time to live (TTL) for cached objects. This is a shortcut for specifying the \fIdefault_ttl\fP run\-time parameter. .TP .B \-V Display the version number and exit. .TP .BI \-W \ waiter Specifies the waiter type to use. .UNINDENT .SS Hash Algorithm Options .sp The following hash algorithms are available: .INDENT 0.0 .TP .BI \-h \ critbit self\-scaling tree structure. The default hash algorithm in Varnish Cache 2.1 and onwards. In comparison to a more traditional B tree the critbit tree is almost completely lockless. Do not change this unless you are certain what you\(aqre doing. .TP .BI \-h \ simple_list A simple doubly\-linked list. Not recommended for production use. .TP .BI \-h \ A standard hash table. The hash key is the CRC32 of the object\(aqs URL modulo the size of the hash table. Each table entry points to a list of elements which share the same hash key. The buckets parameter specifies the number of entries in the hash table. The default is 16383. .UNINDENT .SS Storage Backend Options .sp The following storage types are available: .INDENT 0.0 .TP .BI \-s \ malloc is a memory based backend. .TP .BI \-s \ The file backend stores data in a file on disk. The file will be accessed using mmap. .sp The path is mandatory. If path points to a directory, a temporary file will be created in that directory and immediately unlinked. If path points to a non\-existing file, the file will be created. .sp If size is omitted, and path points to an existing file with a size greater than zero, the size of that file will be used. If not, an error is reported. .sp Granularity sets the allocation block size. Defaults to the system page size or the filesystem block size, whichever is larger. .TP .BI \-s \ Persistent storage. Varnish will store objects in a file in a manner that will secure the survival of \fImost\fP of the objects in the event of a planned or unplanned shutdown of Varnish. The persistent storage backend has multiple issues with it and will likely be removed from a future version of Varnish. .UNINDENT .SS Jail Options .sp Varnish jails are a generalization over various platform specific methods to reduce the privileges of varnish processes. They may have specific options. Available jails are: .INDENT 0.0 .TP .BI \-j \ solaris Reduce privileges(5) for \fIvarnishd\fP and sub\-process to the minimally required set. Only available on platforms which have the setppriv(2) call. .TP .BI \-j \ Default on all other platforms if \fIvarnishd\fP is either started with an effective uid of 0 ("as root") or as user \fBvarnish\fP. .sp With the \fBunix\fP jail technology activated, varnish will switch to an alternative user for subprocesses and change the effective uid of the master process whenever possible. .sp The optional \fIuser\fP argument specifies which alternative user to use. It defaults to \fBvarnish\fP .sp The optional \fIccgroup\fP argument specifies a group to add to varnish subprocesses requiring access to a c\-compiler. There is no default. .TP .BI \-j \ none last resort jail choice: With jail technology \fBnone\fP, varnish will run all processes with the privileges it was started with. .UNINDENT .SS Management Interface .sp If the \-T option was specified, \fIvarnishd\fP will offer a command\-line management interface on the specified address and port. The recommended way of connecting to the command\-line management interface is through varnishadm(1). .sp The commands available are documented in varnish(7). .SH RUN TIME PARAMETERS .SS Run Time Parameter Flags .sp Runtime parameters are marked with shorthand flags to avoid repeating the same text over and over in the table below. The meaning of the flags are: .INDENT 0.0 .IP \(bu 2 \fIexperimental\fP .sp We have no solid information about good/bad/optimal values for this parameter. Feedback with experience and observations are most welcome. .IP \(bu 2 \fIdelayed\fP .sp This parameter can be changed on the fly, but will not take effect immediately. .IP \(bu 2 \fIrestart\fP .sp The worker process must be stopped and restarted, before this parameter takes effect. .IP \(bu 2 \fIreload\fP .sp The VCL programs must be reloaded for this parameter to take effect. .IP \(bu 2 \fIexperimental\fP .sp We\(aqre not really sure about this parameter, tell us what you find. .IP \(bu 2 \fIwizard\fP .sp Do not touch unless you \fIreally\fP know what you\(aqre doing. .IP \(bu 2 \fIonly_root\fP .sp Only works if \fIvarnishd\fP is running as root. .UNINDENT .SS Default Value Exceptions on 32 bit Systems .sp Be aware that on 32 bit systems, certain default values are reduced relative to the values listed below, in order to conserve VM space: .INDENT 0.0 .IP \(bu 2 workspace_client: 16k .IP \(bu 2 thread_pool_workspace: 16k .IP \(bu 2 http_resp_size: 8k .IP \(bu 2 http_req_size: 12k .IP \(bu 2 gzip_stack_buffer: 4k .IP \(bu 2 thread_pool_stack: 64k .UNINDENT .SS List of Parameters .sp This text is produced from the same text you will find in the CLI if you use the param.show command: .\" The following is the autogenerated output from varnishd -x dumprstparam . .SS accept_filter .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bool .IP \(bu 2 Default: off .IP \(bu 2 Flags: must_restart .UNINDENT .UNINDENT .UNINDENT .sp Enable kernel accept\-filters (if available in the kernel). .SS acceptor_sleep_decay .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: 0.9 .IP \(bu 2 Minimum: 0 .IP \(bu 2 Maximum: 1 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp If we run out of resources, such as file descriptors or worker threads, the acceptor will sleep between accepts. This parameter (multiplicatively) reduce the sleep duration for each successful accept. (ie: 0.9 = reduce by 10%) .SS acceptor_sleep_incr .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 0.000 .IP \(bu 2 Minimum: 0.000 .IP \(bu 2 Maximum: 1.000 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp If we run out of resources, such as file descriptors or worker threads, the acceptor will sleep between accepts. This parameter control how much longer we sleep, each time we fail to accept a new connection. .SS acceptor_sleep_max .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 0.050 .IP \(bu 2 Minimum: 0.000 .IP \(bu 2 Maximum: 10.000 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp If we run out of resources, such as file descriptors or worker threads, the acceptor will sleep between accepts. This parameter limits how long it can sleep between attempts to accept new connections. .SS auto_restart .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bool .IP \(bu 2 Default: on .UNINDENT .UNINDENT .UNINDENT .sp Automatically restart the child/worker process if it dies. .SS backend_idle_timeout .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 60.000 .IP \(bu 2 Minimum: 1.000 .UNINDENT .UNINDENT .UNINDENT .sp Timeout before we close unused backend connections. .SS ban_dups .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bool .IP \(bu 2 Default: on .UNINDENT .UNINDENT .UNINDENT .sp Eliminate older identical bans when a new ban is added. This saves CPU cycles by not comparing objects to identical bans. This is a waste of time if you have many bans which are never identical. .SS ban_lurker_age .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 60.000 .IP \(bu 2 Minimum: 0.000 .UNINDENT .UNINDENT .UNINDENT .sp The ban lurker will ignore bans until they are this old. When a ban is added, the active traffic will be tested against it as part of object lookup. This parameter holds the ban\-lurker off, until the rush is over. .SS ban_lurker_batch .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: 1000 .IP \(bu 2 Minimum: 1 .UNINDENT .UNINDENT .UNINDENT .sp The ban lurker sleeps ${ban_lurker_sleep} after examining this many objects. Use this to pace the ban\-lurker if it eats too many resources. .SS ban_lurker_sleep .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 0.010 .IP \(bu 2 Minimum: 0.000 .UNINDENT .UNINDENT .UNINDENT .sp How long the ban lurker sleeps after examining ${ban_lurker_batch} objects. Use this to pace the ban\-lurker if it eats too many resources. A value of zero will disable the ban lurker entirely. .SS between_bytes_timeout .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 60.000 .IP \(bu 2 Minimum: 0.000 .UNINDENT .UNINDENT .UNINDENT .sp We only wait for this many seconds between bytes received from the backend before giving up the fetch. A value of zero means never give up. VCL values, per backend or per backend request take precedence. This parameter does not apply to pipe\(aqed requests. .SS cc_command .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: "exec gcc \-std=gnu99 \-g \-O2 \-Wall \-Werror \-Wno\-error=unused\-result t\-Werror t\-Wall t\-Wno\-format\-y2k t\-W t\-Wstrict\-prototypes t\-Wmissing\-prototypes t\-Wpointer\-arith t\-Wreturn\-type t\-Wcast\-qual t\-Wwrite\-strings t\-Wswitch t\-Wshadow t\-Wunused\-parameter t\-Wcast\-align t\-Wchar\-subscripts t\-Wnested\-externs t\-Wextra t\-Wno\-sign\-compare \-fstack\-protector \-Wno\-pointer\-sign \-Wno\-address \-Wno\-missing\-field\-initializers \-pthread \-fpic \-shared \-Wl,\-x \-o %o %s" .IP \(bu 2 Flags: must_reload .UNINDENT .UNINDENT .UNINDENT .sp Command used for compiling the C source code to a dlopen(3) loadable object. Any occurrence of %s in the string will be replaced with the source file name, and %o will be replaced with the output file name. .SS cli_buffer .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 8k .IP \(bu 2 Minimum: 4k .UNINDENT .UNINDENT .UNINDENT .sp Size of buffer for CLI command input. You may need to increase this if you have big VCL files and use the vcl.inline CLI command. NB: Must be specified with \-p to have effect. .SS cli_limit .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 48k .IP \(bu 2 Minimum: 128b .IP \(bu 2 Maximum: 99999999b .UNINDENT .UNINDENT .UNINDENT .sp Maximum size of CLI response. If the response exceeds this limit, the response code will be 201 instead of 200 and the last line will indicate the truncation. .SS cli_timeout .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 60.000 .IP \(bu 2 Minimum: 0.000 .UNINDENT .UNINDENT .UNINDENT .sp Timeout for the childs replies to CLI requests from the mgt_param. .SS clock_skew .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 10 .IP \(bu 2 Minimum: 0 .UNINDENT .UNINDENT .UNINDENT .sp How much clockskew we are willing to accept between the backend and our own clock. .SS connect_timeout .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 3.500 .IP \(bu 2 Minimum: 0.000 .UNINDENT .UNINDENT .UNINDENT .sp Default connection timeout for backend connections. We only try to connect to the backend for this many seconds before giving up. VCL can override this default value for each backend and backend request. .SS critbit_cooloff .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 180.000 .IP \(bu 2 Minimum: 60.000 .IP \(bu 2 Maximum: 254.000 .IP \(bu 2 Flags: wizard .UNINDENT .UNINDENT .UNINDENT .sp How long the critbit hasher keeps deleted objheads on the cooloff list. .SS debug .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: none .UNINDENT .UNINDENT .UNINDENT .sp Enable/Disable various kinds of debugging. .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fInone\fP Disable all debugging .UNINDENT .UNINDENT .UNINDENT .sp Use +/\- prefix to set/reset individual bits: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fIreq_state\fP VSL Request state engine .TP .B \fIworkspace\fP VSL Workspace operations .TP .B \fIwaiter\fP VSL Waiter internals .TP .B \fIwaitinglist\fP VSL Waitinglist events .TP .B \fIsyncvsl\fP Make VSL synchronous .TP .B \fIhashedge\fP Edge cases in Hash .TP .B \fIvclrel\fP Rapid VCL release .TP .B \fIlurker\fP VSL Ban lurker .TP .B \fIesi_chop\fP Chop ESI fetch to bits .TP .B \fIflush_head\fP Flush after http1 head .TP .B \fIvtc_mode\fP Varnishtest Mode .TP .B \fIwitness\fP Emit WITNESS lock records .TP .B \fIvsm_keep\fP Keep the VSM file on restart .UNINDENT .UNINDENT .UNINDENT .SS default_grace .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 10.000 .IP \(bu 2 Minimum: 0.000 .IP \(bu 2 Flags: obj_sticky .UNINDENT .UNINDENT .UNINDENT .sp Default grace period. We will deliver an object this long after it has expired, provided another thread is attempting to get a new copy. .SS default_keep .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 0.000 .IP \(bu 2 Minimum: 0.000 .IP \(bu 2 Flags: obj_sticky .UNINDENT .UNINDENT .UNINDENT .sp Default keep period. We will keep a useless object around this long, making it available for conditional backend fetches. That means that the object will be removed from the cache at the end of ttl+grace+keep. .SS default_ttl .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 120.000 .IP \(bu 2 Minimum: 0.000 .IP \(bu 2 Flags: obj_sticky .UNINDENT .UNINDENT .UNINDENT .sp The TTL assigned to objects if neither the backend nor the VCL code assigns one. .SS feature .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: none .UNINDENT .UNINDENT .UNINDENT .sp Enable/Disable various minor features. .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fInone\fP Disable all features. .UNINDENT .UNINDENT .UNINDENT .sp Use +/\- prefix to enable/disable individual feature: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fIshort_panic\fP Short panic message. .TP .B \fIwait_silo\fP Wait for persistent silo. .TP .B \fIno_coredump\fP No coredumps. .TP .B \fIesi_ignore_https\fP Treat HTTPS as HTTP in ESI:includes .TP .B \fIesi_disable_xml_check\fP Don\(aqt check of body looks like XML .TP .B \fIesi_ignore_other_elements\fP Ignore non\-esi XML\-elements .TP .B \fIesi_remove_bom\fP Remove UTF\-8 BOM .UNINDENT .UNINDENT .UNINDENT .SS fetch_chunksize .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 16k .IP \(bu 2 Minimum: 4k .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp The default chunksize used by fetcher. This should be bigger than the majority of objects with short TTLs. Internal limits in the storage_file module makes increases above 128kb a dubious idea. .SS fetch_maxchunksize .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 0.25G .IP \(bu 2 Minimum: 64k .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp The maximum chunksize we attempt to allocate from storage. Making this too large may cause delays and storage fragmentation. .SS first_byte_timeout .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 60.000 .IP \(bu 2 Minimum: 0.000 .UNINDENT .UNINDENT .UNINDENT .sp Default timeout for receiving first byte from backend. We only wait for this many seconds for the first byte before giving up. A value of 0 means it will never time out. VCL can override this default value for each backend and backend request. This parameter does not apply to pipe. .SS gzip_buffer .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 32k .IP \(bu 2 Minimum: 2k .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp Size of malloc buffer used for gzip processing. These buffers are used for in\-transit data, for instance gunzip\(aqed data being sent to a client.Making this space to small results in more overhead, writes to sockets etc, making it too big is probably just a waste of memory. .SS gzip_level .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: 6 .IP \(bu 2 Minimum: 0 .IP \(bu 2 Maximum: 9 .UNINDENT .UNINDENT .UNINDENT .sp Gzip compression level: 0=debug, 1=fast, 9=best .SS gzip_memlevel .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: 8 .IP \(bu 2 Minimum: 1 .IP \(bu 2 Maximum: 9 .UNINDENT .UNINDENT .UNINDENT .sp Gzip memory level 1=slow/least, 9=fast/most compression. Memory impact is 1=1k, 2=2k, ... 9=256k. .SS http_gzip_support .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bool .IP \(bu 2 Default: on .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP .B Enable gzip support. When enabled Varnish request compressed objects from the backend and store them compressed. If a client does not support gzip encoding Varnish will uncompress compressed objects on demand. Varnish will also rewrite the Accept\-Encoding header of clients indicating support for gzip to: Accept\-Encoding: gzip .UNINDENT .sp Clients that do not support gzip will have their Accept\-Encoding header removed. For more information on how gzip is implemented please see the chapter on gzip in the Varnish reference. .SS http_max_hdr .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: header lines .IP \(bu 2 Default: 64 .IP \(bu 2 Minimum: 32 .IP \(bu 2 Maximum: 65535 .UNINDENT .UNINDENT .UNINDENT .sp Maximum number of HTTP header lines we allow in {req|resp|bereq|beresp}.http (obj.http is autosized to the exact number of headers). Cheap, ~20 bytes, in terms of workspace memory. Note that the first line occupies five header lines. .SS http_range_support .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bool .IP \(bu 2 Default: on .UNINDENT .UNINDENT .UNINDENT .sp Enable support for HTTP Range headers. .SS http_req_hdr_len .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 8k .IP \(bu 2 Minimum: 40b .UNINDENT .UNINDENT .UNINDENT .sp Maximum length of any HTTP client request header we will allow. The limit is inclusive its continuation lines. .SS http_req_size .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 32k .IP \(bu 2 Minimum: 0.25k .UNINDENT .UNINDENT .UNINDENT .sp Maximum number of bytes of HTTP client request we will deal with. This is a limit on all bytes up to the double blank line which ends the HTTP request. The memory for the request is allocated from the client workspace (param: workspace_client) and this parameter limits how much of that the request is allowed to take up. .SS http_resp_hdr_len .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 8k .IP \(bu 2 Minimum: 40b .UNINDENT .UNINDENT .UNINDENT .sp Maximum length of any HTTP backend response header we will allow. The limit is inclusive its continuation lines. .SS http_resp_size .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 32k .IP \(bu 2 Minimum: 0.25k .UNINDENT .UNINDENT .UNINDENT .sp Maximum number of bytes of HTTP backend response we will deal with. This is a limit on all bytes up to the double blank line which ends the HTTP request. The memory for the request is allocated from the backend workspace (param: workspace_backend) and this parameter limits how much of that the request is allowed to take up. .SS idle_send_timeout .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 60.000 .IP \(bu 2 Minimum: 0.000 .IP \(bu 2 Flags: delayed .UNINDENT .UNINDENT .UNINDENT .sp Time to wait with no data sent. If no data has been transmitted in this many seconds the session is closed. See setsockopt(2) under SO_SNDTIMEO for more information. .SS listen_depth .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: connections .IP \(bu 2 Default: 1024 .IP \(bu 2 Minimum: 0 .IP \(bu 2 Flags: must_restart .UNINDENT .UNINDENT .UNINDENT .sp Listen queue depth. .SS lru_interval .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 2.000 .IP \(bu 2 Minimum: 0.000 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp Grace period before object moves on LRU list. Objects are only moved to the front of the LRU list if they have not been moved there already inside this timeout period. This reduces the amount of lock operations necessary for LRU list access. .SS max_esi_depth .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: levels .IP \(bu 2 Default: 5 .IP \(bu 2 Minimum: 0 .UNINDENT .UNINDENT .UNINDENT .sp Maximum depth of esi:include processing. .SS max_restarts .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: restarts .IP \(bu 2 Default: 4 .IP \(bu 2 Minimum: 0 .UNINDENT .UNINDENT .UNINDENT .sp Upper limit on how many times a request can restart. Be aware that restarts are likely to cause a hit against the backend, so don\(aqt increase thoughtlessly. .SS max_retries .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: retries .IP \(bu 2 Default: 4 .IP \(bu 2 Minimum: 0 .UNINDENT .UNINDENT .UNINDENT .sp Upper limit on how many times a backend fetch can retry. .SS nuke_limit .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: allocations .IP \(bu 2 Default: 50 .IP \(bu 2 Minimum: 0 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp Maximum number of objects we attempt to nuke in order to make space for a object body. .SS pcre_match_limit .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: 10000 .IP \(bu 2 Minimum: 1 .UNINDENT .UNINDENT .UNINDENT .sp The limit for the number of calls to the internal match() function in pcre_exec(). .sp (See: PCRE_EXTRA_MATCH_LIMIT in pcre docs.) .sp This parameter limits how much CPU time regular expression matching can soak up. .SS pcre_match_limit_recursion .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: 20 .IP \(bu 2 Minimum: 1 .UNINDENT .UNINDENT .UNINDENT .sp The recursion depth\-limit for the internal match() function in a pcre_exec(). .sp (See: PCRE_EXTRA_MATCH_LIMIT_RECURSION in pcre docs.) .sp This puts an upper limit on the amount of stack used by PCRE for certain classes of regular expressions. .sp We have set the default value low in order to prevent crashes, at the cost of possible regexp matching failures. .sp Matching failures will show up in the log as VCL_Error messages with regexp errors \-27 or \-21. .sp Testcase r01576 can be useful when tuning this parameter. .SS ping_interval .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 3 .IP \(bu 2 Minimum: 0 .IP \(bu 2 Flags: must_restart .UNINDENT .UNINDENT .UNINDENT .sp Interval between pings from parent to child. Zero will disable pinging entirely, which makes it possible to attach a debugger to the child. .SS pipe_timeout .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 60.000 .IP \(bu 2 Minimum: 0.000 .UNINDENT .UNINDENT .UNINDENT .sp Idle timeout for PIPE sessions. If nothing have been received in either direction for this many seconds, the session is closed. .SS pool_req .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: 10,100,10 .UNINDENT .UNINDENT .UNINDENT .sp Parameters for per worker pool request memory pool. The three numbers are: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fImin_pool\fP minimum size of free pool. .TP .B \fImax_pool\fP maximum size of free pool. .TP .B \fImax_age\fP max age of free element. .UNINDENT .UNINDENT .UNINDENT .SS pool_sess .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: 10,100,10 .UNINDENT .UNINDENT .UNINDENT .sp Parameters for per worker pool session memory pool. The three numbers are: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fImin_pool\fP minimum size of free pool. .TP .B \fImax_pool\fP maximum size of free pool. .TP .B \fImax_age\fP max age of free element. .UNINDENT .UNINDENT .UNINDENT .SS pool_vbo .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: 10,100,10 .UNINDENT .UNINDENT .UNINDENT .sp Parameters for backend object fetch memory pool. The three numbers are: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fImin_pool\fP minimum size of free pool. .TP .B \fImax_pool\fP maximum size of free pool. .TP .B \fImax_age\fP max age of free element. .UNINDENT .UNINDENT .UNINDENT .SS prefer_ipv6 .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bool .IP \(bu 2 Default: off .UNINDENT .UNINDENT .UNINDENT .sp Prefer IPv6 address when connecting to backends which have both IPv4 and IPv6 addresses. .SS rush_exponent .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: requests per request .IP \(bu 2 Default: 3 .IP \(bu 2 Minimum: 2 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp How many parked request we start for each completed request on the object. NB: Even with the implict delay of delivery, this parameter controls an exponential increase in number of worker threads. .SS send_timeout .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 600.000 .IP \(bu 2 Minimum: 0.000 .IP \(bu 2 Flags: delayed .UNINDENT .UNINDENT .UNINDENT .sp Send timeout for client connections. If the HTTP response hasn\(aqt been transmitted in this many seconds the session is closed. See setsockopt(2) under SO_SNDTIMEO for more information. .SS session_max .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: sessions .IP \(bu 2 Default: 100000 .IP \(bu 2 Minimum: 1000 .UNINDENT .UNINDENT .UNINDENT .sp Maximum number of sessions we will allocate from one pool before just dropping connections. This is mostly an anti\-DoS measure, and setting it plenty high should not hurt, as long as you have the memory for it. .SS shm_reclen .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 255b .IP \(bu 2 Minimum: 16b .IP \(bu 2 Maximum: 4084 .UNINDENT .UNINDENT .UNINDENT .sp Old name for vsl_reclen, use that instead. .SS shortlived .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 10.000 .IP \(bu 2 Minimum: 0.000 .UNINDENT .UNINDENT .UNINDENT .sp Objects created with (ttl+grace+keep) shorter than this are always put in transient storage. .SS sigsegv_handler .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bool .IP \(bu 2 Default: on .IP \(bu 2 Flags: must_restart .UNINDENT .UNINDENT .UNINDENT .sp Install a signal handler which tries to dump debug information on segmentation faults, bus errors and abort signals. .SS syslog_cli_traffic .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bool .IP \(bu 2 Default: on .UNINDENT .UNINDENT .UNINDENT .sp Log all CLI traffic to syslog(LOG_INFO). .SS tcp_keepalive_intvl .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 75.000 .IP \(bu 2 Minimum: 1.000 .IP \(bu 2 Maximum: 100.000 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp The number of seconds between TCP keep\-alive probes. .SS tcp_keepalive_probes .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: probes .IP \(bu 2 Default: 9 .IP \(bu 2 Minimum: 1 .IP \(bu 2 Maximum: 100 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp 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. .SS tcp_keepalive_time .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 7200.000 .IP \(bu 2 Minimum: 1.000 .IP \(bu 2 Maximum: 7200.000 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp The number of seconds a connection needs to be idle before TCP begins sending out keep\-alive probes. .SS thread_pool_add_delay .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 0.000 .IP \(bu 2 Minimum: 0.000 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp Wait at least this long after creating a thread. .sp Some (buggy) systems may need a short (sub\-second) delay between creating threads. Set this to a few milliseconds if you see the \(aqthreads_failed\(aq counter grow too much. .sp Setting this too high results in insuffient worker threads. .SS thread_pool_destroy_delay .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 1.000 .IP \(bu 2 Minimum: 0.010 .IP \(bu 2 Flags: delayed, experimental .UNINDENT .UNINDENT .UNINDENT .sp Wait this long after destroying a thread. .sp This controls the decay of thread pools when idle(\-ish). .SS thread_pool_fail_delay .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 0.200 .IP \(bu 2 Minimum: 0.010 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp Wait at least this long after a failed thread creation before trying to create another thread. .sp Failure to create a worker thread is often a sign that the end is near, because the process is running out of some resource. This delay tries to not rush the end on needlessly. .sp If thread creation failures are a problem, check that thread_pool_max is not too high. .sp It may also help to increase thread_pool_timeout and thread_pool_min, to reduce the rate at which treads are destroyed and later recreated. .SS thread_pool_max .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: threads .IP \(bu 2 Default: 5000 .IP \(bu 2 Minimum: 100 .IP \(bu 2 Flags: delayed .UNINDENT .UNINDENT .UNINDENT .sp The maximum number of worker threads in each pool. .sp Do not set this higher than you have to, since excess worker threads soak up RAM and CPU and generally just get in the way of getting work done. .SS thread_pool_min .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: threads .IP \(bu 2 Default: 100 .IP \(bu 2 Maximum: 5000 .IP \(bu 2 Flags: delayed .UNINDENT .UNINDENT .UNINDENT .sp The minimum number of worker threads in each pool. .sp Increasing this may help ramp up faster from low load situations or when threads have expired. .sp Minimum is 10 threads. .SS thread_pool_stack .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 48k .IP \(bu 2 Minimum: 16k .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp Worker thread stack size. This will likely be rounded up to a multiple of 4k (or whatever the page_size might be) by the kernel. .SS thread_pool_timeout .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 300.000 .IP \(bu 2 Minimum: 10.000 .IP \(bu 2 Flags: delayed, experimental .UNINDENT .UNINDENT .UNINDENT .sp Thread idle threshold. .sp Threads in excess of thread_pool_min, which have been idle for at least this long, will be destroyed. .SS thread_pools .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: pools .IP \(bu 2 Default: 2 .IP \(bu 2 Minimum: 1 .IP \(bu 2 Flags: delayed, experimental .UNINDENT .UNINDENT .UNINDENT .sp Number of worker thread pools. .sp Increasing number of worker pools decreases lock contention. .sp Too many pools waste CPU and RAM resources, and more than one pool for each CPU is probably detrimal to performance. .sp Can be increased on the fly, but decreases require a restart to take effect. .SS thread_queue_limit .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: 20 .IP \(bu 2 Minimum: 0 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp Permitted queue length per thread\-pool. .sp This sets the number of requests we will queue, waiting for an available thread. Above this limit sessions will be dropped instead of queued. .SS thread_stats_rate .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: requests .IP \(bu 2 Default: 10 .IP \(bu 2 Minimum: 0 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp Worker threads accumulate statistics, and dump these into the global stats counters if the lock is free when they finish a job (request/fetch etc.) This parameters defines the maximum number of jobs a worker thread may handle, before it is forced to dump its accumulated stats into the global counters. .SS timeout_idle .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 5.000 .IP \(bu 2 Minimum: 0.000 .UNINDENT .UNINDENT .UNINDENT .sp Idle timeout for client connections. A connection is considered idle, until we have received the full request headers. .SS timeout_linger .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 0.050 .IP \(bu 2 Minimum: 0.000 .IP \(bu 2 Flags: experimental .UNINDENT .UNINDENT .UNINDENT .sp How long the worker thread lingers on an idle session before handing it over to the waiter. When sessions are reused, as much as half of all reuses happen within the first 100 msec of the previous request completing. Setting this too high results in worker threads not doing anything for their keep, setting it too low just means that more sessions take a detour around the waiter. .SS vcc_allow_inline_c .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bool .IP \(bu 2 Default: off .UNINDENT .UNINDENT .UNINDENT .sp Allow inline C code in VCL. .SS vcc_err_unref .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bool .IP \(bu 2 Default: on .UNINDENT .UNINDENT .UNINDENT .sp Unreferenced VCL objects result in error. .SS vcc_unsafe_path .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bool .IP \(bu 2 Default: on .UNINDENT .UNINDENT .UNINDENT .sp Allow \(aq/\(aq in vmod & include paths. Allow \(aqimport ... from ...\(aq. .SS vcl_cooldown .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: seconds .IP \(bu 2 Default: 600.000 .IP \(bu 2 Minimum: 0.000 .UNINDENT .UNINDENT .UNINDENT .sp How long a VCL is kept warm after being replaced as the active VCL (granularity approximately 30 seconds). .SS vcl_dir .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: /opt/varnish/etc/varnish .UNINDENT .UNINDENT .UNINDENT .sp Directory (or colon separated list of directories) from which relative VCL filenames (vcl.load and include) are to be found. .SS vmod_dir .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: /opt/varnish/lib/varnish/vmods .UNINDENT .UNINDENT .UNINDENT .sp Directory (or colon separated list of directories) where VMODs are to be found. .SS vsl_buffer .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 4k .IP \(bu 2 Minimum: 267 .UNINDENT .UNINDENT .UNINDENT .sp Bytes of (req\-/backend\-)workspace dedicated to buffering VSL records. Setting this too high costs memory, setting it too low will cause more VSL flushes and likely increase lock\-contention on the VSL mutex. .sp The minimum tracks the vsl_reclen parameter + 12 bytes. .SS vsl_mask .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Default: \-VCL_trace,\-WorkThread,\-Hash,\-VfpAcct .UNINDENT .UNINDENT .UNINDENT .sp Mask individual VSL messages from being logged. .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fIdefault\fP Set default value .UNINDENT .UNINDENT .UNINDENT .sp Use +/\- prefix in front of VSL tag name, to mask/unmask individual VSL messages. .SS vsl_reclen .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 255b .IP \(bu 2 Minimum: 16b .IP \(bu 2 Maximum: 4084b .UNINDENT .UNINDENT .UNINDENT .sp Maximum number of bytes in SHM log record. .sp The maximum tracks the vsl_buffer parameter \- 12 bytes. .SS vsl_space .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 80M .IP \(bu 2 Minimum: 1M .IP \(bu 2 Flags: must_restart .UNINDENT .UNINDENT .UNINDENT .sp The amount of space to allocate for the VSL fifo buffer in the VSM memory segment. If you make this too small, varnish{ncsa|log} etc will not be able to keep up. Making it too large just costs memory resources. .SS vsm_space .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 1M .IP \(bu 2 Minimum: 1M .IP \(bu 2 Flags: must_restart .UNINDENT .UNINDENT .UNINDENT .sp The amount of space to allocate for stats counters in the VSM memory segment. If you make this too small, some counters will be invisible. Making it too large just costs memory resources. .SS workspace_backend .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 64k .IP \(bu 2 Minimum: 1k .IP \(bu 2 Flags: delayed .UNINDENT .UNINDENT .UNINDENT .sp Bytes of HTTP protocol workspace for backend HTTP req/resp. If larger than 4k, use a multiple of 4k for VM efficiency. .SS workspace_client .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 64k .IP \(bu 2 Minimum: 9k .IP \(bu 2 Flags: delayed .UNINDENT .UNINDENT .UNINDENT .sp Bytes of HTTP protocol workspace for clients HTTP req/resp. If larger than 4k, use a multiple of 4k for VM efficiency. .SS workspace_session .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 0.50k .IP \(bu 2 Minimum: 0.25k .IP \(bu 2 Flags: delayed .UNINDENT .UNINDENT .UNINDENT .sp Allocation size for session structure and workspace. The workspace is primarily used for TCP connection addresses. If larger than 4k, use a multiple of 4k for VM efficiency. .SS workspace_thread .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Units: bytes .IP \(bu 2 Default: 2k .IP \(bu 2 Minimum: 0.25k .IP \(bu 2 Maximum: 8k .IP \(bu 2 Flags: delayed .UNINDENT .UNINDENT .UNINDENT .sp Bytes of auxiliary workspace per thread. This workspace is used for certain temporary data structures during the operation of a worker thread. One use is for the io\-vectors for writing requests and responses to sockets, having too little space will result in more writev(2) system calls, having too much just wastes the space. .SH EXIT CODES .sp Varnish and bundled tools will, in most cases, exit with one of the following codes .INDENT 0.0 .IP \(bu 2 \fI0\fP OK .IP \(bu 2 \fI1\fP Some error which could be system\-dependent and/or transient .IP \(bu 2 \fI2\fP Serious configuration / parameter error \- retrying with the same configuration / parameters is most likely useless .UNINDENT .sp The \fIvarnishd\fP master process may also OR its exit code .INDENT 0.0 .IP \(bu 2 with \fI0x20\fP when the \fIvarnishd\fP child process died, .IP \(bu 2 with \fI0x40\fP when the \fIvarnishd\fP child process was terminated by a signal and .IP \(bu 2 with \fI0x80\fP when a core was dumped. .UNINDENT .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fIvarnishlog(1)\fP .IP \(bu 2 \fIvarnishhist(1)\fP .IP \(bu 2 \fIvarnishncsa(1)\fP .IP \(bu 2 \fIvarnishstat(1)\fP .IP \(bu 2 \fIvarnishtop(1)\fP .IP \(bu 2 \fIvarnish\-cli(7)\fP .IP \(bu 2 \fIvcl(7)\fP .UNINDENT .SH HISTORY .sp The \fIvarnishd\fP daemon was developed by Poul\-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software. .sp This manual page was written by Dag\-Erling Smørgrav with updates by Stig Sandbeck Mathisen <\fI\%ssm@debian.org\fP>, Nils Goroll and others. .SH COPYRIGHT .sp This document is licensed under the same licence as Varnish itself. See LICENCE for details. .INDENT 0.0 .IP \(bu 2 Copyright (c) 2007\-2015 Varnish Software AS .UNINDENT .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/vcl.70000644000201500234410000006536412652366755011572 00000000000000.\" Man page generated from reStructeredText. . .TH VCL 7 "" "" "" .SH NAME VCL \- Varnish Configuration Language . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH DESCRIPTION .sp The VCL language is a small domain\-specific language designed to be used to describe request handling and document caching policies for Varnish Cache. .sp When a new configuration is loaded, the varnishd management process translates the VCL code to C and compiles it to a shared object which is then loaded into the server process. .sp This document focuses on the syntax of the VCL language. For a full description of syntax and semantics, with ample examples, please see the online documentation at \fI\%https://www.varnish\-cache.org/docs/\fP . .sp Starting with Varnish 4.0, each VCL file must start by declaring its version with a special "vcl 4.0;" marker at the top of the file. .SS Operators .sp The following operators are available in VCL: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B = Assignment operator. .UNINDENT .INDENT 0.0 .TP .B == Comparison. .UNINDENT .INDENT 0.0 .TP .B ~ Match. Can either be used with regular expressions or ACLs. .UNINDENT .INDENT 0.0 .TP .B ! Negation. .UNINDENT .INDENT 0.0 .TP .B && Logical and. .UNINDENT .INDENT 0.0 .TP .B || Logical or. .UNINDENT .UNINDENT .UNINDENT .SS Conditionals .sp VCL has \fIif\fP and \fIelse\fP statements. Nested logic can be implemented with the \fIelseif\fP statement (\fIelsif\fP/\fIelif\fP/\fIelse if\fP are equivalent). .sp Note that there are no loops or iterators of any kind in VCL. .SS Strings, booleans, time, duration and integers .sp These are the data types in Varnish. You can \fIset\fP or \fIunset\fP these. .sp Example: .sp .nf .ft C set req.http.User\-Agent = "unknown"; unset req.http.Range; .ft P .fi .SS Strings .sp Basic strings are enclosed in double quotes (" ... "), and may not contain newlines. Long strings are enclosed in {" ... "}. They may contain any character including single double quotes ("), newline and other control characters except for the NUL (0x00) character. .SS Booleans .sp Booleans can be either \fItrue\fP or \fIfalse\fP. .SS Time .sp VCL has time. The function \fInow\fP returns a time. A duration can be added to a time to make another time. In string context they return a formatted string. .SS Durations .sp Durations are defined by a number and a designation. The number can be a real so 1.5w is allowed. .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B ms milliseconds .TP .B s seconds .TP .B m minutes .TP .B h hours .TP .B d days .TP .B w weeks .TP .B y years .UNINDENT .UNINDENT .UNINDENT .SS Integers .sp Certain fields are integers, used as expected. In string context they return a string. .SS Real numbers .sp VCL understands real numbers. As with integers, when used in a string context they will return a string. .SS Regular Expressions .sp Varnish uses Perl\-compatible regular expressions (PCRE). For a complete description please see the pcre(3) man page. .sp To send flags to the PCRE engine, such as to do case insensitive matching, add the flag within parens following a question mark, like this: .sp .nf .ft C # If host is NOT example dot com.. if (req.http.host !~ "(?i)example.com$") { ... } .ft P .fi .SS Include statement .sp To include a VCL file in another file use the include keyword: .sp .nf .ft C include "foo.vcl"; .ft P .fi .SS Import statement .sp The \fIimport\fP statement is used to load Varnish Modules (VMODs.) .sp Example: .sp .nf .ft C import std; sub vcl_recv { std.log("foo"); } .ft P .fi .SS Comments .sp Single lines of VCL can be commented out using // or #. Multi\-line blocks can be commented out with /* block /*. .sp Example: .sp .nf .ft C sub vcl_recv { // Single line of out\-commented VCL. # Another way of commenting out a single line. /* Multi\-line block of commented\-out VCL. */ } .ft P .fi .SS Backend definition .sp A backend declaration creates and initialises a named backend object. A declaration start with the keyword \fIbackend\fP followed by the name of the backend. The actual declaration is in curly brackets, in a key/value fashion.: .sp .nf .ft C backend name { .attribute = "value"; } .ft P .fi .sp The only mandatory attribute is \fIhost\fP. The attributes will inherit their defaults from the global parameters. The following attributes are available: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B host (mandatory) The host to be used. IP address or a hostname that resolves to a single IP address. .TP .B port The port on the backend that Varnish should connect to. .TP .B host_header A host header to add. .TP .B connect_timeout Timeout for connections. .TP .B first_byte_timeout Timeout for first byte. .TP .B between_bytes_timeout Timeout between bytes. .TP .B probe Attach a probe to the backend. See \fI\%Probes\fP .TP .B max_connections Maximum number of open connections towards this backend. If Varnish reaches the maximum Varnish it will start failing connections. .UNINDENT .UNINDENT .UNINDENT .sp Backends can be used with \fIdirectors\fP. Please see the \fIvmod_directors(3)\fP man page for more information. .SS Probes .sp Probes will query the backend for status on a regular basis and mark the backend as down it they fail. A probe is defined as this: .sp .nf .ft C probe name { .attribute = "value"; } .ft P .fi .sp There are no mandatory options. These are the options you can set: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B url The URL to query. Defaults to "/". .TP .B request Specify a full HTTP request using multiple strings. .request will have \er\en automatically inserted after every string. If specified, .request will take precedence over .url. .TP .B expected_response The expected HTTP response code. Defaults to 200. .TP .B timeout The timeout for the probe. Default is 2s. .TP .B interval How often the probe is run. Default is 5s. .TP .B initial How many of the polls in .window are considered good when Varnish starts. Defaults to the value of threshold \- 1. In this case, the backend starts as sick and requires one single poll to be considered healthy. .TP .B window How many of the latest polls we examine to determine backend health. Defaults to 8. .TP .B threshold How many of the polls in .window must have succeeded for us to consider the backend healthy. Defaults to 3. .UNINDENT .UNINDENT .UNINDENT .SS Access Control List (ACL) .sp An Access Control List (ACL) declaration creates and initialises a named access control list which can later be used to match client addresses: .sp .nf .ft C acl localnetwork { "localhost"; # myself "192.0.2.0"/24; # and everyone on the local network ! "192.0.2.23"; # except for the dial\-in router } .ft P .fi .sp If an ACL entry specifies a host name which Varnish is unable to resolve, it will match any address it is compared to. Consequently, if it is preceded by a negation mark, it will reject any address it is compared to, which may not be what you intended. If the entry is enclosed in parentheses, however, it will simply be ignored. .sp To match an IP address against an ACL, simply use the match operator: .sp .nf .ft C if (client.ip ~ localnetwork) { return (pipe); } .ft P .fi .SS VCL objects .sp A VCL object can be instantiated with the \fInew\fP keyword: .sp .nf .ft C sub vcl_init { new b = directors.round_robin() b.add_backend(node1); } .ft P .fi .sp This is only available in vcl_init. .SS Subroutines .sp A subroutine is used to group code for legibility or reusability: .sp .nf .ft C sub pipe_if_local { if (client.ip ~ localnetwork) { return (pipe); } } .ft P .fi .sp Subroutines in VCL do not take arguments, nor do they return values. The built in subroutines all have names beginning with vcl_, which is reserved. .sp To call a subroutine, use the call keyword followed by the subroutine\(aqs name: .sp .nf .ft C sub vcl_recv { call pipe_if_local; } .ft P .fi .SS Return statements .sp The ongoing vcl_* subroutine execution ends when a return(\fIaction\fP) statement is made. .sp The \fIaction\fP specifies how execution should proceed. The context defines which actions are available. .SS Multiple subroutines .sp If multiple subroutines with the name of one of the built\-in ones are defined, they are concatenated in the order in which they appear in the source. .sp The built\-in VCL distributed with Varnish will be implicitly concatenated when the VCL is compiled. .SS Variables .sp In VCL you have access to certain variable objects. These contain requests and responses currently being worked on. What variables are available depends on context. .SS bereq .sp bereq .INDENT 0.0 .INDENT 3.5 Type: HTTP .sp Readable from: backend .sp The entire backend request HTTP data structure .UNINDENT .UNINDENT .sp bereq.backend .INDENT 0.0 .INDENT 3.5 Type: BACKEND .sp Readable from: vcl_pipe, backend .sp Writable from: vcl_pipe, backend .sp This is the backend or director we attempt to fetch from. .UNINDENT .UNINDENT .sp bereq.between_bytes_timeout .INDENT 0.0 .INDENT 3.5 Type: DURATION .sp Readable from: backend .sp Writable from: backend .sp The time in seconds to wait between each received byte from the backend. Not available in pipe mode. .UNINDENT .UNINDENT .sp bereq.connect_timeout .INDENT 0.0 .INDENT 3.5 Type: DURATION .sp Readable from: vcl_pipe, backend .sp Writable from: vcl_pipe, backend .sp The time in seconds to wait for a backend connection. .UNINDENT .UNINDENT .sp bereq.first_byte_timeout .INDENT 0.0 .INDENT 3.5 Type: DURATION .sp Readable from: backend .sp Writable from: backend .sp The time in seconds to wait for the first byte from the backend. Not available in pipe mode. .UNINDENT .UNINDENT .sp bereq.http. .INDENT 0.0 .INDENT 3.5 Type: HEADER .sp Readable from: vcl_pipe, backend .sp Writable from: vcl_pipe, backend .sp The corresponding HTTP header. .UNINDENT .UNINDENT .sp bereq.method .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: vcl_pipe, backend .sp Writable from: vcl_pipe, backend .sp The request type (e.g. "GET", "HEAD"). .UNINDENT .UNINDENT .sp bereq.proto .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: vcl_pipe, backend .sp Writable from: vcl_pipe, backend .sp The HTTP protocol version used to talk to the server. .UNINDENT .UNINDENT .sp bereq.retries .INDENT 0.0 .INDENT 3.5 Type: INT .sp Readable from: backend .sp A count of how many times this request has been retried. .UNINDENT .UNINDENT .sp bereq.uncacheable .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: backend .sp Indicates whether this request is uncacheable due to a pass in the client side or a hit on an existing uncacheable object (aka hit\-for\-pass). .UNINDENT .UNINDENT .sp bereq.url .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: vcl_pipe, backend .sp Writable from: vcl_pipe, backend .sp The requested URL. .UNINDENT .UNINDENT .sp bereq.xid .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: backend .sp Unique ID of this request. .UNINDENT .UNINDENT .SS beresp .sp beresp .INDENT 0.0 .INDENT 3.5 Type: HTTP .sp Readable from: vcl_backend_response, vcl_backend_error .sp The entire backend response HTTP data structure .UNINDENT .UNINDENT .sp beresp.age .INDENT 0.0 .INDENT 3.5 Type: DURATION .sp Readable from: vcl_backend_response, vcl_backend_error .sp The age of the object. .UNINDENT .UNINDENT .sp beresp.backend .INDENT 0.0 .INDENT 3.5 Type: BACKEND .sp Readable from: vcl_backend_response, vcl_backend_error .sp This is the backend we fetched from. If bereq.backend was set to a director, this will be the backend selected by the director. .UNINDENT .UNINDENT .sp beresp.backend.ip .INDENT 0.0 .INDENT 3.5 Type: IP .sp Readable from: vcl_backend_response, vcl_backend_error .sp IP of the backend this response was fetched from. .UNINDENT .UNINDENT .sp beresp.backend.name .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: vcl_backend_response, vcl_backend_error .sp Name of the backend this response was fetched from. .UNINDENT .UNINDENT .sp beresp.do_esi .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp Boolean. ESI\-process the object after fetching it. Defaults to false. Set it to true to parse the object for ESI directives. Will only be honored if req.esi is true. .UNINDENT .UNINDENT .sp beresp.do_gunzip .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp Boolean. Unzip the object before storing it in the cache. Defaults to false. .UNINDENT .UNINDENT .sp beresp.do_gzip .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp Boolean. Gzip the object before storing it. Defaults to false. When http_gzip_support is on Varnish will request already compressed content from the backend and as such compression in Varnish is not needed. .UNINDENT .UNINDENT .sp beresp.do_stream .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp Deliver the object to the client directly without fetching the whole object into varnish. If this request is pass\(aqed it will not be stored in memory. .UNINDENT .UNINDENT .sp beresp.grace .INDENT 0.0 .INDENT 3.5 Type: DURATION .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp Set to a period to enable grace. .UNINDENT .UNINDENT .sp beresp.http. .INDENT 0.0 .INDENT 3.5 Type: HEADER .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp The corresponding HTTP header. .UNINDENT .UNINDENT .sp beresp.keep .INDENT 0.0 .INDENT 3.5 Type: DURATION .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp Set to a period to enable conditional backend requests. .sp The keep time is cache lifetime in addition to the ttl. .sp Objects with ttl expired but with keep time left may be used to issue conditional (If\-Modified\-Since / If\-None\-Match) requests to the backend to refresh them. .UNINDENT .UNINDENT .sp beresp.proto .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp The HTTP protocol version used the backend replied with. .UNINDENT .UNINDENT .sp beresp.reason .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp The HTTP status message returned by the server. .UNINDENT .UNINDENT .sp beresp.status .INDENT 0.0 .INDENT 3.5 Type: INT .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp The HTTP status code returned by the server. .UNINDENT .UNINDENT .sp beresp.storage_hint .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp Hint to Varnish that you want to save this object to a particular storage backend. .UNINDENT .UNINDENT .sp beresp.ttl .INDENT 0.0 .INDENT 3.5 Type: DURATION .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp The object\(aqs remaining time to live, in seconds. .UNINDENT .UNINDENT .sp beresp.uncacheable .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: vcl_backend_response, vcl_backend_error .sp Writable from: vcl_backend_response, vcl_backend_error .sp Inherited from bereq.uncacheable, see there. .sp Setting this variable makes the object uncacheable, which may get stored as a hit\-for\-pass object in the cache. .sp Clearing the variable has no effect and will log the warning "Ignoring attempt to reset beresp.uncacheable". .UNINDENT .UNINDENT .sp beresp.was_304 .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: vcl_backend_response, vcl_backend_error .sp Boolean. If this is a successful 304 response to a backend conditional request refreshing an existing cache object. .UNINDENT .UNINDENT .SS client .sp client.identity .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: client .sp Writable from: client .sp Identification of the client, used to load balance in the client director. .UNINDENT .UNINDENT .sp client.ip .INDENT 0.0 .INDENT 3.5 Type: IP .sp Readable from: client .sp The client\(aqs IP address. .UNINDENT .UNINDENT .SS local .sp local.ip .INDENT 0.0 .INDENT 3.5 Type: IP .sp Readable from: client .sp The IP address of the local end of the TCP connection. .UNINDENT .UNINDENT .SS now .sp now .INDENT 0.0 .INDENT 3.5 Type: TIME .sp Readable from: all .sp The current time, in seconds since the epoch. When used in string context it returns a formatted string. .UNINDENT .UNINDENT .SS obj .sp obj.age .INDENT 0.0 .INDENT 3.5 Type: DURATION .sp Readable from: vcl_hit .sp The age of the object. .UNINDENT .UNINDENT .sp obj.grace .INDENT 0.0 .INDENT 3.5 Type: DURATION .sp Readable from: vcl_hit .sp The object\(aqs remaining grace period in seconds. .UNINDENT .UNINDENT .sp obj.hits .INDENT 0.0 .INDENT 3.5 Type: INT .sp Readable from: vcl_hit, vcl_deliver .sp The count of cache\-hits on this object. A value of 0 indicates a cache miss. .UNINDENT .UNINDENT .sp obj.http. .INDENT 0.0 .INDENT 3.5 Type: HEADER .sp Readable from: vcl_hit .sp The corresponding HTTP header. .UNINDENT .UNINDENT .sp obj.keep .INDENT 0.0 .INDENT 3.5 Type: DURATION .sp Readable from: vcl_hit .sp The object\(aqs remaining keep period in seconds. .UNINDENT .UNINDENT .sp obj.proto .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: vcl_hit .sp The HTTP protocol version used when the object was retrieved. .UNINDENT .UNINDENT .sp obj.reason .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: vcl_hit .sp The HTTP status message returned by the server. .UNINDENT .UNINDENT .sp obj.status .INDENT 0.0 .INDENT 3.5 Type: INT .sp Readable from: vcl_hit .sp The HTTP status code returned by the server. .UNINDENT .UNINDENT .sp obj.ttl .INDENT 0.0 .INDENT 3.5 Type: DURATION .sp Readable from: vcl_hit .sp The object\(aqs remaining time to live, in seconds. .UNINDENT .UNINDENT .sp obj.uncacheable .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: vcl_deliver .sp Whether the object is uncacheable (pass or hit\-for\-pass). .UNINDENT .UNINDENT .SS remote .sp remote.ip .INDENT 0.0 .INDENT 3.5 Type: IP .sp Readable from: client .sp The IP address of the other end of the TCP connection. This can either be the clients IP, or the outgoing IP of a proxy server. .UNINDENT .UNINDENT .SS req .sp req .INDENT 0.0 .INDENT 3.5 Type: HTTP .sp Readable from: client .sp The entire request HTTP data structure .UNINDENT .UNINDENT .sp req.backend_hint .INDENT 0.0 .INDENT 3.5 Type: BACKEND .sp Readable from: client .sp Writable from: client .sp Set bereq.backend to this if we attempt to fetch. .UNINDENT .UNINDENT .sp req.can_gzip .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: client .sp Does the client accept the gzip transfer encoding. .UNINDENT .UNINDENT .sp req.esi .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: client .sp Writable from: client .sp Boolean. Set to false to disable ESI processing regardless of any value in beresp.do_esi. Defaults to true. This variable is subject to change in future versions, you should avoid using it. .UNINDENT .UNINDENT .sp req.esi_level .INDENT 0.0 .INDENT 3.5 Type: INT .sp Readable from: client .sp A count of how many levels of ESI requests we\(aqre currently at. .UNINDENT .UNINDENT .sp req.hash_always_miss .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: vcl_recv .sp Writable from: vcl_recv .sp Force a cache miss for this request. If set to true Varnish will disregard any existing objects and always (re)fetch from the backend. .UNINDENT .UNINDENT .sp req.hash_ignore_busy .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: vcl_recv .sp Writable from: vcl_recv .sp Ignore any busy object during cache lookup. You would want to do this if you have two server looking up content from each other to avoid potential deadlocks. .UNINDENT .UNINDENT .sp req.http. .INDENT 0.0 .INDENT 3.5 Type: HEADER .sp Readable from: client .sp Writable from: client .sp The corresponding HTTP header. .UNINDENT .UNINDENT .sp req.method .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: client .sp Writable from: client .sp The request type (e.g. "GET", "HEAD"). .UNINDENT .UNINDENT .sp req.proto .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: client .sp Writable from: client .sp The HTTP protocol version used by the client. .UNINDENT .UNINDENT .sp req.restarts .INDENT 0.0 .INDENT 3.5 Type: INT .sp Readable from: client .sp A count of how many times this request has been restarted. .UNINDENT .UNINDENT .sp req.ttl .INDENT 0.0 .INDENT 3.5 Type: DURATION .sp Readable from: client .sp Writable from: client .UNINDENT .UNINDENT .sp req.url .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: client .sp Writable from: client .sp The requested URL. .UNINDENT .UNINDENT .sp req.xid .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: client .sp Unique ID of this request. .UNINDENT .UNINDENT .SS req_top .sp req_top.http. .INDENT 0.0 .INDENT 3.5 Type: HEADER .sp Readable from: client .sp HTTP headers of the top\-level request in a tree of ESI requests. Identical to req.http. in non\-ESI requests. .UNINDENT .UNINDENT .sp req_top.method .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: client .sp The request method of the top\-level request in a tree of ESI requests. (e.g. "GET", "HEAD"). Identical to req.method in non\-ESI requests. .UNINDENT .UNINDENT .sp req_top.proto .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: client .sp HTTP protocol version of the top\-level request in a tree of ESI requests. Identical to req.proto in non\-ESI requests. .UNINDENT .UNINDENT .sp req_top.url .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: client .sp The requested URL of the top\-level request in a tree of ESI requests. Identical to req.url in non\-ESI requests. .UNINDENT .UNINDENT .SS resp .sp resp .INDENT 0.0 .INDENT 3.5 Type: HTTP .sp Readable from: vcl_deliver, vcl_synth .sp The entire response HTTP data structure. .UNINDENT .UNINDENT .sp resp.http. .INDENT 0.0 .INDENT 3.5 Type: HEADER .sp Readable from: vcl_deliver, vcl_synth .sp Writable from: vcl_deliver, vcl_synth .sp The corresponding HTTP header. .UNINDENT .UNINDENT .sp resp.is_streaming .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: vcl_deliver, vcl_synth .sp Returns true when the response will be streamed from the backend. .UNINDENT .UNINDENT .sp resp.proto .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: vcl_deliver, vcl_synth .sp Writable from: vcl_deliver, vcl_synth .sp The HTTP protocol version to use for the response. .UNINDENT .UNINDENT .sp resp.reason .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: vcl_deliver, vcl_synth .sp Writable from: vcl_deliver, vcl_synth .sp The HTTP status message that will be returned. .UNINDENT .UNINDENT .sp resp.status .INDENT 0.0 .INDENT 3.5 Type: INT .sp Readable from: vcl_deliver, vcl_synth .sp Writable from: vcl_deliver, vcl_synth .sp The HTTP status code that will be returned. .sp Assigning a HTTP standardized code to resp.status will also set resp.reason to the corresponding status message. .UNINDENT .UNINDENT .SS server .sp server.hostname .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: all .sp The host name of the server. .UNINDENT .UNINDENT .sp server.identity .INDENT 0.0 .INDENT 3.5 Type: STRING .sp Readable from: all .sp The identity of the server, as set by the \-i parameter. If the \-i parameter is not passed to varnishd, server.identity will be set to the name of the instance, as specified by the \-n parameter. .UNINDENT .UNINDENT .sp server.ip .INDENT 0.0 .INDENT 3.5 Type: IP .sp Readable from: client .sp The IP address of the socket on which the client connection was received. .UNINDENT .UNINDENT .SS storage .sp storage..free_space .INDENT 0.0 .INDENT 3.5 Type: BYTES .sp Readable from: client, backend .sp Free space available in the named stevedore. Only available for the malloc stevedore. .UNINDENT .UNINDENT .sp storage..used_space .INDENT 0.0 .INDENT 3.5 Type: BYTES .sp Readable from: client, backend .sp Used space in the named stevedore. Only available for the malloc stevedore. .UNINDENT .UNINDENT .sp storage..happy .INDENT 0.0 .INDENT 3.5 Type: BOOL .sp Readable from: client, backend .sp Health status for the named stevedore. Not available in any of the current stevedores. .UNINDENT .UNINDENT .SS Functions .sp The following built\-in functions are available: .INDENT 0.0 .TP .B ban(expression) Invalidates all objects in cache that match the expression with the ban mechanism. .TP .B hash_data(input) Adds an input to the hash input. In the built\-in VCL hash_data() is called on the host and URL of the \fIrequest\fP. Available in vcl_hash. .TP .B rollback() Restore \fIreq\fP HTTP headers to their original state. This function is deprecated. Use std.rollback() instead. .TP .B synthetic(STRING) Prepare a synthetic response body containing the STRING. Available in vcl_synth and vcl_backend_error. .UNINDENT .\" list above comes from struct action_table[] in vcc_action.c. . .INDENT 0.0 .TP .B regsub(str, regex, sub) Returns a copy of str with the first occurrence of the regular expression regex replaced with sub. Within sub, \e0 (which can also be spelled \e&) is replaced with the entire matched string, and \en is replaced with the contents of subgroup n in the matched string. .TP .B regsuball(str, regex, sub) As regsub() but this replaces all occurrences. .UNINDENT .\" regsub* is in vcc_expr.c . .sp For converting or casting VCL values between data types use the functions available in the std VMOD. .SH EXAMPLES .sp For examples, please see the online documentation. .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fIvarnishd(1)\fP .IP \(bu 2 \fIvmod_directors(3)\fP .IP \(bu 2 \fIvmod_std(3)\fP .UNINDENT .SH HISTORY .sp VCL was developed by Poul\-Henning Kamp in cooperation with Verdens Gang AS, Redpill Linpro and Varnish Software. This manual page is written by Per Buer, Poul\-Henning Kamp, Martin Blix Grydeland, Kristian Lyngstøl, Lasse Karstensen and possibly others. .SH COPYRIGHT .sp This document is licensed under the same license as Varnish itself. See LICENSE for details. .INDENT 0.0 .IP \(bu 2 Copyright (c) 2006 Verdens Gang AS .IP \(bu 2 Copyright (c) 2006\-2015 Varnish Software AS .UNINDENT .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/varnish-counters.70000644000201500234410000004506512652366755014314 00000000000000.\" Man page generated from reStructeredText. . .TH VARNISH-COUNTERS 7 "" "" "" .SH NAME varnish-counters \- Varnish counter field definitions . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH COUNTER LEVELS .INDENT 0.0 .TP .B INFO – Informational counters Counters giving runtime information .TP .B DIAG – Diagnostic counters Counters giving diagnostic information .TP .B DEBUG – Debug counters Counters giving Varnish internals debug information .UNINDENT .SH MAIN COUNTERS (MAIN.*) .INDENT 0.0 .TP .B uptime – How long the child process has been running. (INFO) Child process uptime .TP .B sess_conn – Count of sessions successfully accepted (INFO) Sessions accepted .TP .B sess_drop – Count of sessions silently dropped due to lack of worker thread. (INFO) Sessions dropped .TP .B sess_fail – Count of failures to accept TCP connection. Either the client changed its mind, or the kernel ran out of some resource like file descriptors. (INFO) Session accept failures .TP .B client_req_400 – 400 means we couldn\(aqt make sense of the request, it was malformed in some drastic way. (INFO) Client requests received, subject to 400 errors .TP .B client_req_417 – 417 means that something went wrong with an Expect: header. (INFO) Client requests received, subject to 417 errors .TP .B client_req – The count of parseable client requests seen. (INFO) Good client requests received .TP .B cache_hit – Count of cache hits. A cache hit indicates that an object has been delivered to a client without fetching it from a backend server. (INFO) Cache hits .TP .B cache_hitpass – Count of hits for pass A cache hit for pass indicates that Varnish is going to pass the request to the backend and this decision has been cached in it self. This counts how many times the cached decision is being used. (INFO) Cache hits for pass .TP .B cache_miss – Count of misses A cache miss indicates the object was fetched from the backend before delivering it to the backend. (INFO) Cache misses .TP .B backend_conn – How many backend connections have successfully been established. (INFO) Backend conn. success .TP .B backend_unhealthy – (INFO) Backend conn. not attempted .TP .B backend_busy – (INFO) Backend conn. too many .TP .B backend_fail – (INFO) Backend conn. failures .TP .B backend_reuse – Count of backend connection reuses This counter is increased whenever we reuse a recycled connection. (INFO) Backend conn. reuses .TP .B backend_recycle – Count of backend connection recycles This counter is increased whenever we have a keep\-alive connection that is put back into the pool of connections. It has not yet been used, but it might be, unless the backend closes it. (INFO) Backend conn. recycles .TP .B backend_retry – (INFO) Backend conn. retry .TP .B fetch_head – beresp with no body because the request is HEAD. (INFO) Fetch no body (HEAD) .TP .B fetch_length – beresp.body with Content\-Length. (INFO) Fetch with Length .TP .B fetch_chunked – beresp.body with Chunked. (INFO) Fetch chunked .TP .B fetch_eof – beresp.body with EOF. (INFO) Fetch EOF .TP .B fetch_bad – beresp.body length/fetch could not be determined. (INFO) Fetch bad T\-E .TP .B fetch_none – beresp.body empty (INFO) Fetch no body .TP .B fetch_1xx – beresp with no body because of 1XX response. (INFO) Fetch no body (1xx) .TP .B fetch_204 – beresp with no body because of 204 response. (INFO) Fetch no body (204) .TP .B fetch_304 – beresp with no body because of 304 response. (INFO) Fetch no body (304) .TP .B fetch_failed – beresp fetch failed. (INFO) Fetch failed (all causes) .TP .B fetch_no_thread – beresp fetch failed, no thread available. (INFO) Fetch failed (no thread) .TP .B pools – Number of thread pools. See also parameter thread_pools. NB: Presently pools cannot be removed once created. (INFO) Number of thread pools .TP .B threads – Number of threads in all pools. See also parameters thread_pools, thread_pool_min and thread_pool_max. (INFO) Total number of threads .TP .B threads_limited – Number of times more threads were needed, but limit was reached in a thread pool. See also parameter thread_pool_max. (INFO) Threads hit max .TP .B threads_created – Total number of threads created in all pools. (INFO) Threads created .TP .B threads_destroyed – Total number of threads destroyed in all pools. (INFO) Threads destroyed .TP .B threads_failed – Number of times creating a thread failed. See VSL::Debug for diagnostics. See also parameter thread_fail_delay. (INFO) Thread creation failed .TP .B thread_queue_len – Length of session queue waiting for threads. NB: Only updates once per second. See also parameter queue_max. (INFO) Length of session queue .TP .B busy_sleep – Number of requests sent to sleep without a worker thread because they found a busy object. (INFO) Number of requests sent to sleep on busy objhdr .TP .B busy_wakeup – Number of requests taken of the busy object sleep list and and rescheduled. (INFO) Number of requests woken after sleep on busy objhdr .TP .B busy_killed – Number of requests killed from the busy object sleep list due to lack of resources. (INFO) Number of requests killed after sleep on busy objhdr .TP .B sess_queued – Number of times session was queued waiting for a thread. See also parameter queue_max. (INFO) Sessions queued for thread .TP .B sess_dropped – Number of times session was dropped because the queue were too long already. See also parameter queue_max. (INFO) Sessions dropped for thread .TP .B n_object – Number of object structs made (INFO) object structs made .TP .B n_vampireobject – Number of unresurrected objects (DIAG) unresurrected objects .TP .B n_objectcore – Number of objectcore structs made (INFO) objectcore structs made .TP .B n_objecthead – Number of objecthead structs made (INFO) objecthead structs made .TP .B n_waitinglist – Number of waitinglist structs made (DEBUG) waitinglist structs made .TP .B n_backend – Number of backends known to us. (INFO) Number of backends .TP .B n_expired – Number of objects that expired from cache because of old age. (INFO) Number of expired objects .TP .B n_lru_nuked – How many objects have been forcefully evicted from storage to make room for a new object. (INFO) Number of LRU nuked objects .TP .B n_lru_moved – Number of move operations done on the LRU list. (DIAG) Number of LRU moved objects .TP .B losthdr – (INFO) HTTP header overflows .TP .B s_sess – (INFO) Total sessions seen .TP .B s_req – (INFO) Total requests seen .TP .B s_pipe – (INFO) Total pipe sessions seen .TP .B s_pass – (INFO) Total pass\-ed requests seen .TP .B s_fetch – (INFO) Total backend fetches initiated .TP .B s_synth – (INFO) Total synthethic responses made .TP .B s_req_hdrbytes – Total request header bytes received (INFO) Request header bytes .TP .B s_req_bodybytes – Total request body bytes received (INFO) Request body bytes .TP .B s_resp_hdrbytes – Total response header bytes transmitted (INFO) Response header bytes .TP .B s_resp_bodybytes – Total response body bytes transmitted (INFO) Response body bytes .TP .B s_pipe_hdrbytes – Total request bytes received for piped sessions (INFO) Pipe request header bytes .TP .B s_pipe_in – Total number of bytes forwarded from clients in pipe sessions (INFO) Piped bytes from client .TP .B s_pipe_out – Total number of bytes forwarded to clients in pipe sessions (INFO) Piped bytes to client .TP .B sess_closed – (INFO) Session Closed .TP .B sess_closed_err – Total number of sessions closed with errors. See sc_* diag counters for detailed breakdown (INFO) Session Closed with error .TP .B sess_readahead – (INFO) Session Read Ahead .TP .B sess_herd – (DIAG) Session herd .TP .B sc_rem_close – Number of session closes with REM_CLOSE (Client Closed) (DIAG) Session OK REM_CLOSE .TP .B sc_req_close – Number of session closes with REQ_CLOSE (Client requested close) (DIAG) Session OK REQ_CLOSE .TP .B sc_req_http10 – Number of session closes with Error REQ_HTTP10 (Proto < HTTP/1.1) (DIAG) Session Err REQ_HTTP10 .TP .B sc_rx_bad – Number of session closes with Error RX_BAD (Received bad req/resp) (DIAG) Session Err RX_BAD .TP .B sc_rx_body – Number of session closes with Error RX_BODY (Failure receiving req.body) (DIAG) Session Err RX_BODY .TP .B sc_rx_junk – Number of session closes with Error RX_JUNK (Received junk data) (DIAG) Session Err RX_JUNK .TP .B sc_rx_overflow – Number of session closes with Error RX_OVERFLOW (Received buffer overflow) (DIAG) Session Err RX_OVERFLOW .TP .B sc_rx_timeout – Number of session closes with Error RX_TIMEOUT (Receive timeout) (DIAG) Session Err RX_TIMEOUT .TP .B sc_tx_pipe – Number of session closes with TX_PIPE (Piped transaction) (DIAG) Session OK TX_PIPE .TP .B sc_tx_error – Number of session closes with Error TX_ERROR (Error transaction) (DIAG) Session Err TX_ERROR .TP .B sc_tx_eof – Number of session closes with TX_EOF (EOF transmission) (DIAG) Session OK TX_EOF .TP .B sc_resp_close – Number of session closes with RESP_CLOSE (Backend/VCL requested close) (DIAG) Session OK RESP_CLOSE .TP .B sc_overload – Number of session closes with Error OVERLOAD (Out of some resource) (DIAG) Session Err OVERLOAD .TP .B sc_pipe_overflow – Number of session closes with Error PIPE_OVERFLOW (Session pipe overflow) (DIAG) Session Err PIPE_OVERFLOW .TP .B sc_range_short – Number of session closes with Error RANGE_SHORT (Insufficient data for range) (DIAG) Session Err RANGE_SHORT .TP .B shm_records – (DIAG) SHM records .TP .B shm_writes – (DIAG) SHM writes .TP .B shm_flushes – (DIAG) SHM flushes due to overflow .TP .B shm_cont – (DIAG) SHM MTX contention .TP .B shm_cycles – (DIAG) SHM cycles through buffer .TP .B backend_req – (INFO) Backend requests made .TP .B n_vcl – (INFO) Number of loaded VCLs in total .TP .B n_vcl_avail – (DIAG) Number of VCLs available .TP .B n_vcl_discard – (DIAG) Number of discarded VCLs .TP .B bans – Number of all bans in system, including bans superseded by newer bans and bans already checked by the ban\-lurker. (INFO) Count of bans .TP .B bans_completed – Number of bans which are no longer active, either because they got checked by the ban\-lurker or superseded by newer identical bans. (DIAG) Number of bans marked \(aqcompleted\(aq .TP .B bans_obj – Number of bans which use obj.* variables. These bans can possibly be washed by the ban\-lurker. (DIAG) Number of bans using obj.* .TP .B bans_req – Number of bans which use req.* variables. These bans can not be washed by the ban\-lurker. (DIAG) Number of bans using req.* .TP .B bans_added – Counter of bans added to ban list. (DIAG) Bans added .TP .B bans_deleted – Counter of bans deleted from ban list. (DIAG) Bans deleted .TP .B bans_tested – Count of how many bans and objects have been tested against each other during hash lookup. (DIAG) Bans tested against objects (lookup) .TP .B bans_obj_killed – Number of objects killed by bans during object lookup. (DIAG) Objects killed by bans (lookup) .TP .B bans_lurker_tested – Count of how many bans and objects have been tested against each other by the ban\-lurker. (DIAG) Bans tested against objects (lurker) .TP .B bans_tests_tested – Count of how many tests and objects have been tested against each other during lookup. \(aqban req.url == foo && req.http.host == bar\(aq counts as one in \(aqbans_tested\(aq and as two in \(aqbans_tests_tested\(aq (DIAG) Ban tests tested against objects (lookup) .TP .B bans_lurker_tests_tested – Count of how many tests and objects have been tested against each other by the ban\-lurker. \(aqban req.url == foo && req.http.host == bar\(aq counts as one in \(aqbans_tested\(aq and as two in \(aqbans_tests_tested\(aq (DIAG) Ban tests tested against objects (lurker) .TP .B bans_lurker_obj_killed – Number of objects killed by ban\-lurker. (DIAG) Objects killed by bans (lurker) .TP .B bans_dups – Count of bans replaced by later identical bans. (DIAG) Bans superseded by other bans .TP .B bans_lurker_contention – Number of times the ban\-lurker had to wait for lookups. (DIAG) Lurker gave way for lookup .TP .B bans_persisted_bytes – Number of bytes used by the persisted ban lists. (DIAG) Bytes used by the persisted ban lists .TP .B bans_persisted_fragmentation – Number of extra bytes accumulated through dropped and completed bans in the persistent ban lists. (DIAG) Extra bytes in persisted ban lists due to fragmentation .TP .B n_purges – (INFO) Number of purge operations executed .TP .B n_obj_purged – (INFO) Number of purged objects .TP .B exp_mailed – Number of objects mailed to expiry thread for handling. (DIAG) Number of objects mailed to expiry thread .TP .B exp_received – Number of objects received by expiry thread for handling. (DIAG) Number of objects received by expiry thread .TP .B hcb_nolock – (DEBUG) HCB Lookups without lock .TP .B hcb_lock – (DEBUG) HCB Lookups with lock .TP .B hcb_insert – (DEBUG) HCB Inserts .TP .B esi_errors – (DIAG) ESI parse errors (unlock) .TP .B esi_warnings – (DIAG) ESI parse warnings (unlock) .TP .B vmods – (INFO) Loaded VMODs .TP .B n_gzip – (INFO) Gzip operations .TP .B n_gunzip – (INFO) Gunzip operations .TP .B vsm_free – Number of bytes free in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DIAG) Free VSM space .TP .B vsm_used – Number of bytes used in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DIAG) Used VSM space .TP .B vsm_cooling – Number of bytes which will soon (max 1 minute) be freed in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DEBUG) Cooling VSM space .TP .B vsm_overflow – Number of bytes which does not fit in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DIAG) Overflow VSM space .TP .B vsm_overflowed – Total number of bytes which did not fit in the shared memory used to communicate with tools like varnishstat, varnishlog etc. (DIAG) Overflowed VSM space .UNINDENT .SH MANAGEMENT PROCESS COUNTERS (MGT.*) .INDENT 0.0 .TP .B uptime – Uptime in seconds of the management process (INFO) Management process uptime .TP .B child_start – Number of times the child process has been started (DIAG) Child process started .TP .B child_exit – Number of times the child process has been cleanly stopped (DIAG) Child process normal exit .TP .B child_stop – Number of times the child process has exited with an unexpected return code (DIAG) Child process unexpected exit .TP .B child_died – Number of times the child process has died due to signals (DIAG) Child process died (signal) .TP .B child_dump – Number of times the child process has produced core dumps (DIAG) Child process core dumped .TP .B child_panic – Number of times the management process has caught a child panic (DIAG) Child process panic .UNINDENT .SH PER MEMORY POOL COUNTERS (MEMPOOL.*) .INDENT 0.0 .TP .B live – (DEBUG) In use .TP .B pool – (DEBUG) In Pool .TP .B sz_wanted – (DEBUG) Size requested .TP .B sz_actual – (DEBUG) Size allocated .TP .B allocs – (DEBUG) Allocations .TP .B frees – (DEBUG) Frees .TP .B recycle – (DEBUG) Recycled from pool .TP .B timeout – (DEBUG) Timed out from pool .TP .B toosmall – (DEBUG) Too small to recycle .TP .B surplus – (DEBUG) Too many for pool .TP .B randry – (DEBUG) Pool ran dry .UNINDENT .SH PER MALLOC STORAGE COUNTERS (SMA.*) .INDENT 0.0 .TP .B c_req – Number of times the storage has been asked to provide a storage segment. (INFO) Allocator requests .TP .B c_fail – Number of times the storage has failed to provide a storage segment. (INFO) Allocator failures .TP .B c_bytes – Number of total bytes allocated by this storage. (INFO) Bytes allocated .TP .B c_freed – Number of total bytes returned to this storage. (INFO) Bytes freed .TP .B g_alloc – Number of storage allocations outstanding. (INFO) Allocations outstanding .TP .B g_bytes – Number of bytes allocated from the storage. (INFO) Bytes outstanding .TP .B g_space – Number of bytes left in the storage. (INFO) Bytes available .UNINDENT .SH PER FILE STORAGE COUNTERS (SMF.*) .INDENT 0.0 .TP .B c_req – Number of times the storage has been asked to provide a storage segment. (INFO) Allocator requests .TP .B c_fail – Number of times the storage has failed to provide a storage segment. (INFO) Allocator failures .TP .B c_bytes – Number of total bytes allocated by this storage. (INFO) Bytes allocated .TP .B c_freed – Number of total bytes returned to this storage. (INFO) Bytes freed .TP .B g_alloc – Number of storage allocations outstanding. (INFO) Allocations outstanding .TP .B g_bytes – Number of bytes allocated from the storage. (INFO) Bytes outstanding .TP .B g_space – Number of bytes left in the storage. (INFO) Bytes available .TP .B g_smf – (INFO) N struct smf .TP .B g_smf_frag – (INFO) N small free smf .TP .B g_smf_large – (INFO) N large free smf .UNINDENT .SH PER BACKEND COUNTERS (VBE.*) .INDENT 0.0 .TP .B happy – (INFO) Happy health probes .TP .B bereq_hdrbytes – Total backend request header bytes sent (INFO) Request header bytes .TP .B bereq_bodybytes – Total backend request body bytes sent (INFO) Request body bytes .TP .B beresp_hdrbytes – Total backend response header bytes received (INFO) Response header bytes .TP .B beresp_bodybytes – Total backend response body bytes received (INFO) Response body bytes .TP .B pipe_hdrbytes – Total request bytes sent for piped sessions (INFO) Pipe request header bytes .TP .B pipe_out – Total number of bytes forwarded to backend in pipe sessions (INFO) Piped bytes to backend .TP .B pipe_in – Total number of bytes forwarded from backend in pipe sessions (INFO) Piped bytes from backend .TP .B conn – (INFO) Concurrent connections to backend .TP .B req – (INFO) Backend requests sent .UNINDENT .SH LOCK COUNTERS (LCK.*) .INDENT 0.0 .TP .B creat – (DEBUG) Created locks .TP .B destroy – (DEBUG) Destroyed locks .TP .B locks – (DEBUG) Lock Operations .UNINDENT .SH AUTHORS .sp This man page was written by Lasse Karstensen, using content from vsc2rst written by Tollef Fog Heen. .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/Makefile.am0000644000201500234410000000607412652366721012734 00000000000000# dist_man_MANS = \ varnish-cli.7 \ varnish-counters.7 \ vcl.7 \ vsl.7 \ vsl-query.7 \ varnishadm.1 \ varnishd.1 \ varnishhist.1 \ varnishlog.1 \ varnishncsa.1 \ varnishstat.1 \ varnishtest.1 \ varnishtop.1 \ vmod_directors.3 \ vmod_std.3 MAINTAINERCLEANFILES = $(dist_man_MANS) RST2ANY_FLAGS = --halt=2 varnish-cli.7: $(top_srcdir)/doc/sphinx/reference/varnish-cli.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnish-cli.rst $@ varnish-counters.7: $(top_srcdir)/doc/sphinx/reference/varnish-counters.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnish-counters.rst $@ vcl.7: $(top_srcdir)/doc/sphinx/reference/vcl.rst \ $(top_srcdir)/bin/varnishd/builtin.vcl ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/vcl.rst $@ vsl.7: $(top_srcdir)/doc/sphinx/reference/vsl.rst \ $(top_srcdir)/lib/libvarnishapi/vsl-tags.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/vsl.rst $@ vsl-query.7: $(top_srcdir)/doc/sphinx/reference/vsl-query.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/vsl-query.rst $@ varnishadm.1: $(top_srcdir)/doc/sphinx/reference/varnishadm.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishadm.rst $@ varnishd.1: \ $(top_srcdir)/doc/sphinx/reference/varnishd.rst \ $(top_srcdir)/doc/sphinx/include/params.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishd.rst $@ varnishncsa.1: \ $(top_srcdir)/doc/sphinx/reference/varnishncsa.rst \ $(top_srcdir)/doc/sphinx/include/varnishncsa_options.rst \ $(top_srcdir)/doc/sphinx/include/varnishncsa_synopsis.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishncsa.rst $@ varnishlog.1: \ $(top_srcdir)/doc/sphinx/reference/varnishlog.rst \ $(top_srcdir)/doc/sphinx/include/varnishlog_options.rst \ $(top_srcdir)/doc/sphinx/include/varnishlog_synopsis.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishlog.rst $@ # XXX add _options.rst and _synopsis.rst here when it's been _opt2rst'ed varnishstat.1: $(top_srcdir)/doc/sphinx/reference/varnishstat.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishstat.rst $@ varnishtest.1: $(top_srcdir)/doc/sphinx/reference/varnishtest.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishtest.rst $@ varnishtop.1: \ $(top_srcdir)/doc/sphinx/reference/varnishtop.rst \ $(top_srcdir)/doc/sphinx/include/varnishtop_options.rst \ $(top_srcdir)/doc/sphinx/include/varnishtop_synopsis.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishtop.rst $@ varnishhist.1: \ $(top_srcdir)/doc/sphinx/reference/varnishhist.rst \ $(top_srcdir)/doc/sphinx/include/varnishhist_options.rst \ $(top_srcdir)/doc/sphinx/include/varnishhist_synopsis.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishhist.rst $@ vmod_std.3: $(top_builddir)/lib/libvmod_std/vmod_std.man.rst ${RST2MAN} $(RST2ANY_FLAGS) $? $@ vmod_directors.3: $(top_builddir)/lib/libvmod_directors/vmod_directors.man.rst ${RST2MAN} $(RST2ANY_FLAGS) $? $@ varnish-4.1.1/man/varnishhist.10000644000201500234410000001032312652366755013323 00000000000000.\" Man page generated from reStructeredText. . .TH VARNISHHIST 1 "" "" "" .SH NAME varnishhist \- Varnish request histogram . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp varnishhist [\-C] [\-d] [\-g ] [\-h] [\-L limit] [\-n name] [\-N filename] [\-p period] [\-P ] [\-q query] [\-r filename] [\-t ] [\-T seconds] [\-V] .SH DESCRIPTION .sp The varnishhist utility reads varnishd(1) shared memory logs and 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 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 ("#"). .sp The following options are available: .INDENT 0.0 .TP .B \-C Do all regular expression and string matching caseless. .TP .B \-d Start processing log records at the head of the log instead of the tail. .TP .BI \-g \ The grouping of the log records. The default is to group by vxid. .TP .B \-h Print program usage and exit .TP .BI \-L \ limit Sets the upper limit of incomplete transactions kept before the oldest transaction is force completed. A warning record is synthesized when this happens. This setting keeps an upper bound on the memory usage of running queries. Defaults to 1000 transactions. .TP .BI \-n \ name Specify the name of the varnishd instance to get logs from. If \-n is not specified, the host name is used. .TP .BI \-N \ filename Specify the filename of a stale VSM instance. When using this option the abandonment checking is disabled. .TP .BI \-p \ period Specified the number of seconds between screen refreshes. Default is 1 second, and can be changed at runtime by pressing the [1\-9] keys. .TP .BI \-P \ Either specify "size" or "responsetime" profile or create a new one. Define the tag we\(aqll look for, and the field number of the value we are interested in. min and max are the boundaries of the graph (these are power of tens). .TP .BI \-q \ query Specifies the VSL query to use. .TP .BI \-r \ filename Read log in binary file format from this file. The file can be created with \fBvarnishlog \-w filename\fP. .TP .BI \-t \ Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this many seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. Defaults to 5 seconds. .TP .BI \-T \ seconds Sets the transaction timeout in seconds. This defines the maximum number of seconds elapsed between a Begin tag and the End tag. If the timeout expires, a warning record is synthesized and the transaction is force completed. Defaults to 120 seconds. .TP .B \-V Print version information and exit. .UNINDENT .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fIvarnishd(1)\fP .IP \(bu 2 \fIvarnishlog(1)\fP .IP \(bu 2 \fIvarnishncsa(1)\fP .IP \(bu 2 \fIvarnishstat(1)\fP .IP \(bu 2 \fIvarnishtop(1)\fP .UNINDENT .SH HISTORY .sp The varnishhist 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. .SH COPYRIGHT .sp This document is licensed under the same licence as Varnish itself. See LICENCE for details. .INDENT 0.0 .IP \(bu 2 Copyright (c) 2006 Verdens Gang AS .IP \(bu 2 Copyright (c) 2006\-2015 Varnish Software AS .UNINDENT .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/vsl-query.70000644000201500234410000002334012652366755012741 00000000000000.\" Man page generated from reStructeredText. . .TH VSL-QUERY 7 "" "" "" .SH NAME vsl-query \- Varnish VSL Query Expressions . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH OVERVIEW .sp The Varnish VSL Query Expressions extracts transactions from the Varnish shared memory log, and perform queries on the transactions before reporting matches. .sp A transaction is a set of log lines that belongs together, e.g. a client request or a backend request. The API monitors the log, and collects all log records that make up a transaction before reporting on that transaction. Transactions can also be grouped, meaning backend transactions are reported together with the client transaction that initiated it. .sp A query is run on a group of transactions. A query expression is true if there is a log record within the group that satisfies the condition. It is false only if none of the log records satisfies the condition. Query expressions can be combined using boolean functions. .SH GROUPING .sp When grouping transactions, there is a hierarchy structure showing which transaction initiated what. The level increases by one on an \(aqinitiated by\(aq relation, so for example a backend transaction will have one higher level than the client transaction that initiated it on a cache miss. Request restart transactions don\(aqt get their level increased to make it predictable. .sp Levels start counting at 1, except when using raw where it will always be 0. .sp The grouping modes are: .INDENT 0.0 .IP \(bu 2 Session .sp All transactions initiated by a client connection are reported together. Client connections are open ended when using HTTP keep\-alives, so it is undefined when the session will be reported. If the transaction timeout period is exceeded an incomplete session will be reported. Non\-transactional data (VXID == 0) is not reported. .IP \(bu 2 Request .sp Transactions are grouped by request, where the set will include the request itself as well as any backend requests or ESI\-subrequests. Session data and non\-transactional data (VXID == 0) is not reported. .IP \(bu 2 VXID .sp Transactions are not grouped, so each VXID is reported in it\(aqs entirety. Sessions, requests, ESI\-requests and backend requests are all reported individually. Non\-transactional data is not reported (VXID == 0). This is the default. .IP \(bu 2 Raw .sp Every log record will make up a transaction of it\(aqs own. All data, including non\-transactional data will be reported. .UNINDENT .SS Transaction Hierarchy .sp Example transaction hierarchy using request grouping mode .sp .nf .ft C Lvl 1: Client request (cache miss) Lvl 2: Backend request Lvl 2: ESI subrequest (cache miss) Lvl 3: Backend request Lvl 3: Backend request (VCL restart) Lvl 3: ESI subrequest (cache miss) Lvl 4: Backend request Lvl 2: ESI subrequest (cache hit) .ft P .fi .SH MEMORY USAGE .sp The API will use pointers to shared memory log data as long as possible to keep memory usage at a minimum. But as the shared memory log is a ring buffer, data will get overwritten eventually, so the API creates local copies of referenced log data when varnishd comes close to overwriting still unreported content. .sp This process avoids loss of log data in many scenarios, but it is not failsafe: Overruns where varnishd "overtakes" the log reader process in the ring buffer can still happen when API clients cannot keep up reading and/or copying, for instance due to output blocking. .sp Though being unrelated to grouping in principle, copying of log data is particularly relevant for session grouping together with long lasting client connections \- for this grouping, the logging API client process is likely to consume relevant amounts of memory. As the vxid grouping also logs (potentially long lasting) sessions, it is also likely to require memory for copies of log entries, but far less than session grouping. .SH QUERY LANGUAGE .sp A query expression consists of record selection criteria, and optionally an operator and a value to match against the selected records. .sp .nf .ft C .ft P .fi .SS Record selection criteria .sp The record selection criteria determines what kind records from the transaction group the expression applies to. Syntax: .sp .nf .ft C {level}taglist:record\-prefix[field] .ft P .fi .sp Taglist is mandatory, the other components are optional. .sp The level limits the expression to a transaction at that level. If left unspecified, the expression is applied to transactions at all levels. Level is a positive integer or zero. If level is followed by a \(aq+\(aq character, it expresses greater than or equal. If level is followed by a \(aq\-\(aq, it expresses less than or equal. .sp The taglist is a comma\-separated list of VSL record tags that this expression should be checked against. Each list element can be a tag name or a tag glob. Globs allow a \(aq*\(aq either in the beginning of the name or at the end, and will select all tags that match either the prefix or subscript. A single \(aq*\(aq will select all tags. .sp The record prefix will further limit the matches to those records that has this prefix as it\(aqs first part of the record content followed by a colon. The part of the log record matched against will then be limited to what follows the prefix and colon. This is useful when matching against specific HTTP headers. The record prefix matching is done case insensitive. .sp The field will, if present, treat the log record as a white space separated list of fields, and only the nth part of the record will be matched against. Fields start counting at 1. .sp An expression using only a record selection criteria will be true if there is any record in the transaction group that is selected by the criteria. .SS Operators .sp The following matching operators are available: .INDENT 0.0 .IP \(bu 2 == != < <= > >= .sp Numerical comparison. The record contents will be converted to either an integer or a float before comparison, depending on the type of the operand. .IP \(bu 2 eq ne .sp String comparison. \(aqeq\(aq tests string equality, \(aqne\(aq tests for not equality. .IP \(bu 2 ~ !~ .sp Regular expression matching. \(aq~\(aq is a positive match, \(aq!~\(aq is a non\-match. .UNINDENT .SS Operand .sp The operand is the value the selected records will be matched against. .sp An operand can be quoted or unquoted. Quotes can be either single or double quotes, and for quoted operands a backslash can be used to escape the quotes. .sp Unquoted operands can only consist of the following characters: .sp .nf .ft C a\-z A\-Z 0\-9 + \- _ . * .ft P .fi .sp The following types of operands are available: .INDENT 0.0 .IP \(bu 2 Integer .sp A number without any fractional part, valid for the numerical comparison operators. The integer type is used when the operand does not contain any period (.) characters. .IP \(bu 2 Float .sp A number with a fractional part, valid for the numerical comparison operators. The float type is used when the operand does contain a period (.) character. .IP \(bu 2 String .sp A sequence of characters, valid for the string equality operators. .IP \(bu 2 Regular expression .sp A PCRE regular expression. Valid for the regular expression operators. .UNINDENT .SS Boolean functions .sp Query expressions can be linked together using boolean functions. The following are available, in decreasing precedence: .INDENT 0.0 .IP \(bu 2 not .sp Inverts the result of .IP \(bu 2 and .sp True only if both expr1 and expr2 are true .IP \(bu 2 or .sp True if either of expr1 or expr2 is true .UNINDENT .sp Expressions can be grouped using parenthesis. .SH QUERY EXPRESSION EXAMPLES .INDENT 0.0 .IP \(bu 2 Transaction group contains a request URL that equals to "/foo" .sp .nf .ft C ReqURL eq "/foo" .ft P .fi .IP \(bu 2 Transaction group contains a request cookie header .sp .nf .ft C ReqHeader:cookie .ft P .fi .IP \(bu 2 Transaction group doesn\(aqt contain a request cookie header .sp .nf .ft C not ReqHeader:cookie .ft P .fi .IP \(bu 2 Client request where internal handling took more than 800ms.: .sp .nf .ft C Timestamp:Process[2] > 0.8 .ft P .fi .IP \(bu 2 Transaction group contains a request user\-agent header that contains "iPod" and the request delivery time exceeds 1 second .sp .nf .ft C ReqHeader:user\-agent ~ "iPod" and Timestamp:Resp[2] > 1. .ft P .fi .IP \(bu 2 Transaction group contains a backend response status larger than or equal to 500 .sp .nf .ft C BerespStatus >= 500 .ft P .fi .IP \(bu 2 Transaction group contains a request response status of 304, but where the request did not contain an if\-modified\-since header .sp .nf .ft C ReqStatus == 304 and not ReqHeader:if\-modified\-since .ft P .fi .IP \(bu 2 Transactions that have had backend failures or long delivery time on their ESI subrequests. (Assumes request grouping mode). .sp .nf .ft C BerespStatus >= 500 or {2+}Timestamp:Process[2] > 1. .ft P .fi .UNINDENT .SH HISTORY .sp This document was written by Martin Blix Grydeland. .SH COPYRIGHT .sp This document is licensed under the same licence as Varnish itself. See LICENCE for details. .INDENT 0.0 .IP \(bu 2 Copyright (c) 2006 Verdens Gang AS .IP \(bu 2 Copyright (c) 2006\-2015 Varnish Software AS .UNINDENT .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/Makefile.in0000644000201500234410000005147112652366727012754 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = man DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" \ "$(DESTDIR)$(man7dir)" man3dir = $(mandir)/man3 man7dir = $(mandir)/man7 NROFF = nroff MANS = $(dist_man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ dist_man_MANS = \ varnish-cli.7 \ varnish-counters.7 \ vcl.7 \ vsl.7 \ vsl-query.7 \ varnishadm.1 \ varnishd.1 \ varnishhist.1 \ varnishlog.1 \ varnishncsa.1 \ varnishstat.1 \ varnishtest.1 \ varnishtop.1 \ vmod_directors.3 \ vmod_std.3 MAINTAINERCLEANFILES = $(dist_man_MANS) RST2ANY_FLAGS = --halt=2 all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign man/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man1: $(dist_man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list=''; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-man3: $(dist_man_MANS) @$(NORMAL_INSTALL) test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" @list=''; test -n "$(man3dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.3[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ done; } uninstall-man3: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man3dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.3[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir) install-man7: $(dist_man_MANS) @$(NORMAL_INSTALL) test -z "$(man7dir)" || $(MKDIR_P) "$(DESTDIR)$(man7dir)" @list=''; test -n "$(man7dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.7[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^7][0-9a-z]*$$,7,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man7dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man7dir)" || exit $$?; }; \ done; } uninstall-man7: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man7dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.7[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^7][0-9a-z]*$$,7,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man7dir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man7dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-man3 install-man7 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 uninstall-man3 uninstall-man7 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-man1 \ install-man3 install-man7 install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-man uninstall-man1 uninstall-man3 uninstall-man7 varnish-cli.7: $(top_srcdir)/doc/sphinx/reference/varnish-cli.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnish-cli.rst $@ varnish-counters.7: $(top_srcdir)/doc/sphinx/reference/varnish-counters.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnish-counters.rst $@ vcl.7: $(top_srcdir)/doc/sphinx/reference/vcl.rst \ $(top_srcdir)/bin/varnishd/builtin.vcl ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/vcl.rst $@ vsl.7: $(top_srcdir)/doc/sphinx/reference/vsl.rst \ $(top_srcdir)/lib/libvarnishapi/vsl-tags.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/vsl.rst $@ vsl-query.7: $(top_srcdir)/doc/sphinx/reference/vsl-query.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/vsl-query.rst $@ varnishadm.1: $(top_srcdir)/doc/sphinx/reference/varnishadm.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishadm.rst $@ varnishd.1: \ $(top_srcdir)/doc/sphinx/reference/varnishd.rst \ $(top_srcdir)/doc/sphinx/include/params.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishd.rst $@ varnishncsa.1: \ $(top_srcdir)/doc/sphinx/reference/varnishncsa.rst \ $(top_srcdir)/doc/sphinx/include/varnishncsa_options.rst \ $(top_srcdir)/doc/sphinx/include/varnishncsa_synopsis.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishncsa.rst $@ varnishlog.1: \ $(top_srcdir)/doc/sphinx/reference/varnishlog.rst \ $(top_srcdir)/doc/sphinx/include/varnishlog_options.rst \ $(top_srcdir)/doc/sphinx/include/varnishlog_synopsis.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishlog.rst $@ # XXX add _options.rst and _synopsis.rst here when it's been _opt2rst'ed varnishstat.1: $(top_srcdir)/doc/sphinx/reference/varnishstat.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishstat.rst $@ varnishtest.1: $(top_srcdir)/doc/sphinx/reference/varnishtest.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishtest.rst $@ varnishtop.1: \ $(top_srcdir)/doc/sphinx/reference/varnishtop.rst \ $(top_srcdir)/doc/sphinx/include/varnishtop_options.rst \ $(top_srcdir)/doc/sphinx/include/varnishtop_synopsis.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishtop.rst $@ varnishhist.1: \ $(top_srcdir)/doc/sphinx/reference/varnishhist.rst \ $(top_srcdir)/doc/sphinx/include/varnishhist_options.rst \ $(top_srcdir)/doc/sphinx/include/varnishhist_synopsis.rst ${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnishhist.rst $@ vmod_std.3: $(top_builddir)/lib/libvmod_std/vmod_std.man.rst ${RST2MAN} $(RST2ANY_FLAGS) $? $@ vmod_directors.3: $(top_builddir)/lib/libvmod_directors/vmod_directors.man.rst ${RST2MAN} $(RST2ANY_FLAGS) $? $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/man/varnishtest.10000644000201500234410000001054712652366755013343 00000000000000.\" Man page generated from reStructeredText. . .TH VARNISHTEST 1 "" "" "" .SH NAME varnishtest \- Test program for Varnish . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp varnishtest [\-hikLlqvW] [\-b size] [\-D name=val] [\-j jobs] [\-n iter] [\-t duration] file [file ...] .SH DESCRIPTION .sp The varnishtest program is a script driven program used to test the Varnish Cache. .sp The varnishtest program, when started and given one or more script files, can create a number of threads representing backends, some threads representing clients, and a varnishd process. This is then used to simulate a transaction to provoke a specific behavior. .sp The following options are available: .INDENT 0.0 .TP .BI \-b \ size Set internal buffer size (default: 512K) .UNINDENT .sp \-D name=val Define macro for use in scripts .INDENT 0.0 .TP .B \-h Show help .TP .B \-i Find varnishd in build tree .TP .BI \-j \ jobs Run this many tests in parallel .TP .B \-k Continue on test failure .TP .B \-L Always leave temporary vtc.* .TP .B \-l Leave temporary vtc.* if test fails .TP .BI \-n \ iterations Run tests this many times .TP .B \-q Quiet mode: report only failures .TP .BI \-t \ duration Time tests out after this long .TP .B \-v Verbose mode: always report test log .TP .B \-W Enable the witness facility for locking .UNINDENT .sp file File to use as a script .sp Macro definitions that can be overridden. .sp varnishd Path to varnishd to use [varnishd] .sp If \fITMPDIR\fP is set in the environment, varnishtest creates temporary \fIvtc.*\fP directories for each test in \fI$TMPDIR\fP, otherwise in \fI/tmp\fP. .SH SCRIPTS .sp The script language used for Varnishtest is not a strictly defined language. The best reference for writing scripts is the varnishtest program itself. In the Varnish source code repository, under \fIbin/varnishtest/tests/\fP, all the regression tests for Varnish are kept. .sp An example: .sp .nf .ft C varnishtest "#1029" server s1 { rxreq expect req.url == "/bar" txresp \-gzipbody {[bar]} rxreq expect req.url == "/foo" txresp \-body {

FOOBARF

} } \-start varnish v1 \-vcl+backend { sub vcl_backend_response { set beresp.do_esi = true; if (bereq.url == "/foo") { set beresp.ttl = 0s; } else { set beresp.ttl = 10m; } } } \-start client c1 { txreq \-url "/bar" \-hdr "Accept\-Encoding: gzip" rxresp gunzip expect resp.bodylen == 5 txreq \-url "/foo" \-hdr "Accept\-Encoding: gzip" rxresp expect resp.bodylen == 21 } \-run .ft P .fi .sp 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 definition to the VCL specified (\-vcl+backend). Finally it starts the c1\-client, which is a single client sending two requests. .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 varnishtest source code repository with tests .IP \(bu 2 \fIvarnishhist(1)\fP .IP \(bu 2 \fIvarnishlog(1)\fP .IP \(bu 2 \fIvarnishncsa(1)\fP .IP \(bu 2 \fIvarnishstat(1)\fP .IP \(bu 2 \fIvarnishtop(1)\fP .IP \(bu 2 \fIvcl(7)\fP .UNINDENT .SH HISTORY .sp The varnishtest program was developed by Poul\-Henning Kamp <\fI\%phk@phk.freebsd.dk\fP> in cooperation with Varnish Software AS. This manual page was originally written by Stig Sandbeck Mathisen <\fI\%ssm@linpro.no\fP> and updated by Kristian Lyngstøl <\fI\%kristian@varnish\-cache.org\fP>. .SH COPYRIGHT .sp This document is licensed under the same licence as Varnish itself. See LICENCE for details. .INDENT 0.0 .IP \(bu 2 Copyright (c) 2007\-2015 Varnish Software AS .UNINDENT .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/vmod_directors.30000644000201500234410000001612212652366755014011 00000000000000.\" Man page generated from reStructeredText. . .TH VMOD_DIRECTORS 3 "" "" "" .SH NAME vmod_directors \- Varnish Directors Module . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .\" . .\" NB: This file is machine generated, DO NOT EDIT! . .\" . .\" Edit vmod.vcc and run make instead . .\" . .SH SYNOPSIS .sp import directors [from "path"] ; .SH DESCRIPTION .sp \fIvmod_directors\fP enables backend load balancing in Varnish. .sp The module implements a set of basic load balancing techniques, and also serves as an example on how one could extend the load balancing capabilities of Varnish. .sp To enable load balancing you must import this vmod (directors). .sp Then you define your backends. Once you have the backends declared you can add them to a director. This happens in executed VCL code. If you want to emulate the previous behavior of Varnish 3.0 you can just initialize the directors in vcl_init, like this: .sp .nf .ft C sub vcl_init { new vdir = directors.round_robin(); vdir.add_backend(backend1); vdir.add_backend(backend2); } .ft P .fi .sp As you can see there is nothing keeping you from manipulating the directors elsewhere in VCL. So, you could have VCL code that would add more backends to a director when a certain URL is called. .sp Note that directors can use other directors as backends. .SH CONTENTS .INDENT 0.0 .IP \(bu 2 Object fallback .IP \(bu 2 VOID fallback.add_backend(BACKEND) .IP \(bu 2 BACKEND fallback.backend() .IP \(bu 2 VOID fallback.remove_backend(BACKEND) .IP \(bu 2 Object hash .IP \(bu 2 VOID hash.add_backend(BACKEND, REAL) .IP \(bu 2 BACKEND hash.backend(STRING_LIST) .IP \(bu 2 VOID hash.remove_backend(BACKEND) .IP \(bu 2 Object random .IP \(bu 2 VOID random.add_backend(BACKEND, REAL) .IP \(bu 2 BACKEND random.backend() .IP \(bu 2 VOID random.remove_backend(BACKEND) .IP \(bu 2 Object round_robin .IP \(bu 2 VOID round_robin.add_backend(BACKEND) .IP \(bu 2 BACKEND round_robin.backend() .IP \(bu 2 VOID round_robin.remove_backend(BACKEND) .UNINDENT .SH OBJECT ROUND_ROBIN .INDENT 0.0 .TP .B Description Create a round robin director. .sp This director will pick backends in a round robin fashion. .TP .B Example new vdir = directors.round_robin(); .UNINDENT .SS VOID round_robin.add_backend(BACKEND) .INDENT 0.0 .TP .B Prototype VOID round_robin.add_backend(BACKEND) .TP .B Description Add a backend to the round\-robin director. .TP .B Example vdir.add_backend(backend1); vdir.add_backend(backend2); .UNINDENT .SS VOID round_robin.remove_backend(BACKEND) .INDENT 0.0 .TP .B Prototype VOID round_robin.remove_backend(BACKEND) .TP .B Description Remove a backend from the round\-robin director. .TP .B Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); .UNINDENT .SS BACKEND round_robin.backend() .INDENT 0.0 .TP .B Prototype BACKEND round_robin.backend() .TP .B Description Pick a backend from the director. .TP .B Example set req.backend_hint = vdir.backend(); .UNINDENT .SH OBJECT FALLBACK .INDENT 0.0 .TP .B Description Create a fallback director. .sp A fallback director will try each of the added backends in turn, and return the first one that is healthy. .TP .B Example new vdir = directors.fallback(); .UNINDENT .SS VOID fallback.add_backend(BACKEND) .INDENT 0.0 .TP .B Prototype VOID fallback.add_backend(BACKEND) .TP .B Description Add a backend to the director. .sp Note that the order in which this is done matters for the fallback director. .TP .B Example vdir.add_backend(backend1); vdir.add_backend(backend2); .UNINDENT .SS VOID fallback.remove_backend(BACKEND) .INDENT 0.0 .TP .B Prototype VOID fallback.remove_backend(BACKEND) .TP .B Description Remove a backend from the director. .TP .B Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); .UNINDENT .SS BACKEND fallback.backend() .INDENT 0.0 .TP .B Prototype BACKEND fallback.backend() .TP .B Description Pick a backend from the director. .TP .B Example set req.backend_hint = vdir.backend(); .UNINDENT .SH OBJECT RANDOM .INDENT 0.0 .TP .B Description Create a random backend director. .sp The random director distributes load over the backends using a weighted random probability distribution. .TP .B Example new vdir = directors.random(); .UNINDENT .SS VOID random.add_backend(BACKEND, REAL) .INDENT 0.0 .TP .B Prototype VOID random.add_backend(BACKEND, REAL) .TP .B Description Add a backend to the director with a given weight. .sp Each backend backend will receive approximately 100 * (weight / (sum(all_added_weights))) per cent of the traffic sent to this director. .TP .B Example # 2/3 to backend1, 1/3 to backend2. vdir.add_backend(backend1, 10.0); vdir.add_backend(backend2, 5.0); .UNINDENT .SS VOID random.remove_backend(BACKEND) .INDENT 0.0 .TP .B Prototype VOID random.remove_backend(BACKEND) .TP .B Description Remove a backend from the director. .TP .B Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); .UNINDENT .SS BACKEND random.backend() .INDENT 0.0 .TP .B Prototype BACKEND random.backend() .TP .B Description Pick a backend from the director. .TP .B Example set req.backend_hint = vdir.backend(); .UNINDENT .SH OBJECT HASH .INDENT 0.0 .TP .B Description Create a hashing backend director. .sp The director chooses the backend server by computing a hash/digest of the string given to .backend(). .sp Commonly used with \fBclient.ip\fP or a session cookie to get sticky sessions. .TP .B Example new vdir = directors.hash(); .UNINDENT .SS VOID hash.add_backend(BACKEND, REAL) .INDENT 0.0 .TP .B Prototype VOID hash.add_backend(BACKEND, REAL) .TP .B Description Add a backend to the director with a certain weight. .sp Weight is used as in the random director. Recommended value is 1.0 unless you have special needs. .TP .B Example vdir.add_backend(backend1, 1.0); vdir.add_backend(backend2, 1.0); .UNINDENT .SS VOID hash.remove_backend(BACKEND) .INDENT 0.0 .TP .B Prototype VOID hash.remove_backend(BACKEND) .TP .B Description Remove a backend from the director. .TP .B Example vdir.remove_backend(backend1); vdir.remove_backend(backend2); .UNINDENT .SS BACKEND hash.backend(STRING_LIST) .INDENT 0.0 .TP .B Prototype BACKEND hash.backend(STRING_LIST) .TP .B Description Pick a backend from the backend director. .sp Use the string or list of strings provided to pick the backend. .TP .B Example # pick a backend based on the cookie header from the client set req.backend_hint = vdir.backend(req.http.cookie); .UNINDENT .SH COPYRIGHT .sp This document is licensed under the same licence as Varnish itself. See LICENCE for details. .INDENT 0.0 .IP \(bu 2 Copyright (c) 2013\-2015 Varnish Software AS .UNINDENT .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/varnishtop.10000644000201500234410000001333412652366755013163 00000000000000.\" Man page generated from reStructeredText. . .TH VARNISHTOP 1 "" "" "" .SH NAME varnishtop \- Varnish log entry ranking . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp varnishtop [\-1] [\-b] [\-c] [\-C] [\-d] [\-f] [\-g ] [\-h] [\-i taglist] [\-I <[taglist:]regex>] [\-L limit] [\-n name] [\-N filename] [\-p period] [\-q query] [\-r filename] [\-t ] [\-T seconds] [\-x taglist] [\-X <[taglist:]regex>] [\-V] .SH DESCRIPTION .sp The varnishtop utility reads \fIvarnishd(1)\fP shared memory logs and presents a continuously updated list of the most commonly occurring log entries. With suitable filtering using the \fB\-I\fP, \fB\-i\fP, \fB\-X\fP and \fB\-x\fP options, it can be used to display a ranking of requested documents, clients, user agents, or any other information which is recorded in the log. .sp The following options are available: .INDENT 0.0 .TP .B \-1 Instead of a continuously updated display, print the statistics once and exit. Implies \fB\-d\fP. .TP .B \-b Only display transactions and log records coming from backend communication. .TP .B \-c Only display transactions and log records coming from client communication. .TP .B \-C Do all regular expression and string matching caseless. .TP .B \-d Start processing log records at the head of the log instead of the tail. .TP .B \-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. .TP .BI \-g \ The grouping of the log records. The default is to group by vxid. .TP .B \-h Print program usage and exit .TP .BI \-i \ taglist Include log records of these tags in output. Taglist is a comma\-separated list of tag globs. Multiple \-i options may be given. .sp If a tag include option is the first of any tag selection options, all tags are first marked excluded. .TP .BI \-I \ <[taglist:]regex> Include by regex matching. Output only records matching taglist and regular expression. Applies to any tag if taglist is absent. .sp If a tag include option is the first of any tag selection options, all tags are first marked excluded. .TP .BI \-L \ limit Sets the upper limit of incomplete transactions kept before the oldest transaction is force completed. A warning record is synthesized when this happens. This setting keeps an upper bound on the memory usage of running queries. Defaults to 1000 transactions. .TP .BI \-n \ name Specify the name of the varnishd instance to get logs from. If \-n is not specified, the host name is used. .TP .BI \-N \ filename Specify the filename of a stale VSM instance. When using this option the abandonment checking is disabled. .TP .BI \-p \ 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. .TP .BI \-q \ query Specifies the VSL query to use. .TP .BI \-r \ filename Read log in binary file format from this file. The file can be created with \fBvarnishlog \-w filename\fP. .TP .BI \-t \ Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this many seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. Defaults to 5 seconds. .TP .BI \-T \ seconds Sets the transaction timeout in seconds. This defines the maximum number of seconds elapsed between a Begin tag and the End tag. If the timeout expires, a warning record is synthesized and the transaction is force completed. Defaults to 120 seconds. .TP .BI \-x \ taglist Exclude log records of these tags in output. Taglist is a comma\-separated list of tag globs. Multiple \-x options may be given. .TP .BI \-X \ <[taglist:]regex> Exclude by regex matching. Do not output records matching taglist and regular expression. Applies to any tag if taglist is absent. .TP .B \-V Print version information and exit. .UNINDENT .SH EXAMPLES .sp The following example displays a continuously updated list of the most frequently requested URLs: .sp .nf .ft C varnishtop \-i ReqURL .ft P .fi .sp The following example displays a continuously updated list of the most commonly used user agents: .sp .nf .ft C varnishtop \-C \-I ReqHeader:User\-Agent .ft P .fi .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fIvarnishd(1)\fP .IP \(bu 2 \fIvarnishhist(1)\fP .IP \(bu 2 \fIvarnishlog(1)\fP .IP \(bu 2 \fIvarnishncsa(1)\fP .IP \(bu 2 \fIvarnishstat(1)\fP .UNINDENT .SH HISTORY .sp The varnishtop utility was originally developed by Poul\-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS, and later substantially rewritten by Dag\-Erling Smørgrav. This manual page was written by Dag\-Erling Smørgrav, and later updated by Martin Blix Grydeland. .SH COPYRIGHT .sp This document is licensed under the same licence as Varnish itself. See LICENCE for details. .INDENT 0.0 .IP \(bu 2 Copyright (c) 2006 Verdens Gang AS .IP \(bu 2 Copyright (c) 2006\-2015 Varnish Software AS .UNINDENT .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/vmod_std.30000644000201500234410000002423012652366756012605 00000000000000.\" Man page generated from reStructeredText. . .TH VMOD_STD 3 "" "" "" .SH NAME vmod_std \- Varnish Standard Module . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .\" . .\" NB: This file is machine generated, DO NOT EDIT! . .\" . .\" Edit vmod.vcc and run make instead . .\" . .SH SYNOPSIS .sp import std [from "path"] ; .SH DESCRIPTION .sp \fIvmod_std\fP contains basic functions which are part and parcel of Varnish, but which for reasons of architecture fit better in a VMOD. .sp One particular class of functions in vmod_std is the conversions functions which all have the form: .sp .nf .ft C TYPE type(STRING, TYPE) .ft P .fi .sp These functions attempt to convert STRING to the TYPE, and if that fails, they return the second argument, which must have the given TYPE. .SH CONTENTS .INDENT 0.0 .IP \(bu 2 VOID cache_req_body(BYTES) .IP \(bu 2 VOID collect(HEADER) .IP \(bu 2 DURATION duration(STRING, DURATION) .IP \(bu 2 STRING fileread(PRIV_CALL, STRING) .IP \(bu 2 BOOL healthy(BACKEND) .IP \(bu 2 INT integer(STRING, INT) .IP \(bu 2 IP ip(STRING, IP) .IP \(bu 2 VOID log(STRING_LIST) .IP \(bu 2 INT port(IP) .IP \(bu 2 STRING querysort(STRING) .IP \(bu 2 REAL random(REAL, REAL) .IP \(bu 2 REAL real(STRING, REAL) .IP \(bu 2 INT real2integer(REAL, INT) .IP \(bu 2 TIME real2time(REAL, TIME) .IP \(bu 2 VOID rollback(HTTP) .IP \(bu 2 VOID set_ip_tos(INT) .IP \(bu 2 STRING strstr(STRING, STRING) .IP \(bu 2 VOID syslog(INT, STRING_LIST) .IP \(bu 2 TIME time(STRING, TIME) .IP \(bu 2 INT time2integer(TIME, INT) .IP \(bu 2 REAL time2real(TIME, REAL) .IP \(bu 2 VOID timestamp(STRING) .IP \(bu 2 STRING tolower(STRING_LIST) .IP \(bu 2 STRING toupper(STRING_LIST) .UNINDENT .SS STRING toupper(STRING_LIST) .INDENT 0.0 .TP .B Prototype STRING toupper(STRING_LIST s) .TP .B Description Converts the string \fIs\fP to uppercase. .TP .B Example set beresp.http.scream = std.toupper("yes!"); .UNINDENT .SS STRING tolower(STRING_LIST) .INDENT 0.0 .TP .B Prototype STRING tolower(STRING_LIST s) .TP .B Description Converts the string \fIs\fP to lowercase. .TP .B Example set beresp.http.nice = std.tolower("VerY"); .UNINDENT .SS VOID set_ip_tos(INT) .INDENT 0.0 .TP .B Prototype VOID set_ip_tos(INT tos) .TP .B Description Sets the IP type\-of\-service (TOS) field for the current session to \fItos\fP. Please note that the TOS field is not removed by the end of the request so probably want to set it on every request should you utilize it. .TP .B Example .nf if (req.url ~ "^/slow/") { .in +2 std.set_ip_tos(0); .in -2 } .fi .sp .UNINDENT .SS REAL random(REAL, REAL) .INDENT 0.0 .TP .B Prototype REAL random(REAL lo, REAL hi) .TP .B Description Returns a random real number between \fIlo\fP and \fIhi\fP. .TP .B Example set beresp.http.random\-number = std.random(1, 100); .UNINDENT .SS VOID log(STRING_LIST) .INDENT 0.0 .TP .B Prototype VOID log(STRING_LIST s) .TP .B Description Logs the string \fIs\fP to the shared memory log, using VSL tag \fISLT_VCL_Log\fP. .TP .B Example std.log("Something fishy is going on with the vhost " + req.http.host); .UNINDENT .SS VOID syslog(INT, STRING_LIST) .INDENT 0.0 .TP .B Prototype VOID syslog(INT priority, STRING_LIST s) .TP .B Description Logs the string \fIs\fP to syslog tagged with \fIpriority\fP. \fIpriority\fP is formed by ORing the facility and level values. See your system\(aqs syslog.h file for possible values. .TP .B Example std.syslog(9, "Something is wrong"); .sp This will send a message to syslog using LOG_USER | LOG_ALERT. .UNINDENT .SS STRING fileread(PRIV_CALL, STRING) .INDENT 0.0 .TP .B Prototype STRING fileread(PRIV_CALL, STRING) .TP .B Description Reads a file and returns a string with the content. Please note that it is not recommended to send variables to this function the caching in the function doesn\(aqt take this into account. Also, files are not re\-read. .TP .B Example set beresp.http.served\-by = std.fileread("/etc/hostname"); .UNINDENT .SS VOID collect(HEADER) .INDENT 0.0 .TP .B Prototype VOID collect(HEADER hdr) .TP .B Description Collapses multiple \fIhdr\fP headers into one long header. .sp Care should be taken when collapsing headers. In particular collapsing Set\-Cookie will lead to unexpected results on the browser side. .TP .B Example std.collect(req.http.cookie); .UNINDENT .SS DURATION duration(STRING, DURATION) .INDENT 0.0 .TP .B Prototype DURATION duration(STRING s, DURATION fallback) .TP .B Description Converts the string \fIs\fP to seconds. \fIs\fP must be quantified with ms (milliseconds), s (seconds), m (minutes), h (hours), d (days), w (weeks) or y (years) units. If conversion fails, \fIfallback\fP will be returned. .TP .B Example set beresp.ttl = std.duration("1w", 3600s); .UNINDENT .SS INT integer(STRING, INT) .INDENT 0.0 .TP .B Prototype INT integer(STRING s, INT fallback) .TP .B Description Converts the string \fIs\fP to an integer. If conversion fails, \fIfallback\fP will be returned. .TP .B Example .nf if (std.integer(req.http.foo, 0) > 5) { .in +2 ... .in -2 } .fi .sp .UNINDENT .SS IP ip(STRING, IP) .INDENT 0.0 .TP .B Prototype IP ip(STRING s, IP fallback) .TP .B Description Converts the string \fIs\fP to the first IP number returned by the system library function getaddrinfo(3). If conversion fails, \fIfallback\fP will be returned. .TP .B Example .nf if (std.ip(req.http.X\-forwarded\-for, "0.0.0.0") ~ my_acl) { .in +2 ... .in -2 } .fi .sp .UNINDENT .SS REAL real(STRING, REAL) .INDENT 0.0 .TP .B Prototype REAL real(STRING s, REAL fallback) .TP .B Description Converts the string \fIs\fP to a real. If conversion fails, \fIfallback\fP will be returned. .TP .B Example .nf if (std.real(req.http.foo, 0.0) > 5.5) { .in +2 ... .in -2 } .fi .sp .UNINDENT .SS INT real2integer(REAL, INT) .INDENT 0.0 .TP .B Prototype INT real2integer(REAL r, INT fallback) .TP .B Description Converts the real \fIr\fP to an integer. If conversion fails, \fIfallback\fP will be returned. .TP .B Example set req.http.integer = std.real2integer(1140618699.00, 0); .UNINDENT .SS TIME real2time(REAL, TIME) .INDENT 0.0 .TP .B Prototype TIME real2time(REAL r, TIME fallback) .TP .B Description Converts the real \fIr\fP to a time. If conversion fails, \fIfallback\fP will be returned. .TP .B Example set req.http.time = std.real2time(1140618699.00, now); .UNINDENT .SS INT time2integer(TIME, INT) .INDENT 0.0 .TP .B Prototype INT time2integer(TIME t, INT fallback) .TP .B Description Converts the time \fIt\fP to a integer. If conversion fails, \fIfallback\fP will be returned. .TP .B Example set req.http.int = std.time2integer(now, 0); .UNINDENT .SS REAL time2real(TIME, REAL) .INDENT 0.0 .TP .B Prototype REAL time2real(TIME t, REAL fallback) .TP .B Description Converts the time \fIt\fP to a real. If conversion fails, \fIfallback\fP will be returned. .TP .B Example set req.http.real = std.time2real(now, 1.0); .UNINDENT .SS BOOL healthy(BACKEND) .INDENT 0.0 .TP .B Prototype BOOL healthy(BACKEND be) .TP .B Description Returns \fItrue\fP if the backend \fIbe\fP is healthy. .UNINDENT .SS INT port(IP) .INDENT 0.0 .TP .B Prototype INT port(IP ip) .TP .B Description Returns the port number of the IP address \fIip\fP. .UNINDENT .SS VOID rollback(HTTP) .INDENT 0.0 .TP .B Prototype VOID rollback(HTTP h) .TP .B Description Restores the \fIh\fP HTTP headers to their original state. .TP .B Example std.rollback(bereq); .UNINDENT .SS VOID timestamp(STRING) .INDENT 0.0 .TP .B Prototype VOID timestamp(STRING s) .TP .B Description Introduces a timestamp in the log with the current time, using the string \fIs\fP as the label. This is useful to time the execution of lengthy VCL procedures, and makes the timestamps inserted automatically by Varnish more accurate. .TP .B Example std.timestamp("curl\-request"); .UNINDENT .SS STRING querysort(STRING) .INDENT 0.0 .TP .B Prototype STRING querysort(STRING) .TP .B Description Sorts the query string for cache normalization purposes. .TP .B Example set req.url = std.querysort(req.url); .UNINDENT .SS VOID cache_req_body(BYTES) .INDENT 0.0 .TP .B Prototype VOID cache_req_body(BYTES size) .TP .B Description Cache the req.body if it is smaller than \fIsize\fP. .sp Caching the req.body makes it possible to retry pass operations (POST, PUT). .TP .B Example std.cache_req_body(1KB); .sp This will cache the req.body if its size is smaller than 1KB. .UNINDENT .SS STRING strstr(STRING, STRING) .INDENT 0.0 .TP .B Prototype STRING strstr(STRING s1, STRING s2) .TP .B Description Returns a string beginning at the first occurrence of the string \fIs2\fP in the string \fIs1\fP, or an empty string if \fIs2\fP is not found. .sp Note that the comparison is case sensitive. .TP .B Example .nf if (std.strstr(req.url, req.http.restrict)) { .in +2 ... .in -2 } .fi .sp .sp This will check if the content of req.http.restrict occurs anywhere in req.url. .UNINDENT .SS TIME time(STRING, TIME) .INDENT 0.0 .TP .B Prototype TIME time(STRING s, TIME fallback) .TP .B Description Converts the string \fIs\fP to a time. If conversion fails, \fIfallback\fP will be returned. .sp Supported formats: .nf "Sun, 06 Nov 1994 08:49:37 GMT" "Sunday, 06\-Nov\-94 08:49:37 GMT" "Sun Nov 6 08:49:37 1994" "1994\-11\-06T08:49:37" "784111777.00" "784111777" .fi .sp .TP .B Example .nf if (std.time(resp.http.last\-modified, now) < now \- 1w) { .in +2 ... .in -2 } .fi .sp .UNINDENT .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fIvarnishd(1)\fP .IP \(bu 2 \fIvsl(7)\fP .UNINDENT .SH HISTORY .sp The Varnish standard module was released along with Varnish Cache 3.0. This manual page was written by Per Buer with help from Martin Blix Grydeland. .SH COPYRIGHT .sp This document is licensed under the same licence as Varnish itself. See LICENCE for details. .INDENT 0.0 .IP \(bu 2 Copyright (c) 2010\-2015 Varnish Software AS .UNINDENT .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/vsl.70000644000201500234410000004321312652366755011577 00000000000000.\" Man page generated from reStructeredText. . .TH VSL 7 "" "" "" .SH NAME VSL \- Varnish Shared Memory Logging . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH OVERVIEW .sp This document describes the format and content of all the Varnish shared memory logging tags. These tags are used by the varnishlog(1), varnishtop(1), etc. logging tools supplied with Varnish. .SS VSL tags .INDENT 0.0 .TP .B Backend \- Backend selected Logged when a connection is selected for handling a backend request. .sp The format is: .sp .nf .ft C %d %s %s | | | | | +\- Backend display name | +\-\-\-\- VCL name +\-\-\-\-\-\-\- Connection file descriptor .ft P .fi .TP .B BackendClose \- Backend connection closed Logged when a backend connection is closed. .sp The format is: .sp .nf .ft C %d %s [ %s ] | | | | | +\- Optional reason | +\-\-\-\-\-\- Backend display name +\-\-\-\-\-\-\-\-\- Connection file descriptor .ft P .fi .TP .B BackendOpen \- Backend connection opened Logged when a new backend connection is opened. .sp The format is: .sp .nf .ft C %d %s %s %s %s %s | | | | | | | | | | | +\- Local port | | | | +\-\-\-\- Local address | | | +\-\-\-\-\-\-\- Remote port | | +\-\-\-\-\-\-\-\-\-\- Remote address | +\-\-\-\-\-\-\-\-\-\-\-\-\- Backend display name +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Connection file descriptor .ft P .fi .TP .B BackendReuse \- Backend connection put up for reuse Logged when a backend connection is put up for reuse by a later connection. .sp The format is: .sp .nf .ft C %d %s | | | +\- Backend display name +\-\-\-\- Connection file descriptor .ft P .fi .TP .B Backend_health \- Backend health check The result of a backend health probe. .sp The format is: .sp .nf .ft C %s %s %s %u %u %u %f %f %s | | | | | | | | | | | | | | | | | +\- Probe HTTP response | | | | | | | +\-\-\-\- Average response time | | | | | | +\-\-\-\-\-\-\- Response time | | | | | +\-\-\-\-\-\-\-\-\-\- Probe window size | | | | +\-\-\-\-\-\-\-\-\-\-\-\-\- Probe threshold level | | | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Number of good probes in window | | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Probe window bits | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Status message +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Backend name .ft P .fi .TP .B Begin \- Marks the start of a VXID The first record of a VXID transaction. .sp The format is: .sp .nf .ft C %s %d %s | | | | | +\- Reason | +\-\-\-\- Parent vxid +\-\-\-\-\-\-\- Type ("sess", "req" or "bereq") .ft P .fi .TP .B BereqAcct \- Backend request accounting Contains byte counters from backend request processing. .sp The format is: .sp .nf .ft C %d %d %d %d %d %d | | | | | | | | | | | +\- Total bytes received | | | | +\-\-\-\- Body bytes received | | | +\-\-\-\-\-\-\- Header bytes received | | +\-\-\-\-\-\-\-\-\-\- Total bytes transmitted | +\-\-\-\-\-\-\-\-\-\-\-\-\- Body bytes transmitted +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Header bytes transmitted .ft P .fi .TP .B BereqHeader \- Backend request header HTTP header contents. .sp The format is: .sp .nf .ft C %s: %s | | | +\- Header value +\-\-\-\-\- Header name .ft P .fi .TP .B BereqMethod \- Backend request method The HTTP request method used. .TP .B BereqProtocol \- Backend request protocol The HTTP protocol version information. .TP .B BereqURL \- Backend request URL The HTTP request URL. .TP .B BerespHeader \- Backend response header HTTP header contents. .sp The format is: .sp .nf .ft C %s: %s | | | +\- Header value +\-\-\-\-\- Header name .ft P .fi .TP .B BerespProtocol \- Backend response protocol The HTTP protocol version information. .TP .B BerespReason \- Backend response response The HTTP response string received. .TP .B BerespStatus \- Backend response status The HTTP status code received. .TP .B BogoHeader \- Bogus HTTP received Contains the first 20 characters of received HTTP headers we could not make sense of. Applies to both req.http and beresp.http. .TP .B CLI \- CLI communication CLI communication between varnishd master and child process. .TP .B Debug \- Debug messages Debug messages can normally be ignored, but are sometimes helpful during trouble\-shooting. Most debug messages must be explicitly enabled with parameters. .TP .B ESI_xmlerror \- ESI parser error or warning message An error or warning was generated during parsing of an ESI object. The log record describes the problem encountered. .TP .B End \- Marks the end of a VXID The last record of a VXID transaction. .TP .B Error \- Error messages Error messages are stuff you probably want to know. .TP .B ExpBan \- Object evicted due to ban Logs the VXID when an object is banned. .TP .B ExpKill \- Object expiry event Logs events related to object expiry. The events are: .INDENT 7.0 .TP .B EXP_Rearm Logged when the expiry time of an object changes. .TP .B EXP_Inbox Logged when the expiry thread picks an object from the inbox for processing. .TP .B EXP_Kill Logged when the expiry thread kills an object from the inbox. .TP .B EXP_When Logged when the expiry thread moves an object on the binheap. .TP .B EXP_Expired Logged when the expiry thread expires an object. .TP .B LRU_Cand Logged when an object is evaluated for LRU force expiry. .TP .B LRU Logged when an object is force expired due to LRU. .TP .B LRU_Fail Logged when no suitable candidate object is found for LRU force expiry. .UNINDENT .sp The format is: .sp .nf .ft C EXP_Rearm p=%p E=%f e=%f f=0x%x EXP_Inbox p=%p e=%f f=0x%x EXP_Kill p=%p e=%f f=0x%x EXP_When p=%p e=%f f=0x%x EXP_Expired x=%u t=%f LRU_Cand p=%p f=0x%x r=%d LRU x=%u LRU_Fail Legend: p=%p Objcore pointer t=%f Remaining TTL (s) e=%f Expiry time (unix epoch) E=%f Old expiry time (unix epoch) f=0x%x Objcore flags r=%d Objcore refcount x=%u Object VXID .ft P .fi .TP .B FetchError \- Error while fetching object Logs the error message of a failed fetch operation. .TP .B Fetch_Body \- Body fetched from backend Ready to fetch body from backend. .sp The format is: .sp .nf .ft C %d (%s) %s | | | | | +\-\-\-\- \(aqstream\(aq or \(aq\-\(aq | +\-\-\-\-\-\-\-\-\- Text description of body fetch mode +\-\-\-\-\-\-\-\-\-\-\-\-\- Body fetch mode .ft P .fi .TP .B Gzip \- G(un)zip performed on object A Gzip record is emitted for each instance of gzip or gunzip work performed. Worst case, an ESI transaction stored in gzip\(aqed objects but delivered gunziped, will run into many of these. .sp The format is: .sp .nf .ft C %c %c %c %d %d %d %d %d | | | | | | | | | | | | | | | +\- Bit length of compressed data | | | | | | +\-\-\-\- Bit location of \(aqlast\(aq bit | | | | | +\-\-\-\-\-\-\- Bit location of first deflate block | | | | +\-\-\-\-\-\-\-\-\-\- Bytes output | | | +\-\-\-\-\-\-\-\-\-\-\-\-\- Bytes input | | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \(aqE\(aq: ESI, \(aq\-\(aq: Plain object | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \(aqF\(aq: Fetch, \(aqD\(aq: Deliver +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \(aqG\(aq: Gzip, \(aqU\(aq: Gunzip, \(aqu\(aq: Gunzip\-test .ft P .fi .sp Examples: .sp .nf .ft C U F E 182 159 80 80 1392 G F E 159 173 80 1304 1314 .ft P .fi .TP .B Hash \- Value added to hash This value was added to the object lookup hash. .sp NB: This log record is masked by default. .TP .B Hit \- Hit object in cache Object looked up in cache. Shows the VXID of the object. .TP .B HitPass \- Hit for pass object in cache. Hit\-for\-pass object looked up in cache. Shows the VXID of the hit\-for\-pass object. .TP .B HttpGarbage \- Unparseable HTTP request Logs the content of unparseable HTTP requests. .TP .B Length \- Size of object body Logs the size of a fetch object body. .TP .B Link \- Links to a child VXID Links this VXID to any child VXID it initiates. .sp The format is: .sp .nf .ft C %s %d %s | | | | | +\- Reason | +\-\-\-\- Child vxid +\-\-\-\-\-\-\- Child type ("req" or "bereq") .ft P .fi .TP .B LostHeader \- Failed attempt to set HTTP header Logs the header name of a failed HTTP header operation due to resource exhaustion or configured limits. .TP .B ObjHeader \- Object header HTTP header contents. .sp The format is: .sp .nf .ft C %s: %s | | | +\- Header value +\-\-\-\-\- Header name .ft P .fi .TP .B ObjProtocol \- Object protocol The HTTP protocol version information. .TP .B ObjReason \- Object response The HTTP response string received. .TP .B ObjStatus \- Object status The HTTP status code received. .TP .B PipeAcct \- Pipe byte counts Contains byte counters for pipe sessions. .sp The format is: .sp .nf .ft C %d %d %d %d | | | | | | | +\-\-\-\-\-\-\- Piped bytes to client | | +\-\-\-\-\-\-\-\-\-\- Piped bytes from client | +\-\-\-\-\-\-\-\-\-\-\-\-\- Backend request headers +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Client request headers .ft P .fi .TP .B Proxy \- PROXY protocol information PROXY protocol information. .sp The format is: .sp .nf .ft C %d %s %d %s %d [key value]... | | | | | | | | | | | +\- optional information | | | | +\- server port | | | +\- server ip | | +\- client port | +\- client ip +\-\-\-\- PROXY protocol version .ft P .fi .TP .B ProxyGarbage \- Unparseable PROXY request A PROXY protocol header was unparseable. .TP .B ReqAcct \- Request handling byte counts Contains byte counts for the request handling. ESI sub\-request counts are also added to their parent request. The body bytes count does not include transmission (ie: chunked encoding) overhead. The format is: .sp .nf .ft C %d %d %d %d %d %d | | | | | | | | | | | +\- Total bytes transmitted | | | | +\-\-\-\- Body bytes transmitted | | | +\-\-\-\-\-\-\- Header bytes transmitted | | +\-\-\-\-\-\-\-\-\-\- Total bytes received | +\-\-\-\-\-\-\-\-\-\-\-\-\- Body bytes received +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Header bytes received .ft P .fi .TP .B ReqHeader \- Client request header HTTP header contents. .sp The format is: .sp .nf .ft C %s: %s | | | +\- Header value +\-\-\-\-\- Header name .ft P .fi .TP .B ReqMethod \- Client request method The HTTP request method used. .TP .B ReqProtocol \- Client request protocol The HTTP protocol version information. .TP .B ReqStart \- Client request start Start of request processing. Logs the client IP address and port number. .sp The format is: .sp .nf .ft C %s %s | | | +\- Client Port number +\-\-\-\- Client IP4/6 address .ft P .fi .TP .B ReqURL \- Client request URL The HTTP request URL. .TP .B RespHeader \- Client response header HTTP header contents. .sp The format is: .sp .nf .ft C %s: %s | | | +\- Header value +\-\-\-\-\- Header name .ft P .fi .TP .B RespProtocol \- Client response protocol The HTTP protocol version information. .TP .B RespReason \- Client response response The HTTP response string received. .TP .B RespStatus \- Client response status The HTTP status code received. .TP .B SessClose \- Client connection closed SessionClose is the last record for any client connection. .sp The format is: .sp .nf .ft C %s %f | | | +\- How long the session was open +\-\-\-\- Why the connection closed .ft P .fi .TP .B SessOpen \- Client connection opened The first record for a client connection, with the socket\-endpoints of the connection. .sp The format is: .sp .nf .ft C %s %d %s %s %s %d | | | | | | | | | | | +\- File descriptor number | | | | +\-\-\-\- Local TCP port (\(aq\-\(aq if !$log_local_addr) | | | +\-\-\-\-\-\-\- Local IPv4/6 address (\(aq\-\(aq if !$log_local_addr) | | +\-\-\-\-\-\-\-\-\-\- Listen socket (\-a argument) | +\-\-\-\-\-\-\-\-\-\-\-\-\- Remote TCP port +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Remote IPv4/6 address .ft P .fi .TP .B Storage \- Where object is stored Type and name of the storage backend the object is stored in. .sp The format is: .sp .nf .ft C %s %s | | | +\- Name of storage backend +\-\-\-\- Type ("malloc", "file", "persistent" etc.) .ft P .fi .TP .B TTL \- TTL set on object A TTL record is emitted whenever the ttl, grace or keep values for an object is set. .sp The format is: .sp .nf .ft C %s %d %d %d %d [ %d %d %u %u ] | | | | | | | | | | | | | | | | | +\- Max\-Age from Cache\-Control header | | | | | | | +\-\-\-\- Expires header | | | | | | +\-\-\-\-\-\-\- Date header | | | | | +\-\-\-\-\-\-\-\-\-\- Age (incl Age: header value) | | | | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Reference time for TTL | | | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Keep | | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Grace | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- TTL +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- "RFC" or "VCL" .ft P .fi .sp The last four fields are only present in "RFC" headers. .sp Examples: .sp .nf .ft C RFC 60 10 \-1 1312966109 1312966109 1312966109 0 60 VCL 120 10 0 1312966111 .ft P .fi .TP .B Timestamp \- Timing information Contains timing information for the Varnish worker threads. .sp Time stamps are issued by Varnish on certain events, and show the absolute time of the event, the time spent since the start of the work unit, and the time spent since the last timestamp was logged. See vsl(7) for information about the individual timestamps. .sp The format is: .sp .nf .ft C %s: %f %f %f | | | | | | | +\- Time since last timestamp | | +\-\-\-\- Time since start of work unit | +\-\-\-\-\-\-\- Absolute time of event +\-\-\-\-\-\-\-\-\-\-\- Event label .ft P .fi .TP .B VCL_Error \- VCL execution error message Logs error messages generated during VCL execution. .TP .B VCL_Log \- Log statement from VCL User generated log messages insert from VCL through std.log() .TP .B VCL_acl \- VCL ACL check results Logs VCL ACL evaluation results. .TP .B VCL_call \- VCL method called Logs the VCL method name when a VCL method is called. .TP .B VCL_return \- VCL method return value Logs the VCL method terminating statement. .TP .B VCL_trace \- VCL trace data Logs VCL execution trace data. .sp The format is: .sp .nf .ft C %u %u.%u | | | | | +\- VCL program line position | +\-\-\-\- VCL program line number +\-\-\-\-\-\-\- VCL trace point index .ft P .fi .sp NB: This log record is masked by default. .TP .B VSL \- VSL API warnings and error message Warnings and error messages genererated by the VSL API while reading the shared memory log. .TP .B VfpAcct \- Fetch filter accounting Contains name of VFP and statistics. .sp The format is: .sp .nf .ft C %s %d %d | | | | | +\- Total bytes produced | +\-\-\-\- Number of calls made +\-\-\-\-\-\-\- Name of filter .ft P .fi .sp NB: This log record is masked by default. .TP .B Witness \- Lock order witness records Diagnostic recording of locking order. .TP .B WorkThread \- Logs thread start/stop events Logs worker thread creation and termination events. .sp The format is: .sp .nf .ft C %p %s | | | +\- [start|end] +\-\-\-\- Worker struct pointer .ft P .fi .sp NB: This log record is masked by default. .UNINDENT .SH TIMESTAMPS .sp Timestamps are inserted in the log on completing certain events during the worker thread\(aqs task handling. The timestamps has a label showing which event was completed. The reported fields show the absolute time of the event, the time spent since the start of the task and the time spent since the last timestamp was logged. .sp The timestamps logged automatically by Varnish are inserted after completing events that are expected to have delays (e.g. network IO or spending time on a waitinglist). Timestamps can also be inserted from VCL using the std.timestamp() method. If one is doing time consuming tasks in the VCL configuration, it\(aqs a good idea to log a timestamp after completing that task. This keeps the timing information in subsequent timestamps from including the time spent on the VCL event. .SS Request handling timestamps .INDENT 0.0 .TP .B Start The start of request processing (first byte received or restart). .TP .B Req Complete client request received. .TP .B ReqBody Client request body processed (discarded, cached or passed to the backend). .TP .B Waitinglist Came off waitinglist. .TP .B Fetch Fetch processing finished (completely fetched or ready for streaming). .TP .B Process Processing finished, ready to deliver the client response. .TP .B Resp Delivery of response to the client finished. .TP .B Restart Client request is being restarted. .UNINDENT .SS Pipe handling timestamps .INDENT 0.0 .TP .B Pipe Opened a pipe to the backend and forwarded the request. .TP .B PipeSess The pipe session has finished. .UNINDENT .SS Backend fetch timestamps .INDENT 0.0 .TP .B Start Start of the backend fetch processing. .TP .B Bereq Backend request sent. .TP .B Beresp Backend response headers received. .TP .B BerespBody Backend response body received. .TP .B Retry Backend request is being retried. .TP .B Error Backend request failed to vcl_backend_error. .UNINDENT .SH HISTORY .sp This document was initially written by Poul\-Henning Kamp, and later updated by Martin Blix Grydeland. .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fIvarnishhist(1)\fP .IP \(bu 2 \fIvarnishlog(1)\fP .IP \(bu 2 \fIvarnishncsa(1)\fP .IP \(bu 2 \fIvarnishtop(1)\fP .UNINDENT .SH COPYRIGHT .sp This document is licensed under the same licence as Varnish itself. See LICENCE for details. .INDENT 0.0 .IP \(bu 2 Copyright (c) 2006 Verdens Gang AS .IP \(bu 2 Copyright (c) 2006\-2015 Varnish Software AS .UNINDENT .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/varnish-cli.70000644000201500234410000002462112652366755013214 00000000000000.\" Man page generated from reStructeredText. . .TH VARNISH-CLI 7 "" "" "" .SH NAME varnish-cli \- Varnish Command Line Interface . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH DESCRIPTION .sp Varnish as a command line interface (CLI) which can control and change most of the operational parameters and the configuration of Varnish, without interrupting the running service. .sp The CLI can be used for the following tasks: .INDENT 0.0 .TP .B configuration You can upload, change and delete VCL files from the CLI. .TP .B parameters You can inspect and change the various parameters Varnish has available through the CLI. The individual parameters are documented in the varnishd(1) man page. .TP .B bans Bans are filters that are applied to keep Varnish from serving stale content. When you issue a ban Varnish will not serve any \fIbanned\fP object from cache, but rather re\-fetch it from its backend servers. .TP .B process management You can stop and start the cache (child) process though the CLI. You can also retrieve the latest stack trace if the child process has crashed. .UNINDENT .sp If you invoke varnishd(1) with \-T, \-M or \-d the CLI will be available. In debug mode (\-d) the CLI will be in the foreground, with \-T you can connect to it with varnishadm or telnet and with \-M varnishd will connect back to a listening service \fIpushing\fP the CLI to that service. Please see \fIvarnishd(1)\fP for details. .SS Syntax .sp Commands are usually terminated with a newline. Long command can be entered using sh style \fIhere documents\fP. The format of here\-documents is: .sp .nf .ft C << word here document word .ft P .fi .sp \fIword\fP can be any continuous string chosen to make sure it doesn\(aqt appear naturally in the following \fIhere document\fP. .sp When using the here document style of input there are no restrictions on length. When using newline\-terminated commands maximum length is limited by the varnishd parameter \fIcli_buffer\fP. .sp When commands are newline terminated they get \fItokenized\fP before parsing so if you have significant spaces enclose your strings in double quotes. Within the quotes you can escape characters with \e. The n, r and t get translated to newlines, carriage returns and tabs. Double quotes themselves can be escaped with a backslash. .sp To enter characters in octals use the \ennn syntax. Hexadecimals can be entered with the \exnn syntax. .SS Commands .INDENT 0.0 .TP .B help [] Show command/protocol help. .TP .B ping [] Keep connection alive. .TP .B auth Authenticate. .TP .B quit Close connection. .TP .B banner Print welcome banner. .TP .B status Check status of Varnish cache process. .TP .B start Start the Varnish cache process. .TP .B stop Stop the Varnish cache process. .TP .B vcl.load [auto|cold|warm] Compile and load the VCL file under the name provided. .TP .B vcl.inline [auto|cold|warm] Compile and load the VCL data under the name provided. .TP .B vcl.use Switch to the named configuration immediately. .TP .B vcl.discard Unload the named configuration (when possible). .TP .B vcl.list List all loaded configuration. .TP .B vcl.show [\-v] Display the source code for the specified configuration. .TP .B vcl.state Force the state of the specified configuration. State is any of auto, warm or cold values. .TP .B param.show [\-l] [] Show parameters and their values. .TP .B param.set Set parameter value. .TP .B panic.show Return the last panic, if any. .TP .B panic.clear [\-z] Clear the last panic, if any. \-z will clear related varnishstat counter(s). .TP .B storage.list List storage devices. .TP .B backend.list [\-p] [] List backends. .TP .B backend.set_health Set health status on the backends. State is any of auto, healthy or sick values. .TP .B ban [&& ...] Mark obsolete all objects where all the conditions match. .TP .B ban.list List the active bans. .UNINDENT .SS Backend Expression .sp A backend expression can be a backend name or a combination of backend name, IP address and port in "name(IP address:port)" format. All fields are optional. If no exact matching backend is found, partial matching will be attempted based on the provided name, IP address and port fields. .sp Examples: .sp .nf .ft C backend.list def* backend.set_health default sick backend.set_health def* healthy backend.set_health * auto .ft P .fi .SS Ban Expressions .sp A ban expression consists of one or more conditions. A condition consists of a field, an operator, and an argument. Conditions can be ANDed together with "&&". .sp A field can be any of the variables from VCL, for instance req.url, req.http.host or obj.http.set\-cookie. .sp Operators are "==" for direct comparison, "~" for a regular expression match, and ">" or "<" for size comparisons. Prepending an operator with "!" negates the expression. .sp The argument could be a quoted string, a regexp, or an integer. Integers can have "KB", "MB", "GB" or "TB" appended for size related fields. .SS VCL Temperature .sp A VCL program goes through several states related to the different commands: it can be loaded, used, and later discarded. You can load several VCL programs and switch at any time from one to another. There is only one active VCL, but the previous active VCL will be maintained active until all its transactions are over. .sp Over time, if you often refresh your VCL and keep the previous versions around, resource consumption will increase, you can\(aqt escape that. However, most of the time you want only one to pay the price only for the active VCL and keep older VCLs in case you\(aqd need to rollback to a previous version. .sp The VCL temperature allows you to minimize the footprint of inactive VCLs. Once a VCL becomes cold, Varnish will release all the resources that can be be later reacquired. You can manually set the temperature of a VCL or let varnish automatically handle it. .SS Scripting .sp If you are going to write a script that talks CLI to varnishd, the include/cli.h contains the relevant magic numbers. .sp One particular magic number to know, is that the line with the status code and length field always is exactly 13 characters long, including the NL character. .sp For your reference the sourcefile lib/libvarnish/cli_common.h contains the functions Varnish code uses to read and write CLI response. .SS How \-S/PSK Authentication Works .sp If the \-S secret\-file is given as argument to varnishd, all network CLI connections must authenticate, by proving they know the contents of that file. .sp The file is read at the time the auth command is issued and the contents is not cached in varnishd, so it is possible to update the file on the fly. .sp Use the unix file permissions to control access to the file. .sp An authenticated session looks like this: .sp .nf .ft C critter phk> telnet localhost 1234 Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is \(aq^]\(aq. 107 59 ixslvvxrgkjptxmcgnnsdxsvdmvfympg Authentication required. auth 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a 200 193 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Varnish HTTP accelerator CLI. \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- Type \(aqhelp\(aq for command list. Type \(aqquit\(aq to close CLI session. Type \(aqstart\(aq to launch worker process. .ft P .fi .sp The CLI status of 107 indicates that authentication is necessary. The first 32 characters of the response text is the challenge "ixsl...mpg". The challenge is randomly generated for each CLI connection, and changes each time a 107 is emitted. .sp The most recently emitted challenge must be used for calculating the authenticator "455c...c89a". .sp The authenticator is calculated by applying the SHA256 function to the following byte sequence: .INDENT 0.0 .IP \(bu 2 Challenge string .IP \(bu 2 Newline (0x0a) character. .IP \(bu 2 Contents of the secret file .IP \(bu 2 Challenge string .IP \(bu 2 Newline (0x0a) character. .UNINDENT .sp and dumping the resulting digest in lower\-case hex. .sp In the above example, the secret file contained foon and thus: .sp .nf .ft C critter phk> cat > _ ixslvvxrgkjptxmcgnnsdxsvdmvfympg foo ixslvvxrgkjptxmcgnnsdxsvdmvfympg ^D critter phk> hexdump \-C _ 00000000 69 78 73 6c 76 76 78 72 67 6b 6a 70 74 78 6d 63 |ixslvvxrgkjptxmc| 00000010 67 6e 6e 73 64 78 73 76 64 6d 76 66 79 6d 70 67 |gnnsdxsvdmvfympg| 00000020 0a 66 6f 6f 0a 69 78 73 6c 76 76 78 72 67 6b 6a |.foo.ixslvvxrgkj| 00000030 70 74 78 6d 63 67 6e 6e 73 64 78 73 76 64 6d 76 |ptxmcgnnsdxsvdmv| 00000040 66 79 6d 70 67 0a |fympg.| 00000046 critter phk> sha256 _ SHA256 (_) = 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a critter phk> openssl dgst \-sha256 < _ 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a .ft P .fi .sp The sourcefile lib/libvarnish/cli_auth.c contains a useful function which calculates the response, given an open filedescriptor to the secret file, and the challenge string. .SH EXAMPLES .sp Simple example: All requests where req.url exactly matches the string /news are banned from the cache: .sp .nf .ft C req.url == "/news" .ft P .fi .sp Example: Ban all documents where the serving host is "example.com" or "www.example.com", and where the Set\-Cookie header received from the backend contains "USERID=1663": .sp .nf .ft C req.http.host ~ "^(?i)(www\e.)example.com$" && obj.http.set\-cookie ~ "USERID=1663" .ft P .fi .SH AUTHORS .sp This manual page was originally written by Per Buer and later modified by Federico G. Schwindt, Dridi Boukelmoune, Lasse Karstensen and Poul\-Henning Kamp. .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fIvarnishadm(1)\fP .IP \(bu 2 \fIvarnishd(1)\fP .IP \(bu 2 \fIvcl(7)\fP .UNINDENT .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/man/varnishstat.10000644000201500234410000001327012652366755013333 00000000000000.\" Man page generated from reStructeredText. . .TH VARNISHSTAT 1 "" "" "" .SH NAME varnishstat \- Varnish Cache statistics . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp varnishstat [\-1] [\-x] [\-j] [\-f field] [\-l] [\-n varnish_name] [\-N filename] [\-t seconds|] [\-V] .\" TODO: autogenerate this synopsis like the others. . .SH DESCRIPTION .sp The varnishstat utility displays statistics from a running varnishd(1) instance. .SH OPTIONS .sp The following options are available: .INDENT 0.0 .TP .B \-1 Instead of presenting a continuously updated display, print the statistics to stdout. .TP .B \-f Field inclusion glob. A field glob consists of three parts, type, ident and name, where ident is optional. Each part can contain a \(aq*\(aq character at the end to match a prefix. Use backslash to escape characters. If the argument starts with \(aq^\(aq it is used as an exclusion glob. Multiple \-f arguments may be given, and they will be applied in order. .TP .B \-l Lists the available fields to use with the \-f option. .TP .B \-n Specifies the name of the varnishd instance to get logs from. If \-n is not specified, the host name is used. .TP .B \-N Specify a the filename of a stale VSM instance. When using this option the abandonment checking is disabled. .UNINDENT .INDENT 0.0 .TP .B \-t seconds| Timeout before returning error on initial VSM connection. If set the VSM connection is retried every 0.5 seconds for this any seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and wait indefinitely for the Varnish instance to appear. Defaults to 5 seconds. .UNINDENT .INDENT 0.0 .TP .B \-V Display the version number and exit. .TP .B \-x Displays the result as XML. .TP .B \-j Displays the result as JSON. .UNINDENT .SH CURSES MODE .sp When neither \-1, \-j or \-x options are given, the application starts up in curses mode. This shows a continuously updated view of the counter values, along with their description. .sp The top area shows process uptime information. .sp The center area shows a list of counter values. .sp The bottom area shows the description of the currently selected counter. .SS Columns .sp The following columns are displayed, from left to right: .INDENT 0.0 .TP .B Name The name of the counter .TP .B Current The current value of the counter. .TP .B Change The average per second change over the last update interval. .TP .B Average The average value of this counter over the runtime of the Varnish daemon, or a period if the counter can\(aqt be averaged. .TP .B Avg_10 The moving average over the last 10 update intervals. .TP .B Avg_100 The moving average over the last 100 update intervals. .TP .B Avg_1000 The moving average over the last 1000 update intervals. .UNINDENT .SS Key bindings .sp The following keys control the interactive display: .INDENT 0.0 .TP .B Navigate the counter list one line up. .TP .B Navigate the counter list one line down. .TP .B or Navigate the counter list one page up. .TP .B or Navigate the counter list one page down. .TP .B Toggle between showing and hiding unseen counters. Unseen counters are those that has been zero for the entire runtime of varnishstat. Defaults to hide unseen counters. .TP .B Toggle scaling of values. .TP .B Go to the top of the counter list. .TP .B Go to the bottom of the counter list. .TP .B Cycle through the verbosity levels. Defaults to only showing informational counters. .TP .B Quit. .TP .B Sample now. .UNINDENT .SH XML OUTPUT .sp When using the \-x option, the output is: .sp .nf .ft C FIELD TYPE FIELD IDENT FIELD NAME FIELD VALUE FIELD SEMANTICS FIELD DISPLAY FORMAT FIELD DESCRIPTION [..] .ft P .fi .SH JSON OUTPUT .sp With \-j the output format is: .sp .nf .ft C { "timestamp": "YYYY\-MM\-DDTHH:mm:SS", "FIELD NAME": { "description": "FIELD DESCRIPTION", "type": "FIELD TYPE", "ident": "FIELD IDENT", "flag": "FIELD SEMANTICS", "format": "FIELD DISPLAY FORMAT", "value": FIELD VALUE }, "FIELD2 NAME": { "description": "FIELD2 DESCRIPTION", "type": "FIELD2 TYPE", "ident": "FIELD2 IDENT", "flag": "FIELD2 SEMANTICS", "format": "FIELD2 DISPLAY FORMAT", "value": FIELD2 VALUE }, [..] } .ft P .fi .sp Type and ident are optional. Timestamp is the time when the report was generated by varnishstat. .sp Repeated output with \-1, \-x or \-j will have a single empty line (\en) between each block of output. .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fIvarnishd(1)\fP .IP \(bu 2 \fIvarnishhist(1)\fP .IP \(bu 2 \fIvarnishlog(1)\fP .IP \(bu 2 \fIvarnishncsa(1)\fP .IP \(bu 2 \fIvarnishtop(1)\fP .IP \(bu 2 curses(3) .IP \(bu 2 \fIvarnish\-counters(7)\fP .UNINDENT .SH AUTHORS .sp This manual page was written by Dag\-Erling Smørgrav, Per Buer, Lasse Karstensen and Martin Blix Grydeland. .\" Generated by docutils manpage writer. .\" . varnish-4.1.1/etc/0000755000201500234410000000000012652366760010754 500000000000000varnish-4.1.1/etc/example.vcl0000644000201500234410000000231112652366721013027 00000000000000# # 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 # return statement. # # See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/ # and https://www.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. # # Typically you clean up the request here, removing cookies you don't need, # rewriting the request, etc. } sub vcl_backend_response { # Happens after we have read the response headers from the backend. # # Here you clean the response headers, removing silly Set-Cookie headers # and other mistakes your backend does. } sub vcl_deliver { # Happens when we have all the pieces we need, and are about to send the # response to the client. # # You can do accounting or modifying the final object here. } varnish-4.1.1/etc/Makefile.am0000644000201500234410000000077212652366721012733 00000000000000# DISTCLEANFILES = 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\ 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 varnish-4.1.1/etc/Makefile.in0000644000201500234410000003305012652366726012744 00000000000000# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = etc DIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(docdir)" DATA = $(dist_doc_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUMEM = @LIBUMEM@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ varnishconfdir = @varnishconfdir@ DISTCLEANFILES = builtin.vcl dist_doc_DATA = builtin.vcl \ example.vcl all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign etc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign etc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-dist_docDATA: $(dist_doc_DATA) @$(NORMAL_INSTALL) test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)" @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ done uninstall-dist_docDATA: @$(NORMAL_UNINSTALL) @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(docdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dist_docDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_docDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dist_docDATA install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am uninstall-dist_docDATA 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 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-4.1.1/etc/builtin.vcl0000644000201500234410000000776112652366754013066 00000000000000# This is the VCL configuration Varnish will automatically append to your VCL # file during compilation/loading. See the vcl(7) man page for details on syntax # and semantics. # New users is recommended to use the example.vcl file as a starting point. # # sub vcl_recv { # if (req.method == "PRI") { # /* We do not support SPDY or HTTP/2.0 */ # return (synth(405)); # } # 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 { # # By default Connection: close is set on all piped requests, to stop # # connection reuse from sending future requests directly to the # # (potentially) wrong backend. If you do want this to happen, you can undo # # it here. # # unset bereq.http.connection; # 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 (synth(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, deliver it # // Automatically triggers a background fetch # return (deliver); # } # // fetch & deliver once we get the result # return (miss); # } # # sub vcl_miss { # return (fetch); # } # # sub vcl_deliver { # return (deliver); # } # # /* # * We can come here "invisibly" with the following errors: 413, 417 & 503 # */ # sub vcl_synth { # set resp.http.Content-Type = "text/html; charset=utf-8"; # set resp.http.Retry-After = "5"; # synthetic( {" # # # "} + resp.status + " " + resp.reason + {" # # #

Error "} + resp.status + " " + resp.reason + {"

#

"} + resp.reason + {"

#

Guru Meditation:

#

XID: "} + req.xid + {"

#
#

Varnish cache server

# # # "} ); # return (deliver); # } # # ####################################################################### # # Backend 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 = 120s; # set beresp.uncacheable = true; # } # return (deliver); # } # # sub vcl_backend_error { # set beresp.http.Content-Type = "text/html; charset=utf-8"; # set beresp.http.Retry-After = "5"; # synthetic( {" # # # "} + beresp.status + " " + beresp.reason + {" # # #

Error "} + beresp.status + " " + beresp.reason + {"

#

"} + beresp.reason + {"

#

Guru Meditation:

#

XID: "} + bereq.xid + {"

#
#

Varnish cache server

# # # "} ); # return (deliver); # } # # ####################################################################### # # Housekeeping # # sub vcl_init { # } # # sub vcl_fini { # return (ok); # } varnish-4.1.1/README.Packaging0000644000201500234410000000140212652366721012656 00000000000000Packaging ========= Varnish Cache packaging files are kept outside of the main distribution. The main reason for this is to decouple the development work from the packaging work. We want to be able to tag a release and do a tarball release without having to wait for the packagers to finish their work/changes. Official packages ----------------- The official Debian and Redhat packages are built by the Varnish Cache team and made available on https://repo.varnish-cache.org/ . Packaging files and scripts for Debian and Redhat: https://github.com/varnishcache/pkg-varnish-cache Third-party packages -------------------- Varnish Cache is built and packaged in many different operating systems and distributions. Please see the wiki for more information.